<?php session_start();
?>
<?php date_default_timezone_set('Asia/Colombo'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>INV DIS Report</title>
        <style>
            body{
                font-family:Arial, Helvetica, sans-serif;
                font-size:16px;
            }
            table
            {
                border-collapse:collapse;
            }
            table, td, th
            {
                border:1px solid black;
                font-family:Arial, Helvetica, sans-serif;
                padding:5px;
            }
            th
            {
                font-weight:bold;
                font-size:15px;

            }
            td
            {
                font-size:15px;
                border-bottom:thick;
                border-left:none;
                border-right:none;


            }
        </style>
        <style type="text/css">
            <!--
            .style1 {
                color: #0000FF;
                font-weight: bold;
                font-size: 24px;
            }
            -->
        </style>
    </head>

    <body>
        <!-- Progress bar holder -->


        <?php
        require_once("connection_sql.php");

        $dt1 = $_GET['dtfrom'];
        $dt2 = $_GET['dtto'];

 

        echo "<center>
   		<table class=\"table table-bordered\" border=\"0\" >";
        echo "<tr>";
        echo "<td><b>Invoice NO</b></td>";
         echo "<td><b>Date</b></td>";
        echo "<td><b>Customer</b></td>";
         echo "<td><b>Brand</b></td>";
        echo "<td><b>Dis1</b></td>";
         echo "<td><b>Dis2</b></td>";
          echo "<td><b>Dis3</b></td>";


        echo "</tr>";

echo "<tr>";
       
            $rst_sql = "select * from s_salma where     CANCELL = '0' and sdate >='" . $dt1 . "' and sdate <='" . $dt2 . "'  ";

            if($_GET['Txtcusco']!=""){
                  $rst_sql .= " and C_CODE='".$_GET['Txtcusco']."'";
            }

             if($_GET['brand']!="All"){
                  $rst_sql .= " and Brand='".$_GET['brand']."'";
            }

              $rst_sql .= "order by SDATE "; 
               $color="";
            foreach ($conn->query($rst_sql) as $row_sql2) {
                if($row_sql2['DIS']=="0.00"){
                    $color="red";
                }else{
                    $color="";
                }
            echo "<tr>";
                echo "<td>" .  $row_sql2['REF_NO'] . "</td>"; 
                echo "<td>" .  $row_sql2['SDATE'] . "</td>";
                echo "<td>" .  $row_sql2['C_CODE'].'-'. $row_sql2['CUS_NAME'] . "</td>";
                echo "<td>" .  $row_sql2['Brand'] . "</td>";
                echo "<td style=\"background-color:$color\">" .  $row_sql2['DIS'] . "</td>";
                echo "<td>" .  $row_sql2['DIS1'] . "</td>";
                echo "<td>" .  $row_sql2['DIS2'] . "</td>";
                 echo "</tr>";
            }

            



           
        




        echo "</table>";
        ?>
    </body>
</html>
