PageRenderTime 49ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/application/views/pages/admin/shipping4.php

https://bitbucket.org/chadsaun/ifrogz-panel
PHP | 374 lines | 324 code | 49 blank | 1 comment | 59 complexity | 07b29075fff4f23283611b1d01fe3167 MD5 | raw file
  1. <?php
  2. if(@$storesessionvalue=="") $storesessionvalue="virtualstore".time();
  3. if($_SESSION["loggedon1"] != $storesessionvalue || @$disallowlogin1==TRUE) exit();
  4. ?>
  5. <style type="text/css">
  6. <!--
  7. tr {
  8. cursor: hand;
  9. cursor: pointer;
  10. background-color: #FFF;
  11. }
  12. tr.hilite {
  13. background-color: #316AC5;
  14. color: #FFF;
  15. }
  16. tr.hover {
  17. background-color: #EEE;
  18. }
  19. -->
  20. </style>
  21. <script language="JavaScript" type="text/javascript" src="http://assets.ifrogz.com/lib/packages/scriptaculous-js/1.5.1/prototype.js"></script>
  22. <script language="JavaScript" type="text/javascript">
  23. <!--
  24. function changeColor(obj,action) {
  25. if(obj.className!='hilite') {
  26. if(action=='over') obj.className='hover';
  27. if(action=='out') obj.className='blank';
  28. }
  29. }
  30. function altColor(obj,order) {
  31. objInp = document.getElementById('receive' + order);
  32. if(obj.className=='' || obj.className=='hover') {
  33. obj.className='hilite';
  34. objInp.value = 'yes';
  35. }else{
  36. obj.className='';
  37. objInp.value = '';
  38. }
  39. }
  40. function selectAll() {
  41. for(i=0; i<document.frmReceive.elements.length; i++) {
  42. if(document.frmReceive.elements[i].name.substr(0,7)=='receive') {
  43. document.frmReceive.elements[i].value='yes';
  44. }
  45. }
  46. var tableRows = document.getElementById('tblReceive').rows;
  47. for(i=0; i<tableRows.length; i++) {
  48. if(tableRows[i].id.substr(0,4)=='data') {
  49. tableRows[i].className = 'hilite';
  50. }
  51. }
  52. }
  53. function selectNone() {
  54. for(i=0; i<document.frmReceive.elements.length; i++) {
  55. if(document.frmReceive.elements[i].name.substr(0,7)=='receive') {
  56. document.frmReceive.elements[i].value='';
  57. }
  58. }
  59. var tableRows = document.getElementById('tblReceive').rows;
  60. for(i=0; i<tableRows.length; i++) {
  61. if(tableRows[i].id.substr(0,4)=='data') {
  62. tableRows[i].className = '';
  63. }
  64. }
  65. }
  66. function compareOrders(element) {
  67. var scanned=element.value.split("\r\n");
  68. alert(scanned.length+"\r\n"+element.value);
  69. }
  70. function compareOrders2() {
  71. alert($("receive_barcode").value);
  72. }
  73. -->
  74. </script>
  75. <h2 style="text-align: center">iFrogz Shipping</h2>
  76. <h1 style="text-align: center">Viewing <span style="text-decoration: underline"><?=($_GET['status']=='INTL')?'INTL':'USA'?></span> Orders</h1>
  77. <!--BEGINNING OF LEFT COLUMN-->
  78. <div style="width: 100%;">
  79. <div style="width:250px; float: left; text-align:center">
  80. <form id="frmReceiveScan" name="frmReceiveScan" action="/admin/shippingprocess2.php" method="post">
  81. <div>
  82. <p><input type="button" id="rec_ordersScan" name="rec_ordersScan" value="Receive DHL SmartMail Orders" onclick="document.getElementById('recLocationScan').value = 'dhl'; document.frmReceiveScan.submit();"<?=($_GET['status']!='INTL')?'style="visibility: visible"':'style="visibility: hidden"'?> /></p>
  83. <p><input type="button" id="rec_ordersScan" name="rec_ordersScan" value="Receive FedEx Express Orders" onclick="document.getElementById('recLocationScan').value = 'fedex'; document.frmReceiveScan.submit();"<?=($_GET['status']!='INTL')?'style="visibility: visible"':'style="visibility: hidden"'?> /></p>
  84. <p><input type="button" id="rec_ordersScan" name="rec_ordersScan" value="Receive INTL Orders" onclick="document.getElementById('recLocationScan').value = 'intl'; document.frmReceiveScan.submit();"<?=($_GET['status']=='INTL')?'style="visibility: visible"':'style="visibility: hidden"'?> /></p>
  85. <input name="start_barcode" type="button" value="Start Barcode Scan" style="width:200px; height:40px; font-size:16px; " onClick="document.getElementById('receive_barcode').focus();">
  86. <? if(!empty($error_msg)) echo '<div style="color:#FF0000;">'.$error_msg.'</div>';?>
  87. <textarea name="receive_barcode" id="receive_barcode" cols="28" rows="30" onFocus="this.style.backgroundColor='#FF6600'" ><?=$error_order?></textarea>
  88. <input type="hidden" id="recOrdersScan" name="recOrdersScan" value="recOrdersScan" />
  89. <input type="hidden" id="recLocationScan" name="recLocationScan" value="" />
  90. <script language="JavaScript" type="text/javascript">
  91. new Form.Element.Observer('receive_barcode',1, function compareOrders() {
  92. element=$("receive_barcode").value;
  93. var cnt=element.length;
  94. var lastone=element.substr(cnt-9);
  95. check=$("check_orders").value;
  96. //alert(check);
  97. if(check.indexOf(lastone)==-1) alert('Bad'+' '+check.indexOf(lastone)+"\r\n last one="+lastone);
  98. else alert('ok'+' '+check.indexOf(lastone));
  99. });
  100. document.getElementById('receive_barcode').focus();
  101. </script>
  102. </div>
  103. </form>
  104. </div>
  105. <div style="float:left; padding-top: 5px; width:250px; margin:0px 10px 0px 10px;">
  106. <form id="form1" name="form1" action="/admin/shippingprocess2.php" method="post">
  107. <td style="background-color: #EEE"><input type="submit" name="viewStatus" id="viewINTL" value="View INTL"<?=($_GET['status']!='INTL')?'style="visibility: visible"':'style="visibility: hidden"'?> /></td>
  108. <td style="background-color: #EEE"><input type="submit" name="viewStatus" id="viewUSA" value="View USA"<?=($_GET['status']=='INTL')?'style="visibility: visible"':'style="visibility: hidden"'?> /></td>
  109. </form>
  110. <!--START OF DHL SMARTMAIL-->
  111. <?php
  112. unset($listofiles);
  113. $qry = "SELECT COUNT(ordID) num FROM orders WHERE ordStatus = '7'";
  114. $res = mysql_query($qry);
  115. $row = mysql_fetch_assoc($res);
  116. $num_of_orders = $row['num'];
  117. mysql_free_result($res);
  118. ?>
  119. <h2>DHL SmartMail<br />
  120. <?=($num_of_orders>0)?$num_of_orders.' Orders':'No Orders'?><br />
  121. <form id="form3" method="post" action="/admin/shippingprocess2.php">
  122. <input type="submit" id="create" name="create" value="Create Batch" />
  123. <input type="hidden" id="status" name="status" value="7" />
  124. </form>
  125. <form method="post" action="/admin/batchview.php">
  126. <input type="submit" id="viewUSA" name="viewUSA" value="View" />
  127. <input type="hidden" id="status" name="status" value="7" />
  128. </form>
  129. </h2>
  130. <?php
  131. $dir = "../batches/dhl";
  132. $dh = opendir($dir);
  133. $index=0;
  134. while (false !== ($filename = readdir($dh))) {
  135. if ($filename != "." && $filename != ".." && $filename != "error_log" && $filename != "tmp") {
  136. $listofiles[$index++] = $filename;
  137. }
  138. }
  139. if(!empty($listofiles)) {
  140. ?>
  141. <table width="90%" border="0" cellspacing="0" cellpadding="3">
  142. <?
  143. for($i=0; $i<count($listofiles)&&$i<10; $i++) {
  144. $thisfile = $listofiles[(count($listofiles)-1-$i)]; // So that it shows most recent to oldest
  145. echo'<tr><td><a href="/admin/download.php?path='.urlencode('../batches/dhl/').'&file='.urlencode($thisfile).'">'.$thisfile.'</a></td></tr>';
  146. }
  147. ?>
  148. </table>
  149. <? }else {?>
  150. <div style="margin: 5px auto">No batches found.</div>
  151. <? } ?>
  152. <p>&nbsp;</p>
  153. <!--START OF FEDEX EXPRESS-->
  154. <?
  155. unset($listofiles);
  156. $qry = "SELECT COUNT(ordID) num FROM orders WHERE ordStatus = '8'";
  157. $res = mysql_query($qry);
  158. $row = mysql_fetch_assoc($res);
  159. $num_of_orders = $row['num'];
  160. mysql_free_result($res);
  161. ?>
  162. <h2>Fedex Express<br />
  163. <?=($num_of_orders>0)?$num_of_orders.' Orders':'No Orders'?><br />
  164. <form id="form3" method="post" action="/admin/shippingprocess2.php">
  165. <input type="submit" id="create" name="create" value="Create Batch" />
  166. <input type="hidden" id="status" name="status" value="8" />
  167. </form>
  168. <form method="post" action="/admin/batchview.php">
  169. <input type="submit" id="viewUSA" name="viewUSA" value="View" />
  170. <input type="hidden" id="status" name="status" value="8" />
  171. </form>
  172. </h2>
  173. <?
  174. $dir = "../batches/fedex";
  175. $dh = opendir($dir);
  176. $index=0;
  177. while (false !== ($filename = readdir($dh))) {
  178. if ($filename != "." && $filename != ".." && $filename != "error_log") {
  179. $listofiles[$index++] = $filename;
  180. }
  181. }
  182. if(!empty($listofiles)) {
  183. ?>
  184. <table width="90%" border="0" cellspacing="0" cellpadding="3">
  185. <?
  186. for($i=0; $i<count($listofiles)&&$i<10; $i++) {
  187. $thisfile = $listofiles[(count($listofiles)-1-$i)]; // So that it shows most recent to oldest
  188. echo'<tr><td><a href="/admin/download.php?path='.urlencode('../batches/fedex/').'&file='.urlencode($thisfile).'">'.$thisfile.'</a></td></tr>';
  189. }
  190. ?>
  191. </table>
  192. <? }else {?>
  193. <div style="margin: 5px auto">No batches found.</div>
  194. <? } ?>
  195. <p>&nbsp;</p>
  196. <!--START OF INTERNATIONAL BATCH-->
  197. <?php
  198. unset($listofiles);
  199. $qry = "SELECT COUNT(ordID) num FROM orders WHERE ordStatus = '9'";
  200. $res = mysql_query($qry);
  201. $row = mysql_fetch_assoc($res);
  202. $num_of_orders = $row['num'];
  203. mysql_free_result($res);
  204. ?>
  205. <h2>International Batch<br />
  206. <?=($num_of_orders>0)?$num_of_orders.' Orders':'No Orders'?><br />
  207. <form id="form3" method="post" action="/admin/shippingprocess2.php">
  208. <input type="submit" id="create" name="create" value="Create Batch" style="margin: 2px 0" />
  209. <input type="hidden" id="status" name="status" value="9" />
  210. </form>
  211. <form id="form4" method="post" action="/admin/batchview2.php">
  212. <input type="submit" id="viewINTL" name="viewINTL" value="View" style="margin: 2px 0" />
  213. <input type="hidden" id="status" name="status" value="9" />
  214. </form>
  215. </h2>
  216. <?php
  217. $dir = "../batches/intl";
  218. $dh = opendir($dir);
  219. $index=0;
  220. while (false !== ($filename = readdir($dh))) {
  221. if ($filename != "." && $filename != ".." && $filename != "error_log") {
  222. $listofiles[$index++] = $filename;
  223. }
  224. }
  225. if(!empty($listofiles)) {
  226. ?>
  227. <table width="90%" border="0" cellspacing="0" cellpadding="3">
  228. <?php
  229. for($i=0; $i<count($listofiles)&&$i<10; $i++) {
  230. $thisfile = $listofiles[(count($listofiles)-1-$i)]; // So that it shows most recent to oldest
  231. echo '<tr><td><a href="/admin/download.php?path='.urlencode('../batches/intl/').'&file='.urlencode($thisfile).'">'.$thisfile.'</a></td></tr>';
  232. }
  233. ?>
  234. </table>
  235. <? }else {?>
  236. <div style="margin: 5px auto">No batches found.</div>
  237. <? } ?>
  238. <p>&nbsp;</p>
  239. </div>
  240. <div style="width:200px; float: left; text-align:center">
  241. <p>
  242. <input type="button" id="rec_dhl_orders" name="rec_orders" value="Receive DHL SmartMail Orders" onclick="document.getElementById('recLocation').value = 'dhl'; document.frmReceive.submit();"<?=($_GET['status']!='INTL')?'style="visibility: visible"':'style="visibility: hidden"'?> />
  243. </p>
  244. <p>
  245. <input type="button" id="rec_orders" name="rec_orders" value="Receive FedEx Express Orders" onclick="document.getElementById('recLocation').value = 'fedex'; document.frmReceive.submit();"<?=($_GET['status']!='INTL')?'style="visibility: visible"':'style="visibility: hidden"'?> />
  246. </p>
  247. <p>
  248. <input type="button" id="rec_orders" name="rec_orders" value="Receive INTL Orders" onclick="document.getElementById('recLocation').value = 'intl'; document.frmReceive.submit();"<?=($_GET['status']=='INTL')?'style="visibility: visible"':'style="visibility: hidden"'?> />
  249. </p>
  250. <input name="start_normal" type="button" value="Start Manual Receive" style="width:200px; height:40px; font-size:16px; " onClick="document.getElementById('receive_barcode').style.backgroundColor='';document.getElementById('receive_barcode').blur();">
  251. <table id="tblReceive" width="100%" border="0" cellspacing="0" cellpadding="3" style="border-collapse: collapse; border: 1px solid #777;">
  252. <tr>
  253. <th scope="col" style="background-color: #EEE; border-bottom: 1px solid #777; border-top: 1px solid #777">Order #</th>
  254. <th scope="col" style="background-color: #EEE; border-bottom: 1px solid #777; border-top: 1px solid #777">Status</th>
  255. </tr>
  256. <form id="frmReceive" name="frmReceive" action="/admin/shippingprocess2.php" method="post">
  257. <?
  258. $qry = "SELECT o.ordID, o.ordStatus
  259. FROM orders o, orderstatus os
  260. WHERE o.ordStatus = os.statID
  261. AND os.statPrivate = 'Packing'
  262. ORDER BY o.ordID";
  263. $res = mysql_query($qry) or print(mysql_error());
  264. $i=0;
  265. $str_orders='';
  266. while($row=mysql_fetch_assoc($res)) {
  267. if(!empty($_GET['status'])) {
  268. if(getShipStatus($row['ordID'])!=$_GET['status']) {
  269. continue;
  270. }
  271. }else{
  272. if(getShipStatus($row['ordID'])!='USA') {
  273. continue;
  274. }
  275. }
  276. ?>
  277. <tr id="data<?=$i++?>" onMouseOver="changeColor(this,'over');" onMouseOut="changeColor(this,'out');" onClick="altColor(this,'<?=$row['ordID']?>');">
  278. <td style="text-align: center"><?=$row['ordID']?></td>
  279. <td style="text-align: center"><?=getShipStatus($row['ordID'])?>
  280. <input type="hidden" id="receive<?=$row['ordID']?>" name="receive<?=$row['ordID']?>" value="" />
  281. </td>
  282. </tr>
  283. <? $str_orders.=$row['ordID']."\r\n";
  284. }
  285. if($i<=0) {
  286. ?>
  287. <tr>
  288. <td colspan="2" style="text-align: center">No Orders Found</td>
  289. </tr>
  290. <?
  291. }
  292. ?> <textarea name="check_orders" id="check_orders" cols="40" rows="50"><?=$str_orders?></textarea>
  293. <input type="hidden" id="recOrders" name="recOrders" value="recOrders" />
  294. <input type="hidden" id="recLocation" name="recLocation" value="" />
  295. </form>
  296. </table>
  297. <table width="100%" cellpadding="0" cellspacing="3" style="margin: 5px 10px">
  298. <tr>
  299. <td style="text-align: center"><input type="button" value="Select All" onclick="selectAll();" /></td>
  300. <td style="text-align: center"><input type="button" value="Select None" onclick="selectNone();" /></td>
  301. </tr>
  302. </table>
  303. </div>
  304. </div>
  305. <div style="clear: both; height: 10px"></div>
  306. <?
  307. function getShipStatus($ordID) {
  308. $apo = false;
  309. $qry = "SELECT ordCountry, ordShipCountry, ordPoAPO, ordShipPoApo FROM orders WHERE ordID = $ordID";
  310. $res = mysql_query($qry) or print(mysql_error());
  311. $row = mysql_fetch_assoc($res);
  312. if(empty($row['ordShipCountry'])) $country = $row['ordCountry'];
  313. else $country = $row['ordShipCountry'];
  314. if($row['ordPoAPO']=='yes') {
  315. $apo = true;
  316. }
  317. if($row['ordShipPoApo']=='yes') {
  318. $apo = true;
  319. }
  320. if($apo) return 'USA';
  321. elseif($country=='United States of America') return 'USA';
  322. elseif($country=='Canada') return 'INTL';
  323. else return 'INTL';
  324. }
  325. ?>