PageRenderTime 67ms CodeModel.GetById 29ms 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

Large files files are truncated, but you can click here to view the full 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

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