web报表表错误未知原因

0sgqnhkj  于 2021-06-21  发布在  Mysql
关注(0)|答案(0)|浏览(113)

所以我现在正在测试我的web报表。所以在初始测试中没有错误,表看起来是这样的,就像我设计的表报告默认设计一样
但是在把它与硬件和其他东西连接起来之后,我发现这个表有时会变成这个问题表
重新启动程序后,表格又恢复正常。这个问题有时发生,并不经常发生。是什么导致了这一切?
下面是php代码

<?php require_once('Connections/sizeCount.php'); ?>
<?php
$to = date("Y-m-d",strtotime("+1 day".$_GET['to']));
mysql_select_db($database_sizeCount, $sizeCount);
$query_Recordset1 = "SELECT * FROM temp_frm_mngmt_tbl";
$Recordset1 = mysql_query($query_Recordset1, $sizeCount) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

if (!function_exists("GetSQLValueString")) 
{
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

        $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
}

?>
<html>
<head>
    <title>Daily Former Management Report</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style>
        @page {size 8.5in 11in;}
        div.page { page-break-after: always}  <!-- break after printing -->
        <!-- type="text/css" media="print">.breakAfter{ -->
    </style>
    <link href="style.css" rel="stylesheet" type="text/css">
</head>
<thead>
</thead>

<body> <!-- Body1 as Page Header -->
    <div align="center">
    <?php
        #$mnthName =  $_GET['mnthName'];
        #$year =  $_GET['year'];
        $SelectedDate =  $_GET['from'];

        date_default_timezone_set('Asia/Kuala_Lumpur');
        $date = date('d M Y', time() + $timezone);
        $time = date('h:i:s A', time() + $timezone);

        $PageFormat = '<table width="900" border="1" align="center" rules="all" class="graypanel">';
        $TableHeaderStyle="<td style='text-align:center;face:Times New Roman;font-size:20;'>";
        $TableStyleLeft="<td style='text-align:left;face:Times New Roman;font-size:10.5;'>";
        $TableStyleRight="<td style='text-align:right;face:Times New Roman;font-size:10.5;'>";
        $TableStyleCenter="<td style='text-align:center;face:Times New Roman;font-size:10.5;'>";
        $TableStyleSubTotal="<td style='text-align:right;face:Times New Roman;font-size:10.5; background-color:#bebaa7;'>";
        $TableStyleSubTotal="<td style='text-align:right;face:Times New Roman;font-size:10.5;font-weight:bold;'>";
        $TableStyleSubTotalCenter="<td style='text-align:center;face:Times New Roman;font-size:10.5; background-color:#bebaa7;'>";
        #$TableStyleSubTotal="<td style='text-align:right;face:Times New Roman;font-size:10.5;font-weight:bold;background-color:#bebaa7;'>";
        $TableStyleSubTotalLeft="<td style='text-align:left;face:Times New Roman;font-size:10.5;font-weight:bold;'>";
        $TableStyleSubTotalRight="<td colspan = 2 style='text-align:center; face:Times New Roman;font-size:10.5;font-weight:bold;'>";
        #$TableStyleSubTotalLeft="<td style='text-align:left;face:Times New Roman;font-size:10.5; background-color:#bebaa7;'>";

        #$PageHeader1 = '<p align="center"><strong>Perusahaan Getah Asas Sdn Bhd (P2A)</strong><br>';
        #$PageHeader1 = '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp;  &nbsp; &nbsp; &nbsp; Report Generated: '.$date. "&nbsp;&nbsp;&nbsp;&nbsp;". $time;
        #$PageHeader2 = "<strong>Cummulative Glove Size Counting System</strong></p> <p> Line : ".$_GET['line']."&nbsp;&nbsp;&nbsp;&nbsp;Side : ".$_GET['side']."</p>";

        $PageHeader1 = '<strong style ="font-size:18px";>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Daily Former Management Report </strong><strong style ="font-size:10.5px";>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Report Date: '.$date. "&nbsp;". $time.'</strong>';                              
        $PageHeader2 = '<p align="center" style="margin-top: 0px; margin-bottom: 0px;"><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="style4">Plant</span> </strong><strong><span class="style4">P2A - All Lines</strong></p>';
        $PageHeader3 = '<p align="left" style="margin-top: 0px; margin-bottom: 0px;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>Former Management by Line</strong> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<strong>Day: '.$SelectedDate.'</strong></p>';
        #$PageHeader1 = '<div width="900" align="left" rules="all"><strong style ="font-size:18px";><span style="float:center;">Daily Glove Production Performance Report</span></strong><strong style ="font-size:10.5px";><span style="float:right;">Report Date: '.$date. "&nbsp;". $time.'</span></strong></div>';

        $TableHeader = '                    
                    <tr><bgcolor="#E1E1E1">
                    <th colspan = "1" width="40px" align="center"> </th>
                    <th colspan = "17" width="70px" align="center">Former Installation </th>                    
                    </tr>

                    <tr><bgcolor="#E1E1E1">
                    <th colspan = "1" width="40px" align="center"> </th>
                    <th colspan = "1" width="40px" align="center"> </th>
                    <th colspan = "2" width="40px" align="center">Size XS</th>
                    <th colspan = "2" width="40px" align="center">Size S</th>
                    <th colspan = "2" width="40px" align="center">Size M</th>
                    <th colspan = "2" width="40px" align="center">Size L</th>
                    <th colspan = "2" width="40px" align="center">Size XL</th>
                    <th colspan = "2" width="40px" align="center">Size XXL</th>
                    <th colspan = "4" width="40px" align="center">Total</th>
                    </tr>
                    <tr><bgcolor="#E1E1E1">
                    <th width="70px" align="center">Line</th>
                    <th width="70px" align="center">Side</th>
                    <th width="77px" align="center">Shrtg (pcs)</th>
                    <th width="78px" align="center">Instld (pcs)</th>
                    <th width="77px" align="center">Shrtg (pcs)</th>
                    <th width="78px" align="center">Instld (pcs)</th>
                    <th width="77px" align="center">Shrtg (pcs)</th>
                    <th width="78px" align="center">Instld (pcs)</th>
                    <th width="77px" align="center">Shrtg (pcs)</th>
                    <th width="78px" align="center">Instld (pcs)</th>
                    <th width="77px" align="center">Shrtg (pcs)</th>
                    <th width="78px" align="center">Instld (pcs)</th>
                    <th width="77px" align="center">Shrtg (pcs)</th>
                    <th width="78px" align="center">Instld (pcs)</th>
                    <th width="77px" align="center">Shrtg (pcs)</th>
                    <th width="78px" align="center">Shrtg (%)</th>
                    <th width="78px" align="center">Instld (pcs)</th>
                    <th width="78px" align="center">Max. (pcs)</th>                                                            
                    </tr>'; 
    echo '<tbody>';
        $i = 0;
        echo $PageFormat;   # $PageFormat must be included here
        $PrevLine = "";
        $CurrLine = "";

        do
        {
                if (($i % 30) == 0)
                {               
                    if ($i > 0)
                    {
            echo '</td></tr></table>'.$PageFormat;  # $PageFormat must be included here
                        echo '<div class="page"></div>';  # leave blank for text inside div
                    }

                    echo $PageHeader1;
                    echo $PageHeader2;
                    echo $PageHeader3;
                    //echo $TableHeaderStyle; 
                    echo $TableHeader; echo '</td>';                    
                }

                $TestStr1 = $row_Recordset1['LineDayMonth'];
                $TestStr2 = "Total";                            

                $CurrLine = $row_Recordset1['LineDayMonth'];
                    if($CurrLine == $PrevLine)
                    {
                        $CurrLine = "";
                    }
                    if($CurrLine == 'Total')
                    {
                        $CurrLine = $row_Recordset1['LineDayMonth'];

                    }

$shrtg_Perc = $row_Recordset1['Shrtg_Perc'];

if($shrtg_Perc == null)
{
    $shrtg_Perc = 0;

}

                echo '<tr>';
                if($TestStr1 == $TestStr2) {
          echo $TableStyleSubTotalRight;
                        echo "&nbsp;".$CurrLine."&nbsp;&nbsp;&nbsp;";

                        echo "&nbsp;".$row_Recordset1['Side']; echo '</td>';
                    echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_XS']); echo '</td>';
                    echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_XS']); echo '</td>';
                    echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_S']); echo '</td>';
                    echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_S']); echo '</td>';
          echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_M']); echo '</td>';
                    echo $TableStyleSubTotal;
                        echo "&nbsp;".$row_Recordset1['Instl_M']; echo '</td>';
          echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_L']); echo '</td>';
                    echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_L']); echo '</td>';
          echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_XL']); echo '</td>';
                    echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_XL']); echo '</td>';
          echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_XXL']); echo '</td>';
                    echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_XXL']); echo '</td>';
          echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_Total']); echo '</td>';
          echo $TableStyleSubTotal;
                        echo "&nbsp;".$shrtg_Perc; echo '</td>';
          echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_Total']); echo '</td>';
          echo $TableStyleSubTotal;
                        echo "&nbsp;".number_format ($row_Recordset1['MaxPcs']); echo '</td>';
                    }
                    else {
                    echo $TableStyleCenter;
                        echo "&nbsp;".$CurrLine."&nbsp;&nbsp;&nbsp;";
                    echo $TableStyleCenter;
                        echo "&nbsp;".$row_Recordset1['Side']; echo '</td>';
                    echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_XS']); echo '</td>';
                    echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_XS']); echo '</td>';
                    echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_S']); echo '</td>';
                    echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_S']); echo '</td>';
          echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_M']); echo '</td>';
                    echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_M']); echo '</td>';
          echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_L']); echo '</td>';
                    echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_L']); echo '</td>';
          echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_XL']); echo '</td>';
                    echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_XL']); echo '</td>';
          echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_XXL']); echo '</td>';
                    echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_XXL']); echo '</td>';
          echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Shrtg_Total']); echo '</td>';
          echo $TableStyleRight;
                        echo "&nbsp;".$shrtg_Perc; echo '</td>';
          echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['Instl_Total']); echo '</td>';
          echo $TableStyleRight;
                        echo "&nbsp;".number_format ($row_Recordset1['MaxPcs']); echo '</td>';
                    }
                    $PrevLine = $row_Recordset1['LineDayMonth'];
                    echo'</tr>';
            ++$i;
        } while($row_Recordset1 = mysql_fetch_assoc($Recordset1));
    echo '</tbody>';
    ?>
</table>
</div>
</body>
</html>
<?php
    mysql_free_result($Recordset1);
    ?>

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题