<?php 

                 session_start();
    if ($_SESSION['company'] == "") { 
        exit("Please Login");
    }
    if ($_SESSION['CURRENT_USER'] == "") { 
        exit("Please Login");
    }
  require_once("connectioni.php");
  
 
?>  


<link rel="stylesheet" href="css/table.css" type="text/css"/> 
 

</label>
      
 <?php
  $sql="Select * from s_crnfrm where Refno='".$_GET['crnformno']."'"; 
  $result =mysqli_query($GLOBALS['dbinv'],$sql) ;   
  $row = mysqli_fetch_array($result);
 ?>     
          
<fieldset>
                                                  <legend>
  <div class="text_forheader">Cash Credit Note Form</div>
                                                 </legend>             

<form name="form1" id="form1">            
  <table width="100%" border="0"  class=\"form-matrix-table\">
  <tr>
    <td width="14%"><input type="text"  class="label_purchase" value="Reference No" disabled/></td>
    <td width="14%"><input type="text" name="crnno" id="crnno" disabled="disabled" value="<?php echo $row["Refno"]; ?>" class="text_purchase3" onkeypress="keyset('searchcust',event);" onfocus="got_focus('invno');"  onblur="lost_focus('invno');"  /></td>
    <td width="9%">&nbsp;</td>
    <td width="9%"><input type="text"  class="label_purchase1" value="Date" disabled="disabled"/></td>
    <td width="15%"><input type="text"  name="crndate" id="crndate" value="<?php echo $row["Sdate"]; ?>" disabled="disabled" class="text_purchase2"/></td>
     
  </tr>
   <tr>
    <td><input type="text"  class="label_purchase" value="Marketing Executive" disabled="disabled"/></td>
    <td colspan="4"><input type="text" disabled="disabled" value="<?php echo $row["Sal_ex"]; ?>"  class="text_purchase3" name="salesrep" id="salesrep"/></td>
     
  </tr>
  <tr>
    <td><input type="text"  class="label_purchase" value="Customer" disabled="disabled"/></td>
    <td><input type="text" disabled="disabled" value="<?php echo $row["Code"]; ?>"  class="text_purchase3" name="cus_code" id="cus_code"/></td>
    <?php 
    $sql1="Select * from vendor where CODE='".$row["Code"]."'";
    $result1 =mysqli_query($GLOBALS['dbinv'],$sql1) ;   
    $row1 = mysqli_fetch_array($result1);
  
      
  
   ?> 
    <td colspan="3"><input type="text" disabled="disabled" value="<?php echo $row1["NAME"]; ?>"  class="text_purchase2" id="cus_name" name="cus_name" /></td>
    
  </tr>
   <tr>
    <td><input type="text"  class="label_purchase" value="Month" disabled="disabled"/></td>
    <td colspan="4"><input type="text" disabled="disabled" value="<?php echo $row["Mon"]; ?>"  class="text_purchase3" name="salesrep" id="salesrep"/></td>
     
  </tr>
   
  
  
  
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td colspan="2">&nbsp;</td>
    <td>&nbsp;</td>
    
   
    <td>&nbsp;</td>
    <td>&nbsp;</td> 
  </tr>
   
  
  </table>


  
  <br/>   

  <table width="84%" border="0">

                <tr>
                    <td colspan="6">
                        <div class="CSSTableGenerator" id="itemdetails" >
                            <?php
                            echo "<table><tr>
                              <td width=\"100\"  background=\"\" ><font color=\"#FFFFFF\">Date</font></td>
                              <td width=\"300\"  background=\"\"><font color=\"#FFFFFF\">Invoice No</font></td>
                              <td width=\"100\"  background=\"\"><font color=\"#FFFFFF\">Amount</font></td>
                              <td width=\"100\"  background=\"\"><font color=\"#FFFFFF\">Discount</font></td>
                              <td width=\"100\"  background=\"\"><font color=\"#FFFFFF\">Dis 2</font></td>
                              <td width=\"100\"  background=\"\"><font color=\"#FFFFFF\">Qty</font></td>
                              <td width=\"100\"  background=\"\"><font color=\"#FFFFFF\">Discount (%)</font></td>
                              <td width=\"100\"  background=\"\"><font color=\"#FFFFFF\">Discount Val</font></td>
                              <td width=\"100\"  background=\"\"><font color=\"#FFFFFF\">Brand</font></td>   
                            </tr>";



                           $sql_rscrntrn = "Select * from s_crnfrmtrn where Refno = '" . $row["Refno"] . "'";

        $result_rscrntrn = mysqli_query($GLOBALS['dbinv'], $sql_rscrntrn);
        while ($row_rscrntrn = mysqli_fetch_array($result_rscrntrn)) { 
                                  
                                   
                                
                               echo " <td >" . $row_rscrntrn['Sdate'] . "</a></td>
                               <td >" . $row_rscrntrn['Inv_no'] . "</a></td> 
                               <td >" . number_format($row_rscrntrn['Amount'], 2, ".", ",") . "</a></td>
                                         <td >" . $row_rscrntrn['disc'] . "</a></td>
                                        <td >" . number_format($row_rscrntrn['disc1'], 2, ".", ",") . "</td>
                                         <td >" . number_format($row_rscrntrn['Qty'], 2, ".", ",") . "</a></td>
                                         <td >" . number_format($row_rscrntrn['Incen_per'], 2, ".", ",") . "</a></td>
                                           <td >" . number_format($row_rscrntrn['Incen_val'], 2, ".", ",") . "</a></td>
                                           <td >" . $row_rscrntrn['Brand'] . "</a></td>
              
               
                            </tr>";
                            }

                            echo "   </table>";
                            ?>
                        </div>                                                    </td>
                </tr>

                <tr>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                </tr>
                <tr>  
                    <td><span class="style1">
                            <input type="text"  class="label_purchase" value="Total" disabled="disabled"/>
                        </span></td>
                    <td><input type="text"  name="stklevel" id="stklevel" disabled value="<?php echo $row['Amount']; ?>" class="text_purchase1"/></td>
                  
                     
                </tr>
                <tr>
     <td><span class="style1">
                            <input type="text"  class="label_purchase" value="Remark" disabled="disabled"/>
                        </span></td>
                    <td><input type="text" size="5"  name="stklevel" id="stklevel" disabled value="<?php echo $row['Remark']; ?>" class="text_purchase2"/></td>
     
  </tr>
   <tr>  
                    <td><span class="style1">
                            <input type="text"  class="label_purchase" value="Check By" disabled="disabled"/>
                        </span></td>
                    <td><input type="text"  name="stklevel" id="stklevel" disabled value="<?php echo $row['Checked']; ?>" class="text_purchase2"/></td>
  </tr>
   <tr>  
                    <td><span class="style1">
                            <input type="text"  class="label_purchase" value="Check Date" disabled="disabled"/>
                        </span></td>
                    <td><input type="text"  name="stklevel" id="stklevel" disabled value="<?php echo $row['Check_date']; ?>" class="text_purchase2"/></td>
                  
                  
                     
                </tr>
                 <tr>  
                    <td><span class="style1">
                            <input type="text"  class="label_purchase" value="Approved By" disabled="disabled"/>
                        </span></td>
                    <td><input type="text"  name="stklevel" id="stklevel" disabled value="<?php echo $row['Approved']; ?>" class="text_purchase2"/></td>
                      </tr>
   <tr>  
                   <td><span class="style1">
                            <input type="text"  class="label_purchase" value="Approved Date" disabled="disabled"/>
                        </span></td>
                    <td><input type="text"  name="stklevel" id="stklevel" disabled value="<?php echo $row['App_date']; ?>" class="text_purchase2"/></td>
                  
                     
                </tr>
                  </table>
<!-- ================ -->
              
            
  
</form>        

</fieldset>    
            
 