
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<?php

session_start();
date_default_timezone_set('Asia/Colombo');
?>
<html>
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8">


    <title>ZERO COST REPORT</title>

    <style>
        .center {
            text-align: center;
        }

        .right {
            text-align: right;
        }

        .tb  {
           width: 1100px;
           border: 1px solid black;


           border-collapse: collapse;
       }
        
       .tb td  {

           border-top: 1px solid black;
           border-left: 1px solid black;
           font-size:18px;

           border-collapse: collapse;
       }
       .tb th  {

           border-top: 1px solid black;
           border-left: 1px solid black;


           border-collapse: collapse;
       }
       .tb2  {
           
           border: 1px solid black;


           border-collapse: collapse;
       }
       .tb2 td  {

           border-top: 1px solid black;
           border-left: 1px solid black;
           font-size:18px;

           border-collapse: collapse;
       }
       .tb2 th  {

           border-top: 1px solid black;
           border-left: 1px solid black;


           border-collapse: collapse;
       }

       .tb1 {

           border: 1px solid #000000;
       }
 

   </style>
<script language="javascript" type="text/javascript">
        <!--
            /****************************************************
             Author: Eric King
             Url: http://redrival.com/eak/index.shtml
             This script is free to use as long as this info is left in
             Featured on Dynamic Drive script library (http://www.dynamicdrive.com)
             ****************************************************/
             var win = null;
             function NewWindow(mypage, myname, w, h, scroll, pos) {
                if (pos == "random") {
                    LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100;
                    TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
                }
                if (pos == "center") {
                    LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100;
                    TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;
                } else if ((pos != "center" && pos != "random") || pos == null) {
                    LeftPosition = 0;
                    TopPosition = 20
                }
                settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
                win = window.open(mypage, myname, settings);
            }
            // -->
        </script>
</head>
<?php
require_once ("connection_sql.php");

 

$sql_invpara = "SELECT * from invpara";
$result_invpara = $conn->query($sql_invpara);
$row_invpara = $result_invpara->fetch(); 






?>
<body>
    <center>
    <table width="1100px;" cellspacing="0" border="0">

        <tr>
            <th class="center"  colspan=5 ><?php echo $row_invpara['COMPANY']; ?></th>
        </tr> 
        
        <tr> 
            <th class='center' colspan='5'> <?php echo $_GET['type']?> REPORT - (<?php echo date('Y-m-d H:i:s');?>)</th> 
        </tr>
         
        <tr> 
            <th class='center' colspan='5'> <?php echo $_GET['dtfrom']?> To - <?php echo $_GET['dtfrom']?></th> 
        </tr>
          
        <tr> 
        <?php 
         if($_GET['company'] !=""){
            $sql_sto = "SELECT * from s_stomas where CODE='".$_GET['company']."'";
            $result_sto= $conn->query($sql_sto);
            $row_sto = $result_sto->fetch(); 
?>
            <th class='center' colspan='5'>Company Wise - (<?php echo $row_sto['DESCRIPTION']?> ) </th> 
           <?php } ?>
        </tr> 
        <tr>

            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td align="right">&nbsp;</td>
        </tr>
        
        <tr>

            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>

            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        <tr>

            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
        
        <tr>

            <td></td>
            <td></td>
            <td></td>
            <td></td>
            <td></td>
        </tr>
       
    </table>
<!--==================================================================================-->
 
                <table class="tb" width="1100px;" >
   
            
         
            
            <tr >
                <th width="30px;">NO</th> 
                <th width="100px;">invoice No</th>
                <th width="100px;">invoice Date</th>
                <th width="80px;">Item</th>
                <th width="300px;">Description</th>   
                 
            </tr>
            
            <?php
                $j=1;  
                $ii=0;
                $sql_exp = "Select * from s_invo where  SDATE >='" . $_GET["dtfrom"] . "' and SDATE <='" . $_GET["dtto"] . "' and CANCELL='0' AND COST ='0.00' AND (BRAND !='SERVICE' AND BRAND !='CHARGING' AND BRAND !='ALIGNMENT' AND BRAND !='USED ITEM' AND BRAND !='STAFF COMMISION' AND BRAND !='OTHER SERVICE')";
                $sql_exp.=" order by SDATE"; 
                foreach ($conn->query($sql_exp) as $row_exp) {
                   
                       $sql = "select * from s_mas where STK_NO='" . $row_exp['STK_NO']  . "' and CAT='Stock Item'";
                        $result = $conn->query($sql);
                        if ($row = $result->fetch()) {
                    ?>
                    <tr style="font-size:13px;">
          
                        <td class="center" style='font-size:12px;'><?php echo $j ?></td>
                        <td class="left"  style='font-size:12px;'><a onfocus="this.blur()" onclick="NewWindow('../sales_inv_display.php?refno=<?php echo $row_exp['REF_NO']; ?>&amp;trn_type=INV','mywin','900','700','yes','center');return false" class="INV" href=""><?php echo $row_exp['REF_NO']; ?></a> </td>
                        <td class="left"  style='font-size:12px;'><?php echo $row_exp['SDATE']; ?> </td> 
                        <td class="left"  style='font-size:12px;'><?php echo $row_exp['STK_NO']; ?> </td>
                        <td class="left"  style='font-size:12px;'><?php echo $row_exp['DESCRIPT']; ?> </td> 
                    </tr>
                    
                     
                    <?php
                   	
                     $j=$j+1;
                        }
                    
                     
                     
                }
            ?>
           
            
        </table>
    
    
    
    <!--===================================================================================-->
    
    
    
 
<!-- ************************************************************************** -->
</center>
</body>

</html>
