davidjmorin

Conditional Formatting multiple Values

Sep 26th, 2019
236
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.42 KB | None | 0 0
  1. <? php
  2.  
  3.  
  4. <head>
  5.  
  6.  <meta name="viewport" content="width=device-width, initial-scale=1" />
  7.  <style type="text/css">
  8.  
  9. .Fixed_Header thead th{
  10.     background: lightgray;
  11. }
  12.  
  13. .Fixed_Header thead th:first-of-type{
  14.     border-top-left-radius: 10px;
  15. }
  16.  
  17. .Fixed_Header thead th:last-of-type{
  18.     border-top-right-radius: 10px;
  19. }
  20.  
  21. table {
  22. border-collapse: collapse;
  23. }
  24.  
  25. table.Fixed_Header tbody {
  26.         border: 2px solid black;
  27.         border-collapse: separate;
  28.         border-spacing: 6px; }
  29.        
  30. table.Fixed_Header tr {
  31.         border: 2px solid black;
  32.         border-collapse: separate;
  33.         border-spacing: 6px; }
  34.                
  35.         </style>
  36.        
  37. </head>
  38.  
  39. <h1>Team Beverly Whiteboard</h1>
  40.  
  41.  
  42. <?php
  43.  
  44.          echo "as of <b>" . date("Y/m/d") . "</b><br>";
  45.  
  46.         include 'index2.php';
  47.         $hostname = "localhost";
  48.         $username = "root";
  49.         $password = "hidden";
  50.        
  51.        
  52.         ############## Make the mysql connection ###########
  53.       try {
  54.                 $db = new PDO("mysql:host=$hostname;dbname=whiteboard", $username, $password);            
  55.                 $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
  56.        
  57.  
  58.                
  59.                 ////////This is the main table for Whiteboard//////////
  60.                
  61.                 $count = $db->exec($sql);
  62.                 $sql = "Select * from BevWhiteboard ";
  63.                 $result = $db->query($sql);
  64.                 echo "<table class='fixed_header' width='1080'>";
  65.                 echo "<thead background='black'>";
  66.                 Echo "<th id='man' width='100px'>Employee Name</th>";
  67.                 Echo "<th class='model' width='100px'>GP</th>";
  68.                 Echo "<th class='desc' width='75px'>Activations</th>";
  69.                 Echo "<th class='ingram' width='75px'>Upgrades</th>";
  70.                 Echo "<th class='verizon' width='75px'>Smartphones</th>";
  71.                 Echo "<th class='mp' width='75px'>GP / Smart</th>";
  72.                 Echo "<th class='dpmax' width='75px'>Acc. GP / Smart</th>";
  73.                 Echo "<th class='percent' width='75px'>Pullthrough %</th>";
  74.                 Echo "<th class='netprofit' width='75px'>TMP %</th>";
  75.                 Echo "<th class='netprofit' width='75px'>Bundle %</th>";
  76.                 Echo "<th class='netprofit' width='75px'>HUM</th>";
  77.                 echo "</tr></thead>";
  78.                 echo "<tbody id='imwireless' align='center' border='1'>";
  79.  
  80.                 foreach ($result as $data) {
  81.                     if($data["tmppercent"] <"70"){
  82.                         echo '
  83.                        
  84.                       <tr >
  85.                       <td id="man" width="100px">'.$data["Employee_Name1"].'</td>
  86.                       <td id="model" width="100px">'.$data["GP"].'</td>
  87.                       <td width="75px">'.$data["activations"].'</td>
  88.                       <td width="75px">'.$data["upgrades"].'</td>
  89.                        <td width="75px">'.$data["smartphone"].'</td>
  90.                        <td width="75px">'.$data["gp_smart2"].'</td>
  91.                        <td width="75px">'.$data["accessorygp"].'</td>
  92.                        <td width="75px">'.$data["pullthroughpercent"].'</td>
  93.                        <td width="75px" id="tmp"><font color="red">'.$data["tmppercent"].'%</td>
  94.                        <td width="75px" id="tmp">'.$data["bundlepercent"].'</td>
  95.                        <td width="75px" id="profit">'.$data["HUM_Devices"].'</td>
  96.                        ';
  97.                     }  
  98.                    
  99.                     elseif($data["HUM_Devices"] < "1"){
  100.                         echo '
  101.                        
  102.                       <tr >
  103.                       <td id="man" width="100px">'.$data["Employee_Name1"].'</td>
  104.                       <td id="model" width="100px">'.$data["GP"].'</td>
  105.                       <td width="75px">'.$data["activations"].'</td>
  106.                       <td width="75px">'.$data["upgrades"].'</td>
  107.                        <td width="75px">'.$data["smartphone"].'</td>
  108.                        <td width="75px">'.$data["gp_smart2"].'</td>
  109.                        <td width="75px">'.$data["accessorygp"].'</td>
  110.                        <td width="75px">'.$data["pullthroughpercent"].'</td>
  111.                        <td width="75px" id="tmp">'.$data["tmppercent"].'%</td>
  112.                        <td width="75px" id="tmp">'.$data["bundlepercent"].'</td>
  113.                        <td width="75px" id="profit"><font color="red">'.$data["HUM_Devices"].'</td>
  114.                        ';
  115.                     }  
  116.                    
  117.                     else{
  118.                     echo '
  119.                        
  120.                       <tr >
  121.                       <td id="man" width="100px">'.$data["Employee_Name1"].'</td>
  122.                       <td id="model" width="100px">'.$data["GP"].'</td>
  123.                       <td width="75px">'.$data["activations"].'</td>
  124.                       <td width="75px">'.$data["upgrades"].'</td>
  125.                        <td width="75px">'.$data["smartphone"].'</td>
  126.                        <td width="75px">'.$data["gp_smart2"].'</td>
  127.                        <td width="75px">'.$data["accessorygp"].'</td>
  128.                        <td width="75px">'.$data["pullthroughpercent"].'</td>
  129.                        <td width="75px" id="profit">'.$data["tmppercent"].'%</td>
  130.                        <td width="75px" id="profit">'.$data["bundlepercent"].'</td>
  131.                        <td width="75px" id="profit">'.$data["HUM_Devices"].'</td>
  132.                        ';    
  133.                     }
  134.                 }
  135.                 echo "</tr></tbody></table>";
  136.                 //echo 'entry succesfull';
  137.                 $db = null; // close the database connection
  138.                
  139.         }
  140.         catch(PDOException $e) {
  141.                 echo $e->getMessage();
  142.         }
  143.        
  144.         ///////// END MAIN TABLE/////////////////////////      
  145.        
  146.        
  147. ?>
  148.  <style type="text/css">
  149. .copywrite {
  150.     position: fixed;
  151.     bottom: 0;
  152.     width: 100%;
  153.   text-align: center;
  154.   border: 3px solid white;
  155. }
  156. </style>
  157.  
  158. <div class="copywrite">
  159. &copy; IMWireless <?php echo date("Y");?>
  160. </div>
Advertisement
Add Comment
Please, Sign In to add comment