<!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>Dag Report</title>

        <style>
            table
            {
                border-collapse:collapse;
            }
            table, td, th
            {
                 
                font-family:Arial, Helvetica, sans-serif;
                padding:5px;
            }
            th
            {
                font-weight:bold;
                font-size:13px;
            }
            td
            {
                font-size:12px;

            }
        </style>

    </head>

    <body>

        <?php
        session_start();


require_once ("connection_sql.php");
// 		 where REF_NO <> ''"; 
	
// 		 if(($_GET['datecheck']!="on") && ($_GET['c_code']=="") && ($_GET['type']=="All")  ){
// 		      $sql = "Select * from s_invo_dcl wh"; 
// 		 }else{
		     $sql = "Select * from s_invo_dcl  where cancel='0'  "; 
		     if ($_GET['datecheck'] == "on") {
            $sql .= " and sdate >='" . $_GET['from'] . "' and sdate<='" . $_GET['to'] . "'";
            }
            if ($_GET['c_code'] != "") {
                $sql .= " and s_code  '" . $_GET['c_code'] . "'";
            }
            if ($_GET['type'] != "All") {
                $sql .= " and status'" . $_GET['type'] . "'";
            }
// 		 }
        
        
    
        $sql .= " ORDER BY REF_NO limit 50 ";
 
	    if($_GET['type']=='0'){
	        $type="Collected";
	    }else if($_GET['type']=='1'){
	        $type="Transfer";
	    }else if($_GET['type']=='2'){
            $type="Rejected";
	    }else if($_GET['type']=='3'){
	        $type="Completed";
	    }else{
	        $type="All";
	    }
	 
		$sql_invp = "SELECT * FROM invpara";
        $result_para = $conn->query($sql_invp);
        $row_result_para = $result_para->fetch(); 
            $stt = "<center><h3>" . $row_result_para['COMPANY'] . "</h3></center>";
         
		 
        $stt .= "<center><h5>Dag Report From - " .  $_GET['from']  .  " To " .  $_GET['to']  . "</h5></center>";
           if ($_GET['c_code'] != "") {
               $cus=$_GET['c_code'];
               $stt .= "<center><h5> Customer $cus Wise</h5></center>";
           }else{
                $stt .= "<center><h5> Customer All Wise</h5></center>";
           }
           $stt .= "<center><h5> Type $type Wise</h5></center>";
        
        
		   
            $stt .= "<center><table border='1'>";

            $stt .= "<thead>";
            $stt .="<tr><th>Ref No</th>"
                    . "<th>Item Code</th>"
                    . "<th>Customer</th>"
					. "<th>Description</th>"
					. "<th>Dag Charge</th>"
					. "<th>Company Charge</th>";
					
            $stt .= "</tr>";
            $stt .= "</thead>";
                foreach ($conn->query($sql) as $row) {
                    
                
                    $stt .= "<tr> 
            
                              <td >" . $row['REF_NO'] . "</a></td>
                              <td >" . $row['STK_NO'] . "</a></td>
                              <td >" . $row['s_name'] . "</a></td>
                              <td >" . $row['DESCRIPT'] . "</a></td>
                              <td >" . $row['dcharge'] . "</a></td>
                              <td >" . $row['chcarge'] . "</a></td>
                              
                            </tr>";
    }
            $stt .= "<tbody>";
            			
            			
            			
            $stt .= "</tbody>";

            $stt .= "</table>";
        
 
 
 
        echo $stt;


        ?>





    </body>
</html>
