mardi 30 juin 2020

hi i have a problem with my code. The output is displayed too slow

$v = 0; // detect item_id from $itemId
$c = 0;// sum id column

for($h1 = 0;$h1 < $a;$h1++){
 
 if($col[$h1] == 0)
 {   echo "<td></td>";$sumCol[$c]=0;$c++;}
 
 for($h2 = 0;$h2 < $col[$h1];$h2++){ 
   
    $id = $itemId[$v];
    $sqlData = "SELECT * FROM MASTER WHERE  Category = $h1+1 AND Item = $id AND $invStock[$r1] IS NOT NULL  AND Date = '$year-$month-$i'";
   
    $result = $conn->query($sqlData);
    while($row = $result->fetch_assoc())
    {   
         if($row['Status'] == 'OPENING')
          {     $opening[$c] = $row['Stock_In'];$sumCol[$c]+=$row['Stock_In']; }
         else if($row['Status'] == 'CLOSING')
          {     $closing[$c] = $row['Stock_In']; }
         else

          switch($invStock[$r1]){
             
            case "Stock_In" : $curr += $row['Stock_In'];$sumCol[$c]+=$row['Stock_In'];$class="text-success";$remarks.=$row['Remarks']."\n"; break;
            case "Adjustment" : $curr += $row['Adjustment'];$sumCol[$c]+=$row['Adjustment'];$class="text-info";$remarks.=$row['Remarks']."\n";break;
            case "Stock_Out" : $curr += $row['Stock_Out'];$sumCol[$c]-=$row['Stock_Out'];$class="text-danger";$remarks.=$row['Remarks']."\n";break;
          }       
     }

Aucun commentaire:

Enregistrer un commentaire