PHP - Faster Solution To Check Image
I use a script for sharing links. Everything works ok, but checking for valid images can take a long time. First through CURL method I parse certain tags (for description and title) then I use the following script to find images from the submited link: Code: [Select] $dom = new domDocument; @$dom->loadHTML('<?xml encoding="UTF-8">' . substr($content,0,35000)); $dom->preserveWhiteSpace = false; $images = $dom->getElementsByTagName('img'); It sometimes happens that the images have not not a good path(depending on whether the link is permanent or not) and then use the getimagesize function that works well. But it can be very slow ...sometimes it takes 15-30 seconds. Without function getimagesize process takes a few seconds. Is there a better (faster) method to check whether the image is valid or not? Similar TutorialsCode: [Select] <?php $img = $_GET['img']; $wid = $_GET['wid']; $hei = $_GET['hei']; $xoff = $_GET['xoff']; $yoff = $_GET['yoff']; if($img == 0) return; $image = array("HyruleTown","Bosses","ForestNPCs","RoyalFamily","Rings"); header("Content-type: image/png"); $im = imagecreatefrompng($image[$img - 1] . ".png"); $dest = imagecreatetruecolor($wid, $hei); imagecopy($dest, $im, 0, 0, $xoff, $yoff, $wid, $hei); imagepng($dest); imagedestroy($dest); imagedestroy($im); ?> This script allows you to take an image and only show parts of it. This script works great, but there's one problem. As I add more and more to a page, it takes longer and longer to load. http://openzelda.thegaminguniverse.com/wiki/index.php5?title=OZWiki:Alien_Invasion There will be a lot more php images added soon. I used this method so I don't have to upload a ton of images at once. So is there a way to speed things up? Is it possible to have it save cache so the images don't reload everytime you refresh the page? Code: [Select] <table border="1"> <tr> <th>ID</th> <th>Image</th> </tr> <?php for($i=0; $i<=100; $i++) { $url = 'http://localhost/images/icon_'.$i.'_64x64.jpg'; echo "<tr><td>".$i."</td><td><img src='".$url."' /></td></tr>"; } ?> </table> So after testing this script, I get empty cells in the table if the image doesn't exist. Can someone show me how to make it display only the images that exists in that folder ? Hi all I wonder if you could give me some advice. I basically have a mysql database of staff who work at a college, I have a front which displays details of a staff member, I grab the details using userdetails.php?id=44 (44 being the ID of the staff member) One field I have in my MySQL database is "title", which is basically Mr Ms Mrs Miss Dr At the moment, I store the "title" value in the database as "CHAR", so it appears as "Mrs" for example when I print print $row['title']; What I want to know is, which is the best method of storing and getting this data. Is it best to ----------------------------------------------------- 1: Continue as I am and keep text values in the database stored as CHAR[/li][/list] ----------------------------------------------------- 2: Change it so that instead of storing "Mr", "Dr" as CHAR, I would store them as numeric values, so; 2 would be Mr 3 would be Mrs 4 would be Dr then do a if($row['title'] == 2) { print "Mr"; } elseif($row['title'] == 3) { print "Mrs"; } elseif($row['title'] == 4) { print "Dr"; } ----------------------------------------------------- 3: Change it so that instead of storing "Mr", "Dr" as CHAR, I would store them as numeric values, but then have another database table which holds what value each number is, so my new database table would be like --- title_values ---- id value 2 Mr 3 Mrs 4 Dr ------------------------- then on the front end, do a SELECT such as SELECT `value` FROM `title_values` WHERE `id` = "'.$row['id'].'" I guess the advantage to this one, is that I can modify the list of titles and expand it. ----------------------------------------------------- which of those is generally considered better? faster? and less server intensive? or is there a better way to do it? Thanks very much this is my script it gets the values form the database and adds them and saves it to a variable which is then echoed to the user before i typed this code 10 more times changing every variable name i was wondering if their was a more efficient way of doing this Code: [Select] <?php $adam_view_query = "SELECT * FROM pinkpanther_stats WHERE Player = 'Adam' ORDER BY Day_Played DESC"; $adam_view_results = mysql_query($adam_view_query) or die("Query failed ($adam_view_query) - " . mysql_error()); $adam_view_numrows = mysql_num_rows($adam_view_results); $adam_gli_query = "SELECT SUM(GLI) AS 'adam_gli' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_gli_results = mysql_query($adam_gli_query) or die ("Query failed ($adam_gli_query) - " . mysql_error()); $adam_gli_row = mysql_fetch_array($adam_gli_results); $adam_gli = $adam_gli_row['adam_gli']; $adam_goals_query = "SELECT SUM(Goals) AS 'adam_goals' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_goals_results = mysql_query($adam_goals_query) or die ("Query failed ($adam_goals_query) - " . mysql_error()); $adam_goals_row = mysql_fetch_array($adam_goals_results); $adam_goals = $adam_goals_row['adam_goals']; $adam_saves_query = "SELECT SUM(Saves) AS 'adam_saves' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_saves_results = mysql_query($adam_saves_query) or die ("Query failed ($adam_saves_query) - " . mysql_error()); $adam_saves_row = mysql_fetch_array($adam_saves_results); $adam_saves = $adam_saves_row['adam_saves']; $adam_sog_query = "SELECT SUM(SOG) AS 'adam_sog' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_sog_results = mysql_query($adam_sog_query) or die ("Query failed ($adam_sog_query) - " . mysql_error()); $adam_sog_row = mysql_fetch_array($adam_sog_results); $adam_sog = $adam_sog_row['adam_sog']; $adam_assists_query = "SELECT SUM(Assists) AS 'adam_assists' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_assists_results = mysql_query($adam_assists_query) or die ("Query failed ($adam_assists_query) - " . mysql_error()); $adam_assists_row = mysql_fetch_array($adam_assists_results); $adam_assists = $adam_assists_row['adam_assists']; $adam_ck_query = "SELECT SUM(CK) AS 'adam_ck' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_ck_results = mysql_query($adam_ck_query) or die ("Query failed ($adam_ck_query) - " . mysql_error()); $adam_ck_row = mysql_fetch_array($adam_ck_results); $adam_ck = $adam_ck_row['adam_ck']; $adam_yc_query = "SELECT SUM(YC) AS 'adam_yc' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_yc_results = mysql_query($adam_yc_query) or die ("Query failed ($adam_yc_query) - " . mysql_error()); $adam_yc_row = mysql_fetch_array($adam_yc_results); $adam_yc = $adam_yc_row['adam_yc']; $adam_rc_query = "SELECT SUM(RC) AS 'adam_rc' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_rc_results = mysql_query($adam_rc_query) or die ("Query failed ($adam_rc_query) - " . mysql_error()); $adam_rc_row = mysql_fetch_array($adam_rc_results); $adam_rc = $adam_rc_row['adam_rc']; $adam_goalie = ""; if (isset($_POST['adam_go'])) { $adam_view = mysql_real_escape_string($_POST['adam_statview']); if ($adam_view == "Total"){ $adam_gli_query = "SELECT SUM(GLI) AS 'adam_gli' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_gli_results = mysql_query($adam_gli_query) or die ("Query failed ($adam_gli_query) - " . mysql_error()); $adam_gli_row = mysql_fetch_array($adam_gli_results); $adam_gli = $adam_gli_row['adam_gli']; $adam_goals_query = "SELECT SUM(Goals) AS 'adam_goals' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_goals_results = mysql_query($adam_goals_query) or die ("Query failed ($adam_goals_query) - " . mysql_error()); $adam_goals_row = mysql_fetch_array($adam_goals_results); $adam_goals = $adam_goals_row['adam_goals']; $adam_saves_query = "SELECT SUM(Saves) AS 'adam_saves' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_saves_results = mysql_query($adam_saves_query) or die ("Query failed ($adam_saves_query) - " . mysql_error()); $adam_saves_row = mysql_fetch_array($adam_saves_results); $adam_saves = $adam_saves_row['adam_saves']; $adam_sog_query = "SELECT SUM(SOG) AS 'adam_sog' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_sog_results = mysql_query($adam_sog_query) or die ("Query failed ($adam_sog_query) - " . mysql_error()); $adam_sog_row = mysql_fetch_array($adam_sog_results); $adam_sog = $adam_sog_row['adam_sog']; $adam_assists_query = "SELECT SUM(Assists) AS 'adam_assists' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_assists_results = mysql_query($adam_assists_query) or die ("Query failed ($adam_assists_query) - " . mysql_error()); $adam_assists_row = mysql_fetch_array($adam_assists_results); $adam_assists = $adam_assists_row['adam_assists']; $adam_ck_query = "SELECT SUM(CK) AS 'adam_ck' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_ck_results = mysql_query($adam_ck_query) or die ("Query failed ($adam_ck_query) - " . mysql_error()); $adam_ck_row = mysql_fetch_array($adam_ck_results); $adam_ck = $adam_ck_row['adam_ck']; $adam_yc_query = "SELECT SUM(YC) AS 'adam_yc' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_yc_results = mysql_query($adam_yc_query) or die ("Query failed ($adam_yc_query) - " . mysql_error()); $adam_yc_row = mysql_fetch_array($adam_yc_results); $adam_yc = $adam_yc_row['adam_yc']; $adam_rc_query = "SELECT SUM(RC) AS 'adam_rc' FROM pinkpanther_stats WHERE Player = 'Adam'"; $adam_rc_results = mysql_query($adam_rc_query) or die ("Query failed ($adam_rc_query) - " . mysql_error()); $adam_rc_row = mysql_fetch_array($adam_rc_results); $adam_rc = $adam_rc_row['adam_rc']; $adam_goalie = ""; }else{ $adam_stats_query = "SELECT * FROM pinkpanther_stats WHERE Player = 'Adam' AND Day_Played = '$adam_view'"; $adam_stats_results = mysql_query($adam_stats_query) or die ("Query failed ($adam_stats_query) - " . mysql_error()); $adam_stats_row = mysql_fetch_array($adam_stats_results); $adam_goalie_test = $adam_stats_row['Goalie']; $adam_gli = $adam_stats_row['GLI']; $adam_goals = $adam_stats_row['Goals']; $adam_saves = $adam_stats_row['Saves']; $adam_sog = $adam_stats_row['SOG']; $adam_assists = $adam_stats_row['Assists']; $adam_ck = $adam_stats_row['CK']; $adam_yc = $adam_stats_row['YC']; $adam_rc = $adam_stats_row['RC']; if ($adam_goalie_test == 1){ $adam_goalie = "Yes"; }else{ $adam_goalie = "No"; } } } ?> my code: Code: [Select] echo $Profile['display']; ECHO's out: 0|1|0|1 Now I want to explode these, which is easy Code: [Select] $display = explode("|", $Profile['display']); But Now I want to use a php function to check if any of the array's = "1" and have the value set to $value= "checked"; I could do this by doing Code: [Select] if ($display['0'] == "1"){ $value = "checked"; } and then 1 2 3 and so on.. but I want a faster way, maybe a for loop, or a simpliar easier way to just check if each array = 1, make $value = checked Possible right? Hello, i want to check whether image exist or not, but i can't get any data about it. I have tried everything: getimagesize, file_exist, filesize, etc. <? $info = @getimagesize('http://jargames.eu/ic.php?lf=files/All phone/240x320/007-quantum_of_solace_240x320.jar'); if(isset($info['mime'])){echo 'Image exist';} else{echo 'Image doesnt exist';} ?> Ty, for your help. What is the best/proper way to check if a supplied URL goes to an actual image? My site will allow users to enter an image URL (like "http://example.com/images/monkey.jpg"). I will store the URL they enter in a MySQL database and then will call it up later and do some resizing to these images. But I don't want to try to do any resizing if the URL they supply doesn't actually go to an image, or if it's blank (i.e. the user didn't enter a URL yet). So basically, I will run a MySql query to pull back the contents of the column called "imageurl". Let's say those contents are stored in a variable called $imageurl. This is what I'm trying to accomplish.... Code: [Select] if ($theimageurl does NOT contain a URL to an image OR is blank) { // do this } else { //run my resizing code } I guess i could do this to check to see if it's blank, but not sure this is proper/most efficient way to check that part of the issue... Code: [Select] if (trim($theimageurl) == "") But greater than the "is it blank" concern is that people may enter URLs that just to a regular website so whether it's at this point in my code (or for security, I should probably do it BEFORE inserting it into my database :/ ) so curious if there are any functions that check to see if it's an image URL or not. I know of file_exists, but I'm pretty sure that's just checking to see if a file exists and doesn't check image URLs. Any info/suggestions would be appreciated as always! And if there are any recommended functions to check/clean the user-entered URL BEFORE it's entered into the database, please share Thanks! Hi, I have an image handling php script which works fine here if the image is actually a readable format by the php program... Code: [Select] <?php //determine image type if($this->ext == 'jpeg' || $this->ext == 'jpg') { $imageObject = imagecreatefromjpeg($image); } elseif($this->ext == 'gif') { $imageObject = imagecreatefromgif($image); } ?> However, I tested the script with a random gif created in photoshop and i got an ugly php error returned saying the image was not the correct type for imagecreatefromgif even tho the image was a .gif file. In response I then tried to make a safety test, but it doesn't seem to work: Code: [Select] <?php //determine image type if($this->ext == 'jpeg' || $this->ext == 'jpg') { if(imagecreatefromjpeg($image)) { $imageObject = imagecreatefromjpeg($image); } else{ //now remove the old TEMP file ($image) unlink($image); return 'Sorry there is a file type error with the image you are uploading.';*/ } } elseif($this->ext == 'gif') { if(imagecreatefromjpeg($image)) { $imageObject = imagecreatefromgif($image); } else{ //now remove the old TEMP file ($image) unlink($image); return 'Sorry there is a file type error with the image you are uploading.';*/ } } ?> The $image can be either a jpg jpeg gif or png... Could anyone please tell me how to correctly check if the file is in readable by the php program in this context? Any help would be very much appreciated Say I have a MySQL table with two fields: "id" (primary key, INT(7)) and "hash" (indexed, VARCHAR(32)), and there will be hundreds of thousands of records in this table. Would it be faster / less CPU intensive to use MySQL to match both the id and hash fields to cleaned / sanitized request vars, or just match the id field with MySQL, and then use PHP to determine whether or not the hash is correct? So, mysql_query("SELECT * FROM table WHERE id='" .$id. "' AND hash=' .$hash. '"); or: $query = mysql_query("SELECT * FROM table WHERE id='" .$id. "'"); $row = mysql_fetch_assoc($query); if ($row['hash'] == $hash) .. One scenario you're requiring MySQL to match two things (the hash field would be 32 characters long, like a md5 string), the other way it would only have to find one field (a unique, primary key integer, which should be very fast), but MySQL would need to pull the data and put into an array that PHP can then read to determine if the other field is a match. I'm thinking the all-MySQL way would be faster, but I didn't know about it having to search through hundreds of thousands of records for a string of that size. Any thoughts? Thanks! $HEADER = "http://www.google.com"; for($cwb=1; $cwb!=100; $cwb++) { $repeat = file_get_contents($HEADER); $msg = explode('<message>', $repeat); $msg = explode('</', $msg[1]); echo "#$cwb: ".$msg[0]."\n"; } why is this much faster? $HEADER = "http://www.google.com"; $REPEAT = 100; // times to repeat $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); for($cwb=1; $cwb!=$REPEAT; $cwb++) { curl_setopt($ch, CURLOPT_URL, $HEADER); $msg = explode('<message>', curl_exec($ch)); $msg = explode('</', $msg[1]); echo "#$cwb: ".$msg[0]."\n"; } while($ch); curl_close($ch); is there anything faster than both of these options? I have a 5000 item array of grocery UPC numbers and prices (here's a snippet):
$myarray = array(
'3540132662329' => '74.46',
'8870132664186' => '63.24', What is the best/proper way to run an image URL from an external site through a check to see if the image actually exists? I am trying to use file_exists() but it's not recognizing image URLs from external sites as existing, so there must be some other way to deal with external URLs. In other words, the image does exist but file_exists() says it doesn't. Can anyone help? Please help before this script drives me insane. It tries to download a skin from Minecraft. It works fine, except, if it returns an error code, (301, 302, 404), don't download, and using my image (char.png) as a replacement. I can get the error code, except, no matter how I compare it, it will a) still say it's 302 or b) not work at all. Here's my code: userskin.inc.php > <?php require('class.mineuser.php'); if(!isset($_GET['width']) || strlen(trim($_GET['width'])) == 0 || !isset($_GET['height']) || strlen(trim($_GET['height'])) == 0) { $x = 16; $y = 16; } else { $x = $_GET['width']; $y = $_GET['height']; } if(isset($_GET['refresh'])) $refresh = true; else $refresh = false; if(isset($_GET['debug'])) $debug = true; else $debug = false; $http = curl_init("http://www.minecraft.net/skin/{$_GET['user']}.png"); curl_setopt($http, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($http); $http_status = curl_getinfo($http, CURLINFO_HTTP_CODE); $resp = preg_match("/302/", $http_status, $match); $code = $match[0]; if($code == 302) { mineuser::downloadSkin($_GET['user'], $_GET['path'], $code, $refresh); mineuser::getFace($_GET['user'].".png", $x, $y, $_GET['path'], $code, $debug); } else { mineuser::getFace("char.png", $x, $y, $_GET['path'], $code, $debug); } class.mineuser.php > <?php class mineuser { public static function downloadSkin($user, $path = "", $resp, $new = false) { if($resp !== 302) { //Checks if $new is true, if it is, then delete $user.png and download a new one. if($new == true) unlink("$path/$user.png"); //Checks if the users skin already exists (faster loading time) if(!file_exists("$path/$user.png")) { $fh = fopen("$path/$user.png", "w"); $file = file("http://www.minecraft.net/skin/$user.png"); foreach($file as $char) //Since it's an array, we use a foreach loop and write each character individually fwrite($fh, $char); fclose($fh); //Close our file handler. } } else { } } //End of function downloadSkin() public static function getFace($user, $width, $height, $path, $resp, $debug = true) { $im = imagecreatetruecolor($width, $height); if($debug == false) { header("Content-type: image/png"); } if($resp === 302) { $image = imagecreatefrompng("$path/char.png"); } else { $image = imagecreatefrompng("$path/$user"); } imagecopyresampled($im, $image, 0, 0, 8, 8, $width, $height, 8, 8); imagepng($im); imagedestroy($im); } //End of function getFace() } ?> please help before i go insane Thanks in advance This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=317810.0 i need this code to execute faster, is there a faster way? function all_word_combinations($all_words_unknown,$previous_string=''){ $all_words_2=array(); if(is_array($all_words_unknown)){ $all_words_array=$all_words_unknown; }else{ $all_words_array=explode(' ',trim($all_words_unknown)); } $item2remove='the'; $all_words_array=explode(' ',trim(str_replace($item2remove.' ','',str_replace(' '.$item2remove,'',(implode(' ',$all_words_array)))))); if(count($all_words_array)>1){ $previous_array=explode(' ',$previous_string); foreach($all_words_array as $one_word){ if(!in_array($previous_string.$one_word,$all_words_2) && !in_array($one_word,$previous_array)){ $all_words_2[$previous_string.$one_word]=$previous_string.$one_word; $all_words_2=array_merge($all_words_2,all_word_combinations($all_words_array,$previous_string.$one_word.' ')); } } return $all_words_2; }else{return $all_words_array;} } $one_word_combination=''; foreach(all_word_combinations('cat dog mouse turtle shark whale elephant giraffe lion tiger fish monkey') as $one_word_combination){echo str_replace(' ','-',$one_word_combination).'<br />';} $ch = curl_init(); //////////////////////////////////// //////////////////////////////////// for($cwb=1; $cwb!=$Amount; $cwb++) { $action = file_get_contents($Game."refresh_stat_manual?user_id=".$Keys[0]."&auth_key=".$Keys[1]); $xml = simplexml_load_string($action); foreach($xml->xml->viewer->user as $stats) { $energy=$stats->energy; $level=$stats->level; } if($energy <= 0 || $Stop <= $level) { echo "REACHED EITHER LEVEL $Stop OR... YOU ARE OUT OF ENERGY...\n"; sleep(100000); } $send1 = $Game."send_requests?user_id=".$IDone."&to_user_ids=".$Keys[0]."&auth_key=".$AuthOne; curl_setopt($ch, CURLOPT_URL, $send1); curl_exec($ch); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $send2 = $Game."send_requests?user_id=".$IDtwo."&to_user_ids=".$Keys[0]."&auth_key=".$AuthTwo; curl_setopt($ch, CURLOPT_URL, $send2); curl_exec($ch); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $accept = $Game."accept_all_mob_requests?user_id=".$Keys[0]."&auth_key=".$Keys[1]; curl_setopt($ch, CURLOPT_URL, $accept); curl_exec($ch); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $job = $Game."do_job?user_id=".$Keys[0]."&job_id=7200018&auth_key=".$Keys[1]; curl_setopt($ch, CURLOPT_URL, $job); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $exec1 = curl_exec($ch); if(stristr($exec1, 'You gained 6') || stristr($exec1, 'You gained 1') || stristr($exec1, 'ambulance')) { echo "#$cwb: <-- You've gained 1 ambulance... Level - ".$level." ::: ENERGY - ".$energy." :::\n"; } for($abc =1; $abc!=2; $abc++){ $remove1 = $Game."remove_mob_member?user_id=".$Keys[0]."&remove_user_id=".$IDone."&auth_key=".$Keys[1]; curl_setopt($ch, CURLOPT_URL, $remove1); curl_exec($ch); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);} for($abc =1; $abc!=2; $abc++){ $remove2 = $Game."remove_mob_member?user_id=".$Keys[0]."&remove_user_id=".$IDtwo."&auth_key=".$Keys[1]; curl_setopt($ch, CURLOPT_URL, $remove2); curl_exec($ch); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);} $sell = $Game."buy_item?user_id=".$Keys[0]."&item_id=32&amount=".$Amount."&auth_key=".$Keys[1]; curl_setopt($ch, CURLOPT_URL, $sell); $exec2 = curl_exec($ch); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); if(stristr($exec2, 'sold')) { echo "::: You've sold 1 ambulance...\n"; } } curl_close(); Any idea on how I could make this faster or what I could change to make it to more efficient Hello, I'm developing a browser based chat clients(like the one facebook and gtalk uses) which requires an instant generation of of blocks of html code on clicks. So, what i'am basically trying to do is first writes it down the generated code on a text file using php fwrite function and load it immediately into the site as soon as it is done. Some disadvantages using this system of techniques is the various calculations involved which i believe will delay in the deleivery of the code generated. On the otherhand, this is not so in the case of mysql database as all the values are uniquely stored and determined but the whole lot process of querying and reteieving is another factor that i believe will slow down the performance. please tell me which gonna be a faster one...thanks, p.s almost 50percent coding done I read the tutorial, "Handling XML Data" and created this script from it. Excellent tutorial by the way Here is my script: Code: [Select] <?php // load SimpleXML $fx = new SimpleXMLElement('http://www.boj.org.jm/uploads/fxrates.xml', null, true); echo '<table><tr class="fx_header"><th class="fx_date">'; echo $fx->US[0]->DATE; echo '</th><th class="fx_buy">Buy</th><th class="fx_sell">Sell</th></tr><tr class="fx_us"><td class="fx_legend">USD (&#36;)</td><td class="fx_buy_sell">&#36;'; echo $fx->US[0]->BUY; echo '</td><td class="fx_buy_sell">&#36;'; echo $fx->US[0]->SELL; echo '</td></tr><tr class="fx_cad"><td class="fx_legend">CAD (&#36;)</td><td class="fx_buy_sell">&#36;'; echo $fx->CAD[0]->BUY; echo '</td><td class="fx_buy_sell">&#36;'; echo $fx->CAD[0]->SELL; echo '</td></tr><tr class="fx_gbp"><td class="fx_legend">GBP (&#163;)</td><td class="fx_buy_sell">&#36;'; echo $fx->GBP[0]->BUY; echo '</td><td class="fx_buy_sell">&#36;'; echo $fx->GBP[0]->SELL; echo '</td></tr></table>'; ?> This is the XML file that the script is reading from: http://www.boj.org.jm/uploads/fxrates.xml This is the result page (which is just the way it should look): http://projects.wstudiographics.com/ewl/boj/fxrates.php It works very well, but it take a bit of time to return the result. I think it's because of how the XML file data was set up. The thing is that I have no control over the xml data. I am only allowed to read it. I only need the first or rather latest instance of the data. Any help on this will be greatly appreciated. Thanks in advanced. Winchester (WStudio) I apologize for the length of my script. Is there a better way to do some of what I am doing here? My script is working fine but it works off a lot of data and if I try to query all the results, the response is pretty slow (1500ms). I'm concerned about that length of time when it comes to multiple users hitting the server at once. I may have to limit the query with pagination, etc. But, I just have a feeling there's a better way to do what I'm doing without over 1,000 lines....
//fetch production data if( $action == 'fetch_production_data' ) { //setup query $sql = 'SELECT * FROM production_data ORDER BY enterprise, job_number, TRIM(line_item) ASC'; //execute SQL transaction try { //prepare SQL statement & execute $stmt = $pdo->prepare($sql); $stmt->execute(); //bind column names to variables $stmt->bindColumn('id', $id); $stmt->bindColumn('job_number', $job_number); $stmt->bindColumn('enterprise', $enterprise); $stmt->bindColumn('part_number', $part_number); $stmt->bindColumn('description', $description); $stmt->bindColumn('qty', $qty); $stmt->bindColumn('line_item', $line_item); $stmt->bindColumn('as400_ship_date', $as400_ship_date); $stmt->bindColumn('date_showed_on_report', $date_showed_on_report); $stmt->bindColumn('shipping_method', $shipping_method); $stmt->bindColumn('notes', $notes); $stmt->bindColumn('date_shown_complete', $date_shown_complete); $stmt->bindColumn('actual_ship_date', $actual_ship_date); $stmt->bindColumn('qty_shipped', $qty_shipped); //store user dept code $user_dept_code = get_user_dept( $_SESSION[ 'user_id' ], $pdo ); //$button = ''; //output data into spreadsheet view while($row = $stmt->fetch(PDO::FETCH_BOUND)) { //setup vars to store button HTML $btn_qc = ''; $btn_thermoforming = ''; $btn_vinylpaint = ''; $btn_finalassm = ''; $btn_crateship = ''; //store each dept status query for performance $status_qc = isset( get_order_status( $id, 10, $pdo )[0]['status_id'] ) ? get_order_status( $id, 10, $pdo )[0]['status_id'] : '0'; $status_thermoforming = isset( get_order_status( $id, 6, $pdo )[0]['status_id'] ) ? get_order_status( $id, 6, $pdo )[0]['status_id'] : '0'; $status_vinylpaint = isset( get_order_status( $id, 5, $pdo )[0]['status_id'] ) ? get_order_status( $id, 5, $pdo )[0]['status_id'] : '0'; $status_finalassm = isset( get_order_status( $id, 7, $pdo )[0]['status_id'] ) ? get_order_status( $id, 7, $pdo )[0]['status_id'] : '0'; $status_crateship = isset( get_order_status( $id, 8, $pdo )[0]['status_id'] ) ? get_order_status( $id, 8, $pdo )[0]['status_id'] : '0'; $status_msg = 'Order ' . $id .' '; //echo $status_vinylpaint . '<br>'; //build view based on user's department code switch ( $user_dept_code ) { //Design or AMS View case '4': case '9': //determine status of order for qc dept switch ( $status_qc ) { //order in progress case '1': $btn_qc = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>In Progress</button>'; break; //order delayed case '2': $btn_qc = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Delayed</button>'; break; //order finished case '3': $btn_qc = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Finished</button>'; break; //order not started case '0': default: $btn_qc = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Not Started</button>'; break; } //determine status of order thermoforming switch ( $status_thermoforming ) { //order in progress case '1': $btn_thermoforming = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>In Progress</button>'; break; //order delayed case '2': $btn_thermoforming = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Delayed</button>'; break; //order finished case '3': $btn_thermoforming = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Finished</button>'; break; //order not started case '0': default: $btn_thermoforming = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Not Started</button>'; break; } //determine status of order for vinyl & paint switch ( $status_vinylpaint ) { //order in progress case '1': $btn_vinylpaint = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>In Progress</button>'; break; //order delayed case '2': $btn_vinylpaint = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Delayed</button>'; break; //order finished case '3': $btn_vinylpaint = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Finished</button>'; break; //order not started case '0': default: $btn_vinylpaint = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Not Started</button>'; break; } //determine status of order final assembly switch ( $status_finalassm ) { //order in progress case '1': $btn_finalassm = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>In Progress</button>'; break; //order delayed case '2': $btn_finalassm = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Delayed</button>'; break; //order finished case '3': $btn_finalassm = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Finished</button>'; break; //order not started case '0': default: $btn_finalassm = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Not Started</button>'; break; } //determine status of order for crating & shipping switch ( $status_crateship ) { case '1': $btn_crateship = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>In Progress</button>'; break; //order delayed case '2': $btn_crateship = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Delayed</button>'; break; //order finished case '3': $btn_crateship = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Finished</button>'; break; //order not started case '0': default: $btn_crateship = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Not Started</button>'; break; } //break parent switch break; //Vinyl & Paint View case '5': //determine status of order for qc dept switch ( $status_qc ) { //order in progress case '1': $btn_qc = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>In Progress</button>'; break; //order delayed case '2': $btn_qc = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Delayed</button>'; break; //order finished case '3': $btn_qc = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Finished</button>'; break; //order not started case '0': default: $btn_qc = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Not Started</button>'; break; } //determine status of order thermoforming switch ( $status_thermoforming ) { //order in progress case '1': $btn_thermoforming = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>In Progress</button>'; break; //order delayed case '2': $btn_thermoforming = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Delayed</button>'; break; //order finished case '3': $btn_thermoforming = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Finished</button>'; break; //order not started case '0': default: $btn_thermoforming = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Not Started</button>'; break; } //determine status of order for vinyl & paint switch ( $status_vinylpaint ) { //order in progress case '1': $btn_vinylpaint = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5">In Progress</button>'; break; //order delayed case '2': $btn_vinylpaint = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5">Delayed</button>'; break; //order finished case '3': $btn_vinylpaint = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5">Finished</button>'; break; //order not started case '0': default: $btn_vinylpaint = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5">Not Started</button>'; break; } //determine status of order final assembly switch ( $status_finalassm ) { //order in progress case '1': $btn_finalassm = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>In Progress</button>'; break; //order delayed case '2': $btn_finalassm = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Delayed</button>'; break; //order finished case '3': $btn_finalassm = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Finished</button>'; break; //order not started case '0': default: $btn_finalassm = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Not Started</button>'; break; } //determine status of order for crating & shipping switch ( $status_crateship ) { case '1': $btn_crateship = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>In Progress</button>'; break; //order delayed case '2': $btn_crateship = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Delayed</button>'; break; //order finished case '3': $btn_crateship = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Finished</button>'; break; //order not started case '0': default: $btn_crateship = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Not Started</button>'; break; } //break parent switch break; //Thermoforming View case '6': //determine status of order for qc dept switch ( $status_qc ) { //order in progress case '1': $btn_qc = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>In Progress</button>'; break; //order delayed case '2': $btn_qc = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Delayed</button>'; break; //order finished case '3': $btn_qc = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Finished</button>'; break; //order not started case '0': default: $btn_qc = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Not Started</button>'; break; } //determine status of order thermoforming switch ( $status_thermoforming ) { //order in progress case '1': $btn_thermoforming = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6">In Progress</button>'; break; //order delayed case '2': $btn_thermoforming = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6">Delayed</button>'; break; //order finished case '3': $btn_thermoforming = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6">Finished</button>'; break; //order not started case '0': default: $btn_thermoforming = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6">Not Started</button>'; break; } //determine status of order for vinyl & paint switch ( $status_vinylpaint ) { //order in progress case '1': $btn_vinylpaint = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>In Progress</button>'; break; //order delayed case '2': $btn_vinylpaint = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Delayed</button>'; break; //order finished case '3': $btn_vinylpaint = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Finished</button>'; break; //order not started case '0': default: $btn_vinylpaint = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Not Started</button>'; break; } //determine status of order final assembly switch ( $status_finalassm ) { //order in progress case '1': $btn_finalassm = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>In Progress</button>'; break; //order delayed case '2': $btn_finalassm = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Delayed</button>'; break; //order finished case '3': $btn_finalassm = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Finished</button>'; break; //order not started case '0': default: $btn_finalassm = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Not Started</button>'; break; } //determine status of order for crating & shipping switch ( $status_crateship ) { case '1': $btn_crateship = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>In Progress</button>'; break; //order delayed case '2': $btn_crateship = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Delayed</button>'; break; //order finished case '3': $btn_crateship = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Finished</button>'; break; //order not started case '0': default: $btn_crateship = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Not Started</button>'; break; } //break parent switch break; //Derrick Donnel's View case '7,8': //determine status of order for qc dept switch ( $status_qc ) { //order in progress case '1': $btn_qc = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>In Progress</button>'; break; //order delayed case '2': $btn_qc = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Delayed</button>'; break; //order finished case '3': $btn_qc = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Finished</button>'; break; //order not started case '0': default: $btn_qc = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Not Started</button>'; break; } //determine status of order for qc dept switch ( $status_thermoforming ) { //order in progress case '1': $btn_thermoforming = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>In Progress</button>'; break; //order delayed case '2': $btn_thermoforming = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Delayed</button>'; break; //order finished case '3': $btn_thermoforming = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Finished</button>'; break; //order not started case '0': default: $btn_thermoforming = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Not Started</button>'; break; } //determine status of order for qc dept switch ( $status_vinylpaint ) { //order in progress case '1': $btn_vinylpaint = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>In Progress</button>'; break; //order delayed case '2': $btn_vinylpaint = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Delayed</button>'; break; //order finished case '3': $btn_vinylpaint = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Finished</button>'; break; //order not started case '0': default: $btn_vinylpaint = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Not Started</button>'; break; } //determine status of order for qc dept switch ( $status_finalassm ) { //order in progress case '1': $btn_finalassm = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7">In Progress</button>'; break; //order delayed case '2': $btn_finalassm = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7">Delayed</button>'; break; //order finished case '3': $btn_finalassm = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7">Finished</button>'; break; //order not started case '0': default: $btn_finalassm = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7">Not Started</button>'; break; } //determine status of order for qc dept switch ( $status_crateship ) { case '1': $btn_crateship = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8">In Progress</button>'; break; //order delayed case '2': $btn_crateship = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8">Delayed</button>'; break; //order finished case '3': $btn_crateship = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8">Finished</button>'; break; //order not started case '0': default: $btn_crateship = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8">Not Started</button>'; break; } //break parent switch break; //Final Assembly View case '7': //determine status of order for qc dept switch ( $status_qc ) { //order in progress case '1': $btn_qc = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>In Progress</button>'; break; //order delayed case '2': $btn_qc = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Delayed</button>'; break; //order finished case '3': $btn_qc = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Finished</button>'; break; //order not started case '0': default: $btn_qc = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Not Started</button>'; break; } //determine status of order thermoforming switch ( $status_thermoforming ) { //order in progress case '1': $btn_thermoforming = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>In Progress</button>'; break; //order delayed case '2': $btn_thermoforming = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Delayed</button>'; break; //order finished case '3': $btn_thermoforming = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Finished</button>'; break; //order not started case '0': default: $btn_thermoforming = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Not Started</button>'; break; } //determine status of order for vinyl & paint switch ( $status_vinylpaint ) { //order in progress case '1': $btn_vinylpaint = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>In Progress</button>'; break; //order delayed case '2': $btn_vinylpaint = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Delayed</button>'; break; //order finished case '3': $btn_vinylpaint = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Finished</button>'; break; //order not started case '0': default: $btn_vinylpaint = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Not Started</button>'; break; } //determine status of order final assembly switch ( $status_finalassm ) { //order in progress case '1': $btn_finalassm = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7">In Progress</button>'; break; //order delayed case '2': $btn_finalassm = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7">Delayed</button>'; break; //order finished case '3': $btn_finalassm = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7">Finished</button>'; break; //order not started case '0': default: $btn_finalassm = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7">Not Started</button>'; break; } //determine status of order for crating & shipping switch ( $status_crateship ) { case '1': $btn_crateship = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>In Progress</button>'; break; //order delayed case '2': $btn_crateship = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Delayed</button>'; break; //order finished case '3': $btn_crateship = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Finished</button>'; break; //order not started case '0': default: $btn_crateship = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Not Started</button>'; break; } //break parent switch break; //Crating & Shipping View' case '8': //determine status of order for qc dept switch ( $status_qc ) { //order in progress case '1': $btn_qc = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>In Progress</button>'; break; //order delayed case '2': $btn_qc = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Delayed</button>'; break; //order finished case '3': $btn_qc = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Finished</button>'; break; //order not started case '0': default: $btn_qc = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10" disabled>Not Started</button>'; break; } //determine status of order thermoforming switch ( $status_thermoforming ) { //order in progress case '1': $btn_thermoforming = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>In Progress</button>'; break; //order delayed case '2': $btn_thermoforming = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Delayed</button>'; break; //order finished case '3': $btn_thermoforming = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Finished</button>'; break; //order not started case '0': default: $btn_thermoforming = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Not Started</button>'; break; } //determine status of order for vinyl & paint switch ( $status_vinylpaint ) { //order in progress case '1': $btn_vinylpaint = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>In Progress</button>'; break; //order delayed case '2': $btn_vinylpaint = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Delayed</button>'; break; //order finished case '3': $btn_vinylpaint = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Finished</button>'; break; //order not started case '0': default: $btn_vinylpaint = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Not Started</button>'; break; } //determine status of order final assembly switch ( $status_finalassm ) { //order in progress case '1': $btn_finalassm = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>In Progress</button>'; break; //order delayed case '2': $btn_finalassm = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Delayed</button>'; break; //order finished case '3': $btn_finalassm = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Finished</button>'; break; //order not started case '0': default: $btn_finalassm = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Not Started</button>'; break; } //determine status of order for crating & shipping switch ( $status_crateship ) { case '1': $btn_crateship = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8">In Progress</button>'; break; //order delayed case '2': $btn_crateship = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8">Delayed</button>'; break; //order finished case '3': $btn_crateship = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8">Finished</button>'; break; //order not started case '0': default: $btn_crateship = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8">Not Started</button>'; break; } //break parent switch break; //Quality Control View' case '10': //determine status of order for qc dept switch ( $status_qc ) { //order in progress case '1': $btn_qc = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10">In Progress</button>'; break; //order delayed case '2': $btn_qc = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10">Delayed</button>'; break; //order finished case '3': $btn_qc = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10">Finished</button>'; break; //order not started case '0': default: $btn_qc = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10">Not Started</button>'; break; } //determine status of order thermoforming switch ( $status_thermoforming ) { //order in progress case '1': $btn_thermoforming = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>In Progress</button>'; break; //order delayed case '2': $btn_thermoforming = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Delayed</button>'; break; //order finished case '3': $btn_thermoforming = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Finished</button>'; break; //order not started case '0': default: $btn_thermoforming = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="6" disabled>Not Started</button>'; break; } //determine status of order for vinyl & paint switch ( $status_vinylpaint ) { //order in progress case '1': $btn_vinylpaint = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>In Progress</button>'; break; //order delayed case '2': $btn_vinylpaint = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Delayed</button>'; break; //order finished case '3': $btn_vinylpaint = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Finished</button>'; break; //order not started case '0': default: $btn_vinylpaint = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="5" disabled>Not Started</button>'; break; } //determine status of order final assembly switch ( $status_finalassm ) { //order in progress case '1': $btn_finalassm = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>In Progress</button>'; break; //order delayed case '2': $btn_finalassm = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Delayed</button>'; break; //order finished case '3': $btn_finalassm = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Finished</button>'; break; //order not started case '0': default: $btn_finalassm = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="7" disabled>Not Started</button>'; break; } //determine status of order for crating & shipping switch ( $status_crateship ) { case '1': $btn_crateship = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>In Progress</button>'; break; //order delayed case '2': $btn_crateship = '<button type="button" class="btn btn-danger btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Delayed</button>'; break; //order finished case '3': $btn_crateship = '<button type="button" class="btn-success btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Finished</button>'; break; //order not started case '0': default: $btn_crateship = '<button type="button" class="btn btn-secondary btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="8" disabled>Not Started</button>'; break; } //break parent switch break; //SU/Op. Mngt/Prod. Mngt View case '1': case '2': case '3': //determine status of order for qc dept switch ( $status_qc ) { //order in progress case '1': $btn_qc = '<button type="button" class="btn btn-warning btn-sm btn_change_order_status_dialog" style="margin:0; width: 100px; height:100%; font-weight: bold;" data-order-id="'. $id . '" data-order-number="'. $job_number . '" data-order-enterprise="'. $enterprise . '" data-dept-code="10">In Progress</button>'; break; //order delayed case '2': $btn_qc = '<button type="button" cla |