<!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" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<style type="text/css">
.title0 {color:#000033;font-family:Calibri;font-size:16px;}
.title00 {	color: #000033;
	font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif;
	font-size: 16px;
}
.title1{color: #000033;font-family:Calibri;font-size: 17px;}
</style>
</head>
<?php
error_reporting(0);
include ("../../include/db.php");
date_default_timezone_set('Asia/Kolkata');
ob_start();
session_start();
$user_id = $_SESSION['login_user_id'];
?>

<table width="850px" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #999;">
<tr style="height:60">
<td width="112" height="106" align="right" style="font-size:12px; border-bottom:1px solid #999;"><img src="../../img/logo_image.png" width="125" height="173"/></td>
<td width="736" colspan="5" align="center" valign="top" style="border-bottom:1px solid #999;"><strong style="font-size: 50px; color: #06F; padding-top: 5px; width: 80px; font-family: Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;">SRI AMMAN DIGITAL PRINTS</strong><br />
        <span width="80%" class="title1" style="font-size:15px;font-family:Verdana, sans-serif; font-weight:bold"><b></b></span><span width="80%" class="title1" style="font-size:15px;font-family:Verdana, sans-serif; font-weight:bold">DOOR No: 1/2,1/3  KOMBAI THOTTAM MAIN ROAD,</span><br />
        <span width="80%" class="title0" style="font-size:15px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>SELLANDIAMMAN THURAI ROAD,</span><br />
        <span width="80%" class="title0" style="font-size:15px;font-family:Verdana, sans-serif; font-weight:bold">TIRUPUR-641604 <span class="title0" style="font-size:15px;font-family:Verdana, sans-serif; font-weight:bold">TAMILNADU STATE INDIA,</span></span><br/>
        <br/>
        <span width="80%" class="title00" style="font-size:15px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>Contact Office : 0421-4355333,+91 83442-33555,+91 83442-33888.</span><br/>
        <span width="80%" class="title00" style="font-size:15px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>Email Id : sriammandigitalprints@gmail.com/yahoo.com,</span><br/>
       <span width="80%" class="title0" style="font-size:14px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>GSTIN : 33ADDFS1470L1Z1, PAN NO : ADDFS1470L.</span><br/></td>
  </tr>
  <tr>
    <td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0" >
       <tr>
         <td height="20" colspan="4" align="center"  style="padding:3px; font-family:Verdana, sans-serif; font-size:18px; font-weight:bold;border-bottom:1px solid #999;">Delivery Challan</td>
        </tr>
       <tr>
        <td width="535" height="20"  style="padding:3px; font-family:Verdana, sans-serif; font-size:18px; font-weight:bold;border-right:1px solid #999;"><strong>Customer Detail</strong></td>
        <td width="102" colspan="-2" style="font-family:Verdana; font-size:14px;">&nbsp;DC No</td>
        <td width="19" colspan="-2" align="center">:</td>
        <td width="192" colspan="-2" style="font-family:Verdana, sans-serif; font-size:14px;">&nbsp;<?php echo $_GET['delivery_no']; ?></td>
      </tr>
     <?PHP 
	$customer_name=$_GET['customer_name'];
    $sql="select * from   party_creation where party_name='$customer_name' and `party_type`='Customer' and delete_status!='1'   order by party_name ASC ";
    $rs=mysql_query($sql);
	$sno=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{ 
   				$sno=$sno+1;
   				$party_name=$rsdata['party_name'];
     			$mobile_no=$rsdata['mobile_no'];
				$address=$rsdata['address'];
   				$city=$rsdata['city'];
				$tin_no=$rsdata['tin_no'];
				$gst_no=$rsdata['gst_no'];
			}

?>  

 <?PHP 
 
 function get_order_by($job_no)
{
$sql_query11="select * from jobcard_main where jobcard_no='$job_no' ";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $order_by=$rsdata11->order_by;
 } 
	return $order_by;
}
	$delivery_no=$_GET['delivery_no'];
    $sql="select * from   delivery_challan_main where delivery_no='$delivery_no'";
    $rs=mysql_query($sql);
   		while($rsdata=mysql_fetch_array($rs))
  			{ 
   				$style_no=$rsdata['style_no'];
     			$style_name=$rsdata['style_name'];
				$job_type=$rsdata['job_type'];
   				$fabric_type=$rsdata['fabric_type'];
				$combo=$rsdata['combo'];
				$date_time=$rsdata['date_time'];
				$customer_po_no=$rsdata['customer_po_no'];
				$vehicle_no=$rsdata['vehicle_no'];
				$delivery_through=$rsdata['delivery_through'];
				$job_no=$rsdata['job_no'];
			    $order_by=get_order_by($job_no);
		    }

?>  
      <tr>
        <td rowspan="4" valign="top"  style="font-family:Verdana; font-size:16px;  letter-spacing:1px;line-height:16px; padding-left:10px;border-right:1px solid #999;">To.M/S&nbsp;<?php echo $_GET['customer_name'];?>,<br /><?php echo $address;?>&nbsp;<br /><?php echo $city;?>&nbsp;<br /></td>
        <td height="19" colspan="-2" valign="top"  style="font-family:Verdana; font-size:14px;">&nbsp;Date</td>
        <td width="19" colspan="-2" align="center" valign="top" >:</td>
        <td colspan="-2"  align="left" valign="top"  style="font-family:Verdana; font-size:14px;">&nbsp;<?php  echo date('d-m-Y',strtotime($date_time)); ?>
          </td>
      </tr>
      <tr>
        <td height="19" colspan="-2" valign="top"  style="font-family:Verdana; font-size:14px;"> &nbsp;JobCard No</td>
        <td width="19" colspan="-2" align="center" valign="top" >:</td>
        <td colspan="-2"  align="left" valign="top"  style="font-family:Verdana; font-size:14px;">&nbsp;<?php echo $job_no;?></td>
      </tr>
      <tr>
        <td height="19" colspan="-2" valign="top"  style="font-family:Verdana; font-size:14px;">&nbsp;Fabric Type</td>
        <td width="19" colspan="-2" align="center" valign="top" >:</td>
        <td colspan="-2"  align="left" valign="top"  style="font-family:Verdana; font-size:14px;">&nbsp;<?php echo $fabric_type;?></td>
      </tr>
      <tr>
        <td height="19" colspan="-2" valign="top"  style="font-family:Verdana; font-size:14px;">&nbsp;Style No</td>
        <td width="19" colspan="-2" align="center" valign="top" >:</td>
        <td colspan="-2"  align="left" valign="top"  style="font-family:Verdana; font-size:14px;">&nbsp;<?php echo $style_no;?></td>
      </tr>
      <tr>
        <td valign="top" style="font-family:Verdana; font-size:14px;border-right:1px solid #999;"><b>Gst No :</b> &nbsp;&nbsp;<?php echo $gst_no;?></td>
        <td height="18" style="font-family:Verdana; font-size:14px;">&nbsp;Style Name</td>
        <td align="center" style="font-family:Verdana; font-size:14px;">:</td>
        <td style="font-family:Verdana; font-size:14px;">&nbsp;<?php echo $style_name;?></td>
      </tr>
      <tr>
        <td valign="top" style="font-family:Verdana; font-size:14px;border-right:1px solid #999;">&nbsp;</td>
        <td height="18" style="font-family:Verdana; font-size:14px;">&nbsp;Po.No</td>
        <td align="center" style="font-family:Verdana; font-size:14px;">:</td>
        <td style="font-family:Verdana; font-size:14px;">&nbsp;<?php echo $customer_po_no;?></td>
      </tr>
      <tr>
        <td valign="top" style="font-family:Verdana; font-size:14px;border-right:1px solid #999;"><b>Order By :</b> <?php echo $order_by;?></td>
        <td height="18" style="font-family:Verdana; font-size:14px;">&nbsp;Combo</td>
        <td align="center" style="font-family:Verdana; font-size:14px;">:</td>
        <td style="font-family:Verdana; font-size:14px;">&nbsp;<?php echo $combo;?></td>
      </tr>
          <tr>
        <td colspan="10" height="220" valign="top">
          <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> 
           <tr>
       <td width="47" height="21" align="center"  style="font-family:Verdana; font-size:14px; font-weight:bold; border-bottom:1px solid #999; border-top:1px solid #999;border-right:1px solid #999;">S.No</td>
       <td width="316"  align="left"  style="font-family:Verdana; font-size:14px;font-weight:bold; border-bottom:1px solid #999; border-top:1px solid #999;border-right:1px solid #999;">&nbsp;&nbsp;Particulars</td>
       <td width="146"  align="left"  style="font-family:Verdana; font-size:14px;font-weight:bold; border-bottom:1px solid #999; border-top:1px solid #999;border-right:1px solid #999;">&nbsp;&nbsp;HSN Code</td>
              <td width="111"  align="center" style="font-family:Verdana; font-size:14px;font-weight:bold; border-bottom:1px solid #999; border-top:1px solid #999;border-right:1px solid #999;">&nbsp;Width</td>
              <td width="116"  align="center" style="font-family:Verdana; font-size:14px;font-weight:bold; border-bottom:1px solid #999; border-top:1px solid #999;border-right:1px solid #999;">&nbsp;Height</td>
              <td width="112"  align="right" style="font-family:Verdana; font-size:14px;font-weight:bold; border-bottom:1px solid #999; border-top:1px solid #999;border-right:1px solid #999;">Qty&nbsp;</td>
              </tr>
              <?PHP 
function get_hsn_code($job_no)
{
 $sql_query11="select * from jobcard_main where jobcard_no='$job_no' ";
$rs11=mysql_query($sql_query11);
 while($rsdata11=mysql_fetch_object($rs11))
 {
 $hsn_code=$rsdata11->hsn_code;
 } 
	return $hsn_code;
}

	$delivery_no=$_GET['delivery_no'];
    $sql="select * from   delivery_challan_sub where delivery_no='$delivery_no' and job_no='$job_no'";
    $rs=mysql_query($sql);
	$rscount_sub=mysql_num_rows($rs);
	$sno=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{ 
   				$sno=$sno+1;
   				$job_id=$rsdata['job_id'];
     			$jobcard_no=$rsdata['delivery_no'];
				$particulars=$rsdata['particulars'];
   				$width=$rsdata['rollno_width'];
				$height=$rsdata['kg_meter_height'];
				$rate=$rsdata['rate'];
				$amount=$rsdata['amount'];
				$conformed_amt=$rsdata['conformed_amt'];
				$qty=$rsdata['qty'];
				$jobcard_values=$rsdata['jobcard_values'];
				$hsn_code=get_hsn_code($job_no);
				if($weight_kg=="0.00")
				{
					$weight_kg_res='';
				}
				else
				{
					$weight_kg_res=$weight_kg;
				}
				$kg_rate=$rsdata['kg_rate'];
				
				if($kg_rate=="0.00")
				{
					$kg_rate_res='';
				}
				else
				{
					$kg_rate_res=$kg_rate;
				}
				$frieght_charge=$rsdata['frieght_charge'];
?>
              <tr>
              <td width="47" height="26" align="center"  style="font-family:Verdana; font-size:14px;border-right:1px solid #999;border-bottom:1px solid #999;"><?php echo $sno; ?>&nbsp;</td>
              <td width="316" align="left"  style="font-family:Verdana; font-size:14px;border-right:1px solid #999;border-bottom:1px solid #999;">&nbsp;&nbsp;<?php echo $particulars; ?>&nbsp;</td>
              <td width="146" align="left"  style="font-family:Verdana; font-size:14px;border-right:1px solid #999;border-bottom:1px solid #999;">&nbsp;&nbsp;<?php echo $hsn_code; ?>&nbsp;</td>
              <td width="111" align="center" style="font-family:Verdana; font-size:14px;border-right:1px solid #999;border-bottom:1px solid #999;"><?php echo $width; ?>&nbsp;</td>
              <td width="116" align="center" style="font-family:Verdana; font-size:14px;border-right:1px solid #999;border-bottom:1px solid #999;"><?php echo $height; ?>&nbsp;</td>
              <td width="112" align="right"  style="font-family:Verdana; font-size:14px;border-right:1px solid #999;border-bottom:1px solid #999;"><?php echo $qty; ?>&nbsp;</td>
              </tr> <?php $overall_values+= $jobcard_values;
			  $qtys+= $qty;
			  }
			  if($rscount_sub=='20')
			{
				$row_height='200px';
				}
			if($rscount_sub=='19')
			{
				$row_height='220px';
				}
			if($rscount_sub=='18')
			{
				$row_height='240px';
				}
			if($rscount_sub=='17')
			{
				$row_height='260px';
				}
			if($rscount_sub=='16')
			{
				$row_height='280px';
				}
				if($rscount_sub=='15')
			{
				$row_height='300px';
				}
			if($rscount_sub=='14')
			{
				$row_height='320px';
				}
			if($rscount_sub=='13')
			{
				$row_height='340px';
				}
			if($rscount_sub=='12')
			{
				$row_height='360px';
				}
			if($rscount_sub=='11')
			{
				$row_height='380px';
				}
			if($rscount_sub=='10')
			{
				$row_height='400px';
				}
				if($rscount_sub=='9')
			{
				$row_height='420px';
				}
			if($rscount_sub=='8')
			{
				$row_height='440px';
				}
				if($rscount_sub=='7')
			{
				$row_height='460px';
				}	
				if($rscount_sub=='6')
			{
				$row_height='485px';
				}	
			if($rscount_sub=='5')
			{
				$row_height='505px';
				}	
				if($rscount_sub=='4')
			{
				$row_height='525px';
				}	if($rscount_sub=='3')
			{
				$row_height='540px';
				}	if($rscount_sub=='2')
			   {
				$row_height='560px';
				}	if($rscount_sub=='1')
			   {
				$row_height='580px';
				}	 ?>
               <tr height="<?php echo $row_height; ?>">
               <td width="47" align="center"  style="font-family:Verdana; font-size:14px;"></td>
               <td width="316" align="center"  style="font-family:Verdana; font-size:14px;"></td>
               <td width="146" align="left"  >&nbsp;&nbsp;</td>
              <td width="111" align="center"></td>
              <td width="116" align="center" ></td>
              <td width="112" align="right"  style="font-family:Verdana; font-size:14px;"></td>
              </tr>
             
  </table>
          </td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
 <td>
</td>
</tr>
<?php     
$count=mysql_num_rows(mysql_query("select * from   delivery_challan_sub where delivery_no='$delivery_no'"));?>

  <tr>
    <td height="34" colspan="2"> <table width="100%" border="0" cellpadding="0" cellspacing="0" >
      <tr>
              <td width="124" height="34" align="center"   style="font-family: Verdana; font-size: 14px; border-top: 1px solid #999;  border-right:1px solid #999; font-weight: bold;">Bundles</td>
              <td width="144" height="34" align="right"   style="font-family: Verdana; font-size: 14px; border-top: 1px solid #999; font-weight: bold;">
              <input type="text" name="textfield" id="textfield" style="height:35px; width:" /></td>
              <td width="124" height="34" align="center"   style="font-family: Verdana; font-size: 14px; border-top: 1px solid #999;  border-right:1px solid #999; font-weight: bold;">Pieces</td>
              <td width="144" height="34" align="right"   style="font-family: Verdana; font-size: 14px; border-top: 1px solid #999; font-weight: bold;">
              <input type="text" name="textfield" id="textfield" style="height:35px; width:" /></td>


        <td width="74" height="34" align="center"   style="font-family: Verdana; font-size: 14px; border-top: 1px solid #999;  font-weight: bold;">values</td>
              <td width="127" height="34" align="right"   style="font-family: Verdana; font-size: 14px; border-top: 1px solid #999;border-right:1px solid #999;  font-weight: bold;"><span style="font-family: Verdana; font-size: 14px; border-top: 1px solid #999; font-weight: bold;">
                <input type="text" name="textfield2" id="textfield2" style="height:35px; width:" />
              </span></td>
              <td width="75" align="right"   style="font-family: Verdana; font-size: 14px; border-top: 1px solid #999;border-right:1px solid #999;  font-weight: bold;">Qty</td>
        <td width="97" align="right"   style="font-family:Verdana; font-size:14px;border-top:1px solid #999;border-right:1px solid #999;"><?php echo number_format($qtys,2); ?>&nbsp;&nbsp;</td>
        </tr>
        
    </table></td>
  </tr>
  <tr>
    <td colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
    <tr>
    <td width="35%" valign="top" style="border-top:1px solid #999;border-right:1px solid #999; font-family:Verdana, sans-serif; font-size:14px; font-weight:bold;" >&nbsp; &nbsp;Delivery Through : &nbsp; <?php echo $delivery_through; ?><br/></td>
    <td width="36%" valign="top" style="border-top:1px solid #999;border-right:1px solid #999; font-family:Verdana, sans-serif; font-size:14px; font-weight:bold;" >&nbsp; &nbsp;Vehicle No : &nbsp; <?php echo $vehicle_no; ?></td>
   <td width="29%" align="center" valign="bottom"   style="font-family: Verdana; font-size: 14px; padding: 3px; border-top: 1px solid #999; font-weight: bold;"><strong>For <span style="color: #06F">SRI AMMAN DIGITAL PRINTS&nbsp;</span></strong>
          <p>&nbsp;</p>
          <p>Authorised Signature</p></td>
      </tr>
        </table></td>
  </tr>
</table>
<table>
<td align="center" style=" font-family:Verdana, sans-serif; font-size:12px; padding-left: 800px;"><br>Printed Date : <?php echo $curdate=date('d-m-Y');?>&nbsp;&nbsp;&nbsp;&nbsp;<br>Printed Time : <?php echo $current_time=date('h:i:s A');?>&nbsp;&nbsp;<br>IP Address   &nbsp;&nbsp;&nbsp;: <?php echo $ip_address = $_SERVER['REMOTE_ADDR'];?>&nbsp;</p></td>
</table>

  <?php 
function convert_number($number) 
{ 
    if (($number < 0) || ($number >99999999)) 
    { 
    throw new Exception("Number is out of range");
    } 
    $Gn = floor($number / 10000000); 
    $number -= $Gn * 1000000; 
	$ln = floor($number / 100000);  
    $number -= $ln * 100000; 
    $kn = floor($number / 1000);   
    $number -= $kn * 1000; 
    $Hn = floor($number / 100);    
    $number -= $Hn * 100; 
    $Dn = floor($number / 10);      
    $n = $number % 10;               

    $res = ""; 

    if ($Gn) 
    { 
        $res .= convert_number($Gn) . " Crores"; 
    } 
  if ($ln) 
    { 
        $res .= (empty($res) ? "" : " ") . 
            convert_number($ln) . " Laksh"; 
    } 
    if ($kn) 
    { 
        $res .= (empty($res) ? "" : " ") . 
            convert_number($kn) . " Thousand"; 
    } 

    if ($Hn) 
    { 
        $res .= (empty($res) ? "" : " ") . 
            convert_number($Hn) . " Hundred"; 
    } 

    $ones = array("", "One", "Two", "Three", "Four", "Five", "Six", 
        "Seven", "Eight", "Nine", "Ten", "Eleven", "Twelve", "Thirteen", 
        "Fourteen", "Fifteen", "Sixteen", "Seventeen", "Eightteen", 
        "Nineteen"); 
    $tens = array("", "", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty", 
        "Seventy", "Eigthy", "Ninety"); 

    if ($Dn || $n) 
    { 
        if (!empty($res)) 
        { 
            $res .= " and "; 
        } 

        if ($Dn < 2) 
        { 
            $res .= $ones[$Dn * 10 + $n]; 
        } 
        else 
        { 
            $res .= $tens[$Dn]; 

            if ($n) 
            { 
                $res .= " " . $ones[$n]; 
            } 
        } 
    } 
    if (empty($res)) 
    { 
        $res = "zero"; 
    } 
    return $res; 
} 
?>       		