PageRenderTime 70ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/application/views/pages/admin/orderssz.php

https://bitbucket.org/chadsaun/ifrogz-panel
PHP | 2384 lines | 2314 code | 32 blank | 38 comment | 375 complexity | 0a852678f65ae10305511de64de03287 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. if(@$_GET["doedit"]=="true") $doedit=TRUE; else $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(@$htmlemails==TRUE) $emlNl = "<br />"; else $emlNl="\n";
  49. if($lisuccess==2){
  50. ?>
  51. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  52. <tr>
  53. <td width="100%">
  54. <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
  55. <tr>
  56. <td width="100%" colspan="4" align="center"><p>&nbsp;</p><p>&nbsp;</p>
  57. <p><strong><?php print $yyOpFai?></strong></p><p>&nbsp;</p>
  58. <p><?php print $yyCorCoo?> <?php print $yyCorLI?> <a href="/admin/login.php"><?php print $yyClkHer?></a>.</p>
  59. </td>
  60. </tr>
  61. </table>
  62. </td>
  63. </tr>
  64. </table>
  65. <?php
  66. }else{
  67. $success=true;
  68. $alreadygotadmin = getadminsettings();
  69. if(@$_POST["updatestatus"]=="1"){
  70. mysql_query("UPDATE orders SET ordStatusInfo='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["ordStatusInfo"]))) . "' WHERE ordID=" . @$_POST["orderid"]) or print(mysql_error());
  71. }elseif(@$_GET["id"] != ""){
  72. if(@$_POST["delccdets"] != ""){
  73. mysql_query("UPDATE orders SET ordCNum='' WHERE ordID=" . @$_GET["id"]);
  74. }
  75. $sSQL = "SELECT cartProdId,cartProdName,cartProdPrice,cartQuantity,cartID FROM cart WHERE cartOrderID=" . $_GET["id"];
  76. $allorders = mysql_query($sSQL) or print(mysql_error());
  77. }else{
  78. // Delete old uncompleted orders.
  79. if($delccafter != 0){
  80. $sSQL = "UPDATE orders SET ordCNum='' WHERE ordDate<'" . date("Y-m-d H:i:s", time()-($delccafter*60*60*24)) . "'";
  81. mysql_query($sSQL) or print(mysql_error());
  82. }
  83. if($delAfter != 0){
  84. $sSQL = "SELECT cartOrderID,cartID FROM cart WHERE cartCompleted=0 AND cartDateAdded<'" . date("Y-m-d H:i:s", time()-($delAfter*60*60*24)) . "'";
  85. $result = mysql_query($sSQL) or print(mysql_error());
  86. if(mysql_num_rows($result)>0){
  87. $delStr="";
  88. $delOptions="";
  89. $addcomma = "";
  90. while($rs = mysql_fetch_assoc($result)){
  91. $delStr .= $addcomma . $rs["cartOrderID"];
  92. $delOptions .= $addcomma . $rs["cartID"];
  93. $addcomma = ",";
  94. }
  95. mysql_query("DELETE FROM orders WHERE ordID IN (" . $delStr . ")") or print(mysql_error());
  96. mysql_query("DELETE FROM cartoptions WHERE coCartID IN (" . $delOptions . ")") or print(mysql_error());
  97. mysql_query("DELETE FROM cart WHERE cartID IN (" . $delOptions . ")") or print(mysql_error());
  98. }
  99. mysql_free_result($result);
  100. }else{
  101. $sSQL = "SELECT cartOrderID,cartID FROM cart WHERE cartCompleted=0 AND cartOrderID=0 AND cartDateAdded<'" . date("Y-m-d H:i:s", time()-(3*60*60*24)) . "'";
  102. $result = mysql_query($sSQL) or print(mysql_error());
  103. if(mysql_num_rows($result)>0){
  104. $delStr="";
  105. $delOptions="";
  106. $addcomma = "";
  107. while($rs = mysql_fetch_assoc($result)){
  108. $delStr .= $addcomma . $rs["cartOrderID"];
  109. $delOptions .= $addcomma . $rs["cartID"];
  110. $addcomma = ",";
  111. }
  112. mysql_query("DELETE FROM cartoptions WHERE coCartID IN (" . $delOptions . ")") or print(mysql_error());
  113. mysql_query("DELETE FROM cart WHERE cartID IN (" . $delOptions . ")") or print(mysql_error());
  114. }
  115. mysql_free_result($result);
  116. }
  117. $numstatus=0;
  118. $sSQL = "SELECT statID,statPrivate FROM orderstatus WHERE statPrivate<>'' ORDER BY statID";
  119. $result = mysql_query($sSQL) or print(mysql_error());
  120. while($rs = mysql_fetch_assoc($result)){
  121. $allstatus[$numstatus++]=$rs;
  122. }
  123. mysql_free_result($result);
  124. }
  125. if(@$_POST["updatestatus"]=="1"){
  126. ?>
  127. <script language="JavaScript" type="text/javascript">
  128. <!--
  129. setTimeout("history.go(-2);",1100);
  130. // -->
  131. </script>
  132. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  133. <tr>
  134. <td width="100%">
  135. <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
  136. <tr>
  137. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyUpdSuc?></strong><br /><br /><?php print $yyNowFrd?><br /><br />
  138. <?php print $yyNoAuto?> <a href="javascript:history.go(-2)"><strong><?php print $yyClkHer?></strong></a>.<br /><br />
  139. <img src="/lib/images/misc/clearpixel.gif" width="300" height="3" alt="" /></td>
  140. </tr>
  141. </table>
  142. </td>
  143. </tr>
  144. </table>
  145. <?php
  146. }elseif(@$_POST["doedit"] == "true"){
  147. $OWSP = "";
  148. $sSQL = "SELECT ordSessionID FROM orders WHERE ordID='" . $_POST["orderid"] . "'";
  149. $result = mysql_query($sSQL) or print(mysql_error());
  150. $rs = mysql_fetch_array($result);
  151. $thesessionid = $rs["ordSessionID"];
  152. mysql_free_result($result);
  153. $sSQL = "UPDATE orders SET ";
  154. $sSQL .= "ordName='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["name"]))) . "',";
  155. $sSQL .= "ordAddress='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["address"]))) . "',";
  156. if(@$useaddressline2==TRUE) $sSQL .= "ordAddress2='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["address2"]))) . "',";
  157. $sSQL .= "ordCity='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["city"]))) . "',";
  158. $sSQL .= "ordPoApo='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["APO"]))) . "',";
  159. $sSQL .= "ordState='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["state"]))) . "',";
  160. $sSQL .= "ordZip='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["zip"]))) . "',";
  161. $sSQL .= "ordCountry='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["country"]))) . "',";
  162. $sSQL .= "ordEmail='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["email"]))) . "',";
  163. $sSQL .= "ordPhone='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["phone"]))) . "',";
  164. $sSQL .= "ordShipName='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["sname"]))) . "',";
  165. $sSQL .= "ordShipAddress='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["saddress"]))) . "',";
  166. if(@$useaddressline2==TRUE) $sSQL .= "ordShipAddress2='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["saddress2"]))) . "',";
  167. $sSQL .= "ordShipCity='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["scity"]))) . "',";
  168. $sSQL .= "ordShipPoApo='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["ShipAPO"]))) . "',";
  169. $sSQL .= "ordShipState='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["sstate"]))) . "',";
  170. $sSQL .= "ordShipZip='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["szip"]))) . "',";
  171. $sSQL .= "ordShipCountry='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["scountry"]))) . "',";
  172. $sSQL .= "ordShipType='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["shipmethod"]))) . "',";
  173. $sSQL .= "ordIP='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["ipaddress"]))) . "',";
  174. $ordComLoc = 0;
  175. if(trim(@$_POST["commercialloc"])=="Y") $ordComLoc = 1;
  176. if(trim(@$_POST["wantinsurance"])=="Y") $ordComLoc += 2;
  177. $sSQL .= "ordComLoc=" . $ordComLoc . ",";
  178. $sSQL .= "ordAffiliate='" . trim(@$_POST["PARTNER"]) . "',";
  179. $sSQL .= "ordAddInfo='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["ordAddInfo"]))) . "',";
  180. $sSQL .= "ordStatusInfo='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["ordStatusInfo"]))) . "',";
  181. $sSQL .= "ordSupportInfo='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["ordSupportInfo"]))) . "',";
  182. $sSQL .= "order_changed='yes',";
  183. $sSQL .= "ordDiscountText='" . mysql_real_escape_string(trim(unstripslashes(@$_POST["discounttext"]))) . "',";
  184. $sSQL .= "ordExtra1='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["ordextra1"]))) . "',";
  185. $sSQL .= "ordExtra2='" . mysql_real_escape_string(unstripslashes(trim(@$_POST["ordextra2"]))) . "',";
  186. $sSQL .= "ordShipping='" . mysql_real_escape_string(trim(@$_POST["ordShipping"])) . "',";
  187. $sSQL .= "ordStateTax='" . mysql_real_escape_string(trim(@$_POST["ordStateTax"])) . "',";
  188. $sSQL .= "ordCountryTax='" . mysql_real_escape_string(trim(@$_POST["ordCountryTax"])) . "',";
  189. if(@$canadataxsystem==TRUE) $sSQL .= "ordHSTTax='" . mysql_real_escape_string(trim(@$_POST["ordHSTTax"])) . "',";
  190. $sSQL .= "ordDiscount='" . mysql_real_escape_string(trim(@$_POST["ordDiscount"])) . "',";
  191. $sSQL .= "ordHandling='" . mysql_real_escape_string(trim(@$_POST["ordHandling"])) . "',";
  192. $sSQL .= "ordAuthNumber='" . mysql_real_escape_string(trim(@$_POST["ordAuthNumber"])) . "',";
  193. $sSQL .= "ordTransID='" . mysql_real_escape_string(trim(@$_POST["ordTransID"])) . "',";
  194. $sSQL .= "ordTotal='" . mysql_real_escape_string(trim(@$_POST["ordtotal"])) . "',";
  195. $sSQL .= "ord_cert_amt='" . mysql_real_escape_string(trim(@$_POST["ord_cert_amt"])) . "'";
  196. $sSQL .= " WHERE ordID='" . $_POST["orderid"] . "'";
  197. mysql_query($sSQL) or print(mysql_error());
  198. foreach($_POST as $objItem => $objValue){
  199. //print $objItem . " : " . $objValue . "<br>";
  200. if(substr($objItem,0,6)=="prodid"){
  201. $idno = (int)substr($objItem, 6);
  202. $cartid = trim(@$_POST["cartid" . $idno]);
  203. $prodid = trim(@$_POST["prodid" . $idno]);
  204. $quant = trim(@$_POST["quant" . $idno]);
  205. $theprice = trim(@$_POST["price" . $idno]);
  206. $prodname = trim(@$_POST["prodname" . $idno]);
  207. $delitem = trim(@$_POST["del_" . $idno]);
  208. if($delitem=="yes"){
  209. mysql_query("DELETE FROM cart WHERE cartID=" . $cartid) or print(mysql_error());
  210. mysql_query("DELETE FROM cartoptions WHERE coCartID=" . $cartid) or print(mysql_error());
  211. $cartid = "";
  212. }elseif($cartid != ""){
  213. $sSQL = "UPDATE cart SET cartProdID='" . mysql_real_escape_string(trim(unstripslashes($prodid))) . "',cartProdPrice=" . $theprice . ",cartProdName='" . mysql_real_escape_string(trim(unstripslashes($prodname))) . "',cartQuantity=" . $quant . " WHERE cartID=" . $cartid;
  214. mysql_query($sSQL) or print(mysql_error());
  215. mysql_query("DELETE FROM cartoptions WHERE coCartID=" . $cartid) or print(mysql_error());
  216. }else{
  217. $sSQL = "INSERT INTO cart (cartSessionID,cartProdID,cartQuantity,cartCompleted,cartProdName,cartProdPrice,cartOrderID,cartDateAdded) VALUES (";
  218. $sSQL .= "'" . $thesessionid . "',";
  219. $sSQL .= "'" . mysql_real_escape_string(trim(unstripslashes($prodid))) . "',";
  220. $sSQL .= $quant . ",";
  221. $sSQL .= "1,";
  222. $sSQL .= "'" . mysql_real_escape_string(trim(unstripslashes($prodname))) . "',";
  223. $sSQL .= "'" . $theprice . "',";
  224. $sSQL .= @$_POST["orderid"] . ",";
  225. $sSQL .= "'" . date("Y-m-d H:i:s", time() + ($dateadjust*60*60)) . "')";
  226. mysql_query($sSQL) or print(mysql_error());
  227. $cartid = mysql_insert_id();
  228. }
  229. if($cartid != ""){
  230. $optprefix = "optn" . $idno . '_';
  231. $prefixlen = strlen($optprefix);
  232. foreach($_POST as $kk => $kkval){
  233. if(substr($kk,0,$prefixlen)==$optprefix && trim($kkval) != ''){
  234. $optidarr = split('\|', $kkval);
  235. $optid = $optidarr[0];
  236. if(@$_POST["v" . $kk] == ""){
  237. $sSQL="SELECT optID,".getlangid("optGrpName",16).",".getlangid("optName",32)."," . $OWSP . "optPriceDiff,optWeightDiff,optType,optFlags FROM options LEFT JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE optID='" . mysql_real_escape_string($kkval) . "'";
  238. $result = mysql_query($sSQL) or print(mysql_error());
  239. if($rs = mysql_fetch_array($result)){
  240. if(abs($rs["optType"]) != 3){
  241. $sSQL = "INSERT INTO cartoptions (coCartID,coOptID,coOptGroup,coCartOption,coPriceDiff,coWeightDiff) VALUES (" . $cartid . "," . $rs["optID"] . ",'" . mysql_real_escape_string($rs[getlangid("optGrpName",16)]) . "','" . mysql_real_escape_string($rs[getlangid("optName",32)]) . "',";
  242. $sSQL .= $optidarr[1] . ",0)";
  243. }else
  244. $sSQL = "INSERT INTO cartoptions (coCartID,coOptID,coOptGroup,coCartOption,coPriceDiff,coWeightDiff) VALUES (" . $cartid . "," . $rs["optID"] . ",'" . mysql_real_escape_string($rs[getlangid("optGrpName",16)]) . "','',0,0)";
  245. mysql_query($sSQL) or print(mysql_error());
  246. }
  247. mysql_free_result($result);
  248. }else{
  249. $sSQL="SELECT optID,".getlangid("optGrpName",16).",".getlangid("optName",32)." FROM options LEFT JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE optID='" . mysql_real_escape_string($kkval) . "'";
  250. $result = mysql_query($sSQL) or print(mysql_error());
  251. $rs = mysql_fetch_array($result);
  252. $sSQL = "INSERT INTO cartoptions (coCartID,coOptID,coOptGroup,coCartOption,coPriceDiff,coWeightDiff) VALUES (" . $cartid . "," . $rs["optID"] . ",'" . mysql_real_escape_string($rs[getlangid("optGrpName",16)]) . "','" . mysql_real_escape_string(unstripslashes(trim(@$_POST["v" . $kk]))) . "',0,0)";
  253. mysql_query($sSQL) or print(mysql_error());
  254. mysql_free_result($result);
  255. }
  256. }
  257. }
  258. }
  259. }
  260. }
  261. ?>
  262. <script language="JavaScript" type="text/javascript">
  263. <!--
  264. setTimeout("history.go(-2);",1100);
  265. // -->
  266. </script>
  267. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  268. <tr>
  269. <td width="100%">
  270. <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
  271. <tr>
  272. <td width="100%" colspan="4" align="center"><br /><strong><?php print $yyUpdSuc?></strong><br /><br /><?php print $yyNowFrd?><br /><br />
  273. <?php print $yyNoAuto?> <a href="javascript:history.go(-2)"><strong><?php print $yyClkHer?></strong></a>.<br /><br />
  274. <img src="/lib/images/misc/clearpixel.gif" width="300" height="3" alt="" /></td>
  275. </tr>
  276. </table>
  277. </td>
  278. </tr>
  279. </table>
  280. <?php
  281. }elseif(@$_GET["id"] != ""){
  282. $statetaxrate=0;
  283. $countrytaxrate=0;
  284. $hsttaxrate=0;
  285. $countryorder=0;
  286. $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"] . "'";
  287. $result = mysql_query($sSQL) or print(mysql_error());
  288. $alldata = mysql_fetch_array($result);
  289. $alldata["ordDate"] = strtotime($alldata["ordDate"]);
  290. mysql_free_result($result);
  291. if($doedit){
  292. print '<form method="post" name="editform" action="/admin/orderssz.php" onsubmit="return confirmedit()"><input type="hidden" name="orderid" value="' . $_GET["id"] . '" /><input type="hidden" name="doedit" value="true" />';
  293. $overridecurrency=TRUE;
  294. $orcsymbol="";
  295. $orcdecplaces=2;
  296. $orcpreamount=TRUE;
  297. $orcdecimals=".";
  298. $orcthousands="";
  299. }
  300. ?>
  301. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.5.1/prototype.js"></script>
  302. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.5.1/scriptaculous.js"></script>
  303. <script language="JavaScript" type="text/javascript">
  304. <!--
  305. var newwin="";
  306. var plinecnt=0;
  307. function openemailpopup(id) {
  308. 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')
  309. }
  310. function updateoptions(id){
  311. prodid = document.getElementById('prodid'+id).value;
  312. if(prodid != ''){
  313. 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');
  314. }
  315. return(false);
  316. }
  317. function extraproduct(plusminus){
  318. var productspan=document.getElementById('productspan');
  319. if(plusminus=='+'){
  320. 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-->');
  321. plinecnt++;
  322. }else{
  323. if(plinecnt>0){
  324. plinecnt--;
  325. var restr = '<!--PLINE'+plinecnt+'-->(.|\\n)+<!--PLINEEND'+plinecnt+'-->';
  326. //alert(restr);
  327. var re = new RegExp(restr);
  328. productspan.innerHTML=productspan.innerHTML.replace(re,'');
  329. }
  330. }
  331. }
  332. function confirmedit(){
  333. if(confirm('<?php print str_replace("'","\'",$yyChkRec)?>'))
  334. return(true);
  335. return(false);
  336. }
  337. function checkAIM(frm) {
  338. if(frm.aim_type.selectedIndex==0) {
  339. alert("Please choose a transaction type.");
  340. frm.aim_type.focus();
  341. return false;
  342. }else if(frm.aim_txn=='') {
  343. alert("A transaction number is required.");
  344. frm.aim_txn.focus();
  345. return false;
  346. }else if(frm.aim_amt=='') {
  347. alert("Please enter an amount.");
  348. frm.aim_amt.focus();
  349. return false;
  350. }
  351. return true;
  352. }
  353. function toggleTXN() {
  354. if($('div_trans').style.display=='' || $('div_trans').style.display==undefined) {
  355. //$('div_trans').style.display = 'none';
  356. Effect.BlindUp('div_trans');
  357. $('btn_add_txn').value = 'Credit or Void';
  358. }else if($('div_trans').style.display=='none') {
  359. //$('div_trans').style.display = '';
  360. Effect.BlindDown('div_trans');
  361. $('btn_add_txn').value = 'Hide Credit or Void';
  362. }
  363. }
  364. function toggleCharge() {
  365. if($('div_charge').style.display=='' || $('div_charge').style.display==undefined) {
  366. //$('div_charge').style.display = 'none';
  367. Effect.BlindUp('div_charge');
  368. $('btn_charge').value = 'Charge CC';
  369. }else if($('div_charge').style.display=='none') {
  370. //$('div_charge').style.display = '';
  371. Effect.BlindDown('div_charge');
  372. $('btn_charge').value = 'Hide Charge CC';
  373. }
  374. }
  375. function togglePrcAdd() {
  376. if($('div_prc_add').style.display=='' || $('div_prc_add').style.display==undefined) {
  377. //$('div_charge').style.display = 'none';
  378. Effect.BlindUp('div_prc_add');
  379. $('btn_prc_add').value = 'Add Price Adjustment';
  380. }else if($('div_prc_add').style.display=='none') {
  381. //$('div_charge').style.display = '';
  382. Effect.BlindDown('div_prc_add');
  383. $('btn_prc_add').value = 'Hide Price Adjustment';
  384. }
  385. }
  386. //-->
  387. </script>
  388. <style type="text/css">
  389. a img{
  390. border: 0;
  391. }
  392. </style>
  393. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="" align="center">
  394. <tr>
  395. <td width="100%">
  396. <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
  397. <?php if($isprinter && @$invoiceheader != ""){ ?>
  398. <tr>
  399. <td colspan="6"><?php print $invoiceheader?></td>
  400. </tr>
  401. <?php } ?>
  402. <tr <? //if(!empty($alldata["ordEID"])) echo 'bgcolor="#FA6561"'?>>
  403. <td colspan="6" align="center"><strong><?php print $xxOrdNum . " " . $alldata["ordID"] . "<br /><br />" . date($dateformatstr, $alldata["ordDate"]) . " " . date("H:i", $alldata["ordDate"])?></strong></td>
  404. </tr>
  405. <?php if($isprinter && @$invoiceaddress != ""){ ?>
  406. <tr>
  407. <td colspan="6"><?php print $invoiceaddress?></td>
  408. </tr>
  409. <?php } ?>
  410. <?php if(trim(@$extraorderfield1)!=""){ ?>
  411. <tr>
  412. <td width="23%" align="right"><strong><?php print $extraorderfield1 ?>:</strong></td>
  413. <td align="left" colspan="5"><?php print editfunc($alldata["ordExtra1"],"ordextra1",25)?></td>
  414. </tr>
  415. <?php } ?>
  416. <tr>
  417. <td width="23%" align="right"><strong><?php print $xxName?>:</strong></td>
  418. <td colspan="3" align="left"><?php print editfunc($alldata["ordName"],"name",25)?></td>
  419. <td width="25%" align="right">
  420. <strong><?php print $xxEmail?>:</strong></td>
  421. <td width="24%" align="left"><?php
  422. if($isprinter || $doedit) print editfunc($alldata["ordEmail"],"email",25); else print '<a href="mailto:' . $alldata["ordEmail"] . '">' . $alldata["ordEmail"] . '</a>';?></td>
  423. </tr>
  424. <tr>
  425. <td align="right"><strong><?php print $xxAddress?>:</strong></td>
  426. <td colspan="3" align="left"<?php if(@$useaddressline2==TRUE) print ' colspan="3"'?>><?php print editfunc($alldata["ordAddress"],"address",25)?></td>
  427. <?php if(@$useaddressline2==TRUE){ ?>
  428. </tr>
  429. <tr>
  430. <td align="right"><strong><?php print $xxAddress2?>:</strong></td>
  431. <td colspan="3" align="left"><?php print editfunc($alldata["ordAddress2"],"address2",25)?></td>
  432. <?php } ?>
  433. <td align="right"><strong><?php print $xxCity?>:</strong></td>
  434. <td align="left"><?php print editfunc($alldata["ordCity"],"city",25)?></td>
  435. </tr>
  436. <tr>
  437. <td align="right"><strong><?php print $xxAllSta?>:</strong></td>
  438. <td align="left"><?php print editfunc($alldata["ordState"],"state",25)?></td>
  439. <td align="right"><strong>APO/PO:</strong></td>
  440. <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>
  441. <td align="right"><strong><?php print $xxCountry?>:</strong></td>
  442. <td align="left"><?php
  443. if($doedit){
  444. $foundmatch=FALSE;
  445. print '<select name="country" size="1">';
  446. $sSQL = "SELECT countryName,countryTax,countryOrder FROM countries ORDER BY countryOrder DESC, countryName";
  447. $result = mysql_query($sSQL) or print(mysql_error());
  448. while($rs2 = mysql_fetch_array($result)){
  449. print '<option value="' . str_replace('"','&quot;',$rs2["countryName"]) . '"';
  450. if($alldata["ordCountry"]==$rs2["countryName"]){
  451. print ' selected';
  452. $foundmatch=TRUE;
  453. $countrytaxrate=$rs2["countryTax"];
  454. $countryorder=$rs2["countryOrder"];
  455. }
  456. print '>' . $rs2["countryName"] . "</option>\r\n"; }
  457. mysql_free_result($result);
  458. if(! $foundmatch) print '<option value="' . str_replace('"','&quot;',$alldata["ordCountry"]) . '" selected>' . $alldata["ordCountry"] . "</option>\r\n";
  459. print '</select>';
  460. if($countryorder==2){
  461. $sSQL = "SELECT stateTax FROM states WHERE stateAbbrev='" . mysql_real_escape_string($alldata["ordState"]) . "'";
  462. $result = mysql_query($sSQL) or print(mysql_error());
  463. if($rs2 = mysql_fetch_array($result))
  464. $statetaxrate = $rs2["stateTax"];
  465. }
  466. if($alldata["ordStateTax"]==0)$statetaxrate=0;
  467. }else
  468. print $alldata["ordCountry"];?></td>
  469. </tr>
  470. <tr>
  471. <td align="right"><strong><?php print $xxZip?>:</strong></td>
  472. <td colspan="3" align="left"><?php print editfunc($alldata["ordZip"],"zip",15)?></td>
  473. <td align="right"><strong><?php print $xxPhone?>:</strong></td>
  474. <td align="left"><?php print editfunc($alldata["ordPhone"],"phone",25)?></td>
  475. </tr>
  476. <?php if(trim(@$extraorderfield2)!=""){ ?>
  477. <tr>
  478. <td align="right"><strong><?php print @$extraorderfield2 ?>:</strong></td>
  479. <td align="left" colspan="5"><?php print editfunc($alldata["ordExtra2"],"ordextra2",25)?></td>
  480. </tr>
  481. <?php } ?>
  482. <?php if(! $isprinter){ ?>
  483. <tr>
  484. <td align="right"><strong>IP Address:</strong></td>
  485. <td colspan="3" align="left"><?php print editfunc($alldata["ordIP"],"ipaddress",15)?></td>
  486. <td align="right"><strong><?php print $yyAffili?>:</strong></td>
  487. <td align="left"><?php print editfunc($alldata["ordAffiliate"],"PARTNER",15)?></td>
  488. </tr>
  489. <?php }
  490. if(trim($alldata["ordDiscountText"])!=""){ ?>
  491. <tr>
  492. <td align="right" valign="top"><strong><?php print $xxAppDs?>:</strong></td>
  493. <td align="left" colspan="5"><?php print editfunc($alldata["ordDiscountText"],"discounttext",25)?></td>
  494. </tr>
  495. <?php }
  496. if(trim($alldata["ordShipName"]) != "" || trim($alldata["ordShipAddress"]) != "" || trim($alldata["ordShipCity"]) != "" || $doedit){ ?>
  497. <tr>
  498. <td align="center" colspan="6"><strong><?php print $xxShpDet?>.</strong></td>
  499. </tr>
  500. <tr>
  501. <td align="right"><strong><?php print $xxName?>:</strong></td>
  502. <td align="left" colspan="5"><?php print editfunc($alldata["ordShipName"],"sname",25)?></td>
  503. </tr>
  504. <tr>
  505. <td align="right"><strong><?php print $xxAddress?>:</strong></td>
  506. <td colspan="3" align="left"<?php if(@$useaddressline2==TRUE) print ' colspan="3"'?>><?php print editfunc($alldata["ordShipAddress"],"saddress",25)?></td>
  507. <?php if(@$useaddressline2==TRUE){ ?>
  508. </tr>
  509. <tr>
  510. <td align="right"><strong><?php print $xxAddress2?>:</strong></td>
  511. <td colspan="3" align="left"><?php print editfunc($alldata["ordShipAddress2"],"saddress2",25)?></td>
  512. <?php } ?>
  513. <td align="right"><strong><?php print $xxCity?>:</strong></td>
  514. <td align="left"><?php print editfunc($alldata["ordShipCity"],"scity",25)?></td>
  515. </tr>
  516. <tr>
  517. <td align="right"><strong><?php print $xxAllSta?>:</strong></td>
  518. <td align="left"><?php print editfunc($alldata["ordShipState"],"sstate",25)?></td>
  519. <td align="right"><strong>APO/PO:</strong></td>
  520. <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>
  521. <td align="right"><strong><?php print $xxCountry?>:</strong></td>
  522. <td align="left"><?php
  523. if($doedit){
  524. if(trim($alldata["ordShipName"]) != "" || trim($alldata["ordShipAddress"]) != "") $usingshipcountry=TRUE; else $usingshipcountry=FALSE;
  525. $foundmatch=FALSE;
  526. print '<select name="scountry" size="1">';
  527. $sSQL = "SELECT countryName,countryTax,countryOrder FROM countries ORDER BY countryOrder DESC, countryName";
  528. $result = mysql_query($sSQL) or print(mysql_error());
  529. while($rs2 = mysql_fetch_array($result)){
  530. print '<option value="' . str_replace('"','&quot;',$rs2["countryName"]) . '"';
  531. if($alldata["ordShipCountry"]==$rs2["countryName"]){
  532. print ' selected';
  533. $foundmatch=TRUE;
  534. if($usingshipcountry) $countrytaxrate=$rs2["countryTax"];
  535. $countryorder=$rs2["countryOrder"];
  536. }
  537. print '>' . $rs2["countryName"] . "</option>\r\n"; }
  538. mysql_free_result($result);
  539. if(! $foundmatch) print '<option value="' . str_replace('"','&quot;',$alldata["ordShipCountry"]) . '" selected>' . $alldata["ordShipCountry"] . "</option>\r\n";
  540. print '</select>';
  541. if($countryorder==2 && $usingshipcountry){
  542. $sSQL = "SELECT stateTax FROM states WHERE stateName='" . mysql_real_escape_string($alldata["ordShipState"]) . "'";
  543. $result = mysql_query($sSQL) or print(mysql_error());
  544. if($rs2 = mysql_fetch_array($result))
  545. $statetaxrate = $rs2["stateTax"];
  546. }
  547. }else
  548. print $alldata["ordShipCountry"]?></td>
  549. </tr>
  550. <tr>
  551. <td align="right"><strong><?php print $xxZip?>:</strong></td>
  552. <td align="left" colspan="5"><?php print editfunc($alldata["ordShipZip"],"szip",15)?></td>
  553. </tr>
  554. <?php }
  555. if($alldata["ordShipType"] != "" || $alldata["ordComLoc"]>0 || $doedit){ ?>
  556. <tr>
  557. <td align="right"><strong><?php print $xxShpMet?>:</strong></td>
  558. <td colspan="3" align="left"><?php print editfunc($alldata["ordShipType"],"shipmethod",25);
  559. if(! $doedit && ($alldata["ordComLoc"]&2)==2) print $xxWtIns?></td>
  560. <td align="right"><strong><?php print $xxCLoc?>:</strong></td>
  561. <td align="left"><?php if($doedit){
  562. print '<select name="commercialloc" size="1">';
  563. print '<option value="N">' . $yyNo . '</option>';
  564. print '<option value="Y"' . (($alldata["ordComLoc"]&1)==1 ? ' selected' : '') . '>' . $yyYes . '</option>';
  565. print '</select>';
  566. }else{
  567. if(($alldata["ordComLoc"]&1)==1) print $yyYes; else print $yyNo;
  568. }?></td>
  569. </tr>
  570. <?php if($doedit){ ?>
  571. <tr>
  572. <td align="right"><strong><?php print $xxShpIns?>:</strong></td>
  573. <td align="left" colspan="5"><?php
  574. print '<select name="wantinsurance" size="1">';
  575. print '<option value="N">' . $yyNo . '</option>';
  576. print '<option value="Y"' . (($alldata["ordComLoc"]&2)==2 ? ' selected' : '') . '>' . $yyYes . '</option>';
  577. print '</select>';
  578. ?></td>
  579. </tr>
  580. <?php }
  581. }
  582. $ordAuthNumber = trim($alldata["ordAuthNumber"]);
  583. $ordTransID = trim($alldata["ordTransID"]);
  584. if(! $isprinter && ($ordAuthNumber != "" || $ordTransID != "" || $doedit)){ ?>
  585. <tr>
  586. <td align="right"><strong><?php print $yyAutCod?>:</strong></td>
  587. <td colspan="3" align="left"><?php print editfunc($ordAuthNumber,"ordAuthNumber",15) ?></td>
  588. <td align="right"><strong><?php print $yyTranID?>:</strong></td>
  589. <td align="left"><?php print editfunc($ordTransID,"ordTransID",15) ?></td>
  590. </tr>
  591. <?php }
  592. // BOL#s ADDED BY CHAD JUL 27,06
  593. $sql_bol = "SELECT * FROM bol WHERE ordID = " . $alldata["ordID"];
  594. $res_bol = mysql_query($sql_bol) or print(mysql_error());
  595. if(mysql_num_rows($res_bol) > 0) {
  596. $row_bol = mysql_fetch_assoc($res_bol);
  597. ?>
  598. <tr>
  599. <td align="right"><strong>Express BOL#:</strong></td>
  600. <td colspan="3"><?=$row_bol['exBOL']?></td>
  601. <?php
  602. if(!empty($row_bol['smBOL'])) {
  603. ?>
  604. <td align="right"><strong>Smart Mail BOL#:</strong></td>
  605. <td><?=$row_bol['smBOL']?></td>
  606. <?php
  607. }
  608. if(!empty($row_bol['gmBOL'])) {
  609. ?>
  610. <td align="right"><strong>Global Mail BOL#:</strong></td>
  611. <td><?=$row_bol['gmBOL']?></td>
  612. <?php
  613. }
  614. ?>
  615. </tr>
  616. <?php
  617. }
  618. // ADD ENDED
  619. $ordAddInfo = Trim($alldata["ordAddInfo"]);
  620. if($ordAddInfo != "" || $doedit){ ?>
  621. <tr>
  622. <td align="right" valign="top"><strong><?php print $xxAddInf?>:</strong></td>
  623. <td align="left" colspan="5"><?php
  624. if($doedit)
  625. print '<textarea name="ordAddInfo" cols="50" rows="4" wrap=virtual>' . $ordAddInfo . '</textarea>';
  626. else
  627. print str_replace(array("\r\n","\n"),array("<br />","<br />"),$ordAddInfo); ?></td>
  628. </tr>
  629. <?php }
  630. if(! $isprinter){
  631. if(! $doedit) print '<form method="post" action="/admin/orderssz.php"><input type="hidden" name="updatestatus" value="1" /><input type="hidden" name="orderid" value="' . @$_GET["id"] . '" />';
  632. ?> <tr>
  633. <td align="right" valign="top"><strong><?php print $yyStaInf?>:</strong></td>
  634. <td align="left" colspan="5"><?php print $alldata["ordStatusInfo"]?> </td>
  635. </tr>
  636. <? if($doedit) { ?>
  637. <tr>
  638. <td align="right" valign="top"><strong><?php print $yySupInf?>:</strong></td>
  639. <td align="left" colspan="5"><textarea name="ordSupportInfo" cols="50" rows="4" wrap=virtual><?php print $alldata["ordSupportInfo"]?></textarea> <?php if(! $doedit) print '<input type="submit" value="' . $yyUpdate . '" />'?></td>
  640. </tr>
  641. <? } ?>
  642. <?php if(($alldata["ordPayProvider"]==3 || $alldata["ordPayProvider"]==13) && $alldata["ordAuthNumber"] != ""){ ?>
  643. <tr>
  644. <td align="center" colspan="6">&nbsp;</td>
  645. </tr>
  646. <?php }
  647. if(! $doedit) print '</form>';
  648. if((int)$alldata["ordPayProvider"]==10){ ?>
  649. <tr>
  650. <td align="center" colspan="6"><hr width="50%"> </td>
  651. </tr>
  652. <?php if(@$_SERVER["HTTPS"] != "on" && (@$_SERVER["SERVER_PORT"] != "443") && @$nochecksslserver != TRUE){ ?>
  653. <tr>
  654. <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>
  655. </tr>
  656. <?php }else{
  657. $ordCNum = $alldata["ordCNum"];
  658. if($ordCNum != ""){
  659. $cnumarr = "";
  660. $encryptmethod = strtolower(@$encryptmethod);
  661. if($encryptmethod=="none"){
  662. $cnumarr = explode("&",$ordCNum);
  663. }elseif($encryptmethod=="mcrypt"){
  664. if(@$mcryptalg == "") $mcryptalg = MCRYPT_BLOWFISH;
  665. $td = mcrypt_module_open($mcryptalg, '', 'cbc', '');
  666. $thekey = @$ccencryptkey;
  667. $thekey = substr($thekey, 0, mcrypt_enc_get_key_size($td));
  668. $cnumarr = explode(" ", $ordCNum);
  669. $iv = @$cnumarr[0];
  670. $iv = @pack("H" . strlen($iv), $iv);
  671. $ordCNum = @pack("H" . strlen(@$cnumarr[1]), @$cnumarr[1]);
  672. mcrypt_generic_init($td, $thekey, $iv);
  673. $cnumarr = explode("&", mdecrypt_generic($td, $ordCNum));
  674. mcrypt_generic_deinit($td);
  675. mcrypt_module_close($td);
  676. }else{
  677. print '<tr><td colspan="4">WARNING: $encryptmethod is not set. Please see http://www.ecommercetemplates.com/phphelp/ecommplus/parameters.asp#encryption</td></tr>';
  678. }
  679. } ?>
  680. <tr>
  681. <td align="right" colspan="4"><strong><?php print $xxCCName?>:</strong></td>
  682. <td align="left" colspan="2"><?php
  683. if(@$encryptmethod!=""){
  684. if(is_array(@$cnumarr)) print URLDecode(@$cnumarr[4]);
  685. } ?></td>
  686. </tr>
  687. <tr>
  688. <td align="right" colspan="4"><strong><?php print $yyCarNum?>:</strong></td>
  689. <td align="left" colspan="2"><?php
  690. if($ordCNum != ""){
  691. if(is_array($cnumarr)) print $cnumarr[0];
  692. }else{
  693. print "(no data)";
  694. } ?></td>
  695. </tr>
  696. <tr>
  697. <td align="right" colspan="4"><strong><?php print $yyExpDat?>:</strong></td>
  698. <td align="left" colspan="2"><?php
  699. if(@$encryptmethod!=""){
  700. if(is_array(@$cnumarr)) print @$cnumarr[1];
  701. } ?></td>
  702. </tr>
  703. <tr>
  704. <td align="right" colspan="4"><strong>CVV Code:</strong></td>
  705. <td align="left" colspan="2"><?php
  706. if(@$encryptmethod!=""){
  707. if(is_array(@$cnumarr)) print @$cnumarr[2];
  708. } ?></td>
  709. </tr>
  710. <tr>
  711. <td align="right" colspan="4"><strong>Issue Number:</strong></td>
  712. <td align="left" colspan="2"><?php
  713. if(@$encryptmethod!=""){
  714. if(is_array(@$cnumarr)) print @$cnumarr[3];
  715. } ?></td>
  716. </tr>
  717. <?php if($ordCNum != "" && !$doedit){ ?>
  718. <form method=POST action="/admin/orderssz.php?id=<?php print $_GET["id"]?>">
  719. <input type="hidden" name="delccdets" value="<?php print $_GET["id"]?>" />
  720. <tr>
  721. <td align="center" colspan="6"><input type=submit value="<?php print $yyDelCC?>" /></td>
  722. </tr>
  723. </form>
  724. <?php }
  725. }
  726. }
  727. } // isprinter ?>
  728. <tr>
  729. <td align="center" colspan="6">&nbsp;<br /></td>
  730. </tr>
  731. </table>
  732. <span id="productspan">
  733. <table width="100%" border="1" cellspacing="0" cellpadding="4" bordercolor="#999999" style="border-collapse: collapse">
  734. <tr>
  735. <td><strong><?php print $xxPrId?></strong></td>
  736. <td><strong><?php print $xxPrNm?></strong></td>
  737. <td><strong><?php print $xxPrOpts?></strong></td>
  738. <td><strong><?php print $xxQuant?></strong></td>
  739. <td><strong><?php if($doedit) print $xxUnitPr; else print $xxPrice?></strong></td>
  740. <?php if($doedit) print '<td align="center"><strong>DEL</strong></td>' ?>
  741. </tr>
  742. <?php
  743. $totoptpricediff = 0;
  744. if(mysql_num_rows($allorders)>0){
  745. $totoptpricediff = 0;
  746. $rowcounter=0;
  747. while($rsOrders = mysql_fetch_assoc($allorders)){
  748. $optpricediff = 0;
  749. ?>
  750. <tr>
  751. <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>
  752. <td valign="top">
  753. <?php print editfunc($rsOrders["cartProdName"],'prodname' . $rowcounter,24)?><br />
  754. <?
  755. $sql_cert="SELECT cert_id,cert_code FROM certificates WHERE cert_order_id=".$_GET["id"]." AND cert_prod_id='".$rsOrders["cartProdId"]."'";
  756. //echo $sql_cert;
  757. $result_cert=mysql_query($sql_cert);
  758. if(mysql_num_rows($result_cert)>0) {
  759. while($row_cert=mysql_fetch_assoc($result_cert)){?>
  760. <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 />
  761. <? }
  762. }?>
  763. <?
  764. $sql_down="SELECT * FROM digitaldownloads WHERE orderID=".$_GET["id"]." AND type='".$rsOrders["cartProdId"]."'";
  765. //echo $sql_cert;
  766. $result_down=mysql_query($sql_down);
  767. if(mysql_num_rows($result_down)>0) {?>
  768. <ol style="margin:2px;">
  769. <? while($row_down=mysql_fetch_assoc($result_down)){?>
  770. <li style="margin:1px; font-weight:bold;">License ID: <?=$row_down['licenseID']?><br />
  771. Password: <?=$row_down['password']?></li>
  772. <? } ?>
  773. </ol>
  774. <? }?>
  775. </td>
  776. <td valign="top"><?php
  777. if($doedit) print '<span id="optionsspan' . $rowcounter . '">';
  778. $sSQL = "SELECT coOptGroup,coCartOption,coPriceDiff,coOptID,optGroup,coExtendShipping FROM cartoptions LEFT JOIN options ON cartoptions.coOptID=options.optID WHERE coCartID=" . $rsOrders["cartID"] . " ORDER BY coID";
  779. $result = mysql_query($sSQL) or print(mysql_error());
  780. if(mysql_num_rows($result) > 0){
  781. if($doedit) print '<table border="0" cellspacing="0" cellpadding="1" width="100%">';
  782. while($rs2 = mysql_fetch_array($result)){
  783. if($doedit){
  784. print '<tr><td align="right"><strong>' . $rs2["coOptGroup"] . ':</strong></td><td>';
  785. if(is_null($rs2["optGroup"])){
  786. print 'xxxxxx';
  787. }else{
  788. $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';
  789. $result2 = mysql_query($sSQL) or print(mysql_error());
  790. if($rsl = mysql_fetch_assoc($result2)){
  791. if(abs($rsl["optType"])==2){
  792. print '<select onchange="dorecalc(true)" name="optn' . $rowcounter . '_' . $rs2["coOptID"] . '" id="optn' . $rowcounter . '_' . $rs2["coOptID"] . '" size="1">';
  793. do {
  794. print '<option value="' . $rsl["optID"] . "|" . (($rsl["optFlags"] & 1) == 1 ? ($rsOrders["cartProdPrice"]*$rsl["optPriceDiff"])/100.0 : $rsl["optPriceDiff"]) . '"';
  795. if($rsl["optID"]==$rs2["coOptID"]) print ' selected';
  796. print '>' . $rsl[getlangid("optName",32)];
  797. if((double)$rsl["optPriceDiff"] != 0){
  798. print ' ';
  799. if((double)$rsl["optPriceDiff"] > 0) print '+';
  800. if(($rsl["optFlags"] & 1) == 1)
  801. print number_format(($rsOrders["cartProdPrice"]*$rsl["optPriceDiff"])/100.0,2,'.','');
  802. else
  803. print number_format($rsl["optPriceDiff"],2,'.','');
  804. }
  805. print '</option>';
  806. } while($rsl = mysql_fetch_array($result2));
  807. print '</select>';
  808. }else{
  809. 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'>";
  810. print $rs2["coCartOption"] . '</textarea>';
  811. }
  812. }
  813. }
  814. print "</td></tr>";
  815. }else{
  816. $extend_shipping='';
  817. if(!empty($rs2["coExtendShipping"])) $extend_shipping=' <span style="color:#FF0000;font-weight:bold;">(This option increases shipping time by '.$rs2["coExtendShipping"]. ' days)</span>';
  818. print '<strong>' . $rs2["coOptGroup"] . ':</strong> ' . str_replace(array("\r\n","\n"),array("<br />","<br />"),$rs2["coCartOption"]) .$cert_code. $extend_shipping . '<br />';
  819. }
  820. if($doedit)
  821. $optpricediff += $rs2["coPriceDiff"];
  822. else
  823. $rsOrders["cartProdPrice"] += $rs2["coPriceDiff"];
  824. }
  825. if($doedit) print '</table>';
  826. }else{
  827. print '-';
  828. }
  829. mysql_free_result($result);
  830. if($doedit) print '</span>' ?></td>
  831. <td valign="top"><?php print editfunc($rsOrders["cartQuantity"],'quant' . $rowcounter . '" onchange="dorecalc(true)',5)?></td>
  832. <td valign="top"><?php if($doedit) print editnumeric($rsOrders["cartProdPrice"],'price' . $rowcounter . '" onchange="dorecalc(true)',7); else print FormatEuroCurrency($rsOrders["cartProdPrice"]*$rsOrders["cartQuantity"])?>
  833. <?php if($doedit){
  834. print '<input type="hidden" id="optdiffspan' . $rowcounter . '" value="' . $optpricediff . '">';
  835. $totoptpricediff += ($optpricediff*$rsOrders["cartQuantity"]);
  836. }
  837. ?></td>
  838. <?php if($doedit) print '<td align="center"><input type="checkbox" name="del_' . $rowcounter . '" id="del_' . $rowcounter . '" value="yes" /></td>' ?>
  839. </tr>
  840. <?php $rowcounter++;
  841. }
  842. }
  843. ?>
  844. <!--NEXTPRODUCTCOMMENT-->
  845. <?php if($doedit){ ?>
  846. <tr>
  847. <td align="right" colspan="4">
  848. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  849. <tr>
  850. <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>
  851. <td align="right"><strong>Options Total:</strong></td>
  852. </tr>
  853. </table></td>
  854. <td align="left" colspan="2"><span id="optdiffspan"><?php print number_format($totoptpricediff, 2, '.', '')?></span></td>
  855. </tr>
  856. <?php } ?>
  857. <tr>
  858. <td align="right" colspan="4"><strong><?php print $xxOrdTot?>:</strong></td>
  859. <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>
  860. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  861. </tr>
  862. <?php
  863. $runTot = $alldata["ordTotal"];
  864. $sql = "SELECT * FROM price_adj WHERE ordID = " . $_GET['id'] . " ORDER BY ordering";
  865. $res = mysql_query($sql) or print(mysql_error());
  866. if(mysql_num_rows($res) > 0) {
  867. $k=1;
  868. $prcTot = 0;
  869. ?>
  870. <tr>
  871. <td>&nbsp;</td>
  872. <td>&nbsp;</td>
  873. <td>&nbsp;</td>
  874. <td>&nbsp;</td>
  875. <td>&nbsp;</td>
  876. </tr>
  877. <?php
  878. while($row=mysql_fetch_assoc($res)) {
  879. $price = 0;
  880. $disp_price = 0;
  881. $amount = '';
  882. if($row['type'] == 'credit') {
  883. if($row['amt_type'] == 'percentage') {
  884. $price = $runTot * ($row['amt'] * .01);
  885. $runTot -= $price;
  886. $prcTot -= $price;
  887. $disp_price = '-'.(int)$row['amt'].'%';
  888. $amount = '-'.money_format("%!.2n",$price);
  889. }else{
  890. $price = '$-'.money_format("%!.2n",$row['amt']);
  891. $runTot -= $row['amt'];
  892. $prcTot -= $row['amt'];
  893. $disp_price = $price;
  894. $amount = '-'.money_format("%!.2n",$row['amt']);
  895. }
  896. }else{
  897. if($row['amt_type'] == 'percentage') {
  898. $price = $runTot * ($row['amt'] * .01);
  899. $runTot += $price;
  900. $prcTot += $price;
  901. $disp_price = (int)$row['amt'].'%';
  902. $amount = money_format("%.2n",$price);
  903. }else{
  904. $price = money_format("%.2n",$row['amt']);
  905. $runTot += $row['amt'];
  906. $prcTot += $row['amt'];
  907. $disp_price = $price;
  908. $amount = money_format("%.2n",$row['amt']);
  909. }
  910. }
  911. ?>
  912. <tr>
  913. <td colspan="3" style="font-weight: bold; text-align: right">Price Adjustment <?=$k?>:</td>
  914. <td align="left"<?=(strstr($disp_price,"-"))?' style="color: red"':''?>><?=$disp_price?></td>
  915. <td align="left"<?=(strstr($disp_price,"-"))?' style="color: red"':''?>><?=$amount?></td>
  916. </tr>
  917. <?php
  918. $k++;
  919. }
  920. ?>
  921. <tr>
  922. <td>&nbsp;</td>
  923. <td>&nbsp;</td>
  924. <td>&nbsp;</td>
  925. <td>&nbsp;</td>
  926. <td>&nbsp;</td>
  927. </tr>
  928. <?php
  929. }
  930. ?>
  931. <?php if((double)$alldata["ordShipping"]!=0.0 || $doedit){ ?>
  932. <tr>
  933. <td align="right" colspan="4"><strong><?php print $xxShippg?>:</strong></td>
  934. <td align="left"><?php print editnumeric($alldata["ordShipping"],"ordShipping",7)?></td>
  935. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  936. </tr>
  937. <?php }
  938. if((double)$alldata["ordHandling"]!=0.0 || $doedit){ ?>
  939. <tr>
  940. <td align="right" colspan="4"><strong><?php print $xxHndlg?>:</strong></td>
  941. <td align="left"><?php print editnumeric($alldata["ordHandling"],"ordHandling",7)?></td>
  942. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  943. </tr>
  944. <?php }
  945. if((double)$alldata["ordDiscount"]!=0.0 || $doedit){ ?>
  946. <tr>
  947. <td align="right" colspan="4"><strong><?php print $xxDscnts?>:</strong></td>
  948. <td align="left"><font color="#FF0000"><?php print editnumeric($alldata["ordDiscount"],"ordDiscount",7)?></font></td>
  949. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  950. </tr>
  951. <?php }
  952. if((double)$alldata["ord_cert_amt"]!=0.0 || $doedit){
  953. $sqlcert="SELECT cert_code FROM certificates WHERE cert_id=".$alldata["ord_cert_id"];
  954. $resultcert=mysql_query($sqlcert);
  955. $rowcert=mysql_fetch_assoc($resultcert);
  956. ?>
  957. <tr>
  958. <td align="right" colspan="4"><strong><?='('.$rowcert["cert_code"].')'?> <?php print $xxGCerts?>:</strong></td>
  959. <td align="left"><font color="#FF0000"><?php print editnumeric($alldata["ord_cert_amt"],"ord_cert_amt",7)?></font></td>
  960. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  961. </tr>
  962. <?php }
  963. if((double)$alldata["ordStateTax"]!=0.0 || $doedit){ ?>
  964. <tr>
  965. <td align="right" colspan="4"><strong><?php print $xxStaTax?>:</strong></td>
  966. <td align="left"><?php print editnumeric($alldata["ordStateTax"],"ordStateTax",7)//$alldata["ordStateTax"]?></td>
  967. <?php if($doedit) print '<td align="center" nowrap><input type="text" name="staterate" id="staterate" size="1" value="' . $statetaxrate . '">%</td>' ?>
  968. </tr>
  969. <?php }
  970. if((double)$alldata["ordCountryTax"]!=0.0 || $doedit){ ?>
  971. <tr>
  972. <td align="right" colspan="4"><strong><?php print $xxCntTax?>:</strong></td>
  973. <td align="left"><?php print editnumeric($alldata["ordCountryTax"],"ordCountryTax",7)?></td>
  974. <?php if($doedit) print '<td align="center" nowrap><input type="text" name="countryrate" id="countryrate" size="1" value="' . $countrytaxrate . '">%</td>' ?>
  975. </tr>
  976. <?php }
  977. if((double)$alldata["ordHSTTax"]!=0.0 || ($doedit && @$canadataxsystem)){ ?>
  978. <tr>
  979. <td align="right" colspan="4"><strong><?php print $xxHST?>:</strong></td>
  980. <td align="left"><?php print editnumeric($alldata["ordHSTTax"],"ordHSTTax",7)?></td>
  981. <?php if($doedit) print '<td align="center" nowrap><input type="text" name="hstrate" id="hstrate" size="1" value="' . $hsttaxrate . '">%</td>' ?>
  982. </tr>
  983. <?php } ?>
  984. <tr>
  985. <td align="right" colspan="4"><strong><?php print $xxGndTot?>:</strong></td>
  986. <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>
  987. <?php if($doedit) print '<td align="center">&nbsp;</td>' ?>
  988. </tr>
  989. </table>
  990. </span>
  991. </td>
  992. </tr>
  993. <?php if($isprinter && @$invoicefooter != ""){ ?>
  994. <tr>
  995. <td width="100%"><?php print $invoicefooter?></td>
  996. </tr>
  997. <?php }elseif($doedit){ ?>
  998. <tr>
  999. <td align="center" width="100%">&nbsp;<br /><input type="submit" value="<?php print $yyUpdate?>" /><br />&nbsp;</td>
  1000. </tr>
  1001. <?php } ?>
  1002. </table>
  1003. <?php
  1004. if($doedit) print '</form>';
  1005. if($doedit){
  1006. // ADDED by Chad Jun-06-06
  1007. // PRICE ADJUSTMENTS
  1008. ?>
  1009. <h2><a name="prc_adj"></a>Price Adjustments</h2>
  1010. <?php
  1011. if(!empty($_GET['adj_err'])) {
  1012. ?>
  1013. <div style="margin: 5px auto; color: #FF0000; font-weight: bold; text-align: center"><?=$_GET['adj_err']?></div>
  1014. <?php
  1015. }elseif(!empty($_GET['adj_msg'])) {
  1016. ?>
  1017. <div style="margin: 5px auto; color: #009900; font-weight: bold; text-align: center"><?=$_GET['adj_msg']?></div>
  1018. <?php
  1019. }
  1020. ?>
  1021. <table width="95%" cellpadding="3" cellspacing="0" border="1" style="margin: 0 auto 5px auto; border: 1px solid #BFC9E0; border-collapse: collapse">
  1022. <tr style="background-color: #BFC9E0; color: #194C7F">
  1023. <th width="60" style="text-align: center">Type</th>
  1024. <th width="80" style="text-align: center">Amount Type</th>
  1025. <th width="80" style="text-align: center">Amount</th>
  1026. <th width="150" style="text-align: center">Date</th>
  1027. <th>Note</th>
  1028. <?php
  1029. if(strstr($_SESSION['employee']['permissions'],"all") || $_SESSION['employee']['id']==19 || $_SESSION['employee']['id']==12 || $_SESSION['employee']['id']==2) {
  1030. ?>
  1031. <th width="28">Edit</th>
  1032. <th width="28">Delete</th>
  1033. <th width="28">Move Up</th>
  1034. <th width="28">Move Down</th>
  1035. <?php
  1036. }
  1037. ?>
  1038. </tr>
  1039. <?php
  1040. $sql = "SELECT * FROM price_adj WHERE ordID = " . $_GET["id"] . " ORDER BY ordering";
  1041. $res = mysql_query($sql) or print(mysql_error());
  1042. $num_rows = mysql_num_rows($res);
  1043. if($num_rows > 0) {
  1044. $j=0;
  1045. while($row=mysql_fetch_assoc($res)) {
  1046. ?>
  1047. <tr<?=($j%0==0?'':' style="background-color: #E6E9F5"')?>>
  1048. <td style="text-align: center"><?=$row['type']?></td>
  1049. <td style="text-align: center"><?=$row['amt_type']?></td>
  1050. <td style="text-align: right"><?=$row['amt']?></td>
  1051. <td style="text-align: left"><?=date("n/j/Y g:i a",strtotime($row['date']))?></td>
  1052. <td style="text-align: left"><?=$row['note']?></td>
  1053. <?php
  1054. if(strstr($_SESSION['employee']['permissions'],"all") || $_SESSION['employee']['id']==19 || $_SESSION['employee']['id']==12 || $_SESSION['employee']['id']==2) {
  1055. ?>
  1056. <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>
  1057. <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>
  1058. <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>
  1059. <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>
  1060. <?php
  1061. }
  1062. ?>
  1063. </tr>
  1064. <?php
  1065. $j++;
  1066. }
  1067. }else{
  1068. ?>
  1069. <tr>
  1070. <td colspan="9" style="text-align: center; font-weight: bold">No Price Adjustments Found</td>
  1071. </tr>
  1072. <?php
  1073. }
  1074. ?>
  1075. </table>
  1076. <?php
  1077. if(strstr($_SESSION['employee']['permissions'],"all") || $_SESSION['employee']['id']==19 || $_SESSION['employee']['id']==12 || $_SESSION['employee']['id']==2) {
  1078. ?>
  1079. <input type="button" id="btn_prc_add" value="Add Price Adjustment" onclick="togglePrcAdd();" />
  1080. <div id="div_prc_add" style="display: none">
  1081. <form id="adj_frm" name="adj_frm" method="post" action="adminorderssz_process.php">
  1082. <table cellpadding="3" cellspacing="0" border="1" style="margin: 0 auto 5px auto; border: 1px solid #BFC9E0; border-collapse: collapse">
  1083. <tr style="background-color: #BFC9E0; color: #194C7F">
  1084. <td colspan="2" style="text-align: center; font-weight: bold; font-size: 14px">Add Price Adjustment</td>
  1085. </tr>
  1086. <tr>
  1087. <td style="font-weight: bold">Type:</td>
  1088. <td>
  1089. <select id="adj_type" name="adj_type">
  1090. <option value="" selected="selected">Choose...</option>
  1091. <option value="credit">Credit</option>
  1092. <option value="debit">Debit</option>
  1093. </select>
  1094. </td>
  1095. </tr>
  1096. <tr>
  1097. <td style="font-weight: bold">Amt Type:</td>
  1098. <td>
  1099. <select id="adj_amt_type" name="adj_amt_type">
  1100. <option value="" selected="selected">Choose...</option>
  1101. <option value="fixed">Fixed</option>
  1102. <option value="percentage">Percentage</option>
  1103. </select>
  1104. </td>
  1105. </tr>
  1106. <tr>
  1107. <td style="font-weight: bold">Amount:</td>
  1108. <td><input id="adj_amt" name="adj_amt" type="text" value="" /></td>
  1109. </tr>
  1110. <tr>
  1111. <td style="font-weight: bold">Note:</td>
  1112. <td><textarea id="adj_note" name="adj_note"></textarea></td>
  1113. </tr>
  1114. <tr>
  1115. <td colspan="2" style="text-align: center"><input type="submit" id="adj_submit" name="adj_submit" value="Add" /></td>
  1116. </tr>
  1117. </table>
  1118. <input type="hidden" id="adj_ordID" name="adj_ordID" value="<?=$_GET["id"]?>" />
  1119. <input type="hidden" id="adj_doedit" name="adj_doedit" value="<?=$_GET["doedit"]?>" />
  1120. </form>
  1121. </div>
  1122. <?php
  1123. }
  1124. // ADD ENDED
  1125. // ADDED by Chad Jun-05-06
  1126. // TRANSACTIONS
  1127. $sql = "SELECT * FROM transactions WHERE ordID = " . $_GET["id"];
  1128. $res = mysql_query($sql) or print(mysql_error());
  1129. ?>
  1130. <h2><a name="aim"></a>Transactions</h2>
  1131. <?php
  1132. if(!empty($_GET['aim_err'])) {
  1133. ?>
  1134. <div style="margin: 5px auto; color: #FF0000; font-weight: bold; text-align: center"><?=$_GET['aim_err']?></div>
  1135. <?php
  1136. }elseif(!empty($_GET['aim_msg'])) {
  1137. ?>
  1138. <div style="margin: 5px auto; color: #009900; font-weight: bold; text-align: center"><?=$_GET['aim_msg']?></div>
  1139. <?php
  1140. }
  1141. ?>
  1142. <table width="95%" cellpadding="3" cellspacing="0" border="1" style="margin: 0 auto 5px auto; border: 1px solid #BFC9E0; border-collapse: collapse">
  1143. <tr style="background-color: #BFC9E0; color: #194C7F">
  1144. <th width="85" style="text-align: center">Type</th>
  1145. <th width="60" style="text-align: right">Amount</th>
  1146. <th width="80" style="text-align: center">TXN</th>
  1147. <th width="120" style="text-align: left">Date</th>
  1148. <th>Note</th>
  1149. </tr>
  1150. <?php
  1151. while($row=mysql_fetch_assoc($res)) {
  1152. ?>
  1153. <tr>
  1154. <td style="text-align: center"><?=$row['type']?></td>
  1155. <td style="text-align: center"><?=money_format("%.2n",$row['amt'])?></td>
  1156. <td style="text-align: center"><?=$row['txn']?></td>
  1157. <td style="text-align: center"><?=date("n/j/Y g:i a",strtotime($row['date_received']))?></td>
  1158. <td><?=$row['note']?></td>
  1159. </tr>
  1160. <?php
  1161. }
  1162. ?>
  1163. </table>
  1164. <?php
  1165. if(strstr($_SESSION['employee']['permissions'],"all") || $_SESSION['employee']['id']==19 || $_SESSION['employee']['id']==12 || $_SESSION['employee']['id']==2) {
  1166. ?>
  1167. <input type="button" id="btn_add_txn" value="Credit or Void" onclick="toggleTXN();" />
  1168. <div id="div_trans" style="display: none">
  1169. <form id="aim_frm" name="aim_frm" method="post" action="/admin/ordersprocess.php" onsubmit="return checkAIM(this);">
  1170. <table cellpadding="3" cellspacing="0" border="1" style="margin: 5px auto 5px auto; border: 1px solid #BFC9E0; border-collapse: collapse">
  1171. <tr style="background-color: #BFC9E0; color: #194C7F">
  1172. <td colspan="4" style="text-align: center; font-weight: bold; font-size: 14px">Credit or Void a Transaction</td>
  1173. </tr>
  1174. <tr>
  1175. <th style="text-align: center">Type</th>
  1176. <th style="text-align: center">TXN</th>
  1177. <th style="text-align: center">Amount</th>
  1178. <th>Note</th>
  1179. </tr>
  1180. <tr>
  1181. <td valign="top">
  1182. <select name="aim_type" id="aim_type">
  1183. <option value="" selected="selected">Choose...</option>
  1184. <option value="CREDIT">Credit</option>
  1185. <option value="VOID">Void</option>
  1186. </select>
  1187. </td>
  1188. <td valign="top"><input type="text" id="aim_txn" name="aim_txn" value="" autocomplete="off" /></td>
  1189. <td valign="top"><input type="text" id="aim_amt" name="aim_amt" value="" autocomplete="off" /></td>
  1190. <td valign="top"><textarea id="aim_note" name="aim_note"></textarea></td>
  1191. </tr>
  1192. <tr>
  1193. <td colspan="4" style="text-align: right"><input type="submit" id="aim_submit" name="aim_submit" value="Submit" /></td>
  1194. </tr>
  1195. </table>
  1196. <input type="hidden" id="aim_inv" name="aim_inv" value="<?=$_GET["id"]?>" />
  1197. <?php
  1198. $tmp = explode(" ",$alldata["ordName"]);
  1199. ?>
  1200. <input type="hidden" id="aim_fname" name="aim_fname" value="<?=$tmp[0]?>" />
  1201. <input type="hidden" id="aim_lname" name="aim_lname" value="<?=(!empty($tmp[1]))?$tmp[1]:''?>" />
  1202. <input type="hidden" id="aim_doedit" name="aim_doedit" value="<?=$_GET['doedit']?>" />
  1203. </form>
  1204. </div>
  1205. <input type="button" id="btn_charge" value="Charge CC" onclick="toggleCharge();" style="display: block; margin: 5px 5px 5px 0" />
  1206. <div id="div_charge" style="display: none">
  1207. <?
  1208. if(!empty($alldata["ordEID"])){
  1209. $sql_eid="SELECT * FROM customers WHERE custID=".$alldata["ordEID"];
  1210. $result_eid=mysql_query($sql_eid);
  1211. if(mysql_num_rows($result_eid)>0){
  1212. $row_eid=mysql_fetch_assoc($result_eid);
  1213. }
  1214. }
  1215. ?>
  1216. <form id="frmCharge" name="frmCharge" method="post" action="/admin/ordersprocess.php">
  1217. <table cellpadding="3" cellspacing="0" border="1" style="margin: 5px auto 5px auto; border: 1px solid #BFC9E0; border-collapse: collapse">
  1218. <tr style="background-color: #BFC9E0; color: #194C7F">
  1219. <td colspan="2" style="font-size: 14px; font-weight: bold; text-align: center">Authorize &amp; Capture</td>
  1220. </tr>
  1221. <tr>
  1222. <td>First Name:</td>
  1223. <td><input type="text" id="am_fname" name="am_fname" value="<?=$row_eid['Name']?>" /></td>
  1224. </tr>
  1225. <tr>
  1226. <td>Last Name:</td>
  1227. <td><input type="text" id="am_lname" name="am_lname" value="" /></td>
  1228. </tr>
  1229. <tr>
  1230. <td>Address:</td>
  1231. <td><input type="text" id="am_address" name="am_address" value="<?=$row_eid['Address']?>" /></td>
  1232. </tr>
  1233. <tr>
  1234. <td>Address 2:</td>
  1235. <td><input type="text" id="am_address2" name="am_address2" value="<?=$row_eid['Address2']?>" /></td>
  1236. </tr>
  1237. <tr>
  1238. <td>City:</td>
  1239. <td><input type="text" id="am_city" name="am_city" value="<?=$row_eid['City']?>" /></td>
  1240. </tr>
  1241. <tr>
  1242. <td>State:</td>
  1243. <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>
  1244. </tr>
  1245. <tr>
  1246. <td>Zip:</td>
  1247. <td><input type="text" id="am_zip" name="am_zip" value="<?=$row_eid['Zip']?>" /></td>
  1248. </tr>
  1249. <tr>
  1250. <td>Amount:</td>
  1251. <td><input type="text" id="am_amt" name="am_amt" value="" autocomplete="off" /></td>
  1252. </tr>
  1253. <tr>
  1254. <td>CC#:</td>
  1255. <td><input type="text" id="am_cc_num" name="am_cc_num" value="<?=Decrypt($row_eid['ccNum'], $cart_misc)?>" autocomplete="off" /></td>
  1256. </tr>
  1257. <tr>
  1258. <td>Exp. Date:</td>
  1259. <td>
  1260. <select id="am_exp_mon" name="am_exp_mon">
  1261. <?
  1262. $ccexp=explode('/',$row_eid['ccExp']);
  1263. for($i=1; $i<=12; $i++)
  1264. {
  1265. if($i<10)
  1266. $i = '0'.$i;
  1267. if($i == $ccexp[0])
  1268. echo '<option value="'.$i.'" selected="selected">'.$i.'</option>';
  1269. else if(date('n') == $i )
  1270. echo '<option value="'.$i.'" selected="selected">'.$i.'</option>';
  1271. else
  1272. echo '<option value="'.$i.'">'.$i.'</option>';
  1273. }
  1274. ?>
  1275. </select>&nbsp;/&nbsp;
  1276. <select id="am_exp_year" name="am_exp_year">
  1277. <?
  1278. $cur_year = date('Y');
  1279. for($i=($cur_year); $i<=$cur_year+10; $i++)
  1280. {
  1281. if($i == $ccexp[1])
  1282. echo '<option value="'.$i.'" selected="selected">'.$i.'</option>';
  1283. elseif(date('Y') == $i || $i==$ccexp[1])
  1284. echo '<option value="'.$i.'" selected="selected">'.$i.'</option>';
  1285. else
  1286. echo '<option value="'.$i.'">'.$i.'</option>';
  1287. }
  1288. ?>
  1289. </select>
  1290. </td>
  1291. </tr>
  1292. <tr>
  1293. <td>CCV:</td>
  1294. <td><input type="text" id="am_ccv" name="am_ccv" value="<?=$row_eid['ccCCV']?>" autocomplete="off" /></td>
  1295. </tr>
  1296. <tr>
  1297. <td colspan="2" style="text-align: center"><input type="submit" id="am_submit" name="am_submit" value="Submit" /></td>
  1298. </tr>
  1299. </table>
  1300. <input type="hidden" id="am_inv" name="am_inv" value="<?=$_GET["id"]?>" />
  1301. <input type="hidden" id="am_type" name="am_type" value="AUTH_CAPTURE" />
  1302. <input type="hidden" id="am_doedit" name="am_doedit" value="<?=$_GET['doedit']?>" />
  1303. </form>
  1304. </div>
  1305. <?php
  1306. }
  1307. } // End of User permission check
  1308. // ADDED by Chad Apr-04-06
  1309. // LOCATION HISTORY
  1310. $qry = "SELECT * FROM location WHERE ordID = '".$_GET["id"]."'";
  1311. $res = mysql_query($qry) or print(mysql_error());
  1312. ?>
  1313. <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">
  1314. <tr style="border-bottom: 1px solid #4B1610">
  1315. <td colspan="2" style="text-align: center; background-color: #4B1610; color: #FFFFFF; font-weight: bold">Location History</td>
  1316. </tr>
  1317. <?php
  1318. $i=0;
  1319. if(mysql_num_rows($res) > 0 ) {
  1320. while($row = mysql_fetch_assoc($res)) {
  1321. ?>
  1322. <tr style="background-color: #<?=($i%2==0)?'903E36':'903E36'?>; border-bottom: 1px solid #4B1610">
  1323. <td width="50%" style="color: #FFFFFF"><?=$row['location']?></td>
  1324. <td style="color: #FFFFFF"><?=$row['stamp']?></td>
  1325. </tr>
  1326. <?php
  1327. $i++;
  1328. }
  1329. }else{
  1330. ?>
  1331. <tr>
  1332. <td colspan="2" style="text-align: center">No location found</td>
  1333. </tr>
  1334. <?php
  1335. }
  1336. ?>
  1337. </table>
  1338. <?php
  1339. // ADD ENDED
  1340. // ADDED by Chad Apr-04-06
  1341. // FEDEX TRACKING
  1342. $qry = "SELECT * FROM fedex WHERE ordID = '".$_GET["id"]."'";
  1343. $res = mysql_query($qry);
  1344. if(mysql_num_rows($res) > 0) {
  1345. $row = mysql_fetch_assoc($res);
  1346. $trackNum = $row['trackNum'];
  1347. if(!empty($trackNum)) {
  1348. include(DOCROOT.'includes/fedex/fedexdc.php');
  1349. $fed = new FedExDC();
  1350. $track_Ret = $fed->track(
  1351. array(
  1352. '1537' => $trackNum, //Tracking Number
  1353. '1534' =>'Y' // detail_scan_indicator (Show me all the tracking data)
  1354. )
  1355. );
  1356. $ctr = 0;
  1357. $hasChanged = false;
  1358. $isDelivered = false;
  1359. for($i=1; $i<=$track_Ret[1584]; $i++) {
  1360. // See Customer Service Page for displaying results
  1361. ?>
  1362. <div style="margin: 10px auto; border: 2px solid #2C578A; width: 550px">
  1363. <table align="center" width="550" border="0" cellpadding="3" cellspacing="0" style="font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif">
  1364. <tr>
  1365. <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>
  1366. <th colspan="3" style="font-size: 14px; text-align: right; background-color: #2C578A; color: #FFF; font-weight: bold">Tracking# <?=$trackNum?></th>
  1367. </tr>
  1368. <?php
  1369. if(!empty($track_Ret['1339-'.$i]))
  1370. {
  1371. $tmp_date = $track_Ret['1339-'.$i];
  1372. $est_del = substr($tmp_date,0,4).'-'.substr($tmp_date,4,2).'-'.substr($tmp_date,6,2);
  1373. ?>
  1374. <tr>
  1375. <td colspan="5" style="background-color: #2C578A; height: 15px">&nbsp;</td>
  1376. </tr>
  1377. <tr>
  1378. <td colspan="5" style="background-color: #DFE7FF"><strong>Estimated Delivery Date:</strong> <?=date('M j, Y',strtotime($est_del))?></td>
  1379. </tr>
  1380. <?php
  1381. }
  1382. ?>
  1383. <tr>
  1384. <th align="left" width="150" colspan="2" style="background-color: #2C578A; color: #FFF; font-weight: bold">Date/Time</th>
  1385. <th align="left" style="background-color: #2C578A; color: #FFF; font-weight: bold">Activity</th>
  1386. <th align="left" style="background-color: #2C578A; color: #FFF; font-weight: bold">Location</th>
  1387. <th align="left" style="background-color: #2C578A; color: #FFF; font-weight: bold">Details</th>
  1388. </tr>
  1389. <?php
  1390. for($j=1; $j<=$track_Ret['1715-'.$i]; $j++)
  1391. {
  1392. $date = $track_Ret['1162-'.$i.'-'.$j];
  1393. $year = substr($date,0,4);
  1394. $mon = substr($date,4,2);
  1395. $day = substr($date,6,2);
  1396. $hrs = substr($track_Ret['1163-'.$i.'-'.$j],0,2);
  1397. $min = substr($track_Ret['1163-'.$i.'-'.$j],2,2);
  1398. $sec = substr($track_Ret['1163-'.$i.'-'.$j],4,2);
  1399. $date = $year.'-'.$mon.'-'.$day.' '.$hrs.':'.$min.':'.$sec;
  1400. $unixDate = strtotime($date);
  1401. if(empty($track_Ret['1161-'.$i.'-'.$j]))
  1402. {
  1403. $state = $track_Ret['1164-'.$i.'-'.$j];
  1404. }
  1405. else
  1406. {
  1407. $state = $track_Ret['1161-'.$i.'-'.$j];
  1408. }
  1409. if(date('Ymd',$unixDate) != date('Ymd',$last_date))
  1410. {
  1411. $ctr++;
  1412. $hasChanged = true;
  1413. }
  1414. if($track_Ret['1159-'.$i.'-'.$j] == 'Delivered' && empty($track_Ret['1711-'.$i.'-'.$j]))
  1415. {
  1416. $isDelivered = true;
  1417. }
  1418. ?>
  1419. <tr style="background-color: #<?=($ctr%2==0)?'FFF':'DFE7FF'?>">
  1420. <?php
  1421. if($hasChanged)
  1422. {
  1423. ?>
  1424. <td style="text-align: left" valign="top">
  1425. <span style="font-weight: bold"><?=date('M j, Y',$unixDate)?></span>
  1426. </td>
  1427. <td valign="top" style="text-align: right; border-right: 1px solid #<?=($ctr%2!=0)?'FFF':'DFE7FF'?>"><?=date('g:i A',$unixDate)?></td>
  1428. <?php
  1429. $hasChanged = false;
  1430. }
  1431. else
  1432. {
  1433. ?>
  1434. <td valign="top" colspan="2" style="text-align: right; border-right: 1px solid #<?=($ctr%2!=0)?'FFF':'DFE7FF'?>"><?=date('g:i A',$unixDate)?></td>
  1435. <?php
  1436. }
  1437. ?>
  1438. </td>
  1439. <td valign="top" style="border-right: 1px solid #<?=($ctr%2!=0)?'FFF':'DFE7FF'?>"><?=($isDelivered)?'<strong>':''?><?=$track_Ret['1159-'.$i.'-'.$j]?><?=($isDelivered)?'</strong>':''?></td>
  1440. <td valign="top" style="border-right: 1px solid #<?=($ctr%2!=0)?'FFF':'DFE7FF'?>"><?=$track_Ret['1160-'.$i.'-'.$j]?>, <?=$state?></td>
  1441. <td valign="top"><?=$track_Ret['1711-'.$i.'-'.$j]?></td>
  1442. </tr>
  1443. <?php
  1444. if($isDelivered)
  1445. {
  1446. $isDelivered = false;
  1447. }
  1448. $last_date = $unixDate;
  1449. }
  1450. }
  1451. ?>
  1452. </table>
  1453. </div>
  1454. <?php
  1455. }
  1456. }
  1457. // ADD ENDED
  1458. // ADDED by Chad Apr-03-06
  1459. // DHL AND USPS TRACKING
  1460. $qry = "SELECT * FROM dhl WHERE custPackID = '".$_GET["id"]."'";
  1461. $res = mysql_query($qry) or print(mysql_error());
  1462. if(mysql_num_rows($res) > 0) {
  1463. $row = mysql_fetch_assoc($res);
  1464. $trackNum = $row['DHLGMTrackNum'];
  1465. if(!empty($trackNum)) {
  1466. $ch = curl_init();
  1467. curl_setopt($ch,CURLOPT_URL,"http://api.smartmail.com/tnt2.cfm?number=$trackNum&criteria=3&type=wddx&custid=rband&passwd=sm36732");
  1468. //curl_setopt($ch, CURLOPT_POST, 1);
  1469. curl_setopt($ch,CURLOPT_HEADER,0);
  1470. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  1471. //curl_setopt($ch, CURLOPT_POSTFIELDS, "number=$trackNum&criteria=3&type=wddx&custid=rband&passwd=sm36732");
  1472. $res = curl_exec($ch);
  1473. curl_close($ch);
  1474. $info = wddx_deserialize($res);
  1475. if(empty($info['Detail'][0])) { //If no errors
  1476. ?>
  1477. <div style="height: 20px"></div>
  1478. <table align="center" width="500" cellpadding="3" cellspacing="0" style="border: 1px solid #FFFFFF">
  1479. <tr>
  1480. <td colspan="2" style="color: #FFFFFF; background-color: #CC0000; text-align: center; font-weight: bold; font-size: 18px">DHL Tracking</td>
  1481. </tr>
  1482. <?php
  1483. if(!empty($info['TRACK_PKUP_DATE'][0])) {
  1484. ?>
  1485. <tr>
  1486. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_PKUP_DATE'][0]?></td>
  1487. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Picked Up by SmartMail</td>
  1488. </tr>
  1489. <?php
  1490. }
  1491. if(!empty($info['TRACK_RECV_DATE'][0])) {
  1492. ?>
  1493. <tr>
  1494. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_RECV_DATE'][0]?></td>
  1495. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Arrived at Smart Center</td>
  1496. </tr>
  1497. <?php
  1498. }
  1499. if(!empty($info['TRACK_ENCD_DATE'][0])) {
  1500. ?>
  1501. <tr>
  1502. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_ENCD_DATE'][0]?></td>
  1503. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Processed and Verified</td>
  1504. </tr>
  1505. <?php
  1506. }
  1507. if(!empty($info['TRACK_DNSD_DATE'][0])) {
  1508. ?>
  1509. <tr>
  1510. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_DNSD_DATE'][0]?></td>
  1511. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Sent via <?=(!empty($info['TRACK_DNDC'][0]))?$info['TRACK_DNDC'][0]:"SmartMail"?></td>
  1512. </tr>
  1513. <?php
  1514. }
  1515. if(!empty($info['TRACK_DNRC_DATE'][0])) {
  1516. ?>
  1517. <tr>
  1518. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_DNRC_DATE'][0]?></td>
  1519. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Received</td>
  1520. </tr>
  1521. <?php
  1522. }
  1523. if(!empty($info['TRACK_MFST_DATE'][0])) {
  1524. ?>
  1525. <tr>
  1526. <td style="background-color: #FFCC00; text-align: left; font-weight: bold"><?=$info['TRACK_MFST_DATE'][0]?></td>
  1527. <td bordercolor="#FFFFFF" style="background-color: #FFCC00">Mail Delivered to Post Office</td>
  1528. </tr>
  1529. <?php
  1530. }
  1531. ?>
  1532. </table>
  1533. <?php
  1534. // CHECK USPS TRACKING INFO
  1535. if(!empty($info['TRACK_DELV_CONF'][0])) {
  1536. $ch = curl_init();
  1537. curl_setopt($ch,CURLOPT_URL,"http://Production.ShippingAPIs.com/ShippingAPI.dll");
  1538. curl_setopt($ch, CURLOPT_POST, 1);
  1539. curl_setopt($ch,CURLOPT_HEADER,0);
  1540. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  1541. curl_setopt($ch, CURLOPT_POSTFIELDS, 'API=TrackV2&XML=<TrackFieldRequest USERID="268REMIN3619"><TrackID ID="'.$info['TRACK_DELV_CONF'][0].'"></TrackID></TrackFieldRequest>');
  1542. $res = curl_exec($ch);
  1543. curl_close($ch);
  1544. include(APPPATH.'views/pages/admin/xml2array.php');
  1545. $xmlData = new xml2array();
  1546. $uspsData = $xmlData -> parseXMLintoarray($res);
  1547. ?>
  1548. <div style="margin: 5px auto; width: 500px">
  1549. <div style="margin: 0; height: 5px; background-color: #CC0000"></div>
  1550. <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>
  1551. <div style="margin: 0; height: 7px; background-color: #98CCFF"></div>
  1552. <div style="margin: 2px 0 0 0; background-color: #E3F1FC; border: 1px solid #89B9E7">
  1553. <?php
  1554. if(is_array($uspsData['TrackResponse']['TrackInfo']['Error'])) {
  1555. echo '<div style="margin: 0; text-align: center; font-weight: bold">Error Getting USPS Tracking Information</div>';
  1556. }else{
  1557. if(is_array($uspsData['TrackResponse']['TrackInfo']['TrackSummary'])) {
  1558. $eventTime = $uspsData['TrackResponse']['TrackInfo']['TrackSummary']['EventDate'].' '.$uspsData['TrackResponse']['TrackInfo']['TrackSummary']['EventTime'];
  1559. ?>
  1560. <div style="margin: 0; padding: 3px; background-color: #89B9E7; color: #FFFFFF; font-weight: bold">Event Summary</div>
  1561. <div style="margin: 0">
  1562. <table width="500" border="0" cellpadding="3" cellspacing="0" style="margin: 2px;">
  1563. <tr>
  1564. <td valign="top" style="font-weight: bold"><?=$eventTime?></td>
  1565. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackSummary']['EventCity']?>, <?=$uspsData['TrackResponse']['TrackInfo']['TrackSummary']['EventState']?></td>
  1566. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackSummary']['Event']?></td>
  1567. </tr>
  1568. </table>
  1569. </div>
  1570. <?php
  1571. }
  1572. if(is_array($uspsData['TrackResponse']['TrackInfo']['TrackDetail'])) {
  1573. ?>
  1574. <div style="margin: 0; padding: 3px; background-color: #89B9E7; color: #FFFFFF; font-weight: bold">Tracking Details</div>
  1575. <table width="500" border="0" align="center" cellpadding="3" cellspacing="0" style="margin: 2px;">
  1576. <?php
  1577. if(is_array($uspsData['TrackResponse']['TrackInfo']['TrackDetail'][0])){
  1578. for($i=0; $i<count($uspsData['TrackResponse']['TrackInfo']['TrackDetail']); $i++) {
  1579. $eventTime = $uspsData['TrackResponse']['TrackInfo']['TrackDetail'][$i]['EventDate'].' '.$uspsData['TrackResponse']['TrackInfo']['TrackDetail'][$i]['EventTime'];
  1580. ?>
  1581. <tr>
  1582. <td valign="top" style="font-weight: bold"><?=$eventTime?></td>
  1583. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail'][$i]['EventCity']?>, <?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail'][$i]['EventState']?></td>
  1584. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail'][$i]['Event']?></td>
  1585. </tr>
  1586. <?php
  1587. } // End of TrackDetail Loop
  1588. }else{
  1589. $eventTime = $uspsData['TrackResponse']['TrackInfo']['TrackDetail']['EventDate'].' '.$uspsData['TrackResponse']['TrackInfo']['TrackDetail']['EventTime'];
  1590. ?>
  1591. <tr>
  1592. <td valign="top" style="font-weight: bold"><?=$eventTime?></td>
  1593. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail']['EventCity']?>, <?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail']['EventState']?></td>
  1594. <td valign="top"><?=$uspsData['TrackResponse']['TrackInfo']['TrackDetail']['Event']?></td>
  1595. </tr>
  1596. <?php
  1597. }
  1598. ?>
  1599. </table>
  1600. <?php
  1601. } // End of displaying all Tracking Details
  1602. } // End of displaying all USPS tracking information
  1603. ?>
  1604. </div>
  1605. </div>
  1606. <?php
  1607. }
  1608. }
  1609. }
  1610. }
  1611. // ADD ENDED
  1612. }else{
  1613. $sSQL = "SELECT ordID FROM orders WHERE ordStatus=1";
  1614. if(@$_POST["act"] != "purge") $sSQL .= " AND ordStatusDate<'" . date("Y-m-d H:i:s", time()-(3*60*60*24)) . "'";
  1615. $result = mysql_query($sSQL) or print(mysql_error());
  1616. while($rs = mysql_fetch_assoc($result)){
  1617. $theid = $rs["ordID"];
  1618. $delOptions = "";
  1619. $addcomma = "";
  1620. $result2 = mysql_query("SELECT cartID FROM cart WHERE cartOrderID=" . $theid) or print(mysql_error());
  1621. while($rs2 = mysql_fetch_assoc($result2)){
  1622. $delOptions .= $addcomma . $rs2["cartID"];
  1623. $addcomma = ",";
  1624. }
  1625. if($delOptions != ""){
  1626. $sSQL = "DELETE FROM cartoptions WHERE coCartID IN (" . $delOptions . ")";
  1627. mysql_query($sSQL) or print(mysql_error());
  1628. }
  1629. mysql_query("DELETE FROM cart WHERE cartOrderID=" . $theid) or print(mysql_error());
  1630. mysql_query("DELETE FROM orders WHERE ordID=" . $theid) or print(mysql_error());
  1631. }
  1632. if(@$_POST["act"]=="authorize"){
  1633. do_stock_management(trim($_POST["id"]));
  1634. if(trim($_POST["authcode"]) != "")
  1635. $sSQL = "UPDATE orders set ordAuthNumber='" . mysql_real_escape_string(trim($_POST["authcode"])) . "',ordStatus=3 WHERE ordID=" . $_POST["id"];
  1636. else
  1637. $sSQL = "UPDATE orders set ordAuthNumber='" . mysql_real_escape_string($yyManAut) . "',ordStatus=3 WHERE ordID=" . $_POST["id"];
  1638. if(mysql_query($sSQL)) {
  1639. if(!setNewLocation( 3 , $_POST["id"] )) print("Unable to record status change.");
  1640. }else{
  1641. print(mysql_error());
  1642. }
  1643. mysql_query("UPDATE cart SET cartCompleted=1 WHERE cartOrderID=" . $_POST["id"]) or print(mysql_error());
  1644. }elseif(@$_POST["act"]=="status"){
  1645. $maxitems=(int)($_POST["maxitems"]);
  1646. for($index=0; $index < $maxitems; $index++){
  1647. $iordid = trim($_POST["ordid" . $index]);
  1648. $ordstatus = trim($_POST["ordstatus" . $index]);
  1649. $ordauthno = "";
  1650. $oldordstatus=999;
  1651. $result = mysql_query("SELECT ordStatus,ordAuthNumber,ordEmail,ordDate,".getlangid("statPublic",64).",ordStatusInfo,ordName FROM orders INNER JOIN orderstatus ON orders.ordStatus=orderstatus.statID WHERE ordID=" . $iordid) or print(mysql_error());
  1652. if($rs = mysql_fetch_assoc($result)){
  1653. $oldordstatus=$rs["ordStatus"];
  1654. $ordauthno=$rs["ordAuthNumber"];
  1655. $ordemail=$rs["ordEmail"];
  1656. $orddate=strtotime($rs["ordDate"]);
  1657. $oldstattext=$rs[getlangid("statPublic",64)];
  1658. $ordstatinfo=$rs["ordStatusInfo"];
  1659. $ordername=$rs["ordName"];
  1660. }
  1661. if(! ($oldordstatus==999) && ($oldordstatus < 3 && $ordstatus >=3)){
  1662. // This is to force stock management
  1663. mysql_query("UPDATE cart SET cartCompleted=0 WHERE cartOrderID=" . $iordid) or print(mysql_error());
  1664. do_stock_management($iordid);
  1665. mysql_query("UPDATE cart SET cartCompleted=1 WHERE cartOrderID=" . $iordid) or print(mysql_error());
  1666. if($ordauthno=="") mysql_query("UPDATE orders SET ordAuthNumber='". mysql_real_escape_string($yyManAut) . "' WHERE ordID=" . $iordid) or print(mysql_error());
  1667. }
  1668. if(! ($oldordstatus==999) && ($oldordstatus >=3 && $ordstatus < 3)) release_stock($iordid);
  1669. if($iordid != "" && $ordstatus != ""){
  1670. if($oldordstatus != (int)$ordstatus && @$_POST["emailstat"]=="1"){
  1671. $result = mysql_query("SELECT ".getlangid("statPublic",64)." FROM orderstatus WHERE statID=" . $ordstatus);
  1672. if($rs = mysql_fetch_assoc($result))
  1673. $newstattext = $rs[getlangid("statPublic",64)];
  1674. $emailsubject = "Order status updated";
  1675. if(@$orderstatussubject != "") $emailsubject=$orderstatussubject;
  1676. $ose = $orderstatusemail;
  1677. $ose = str_replace("%orderid%", $iordid, $ose);
  1678. $ose = str_replace("%orderdate%", date($dateformatstr, $orddate), $ose);// . " " . date("H:i", $orddate), $ose);
  1679. $ose = str_replace("%oldstatus%", $oldstattext, $ose);
  1680. $ose = str_replace("%newstatus%", $newstattext, $ose);
  1681. $thetime = time() + ($dateadjust*60*60);
  1682. $ose = str_replace("%date%", date($dateformatstr, $thetime), $ose);// . " " . date("H:i", $thetime), $ose);
  1683. $ose = str_replace("%statusinfo%", $ordstatinfo, $ose);
  1684. $ose = str_replace("%ordername%", $ordername, $ose);
  1685. $ose = str_replace("%nl%", $emlNl, $ose);
  1686. if(@$customheaders == ""){
  1687. $customheaders = "MIME-Version: 1.0\n";
  1688. $customheaders .= "From: %from% <%from%>\n";
  1689. if(@$htmlemails==TRUE)
  1690. $customheaders .= "Content-type: text/html; charset=".$emailencoding."\n";
  1691. else
  1692. $customheaders .= "Content-type: text/plain; charset=".$emailencoding."\n";
  1693. }
  1694. $headers = str_replace('%from%',$emailAddr,$customheaders);
  1695. $headers = str_replace('%to%',$ordemail,$headers);
  1696. if((int)$ordstatus==9) {
  1697. $ose = $orderstatusshippedemail;
  1698. $ose = str_replace("%orderid%", $iordid, $ose);
  1699. $ose = str_replace("%orderdate%", date($dateformatstr, $orddate) . " " . date("H:i", $orddate), $ose);
  1700. $emailsubject = $orderstatusshippedsubject;
  1701. }
  1702. mail($ordemail, $emailsubject, $ose, $headers);
  1703. }
  1704. if($oldordstatus != (int)$ordstatus) {
  1705. if(mysql_query("UPDATE orders SET ordStatus=" . $ordstatus . ",ordStatusDate='" . date("Y-m-d H:i:s", time() + ($dateadjust*60*60)) . "' WHERE ordID=" . $iordid)) {
  1706. if(!setNewLocation( $ordstatus , $iordid )) print("Unable to record status change.");
  1707. }else{
  1708. print(mysql_error());
  1709. }
  1710. }
  1711. }
  1712. }
  1713. }
  1714. if(@$_POST["sd"] != "")
  1715. $sd = @$_POST["sd"];
  1716. elseif(@$_GET["sd"] != "")
  1717. $sd = @$_GET["sd"];
  1718. else
  1719. $sd = date($admindatestr, time() + ($dateadjust*60*60));
  1720. if(@$_POST["ed"] != "")
  1721. $ed = @$_POST["ed"];
  1722. elseif(@$_GET["ed"] != "")
  1723. $ed = @$_GET["ed"];
  1724. else
  1725. $ed = date($admindatestr, time() + ($dateadjust*60*60));
  1726. $sd = parsedate($sd);
  1727. $ed = parsedate($ed);
  1728. if($sd > $ed) $ed = $sd;
  1729. $fromdate = trim(@$_POST["fromdate"]);
  1730. $todate = trim(@$_POST["todate"]);
  1731. $ordid = trim(str_replace('"',"",str_replace("'","",@$_POST["ordid"])));
  1732. $origsearchtext = trim(unstripslashes(@$_POST["searchtext"]));
  1733. $searchtext = trim(mysql_real_escape_string(unstripslashes(@$_POST["searchtext"])));
  1734. $ordstatus = "";
  1735. if(@$_POST["powersearch"]=="1"){
  1736. $sSQL = "SELECT ordID,ordName,payProvName,ordAuthNumber,ordDate,ordStatus,ordTotal-ordDiscount AS ordTot,ordTransID,order_changed,ordDiscountText,ordEID FROM orders INNER JOIN payprovider ON payprovider.payProvID=orders.ordPayProvider WHERE ordStatus>=0 ";
  1737. $addcomma = "";
  1738. if(is_array(@$_POST["ordstatus"])){
  1739. foreach($_POST["ordstatus"] as $objValue){
  1740. if(is_array($objValue))$objValue=$objValue[0];
  1741. $ordstatus .= $addcomma . $objValue;
  1742. $addcomma = ",";
  1743. }
  1744. }else
  1745. $ordstatus = trim((string)@$_POST["ordstatus"]);
  1746. //discounts
  1747. $ordcoupon = trim((string)@$_POST["ordcoupon"]);
  1748. if($ordid != ""){
  1749. if(is_numeric($ordid)){
  1750. $sSQL .= " AND ordID=" . $ordid;
  1751. }else{
  1752. $success=FALSE;
  1753. $errmsg="The order id you specified seems to be invalid - " . $ordid;
  1754. $sSQL .= " AND ordID=0";
  1755. }
  1756. }else{
  1757. if($fromdate != ""){
  1758. if(is_numeric($fromdate))
  1759. $thefromdate = time()-($fromdate*60*60*24);
  1760. else
  1761. $thefromdate = parsedate($fromdate);
  1762. if($todate=="")
  1763. $thetodate = $thefromdate;
  1764. elseif(is_numeric($todate))
  1765. $thetodate = time()-($todate*60*60*24);
  1766. else
  1767. $thetodate = parsedate($todate);
  1768. if($thefromdate > $thetodate){
  1769. $tmpdate = $thetodate;
  1770. $thetodate = $thefromdate;
  1771. $thefromdate = $tmpdate;
  1772. }
  1773. $sd = $thefromdate;
  1774. $ed = $thetodate;
  1775. $sSQL .= " AND ordDate BETWEEN '" . date("Y-m-d", $sd) . "' AND '" . date("Y-m-d", $ed) . " 23:59:59'";
  1776. }
  1777. //discount
  1778. if($ordcoupon != "") $sSQL .= " AND ordDiscountText = '" . $ordcoupon . "'";
  1779. if($ordstatus != "" && strpos($ordstatus,"9999")===FALSE) $sSQL .= " AND ordStatus IN (" . $ordstatus . ")";
  1780. if($searchtext != "") $sSQL .= " AND (ordTransID LIKE '%" . $searchtext . "%' OR ordAuthNumber LIKE '%" . $searchtext . "%' OR ordName LIKE '%" . $searchtext . "%' OR ordEmail LIKE '%" . $searchtext . "%' OR ordAddress LIKE '%" . $searchtext . "%' OR ordCity LIKE '%" . $searchtext . "%' OR ordState LIKE '%" . $searchtext . "%' OR ordZip LIKE '%" . $searchtext . "%' OR ordPhone LIKE '%" . $searchtext . "%')";
  1781. if($_POST['ordPOAPOs'] == 'shipping_APOs') {
  1782. $sSQL .= " AND IF(ordShipAddress != '',ordShipState IN('AA','AE','AP') AND ordShipPoApo = 1,ordState IN('AA','AE','AP') AND ordPoApo = 1)";
  1783. }elseif($_POST['ordPOAPOs'] == 'shipping_POs') {
  1784. $sSQL .= " AND IF(ordShipAddress != '',ordShipState NOT IN('AA','AE','AP') AND ordShipPoApo = 1,ordState NOT IN('AA','AE','AP') AND ordPoApo = 1)";
  1785. }elseif($_POST['ordPOAPOs'] == 'shipping_PO_APO') {
  1786. $sSQL .= " AND IF(ordShipAddress != '',ordShipPoApo = 1,ordPoApo = 1)";
  1787. }elseif($_POST['ordPOAPOs'] == 'APOs') {
  1788. $sSQL .= " AND ((ordPoApo = 1 AND ordState IN('AA','AE','AP')) OR (ordPoApo = 1 AND ordState IN('AA','AE','AP')))";
  1789. }elseif($_POST['ordPOAPOs'] == 'PO_APO') {
  1790. $sSQL .= " AND (ordPoApo = 1 OR ordShipPoApo = 1)";
  1791. }elseif($_POST['ordPOAPOs'] == 'POs') {
  1792. $sSQL .= " AND ((ordPoApo = 1 AND ordState NOT IN('AA','AE','AP')) OR (ordPoApo = 1 AND ordState NOT IN('AA','AE','AP')))";
  1793. }
  1794. if($_POST['custID'] !="") $sSQL .= " AND ordEID=".$_POST['custID'];
  1795. }
  1796. $sSQL .= " AND ordEID=13 ORDER BY ordID";
  1797. }else{
  1798. $sSQL = "SELECT ordID,ordName,payProvName,ordAuthNumber,ordDate,ordStatus,ordTotal-ordDiscount AS ordTot,ordTransID,order_changed,ordEID FROM orders LEFT JOIN payprovider ON payprovider.payProvID=orders.ordPayProvider WHERE ordStatus<>1 AND ordDate BETWEEN '" . date("Y-m-d", $sd) . "' AND '" . date("Y-m-d", $ed) . " 23:59:59' AND ordEID=13 ORDER BY ordID";
  1799. }
  1800. $alldata = mysql_query($sSQL) or print(mysql_error());
  1801. //echo $sSQL;
  1802. $hasdeleted=false;
  1803. $sSQL = "SELECT COUNT(*) AS NumDeleted FROM orders WHERE ordStatus=1";
  1804. $result = mysql_query($sSQL) or print(mysql_error());
  1805. $rs = mysql_fetch_assoc($result);
  1806. if($rs["NumDeleted"] > 0) $hasdeleted=true;
  1807. mysql_free_result($result);
  1808. ?>
  1809. <script language="JavaScript" type="text/javascript" src="/lib/js/util/popcalendar.js">
  1810. </script>
  1811. <script language="JavaScript" type="text/javascript">
  1812. <!--
  1813. function delrec(id) {
  1814. cmsg = "<?php print $yyConDel?>\n"
  1815. if (confirm(cmsg)) {
  1816. document.mainform.id.value = id;
  1817. document.mainform.act.value = "delete";
  1818. document.mainform.sd.value="<?php print date($admindatestr, $sd)?>";
  1819. document.mainform.ed.value="<?php print date($admindatestr, $ed)?>";
  1820. document.mainform.submit();
  1821. }
  1822. }
  1823. function authrec(id) {
  1824. var aucode;
  1825. cmsg = "<?php print $yyEntAuth?>"
  1826. if ((aucode=prompt(cmsg,'<?php print $yyManAut?>'))!=null) {
  1827. document.mainform.id.value = id;
  1828. document.mainform.act.value = "authorize";
  1829. document.mainform.authcode.value = aucode;
  1830. document.mainform.sd.value="<?php print date($admindatestr, $sd)?>";
  1831. document.mainform.ed.value="<?php print date($admindatestr, $ed)?>";
  1832. document.mainform.submit();
  1833. }
  1834. }
  1835. function checkcontrol(tt,evt){
  1836. <?php if(strstr(@$HTTP_SERVER_VARS["HTTP_USER_AGENT"], "Gecko")){ ?>
  1837. theevnt = evt;
  1838. return;
  1839. <?php }else{ ?>
  1840. theevnt=window.event;
  1841. <?php } ?>
  1842. if(theevnt.ctrlKey){
  1843. maxitems=document.mainform.maxitems.value;
  1844. for(index=0;index<maxitems;index++){
  1845. if(eval('document.mainform.ordstatus'+index+'.length') > tt.selectedIndex){
  1846. eval('document.mainform.ordstatus'+index+'.selectedIndex='+tt.selectedIndex);
  1847. eval('document.mainform.ordstatus'+index+'.options['+tt.selectedIndex+'].selected=true');
  1848. }
  1849. }
  1850. }
  1851. }
  1852. function displaysearch(){
  1853. thestyle = document.getElementById('searchspan').style;
  1854. if(thestyle.display=='none')
  1855. thestyle.display = 'block';
  1856. else
  1857. thestyle.display = 'none';
  1858. }
  1859. function checkprinter(tt,evt){
  1860. }
  1861. // -->
  1862. </script>
  1863. <div style="width:19.4%; float:right; border:#030133 solid 1px;">
  1864. <table width="100%" border="0" cellspacing="1" cellpadding="2">
  1865. <?
  1866. if(empty($_POST['packing'])) {
  1867. $_POST['month']=date('m');
  1868. $_POST['year']=date('Y');
  1869. $thefromdate=$_POST['year'].'_'.$_POST['month'];
  1870. } else $thefromdate=$_POST['year'].'_'.$_POST['month'];
  1871. $file_path='order_ids/';
  1872. $folderName=$thefromdate;
  1873. $dir = $file_path.$folderName."/";
  1874. ?>
  1875. <tr bgcolor="#030133">
  1876. <td width="33%" align="center"><strong><font color="#E7EAEF">Shieldzone Packing Slips</font></strong></td>
  1877. </tr>
  1878. <tr>
  1879. <td width="33%" align="center">
  1880. <form action="" method="post">
  1881. <select name="month">
  1882. <option value="01" <?php if (!(strcmp('01', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Jan</option>
  1883. <option value="02" <?php if (!(strcmp('02', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Feb</option>
  1884. <option value="03" <?php if (!(strcmp('03', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Mar</option>
  1885. <option value="04" <?php if (!(strcmp('04', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Apr</option>
  1886. <option value="05" <?php if (!(strcmp('05', $_POST['month']))) {echo "selected=\"selected\"";} ?>>May</option>
  1887. <option value="06" <?php if (!(strcmp('06', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Jun</option>
  1888. <option value="07" <?php if (!(strcmp('07', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Jul</option>
  1889. <option value="08" <?php if (!(strcmp('08', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Aug</option>
  1890. <option value="09" <?php if (!(strcmp('09', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Sep</option>
  1891. <option value="10" <?php if (!(strcmp('10', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Oct</option>
  1892. <option value="11" <?php if (!(strcmp('11', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Nov</option>
  1893. <option value="12" <?php if (!(strcmp('12', $_POST['month']))) {echo "selected=\"selected\"";} ?>>Dec</option>
  1894. </select>
  1895. <?
  1896. $start_year='2006';
  1897. $this_year=date('Y');
  1898. ?>
  1899. <select name="year">
  1900. <? for($i=$start_year;$i<=$this_year;$i++){?>
  1901. <option value="<?=$i?>" <?php if (!(strcmp($i, $_POST['year']))) {echo "selected=\"selected\"";} ?>><?=$i?></option>
  1902. <? } ?>
  1903. </select>
  1904. <input name="packing" type="submit" value="go" />
  1905. </form>
  1906. </td>
  1907. </tr>
  1908. <tr>
  1909. <?
  1910. // Open a known directory, and proceed to read its contents
  1911. $i=0;
  1912. if (is_dir($dir)) {
  1913. if ($dh = opendir($dir)) {
  1914. while (($file = readdir($dh)) !== false) {
  1915. if($i>1 && strstr($file,'sz')) {
  1916. $file_info1[$i]['dir']=$dir;
  1917. $file_info1[$i]['file']=$file;
  1918. }
  1919. $i++;
  1920. }
  1921. closedir($dh);
  1922. }
  1923. }
  1924. if(!empty($file_info1)) array_multisort($file_info1,SORT_DESC,SORT_REGULAR);
  1925. ?>
  1926. <? /*
  1927. for($i=0;$i<16 && $i<count($file_info1);$i++) {
  1928. echo '<a href="/admin/print2.php?printer=true&path='.$folderName.'&file='.$file_info1[$i]['file'].'" target="_blank">'.(str_replace('.txt','',$file_info1[$i]['file'])).'</a><br />';
  1929. } */
  1930. ?>
  1931. <td align="center">
  1932. <? for($i=0;$i<count($file_info1);$i++) {?>
  1933. <table width="100%" border="0">
  1934. <tr>
  1935. <td><a href="/admin/print2.php?printer=true&path=<?=$folderName?>&file=<?=$file_info1[$i]['file']?>" target="_blank"><?=(str_replace('.txt','',$file_info1[$i]['file']))?></a></td>
  1936. <td width="20" align="right"><a href="/admin/print2.php?printer=true&ptype=1&path=<?=$folderName?>&file=<?=$file_info1[$i]['file']?>" target="_blank">Printer</a></td>
  1937. </tr>
  1938. </table>
  1939. <? } ?>
  1940. </td>
  1941. </tr>
  1942. </table>
  1943. </div>
  1944. <div style="width:80%; border:#030133 solid 1px; " >
  1945. <table border="0" cellspacing="0" cellpadding="0" width="100%" bgcolor="">
  1946. <tr>
  1947. <td width="100%" align="center">
  1948. <?php $themask = 'yyyy-mm-dd';
  1949. if($admindateformat==1)
  1950. $themask='mm/dd/yyyy';
  1951. elseif($admindateformat==2)
  1952. $themask='dd/mm/yyyy';
  1953. if(! $success) print "<p><font color='#FF0000'>" . $errmsg . "</font></p>"; ?>
  1954. <span name="searchspan" id="searchspan" <?php if($usepowersearch) print 'style="display:block"'; else print 'style="display:none"'?>>
  1955. <table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="">
  1956. <form method="post" action="/admin/orderssz.php" name="psearchform">
  1957. <input type="hidden" name="powersearch" value="1" />
  1958. <tr bgcolor="#030133"><td colspan="6"><strong><font color="#E7EAEF">&nbsp;<?php print $yyPowSea?></font></strong></td></tr>
  1959. <tr bgcolor="#E7EAEF">
  1960. <td align="right"><strong><?php print $yyOrdFro?>:</strong></td>
  1961. <td align="left">&nbsp;
  1962. <input type="text" size="14" name="fromdate" value="<?php print $fromdate?>" /> <input type=button onclick="popUpCalendar(this, document.forms.psearchform.fromdate, '<?php print $themask?>', 0)" value='DP' /></td>
  1963. <td align="right"><strong><?php print $yyOrdTil?>:</strong></td>
  1964. <td align="left">&nbsp;
  1965. <input type="text" size="14" name="todate" value="<?php print $todate?>" />
  1966. <input type="button" onclick="popUpCalendar(this, document.forms.psearchform.todate, '<?php print $themask?>', -205)" value='DP' /></td>
  1967. <td rowspan="2" align="right"><strong><?php print $yyOrdSta?>:</strong></td>
  1968. <td rowspan="2" align="left"><select name="ordstatus" size="3" multiple="multiple" id="ordstatus">
  1969. <option value="9999" <?php if(strpos($ordstatus,"9999") !== FALSE) print "selected"?>><?php print $yyAllSta?></option>
  1970. <?php
  1971. $ordstatus="";
  1972. $addcomma = "";
  1973. if(is_array(@$_REQUEST["ordstatus"])){
  1974. foreach($_REQUEST["ordstatus"] as $objValue){
  1975. if(is_array($objValue))$objValue=$objValue[0];
  1976. $ordstatus .= $addcomma . $objValue;
  1977. $addcomma = ",";
  1978. }
  1979. }else
  1980. $ordstatus = trim(@$_REQUEST["ordstatus"]);
  1981. $ordstatusarr = explode(",", $ordstatus);
  1982. for($index=0; $index < $numstatus; $index++){
  1983. print '<option value="' . $allstatus[$index]["statID"] . '"';
  1984. if(is_array($ordstatusarr)){
  1985. foreach($ordstatusarr as $objValue)
  1986. if($objValue==$allstatus[$index]["statID"]) print " selected";
  1987. }
  1988. print ">" . $allstatus[$index]["statPrivate"] . "</option>";
  1989. } ?>
  1990. </select>
  1991. </td>
  1992. </tr>
  1993. <tr bgcolor="#EAECEB">
  1994. <td align="right"><strong><?php print $yyOrdId?>:</strong></td>
  1995. <td align="left">&nbsp;<input type="text" size="14" name="ordid" value="<?php print $ordid?>" /></td>
  1996. <td align="right"><strong><?php print $yySeaTxt?>:</strong></td>
  1997. <td align="left">&nbsp;
  1998. <input type="text" size="24" name="searchtext" value="<?php print $origsearchtext?>" /></td>
  1999. </tr>
  2000. <tr bgcolor="#E7EAEF">
  2001. <td align="right">&nbsp;</td>
  2002. <td align="left">&nbsp; </td>
  2003. <td align="right">&nbsp;</td>
  2004. <td align="left">&nbsp;</td>
  2005. <td colspan="2" align="center"><input type="checkbox" name="startwith" value="1" <?php if($usepowersearch) print "checked"?> /> <strong><?php print $yyStaPow?></strong><br /><br />
  2006. <input type="submit" value="<?php print $yySearch?>" /> <input type="button" value="Stats" onclick="document.forms.psearchform.action='/admin/statssz.php';document.forms.psearchform.submit();" /></td>
  2007. </tr>
  2008. <tr>
  2009. <td colspan="6">
  2010. <?
  2011. $sql_status = "SELECT count( * ) as statcount , os.statPrivate , os.statID
  2012. FROM orders o, orderstatus os
  2013. WHERE o.ordStatus = os.statID
  2014. AND ordEID=13
  2015. AND o.ordStatus
  2016. BETWEEN 0
  2017. AND 10
  2018. GROUP BY os.statID,os.statPrivate";
  2019. $result_status=mysql_query($sql_status);
  2020. while($row_status=mysql_fetch_assoc($result_status)){?>
  2021. <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>
  2022. <? } ?> </td>
  2023. </tr>
  2024. </form>
  2025. </table>
  2026. </span>
  2027. <table width="100%" border="0" cellspacing="0" cellpadding="2" bgcolor="">
  2028. <form method="post" action="/admin/orderssz.php">
  2029. <tr>
  2030. <td align="center"> <input type="button" value="<?php print $yyPowSea?>" onclick="displaysearch()" /></td><td align="center"><p><strong><?php print $yyShoFrm?>:</strong> <select name="sd" size="1"><?php
  2031. $gotmatch=FALSE;
  2032. $thetime = time() + ($dateadjust*60*60);
  2033. $dayToday = date("d",$thetime);
  2034. $monthToday = date("m",$thetime);
  2035. $yearToday = date("Y",$thetime);
  2036. for($index=$dayToday; $index > 0; $index--){
  2037. $thedate = mktime(0, 0, 0, $monthToday, $index, $yearToday);
  2038. $thedatestr = date($admindatestr, $thedate);
  2039. print "<option value='" . $thedatestr . "'";
  2040. if($thedate==$sd){
  2041. print " selected";
  2042. $gotmatch=TRUE;
  2043. }
  2044. print ">" . $thedatestr . "</option>\n";
  2045. }
  2046. for($index=1; $index<=12; $index++){
  2047. $thedatestr = date($admindatestr, $thedate = mktime(0,0,0,date("m",$thetime)-$index,1,date("Y",$thetime)));
  2048. if(! $gotmatch && $thedate < $sd){
  2049. print "<option value='" . date($admindatestr, $sd) . "' selected>" . date($admindatestr, $sd) . "</option>";
  2050. $gotmatch=TRUE;
  2051. }
  2052. print "<option value='" . $thedatestr . "'";
  2053. if($thedate==$sd){
  2054. print " selected";
  2055. $gotmatch=TRUE;
  2056. }
  2057. print ">" . $thedatestr . "</option>\n";
  2058. }
  2059. if(!$gotmatch) print "<option value='" . date($admindatestr, $sd) . "' selected>" . date($admindatestr, $sd) . "</option>";
  2060. ?></select> <strong><?php print $yyTo?>:</strong> <select name="ed" size="1"><?php
  2061. $gotmatch=FALSE;
  2062. $dayToday = date("d",$thetime);
  2063. $monthToday = date("m",$thetime);
  2064. $yearToday = date("Y",$thetime);
  2065. for($index=$dayToday; $index > 0; $index--){
  2066. $thedate = mktime(0, 0, 0, $monthToday, $index, $yearToday);
  2067. $thedatestr = date($admindatestr, $thedate);
  2068. print "<option value='" . $thedatestr . "'";
  2069. if($thedate==$ed){
  2070. print " selected";
  2071. $gotmatch=TRUE;
  2072. }
  2073. print ">" . $thedatestr . "</option>\n";
  2074. }
  2075. for($index=1; $index<=12; $index++){
  2076. if(! $gotmatch && $thedate < $ed){
  2077. print "<option value='" . date($admindatestr, $ed) . "' selected>" . date($admindatestr, $ed) . "</option>";
  2078. $gotmatch=TRUE;
  2079. }
  2080. $thedatestr = date($admindatestr, $thedate = mktime(0,0,0,date("m",$thetime)-$index,1,date("Y",$thetime)));
  2081. print "<option value='" . $thedatestr . "'";
  2082. if($thedate==$ed){
  2083. print " selected";
  2084. $gotmatch=TRUE;
  2085. }
  2086. print ">" . $thedatestr . "</option>\n";
  2087. }
  2088. if(!$gotmatch) print "<option value='" . date($admindatestr, $sd) . "' selected>" . date($admindatestr, $sd) . "</option>";
  2089. ?></select> <input type="submit" value="Go" /></td>
  2090. </tr>
  2091. <tr><td colspan="2">&nbsp;</td></tr>
  2092. </form>
  2093. </table>
  2094. <table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="">
  2095. <tr bgcolor="#030133">
  2096. <td align="center"><strong><font color="#E7EAEF"><?php print $yyOrdId?></font></strong></td>
  2097. <td align="center"><strong><font color="#E7EAEF"><?php print $yyName?></font></strong></td>
  2098. <td align="center"><strong><font color="#E7EAEF"><?php print $yyMethod?></font></strong></td>
  2099. <td align="center"><strong><font color="#E7EAEF"><?php print $yyAutCod?></font></strong></td>
  2100. <td align="center"><strong><font color="#E7EAEF"><?php print $yyDate?></font></strong></td>
  2101. <td align="center" bgcolor="#030133"><strong><font color="#E7EAEF"><?php print $yyStatus?></font></strong></td>
  2102. </tr>
  2103. <form method="post" name="mainform" action="/admin/orderssz.php">
  2104. <?php if(@$_POST["powersearch"]=="1"){ ?>
  2105. <input type="hidden" name="powersearch" value="1" />
  2106. <input type="hidden" name="fromdate" value="<?php print trim(@$_POST["fromdate"])?>" />
  2107. <input type="hidden" name="todate" value="<?php print trim(@$_POST["todate"])?>" />
  2108. <input type="hidden" name="ordid" value="<?php print trim(str_replace('"','',str_replace("'",'',@$_POST["ordid"])))?>" />
  2109. <input type="hidden" name="origsearchtext" value="<?php print trim(str_replace('"','&quot;',@$_POST["searchtext"]))?>" />
  2110. <input type="hidden" name="searchtext" value="<?php print trim(str_replace('"',"&quot;",@$_POST["searchtext"]))?>" />
  2111. <input type="hidden" name="ordstatus[]" value="<?php print $ordstatus?>" />
  2112. <input type="hidden" name="startwith" value="<?php if($usepowersearch) print "1"?>" />
  2113. <?php } ?>
  2114. <input type="hidden" name="act" value="xxx" />
  2115. <input type="hidden" name="id" value="xxx" />
  2116. <input type="hidden" name="authcode" value="xxx" />
  2117. <input type="hidden" name="ed" value="<?php print date($admindatestr, $ed)?>" />
  2118. <input type="hidden" name="sd" value="<?php print date($admindatestr, $sd)?>" />
  2119. <?php
  2120. if(mysql_num_rows($alldata) > 0){
  2121. $rowcounter=0;
  2122. $ordTot=0;
  2123. $i=0;
  2124. $num_rows_order=mysql_num_rows($alldata);
  2125. while($rs = mysql_fetch_assoc($alldata)){
  2126. $order_id_array[$i]=$rs["ordID"];
  2127. $i++;
  2128. if($rs["ordStatus"]>=3) $ordTot += $rs["ordTot"];
  2129. if($rs["ordStatus"]>=3) $num_auth_order += 1;
  2130. if($rs["ordAuthNumber"]=="" || is_null($rs["ordAuthNumber"])){
  2131. $startfont="<font color='#FF0000'>";
  2132. $endfont="</font>";
  2133. } else{
  2134. $startfont="";
  2135. $endfont="";
  2136. }
  2137. if($rs["order_changed"]=='yes'){
  2138. $startfont="<font color='#00CC00'>";
  2139. $endfont="</font>";
  2140. }
  2141. if(@$bgcolor=="#E7EAEF") $bgcolor="#EAECEB"; else $bgcolor="#E7EAEF";
  2142. //if(!empty($rs["ordEID"])) $bgcolor="#FA6561";
  2143. ?>
  2144. <tr bgcolor="<?php print $bgcolor?>">
  2145. <td align="center"><a onclick="return(checkprinter(this,event));" href="/admin/orderssz.php?id=<?php print $rs["ordID"]?>"><?php print "<strong>" . $startfont . $rs["ordID"] . $endfont . "</strong>"?></a></td>
  2146. <td align="center"><a onclick="return(checkprinter(this,event));" href="/admin/orderssz.php?id=<?php print $rs["ordID"]?>"><?php print $startfont . $rs["ordName"] . $endfont?></a></td>
  2147. <td align="center"><?php print $startfont . $rs["payProvName"] . ($rs["payProvName"]=='PayPal' && trim($rs["ordTransID"]) != '' ? ' CC' : '') . $endfont?></td>
  2148. <td align="center"><?
  2149. if($rs["ordAuthNumber"]=="" || is_null($rs["ordAuthNumber"])){
  2150. $isauthorized=FALSE;
  2151. //print '<input type="button" name="auth" value="' . $yyAuthor . '" onclick="authrec(\'' . $rs["ordID"] . '\')" />';
  2152. }else{
  2153. print $rs["ordAuthNumber"] ;
  2154. $isauthorized=TRUE;
  2155. }
  2156. ?></td>
  2157. <td align="center"><font size="1"><?php print $startfont . date($admindatestr . "\<\\b\\r\>H:i:s", strtotime($rs["ordDate"])) . $endfont?></font></td>
  2158. <td align="center"><input type="hidden" style="background-color: " name="ordid<?php print $rowcounter?>" value="<?php print $rs["ordID"]?>" />
  2159. <?php
  2160. $gotitem=FALSE;
  2161. for($index=0; $index<$numstatus; $index++){
  2162. if(! $isauthorized && $allstatus[$index]["statID"]>2) break;
  2163. //if(! ($rs["ordStatus"] != 2 && $allstatus[$index]["statID"]==2)){
  2164. //print $allstatus[$index]["statID"];
  2165. if($rs["ordStatus"]==$allstatus[$index]["statID"]){
  2166. print $allstatus[$index]["statPrivate"];
  2167. }
  2168. //}
  2169. }
  2170. ?> </td>
  2171. </tr>
  2172. <?php $rowcounter++;
  2173. if($rowcounter>=1000){
  2174. print "<tr><td colspan='6' align='center'><strong>Limit of " . $rowcounter . " orders reached. Please refine your search.</strong></td></tr>";
  2175. break;
  2176. }
  2177. }
  2178. ?>
  2179. <tr>
  2180. <td align="center" bgcolor="#030133"><strong><font color="#E7EAEF"><?php print FormatEuroCurrency($ordTot)?></font></strong></td>
  2181. <td align="center" bgcolor="#030133"><?php if($hasdeleted){ ?>
  2182. <?php } ?></td>
  2183. <td bgcolor="#030133">
  2184. &nbsp;&nbsp;&nbsp;</td>
  2185. <td bgcolor="#030133">&nbsp;</td>
  2186. <td bgcolor="#030133">&nbsp;</td>
  2187. <td align="center" bgcolor="#030133"><input type="hidden" name="maxitems" value="<?php print $rowcounter?>" /></td>
  2188. </tr>
  2189. </form>
  2190. <form method="post" action="/admin/dumporders.php" name="dumpform">
  2191. <?php if(@$_POST["powersearch"]=="1"){ ?>
  2192. <input type="hidden" name="powersearch" value="1" />
  2193. <input type="hidden" name="fromdate" value="<?php print trim(@$_POST["fromdate"])?>" />
  2194. <input type="hidden" name="todate" value="<?php print trim(@$_POST["todate"])?>" />
  2195. <input type="hidden" name="ordid" value="<?php print trim(str_replace('"','',str_replace("'",'',@$_POST["ordid"])))?>" />
  2196. <input type="hidden" name="origsearchtext" value="<?php print trim(str_replace('"','&quot;',@$_POST["searchtext"]))?>" />
  2197. <input type="hidden" name="searchtext" value="<?php print trim(str_replace('"',"&quot;",@$_POST["searchtext"]))?>" />
  2198. <input type="hidden" name="ordstatus[]" value="<?php print $ordstatus?>" />
  2199. <input type="hidden" name="startwith" value="<?php if($usepowersearch) print "1"?>" />
  2200. <?php } ?>
  2201. <input type="hidden" name="sd" value="<?php print date($admindatestr, $sd)?>" />
  2202. <input type="hidden" name="ed" value="<?php print date($admindatestr, $ed)?>" />
  2203. <input type="hidden" name="details" value="false" />
  2204. <tr>
  2205. <td align="center"><?=$num_rows_order?> Orders</td>
  2206. <td align="center"><?=$num_auth_order?> Authorized Orders</td>
  2207. <td colspan="2" align="center"><input type="submit" value="<?php print $yyDmpOrd?>" onclick="document.dumpform.details.value='false';" /></td>
  2208. <td colspan="2" align="center"><input type="submit" value="<?php print $yyDmpDet?>" onclick="document.dumpform.details.value='true';" /></td>
  2209. </tr>
  2210. </form>
  2211. <?php
  2212. }else{
  2213. ?>
  2214. <tr>
  2215. <td width="100%" colspan="6" align="center">
  2216. <p><?php
  2217. if(@$_POST["powersearch"]=="1")
  2218. print $yyNoMat1;
  2219. elseif($sd==$ed)
  2220. print $yyNoMat2 . " " . date($admindatestr, $sd) . ".";
  2221. else
  2222. print $yyNoMat3 . " " . date($admindatestr, $sd) . " and " . date($admindatestr, $ed) . ".";
  2223. ?></p> </td>
  2224. </tr>
  2225. <?php if($hasdeleted){ ?>
  2226. <tr>
  2227. <td colspan="6">&nbsp;</td>
  2228. </tr>
  2229. <?php } ?>
  2230. </form>
  2231. <?php
  2232. } ?>
  2233. <tr>
  2234. <td width="100%" colspan="6" align="center">
  2235. <p><br />
  2236. <a href="/admin/orderssz.php?sd=<?php print date($admindatestr,mktime(0,0,0,date("m",$sd)-1,date("d",$sd),date("Y",$sd)))?>&ed=<?php print date($admindatestr,mktime(0,0,0,date("m",$ed)-1,date("d",$ed),date("Y",$ed)))?>"><strong>- <?php print $yyMonth?></strong></a> |
  2237. <a href="/admin/orderssz.php?sd=<?php print date($admindatestr,mktime(0,0,0,date("m",$sd),date("d",$sd)-7,date("Y",$sd)))?>&ed=<?php print date($admindatestr,mktime(0,0,0,date("m",$ed),date("d",$ed)-7,date("Y",$ed)))?>"><strong>- <?php print $yyWeek?></strong></a> |
  2238. <a href="/admin/orderssz.php?sd=<?php print date($admindatestr,mktime(0,0,0,date("m",$sd),date("d",$sd)-1,date("Y",$sd)))?>&ed=<?php print date($admindatestr,mktime(0,0,0,date("m",$ed),date("d",$ed)-1,date("Y",$ed)))?>"><strong>- <?php print $yyDay?></strong></a> |
  2239. <a href="/admin/orderssz.php"><strong><?php print $yyToday?></strong></a> |
  2240. <a href="/admin/orderssz.php?sd=<?php print date($admindatestr,mktime(0,0,0,date("m",$sd),date("d",$sd)+1,date("Y",$sd)))?>&ed=<?php print date($admindatestr,mktime(0,0,0,date("m",$ed),date("d",$ed)+1,date("Y",$ed)))?>"><strong><?php print $yyDay?> +</strong></a> |
  2241. <a href="/admin/orderssz.php?sd=<?php print date($admindatestr,mktime(0,0,0,date("m",$sd),date("d",$sd)+7,date("Y",$sd)))?>&ed=<?php print date($admindatestr,mktime(0,0,0,date("m",$ed),date("d",$ed)+7,date("Y",$ed)))?>"><strong><?php print $yyWeek?> +</strong></a> |
  2242. <a href="/admin/orderssz.php?sd=<?php print date($admindatestr,mktime(0,0,0,date("m",$sd)+1,date("d",$sd),date("Y",$sd)))?>&ed=<?php print date($admindatestr,mktime(0,0,0,date("m",$ed),date("d",$ed)+1,date("Y",$ed)))?>"><strong><?php print $yyMonth?> +</strong></a> </p> </td>
  2243. </tr>
  2244. </table>
  2245. </td>
  2246. </tr>
  2247. </table>
  2248. </div>
  2249. <?php
  2250. }
  2251. }
  2252. ?>
  2253. <script language="JavaScript" type="text/javascript">
  2254. function dorecalc(onlytotal){
  2255. var thetotal=0,totoptdiff=0;
  2256. for(var i in document.forms.editform){
  2257. if(i.substr(0,5)=="quant"){
  2258. theid = i.substr(5);
  2259. totopts=0;
  2260. delbutton = document.getElementById("del_"+theid);
  2261. if(delbutton==null)
  2262. isdeleted=false;
  2263. else
  2264. isdeleted=delbutton.checked;
  2265. if(! isdeleted){
  2266. for(var ii in document.forms.editform){
  2267. var opttext="optn"+theid+"_";
  2268. if(ii.substr(0,opttext.length)==opttext){
  2269. theitem = document.getElementById(ii);
  2270. if(document.getElementById('v'+ii)==null){
  2271. thevalue = theitem[theitem.selectedIndex].value;
  2272. if(thevalue.indexOf('|')>0){
  2273. totopts += parseFloat(thevalue.substr(thevalue.indexOf('|')+1));
  2274. }
  2275. }
  2276. }
  2277. }
  2278. thequant = parseInt(document.getElementById(i).value);
  2279. if(isNaN(thequant)) thequant=0;
  2280. theprice = parseFloat(document.getElementById("price"+theid).value);
  2281. if(isNaN(theprice)) theprice=0;
  2282. document.getElementById("optdiffspan"+theid).value=totopts;
  2283. optdiff = parseFloat(document.getElementById("optdiffspan"+theid).value);
  2284. if(isNaN(optdiff)) optdiff=0;
  2285. thetotal += thequant * (theprice + optdiff);
  2286. totoptdiff += thequant * optdiff;
  2287. }
  2288. }
  2289. }
  2290. document.getElementById("optdiffspan").innerHTML=totoptdiff.toFixed(2);
  2291. //document.getElementById("ordtotal").value = thetotal.toFixed(2);
  2292. document.getElementById("ordTot").innerHTML = thetotal.toFixed(2);
  2293. document.getElementById("ordtotal").value = thetotal.toFixed(2);
  2294. if(onlytotal==true) return;
  2295. <? if(!empty($prcTot)){?>
  2296. thetotal+=<?=$prcTot?>;
  2297. <? } ?>
  2298. statetaxrate = parseFloat(document.getElementById("staterate").value);
  2299. if(isNaN(statetaxrate)) statetaxrate=0;
  2300. countrytaxrate = parseFloat(document.getElementById("countryrate").value);
  2301. if(isNaN(countrytaxrate)) countrytaxrate=0;
  2302. discount = parseFloat(document.getElementById("ordDiscount").value);
  2303. if(isNaN(discount)){
  2304. discount=0;
  2305. document.getElementById("ordDiscount").value=0;
  2306. }
  2307. statetaxtotal = (statetaxrate * (thetotal-discount)) / 100.0;
  2308. countrytaxtotal = (countrytaxrate * (thetotal-discount)) / 100.0;
  2309. shipping = parseFloat(document.getElementById("ordShipping").value);
  2310. if(isNaN(shipping)){
  2311. //shipping=0;
  2312. //document.getElementById("ordShipping").value=0;
  2313. }
  2314. handling = parseFloat(document.getElementById("ordHandling").value);
  2315. if(isNaN(handling)){
  2316. handling=0;
  2317. document.getElementById("ordHandling").value=0;
  2318. }
  2319. <?php if(@$taxShipping==2){ ?>
  2320. statetaxtotal += (statetaxrate * shipping) / 100.0;
  2321. countrytaxtotal += (countrytaxrate * shipping) / 100.0;
  2322. <?php }
  2323. if(@$taxHandling==2){ ?>
  2324. statetaxtotal += (statetaxrate * handling) / 100.0;
  2325. countrytaxtotal += (countrytaxrate * handling) / 100.0;
  2326. <?php } ?>
  2327. document.getElementById("ordStateTax").value = statetaxtotal.toFixed(2);
  2328. document.getElementById("ordCountryTax").value = countrytaxtotal.toFixed(2);
  2329. hstobj = document.getElementById("ordHSTTax");
  2330. hsttax=0;
  2331. if(! (hstobj==null)){
  2332. hsttax = parseFloat(hstobj.value);
  2333. }
  2334. grandtotal = (thetotal + shipping + handling + statetaxtotal + countrytaxtotal + hsttax) - discount;
  2335. document.getElementById("grandtotalspan").innerHTML = grandtotal.toFixed(2);
  2336. }
  2337. </script>