<style type="text/css">
.header{
	font-family: Cambria, "Hoefler Text", "Liberation Serif", Times, "Times New Roman", serif;
	font-size: 60px;
	color: #06F;
}
.headersub{line-height:25px;color:#333333;}
.padleft{padding-left:15px;}
.title00{
	color: #000033;
	font-family: Segoe, "Segoe UI", "DejaVu Sans", "Trebuchet MS", Verdana, sans-serif;
	font-size: 16px;
}
.title0{color:#000033;font-family:Calibri;font-size:15px;}
.title1{color: #000033;font-family:Calibri;font-size: 14px;}
.title20{font-style:normal;color:#000033;padding-left:5px}
.title2a{
	font-style: normal;
	color: #000033;
	padding-left: 5px;
	font-size: 17px;
}

.title2{font-style:normal;color:#000033;font-weight:bold;padding-left:5px}
.title3{text-align:top;font-size:1px;font-family:Verdana, Arial, Helvetica, sans-serif;}
.title4{font-style:normal;color:#000033;padding-left:15px;font-size:15px;font-family:Verdana, Arial, Helvetica, sans-serif;}
.title5{font-style:normal;color:#000033;font-weight:bold;padding-right:15px;font-size:15px;text-align:center;font-family:Verdana, Arial, Helvetica, sans-serif;}
.title6{font-style:normal;color:#000033;padding-left:15px;font-size:15px;line-height:18px;font-family:Verdana, Arial, Helvetica, sans-serif;}
.title7{font-style:normal;color:#000033;padding-left:15px;font-size:15px;font-family:Verdana, Arial, Helvetica, sans-serif;font-weight:bold;}
.style1{ border-top:solid 1px; border-color:#000000; }
.style2 {border-left:solid 1px;  border-color:#000000;}
.style3 {border-bottom:solid 1px;  border-color:#000000;}
.style31 {border-bottom:solid 1px #999999 ;}
.style32 {border-right:solid 1px #999999 ;}
.style33 {border-left:solid 1px #999999 ;}
.style4 {border-right:solid 1px;  border-color:#000000;}
.stylelg {border-left:solid 1px;  border-color:#D3D3D3;}
.styleg {border-left:solid 1px;  border-color:#808080;}

</style>
    <?php 
include ("../../include/db.php");

function convert_number($number) 
{ 
    if (($number < 0) || ($number >99999999)) 
    { 
    throw new Exception("Number is out of range");
    } 
    $Gn = floor($number / 10000000);  /* Crores (giga) */ 
    $number -= $Gn * 1000000; 
	$ln = floor($number / 100000);   /* laksh (giga1) */ 
    $number -= $ln * 100000; 
    $kn = floor($number / 1000);     /* Thousands (kilo) */ 
    $number -= $kn * 1000; 
    $Hn = floor($number / 100);      /* Hundreds (hecto) */ 
    $number -= $Hn * 100; 
    $Dn = floor($number / 10);       /* Tens (deca) */ 
    $n = $number % 10;               /* Ones */ 

    $res = ""; 

    if ($Gn) 
    { 
        $res .= convert_number($Gn) . " Crores"; 
    } 
  if ($ln) 
    { 
        $res .= (empty($res) ? "" : " ") . 
            convert_number($ln) . " Lakhs"; 
    } 
    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", "Eighteen", 
        "Nineteen"); 
    $tens = array("", "", "Twenty", "Thirty", "Fourty", "Fifty", "Sixty", 
        "Seventy", "Eighty", "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; 
	
} 


 
 
 
 function get_estimate_type($jobcard_no1)
  {
  	//echo "select billing_type as billing_type from fusing_production_main where job_card_no='$jobcard_no1' and billing_type!=''  union select billing_type as billing_type from printer_production_main where job_card_no='$jobcard_no1' and billing_type!=''";
	  $sql_user="select billing_type as billing_type from fusing_production_main where job_card_no='$jobcard_no1' and billing_type!=''  union select billing_type as billing_type from printer_production_main where job_card_no='$jobcard_no1' and billing_type!=''";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$billing_type=$rsdata_user->billing_type;
	}
	return $billing_type;
 } 
 
 
 function get_invoice_no($jobcard_no1)
  {
  	//echo "select invoice_no as invoice_no from fusing_production_main where job_card_no='$jobcard_no1' and invoice_no!='' union select invoice_no as invoice_no from printer_production_main where job_card_no='$jobcard_no1' and invoice_no!=''";
	$sql_user="select invoice_no as invoice_no from fusing_production_main where job_card_no='$jobcard_no1' and invoice_no!='' union select invoice_no as invoice_no from printer_production_main where job_card_no='$jobcard_no1' and invoice_no!=''";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$invoice_no=$rsdata_user->invoice_no;
	}
	return $invoice_no;
 } 
 
 
 function get_created_dates($jobcard_no1)
  {
  	//echo "select bill_date as bill_date from fusing_production_main where job_card_no='$jobcard_no1' and invoice_no!='' union select bill_date as bill_date from printer_production_main where job_card_no='$jobcard_no1' and invoice_no!=''";
	$sql_user="select bill_date as bill_date from fusing_production_main where job_card_no='$jobcard_no1' and invoice_no!='' union select bill_date as bill_date from printer_production_main where job_card_no='$jobcard_no1' and invoice_no!=''";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$bill_date=$rsdata_user->bill_date;
	}
	return $bill_date;
 } 
 function get_estimate_type11($jobcard_no1)
  {
  	//echo "select billing_type as billing_type,remarks as remarks,description as description from fusing_production_main where job_card_no='$jobcard_no1' and billing_type!=''  union select billing_type as billing_type,remarks as remarks,description as description from printer_production_main where job_card_no='$jobcard_no1' and billing_type!=''";
	  $sql_user="select billing_type as billing_type,remarks as remarks,description as description from fusing_production_main where job_card_no='$jobcard_no1' and billing_type!=''  union select billing_type as billing_type,remarks as remarks,description as description from printer_production_main where job_card_no='$jobcard_no1' and billing_type!=''";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$billing_type=$rsdata_user->billing_type;
	$remarks=$rsdata_user->remarks;
	$description=$rsdata_user->description;
	}
	return array($billing_type,$remarks,$description);
 } 
 
    $job_card_no=$_GET['job_card_no'];
    //echo $job_card_no;
	$invoice_no=$_GET['invoice_no'];
	
 
 //echo "select * from jobcard_main where jobcard_no='$job_card_no' ";
    $sql="select * from jobcard_main where jobcard_no='$job_card_no' ";
	$rs=mysql_query($sql);
	$sno=0;
	$from=0;
   		while($rsdata=mysql_fetch_array($rs))		
		{
   				$sno=$sno+1;
				$from=$from+1;
           	    $jobcard_no1=$rsdata['jobcard_no'];
           	    //echo $jobcard_no1;
			    $createdate=$rsdata['createdate'];
			    $print_date=$rsdata['print_date'];
	   		    $job_created=$rsdata['job_created'];
			    $cust_name=$rsdata['cust_name'];
	   		    $cust_po=$rsdata['cust_po'];
	   			$style_no=$rsdata['style_no'];
	   			$style_name=$rsdata['style_name'];
				$combo=$rsdata['combo'];
	   			$printed_qty=$rsdata['printed_qty'];
				$billed_status=$rsdata['billed_status'];
		    	$job_type=$rsdata['job_type'];
				$amount=$rsdata['amount'];
				$cust_po_no=$rsdata['cust_po_no'];
				$qty =$rsdata['qty'];
				$jobcard_values=$rsdata['jobcard_values'];
				
			    $estimate_type = get_estimate_type($jobcard_no1);
				$invoice_no = get_invoice_no($jobcard_no1);
				$dates=get_created_dates($jobcard_no1);
				list($estimate_type,$remark,$desc) = get_estimate_type11($jobcard_no1);
				}
  
     $sql="select * from party_creation where party_name='$cust_name' and delete_status!='1' order by party_name ASC ";
	 $rs1=mysql_query($sql);
   		while($rsdata=mysql_fetch_array($rs1))		
		{
           	    $party_no=$rsdata['party_no'];
			    $party_name1=$rsdata['party_name'];
			    $mobile_no=$rsdata['mobile_no'];
	   		    $phone_no=$rsdata['phone_no'];
			    $address=$rsdata['address'];
	   		    $city=$rsdata['city'];
	   			$cst_no=$rsdata['cst_no'];
	   			$tin_no=$rsdata['tin_no'];
				$gst_no=$rsdata['gst_no'];
}
?>
<table width="900" align="center" border="0" cellspacing="0" cellpadding="0" class="style1 style2  style4">
  <tr>
    <td height="165" colspan="4"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
  <td width="15%" height="174"  align="center" ><img src="../../img/logo_image.png" width="125" height="173" style="padding-left:7px;"/></td> 
 <td width="85%" align="center" valign="top" >
   <span class="header">SRI AMMAN DIGITAL PRINTS</span><br/>
   <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:15px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>GSTIN : 33ADDFS1470L1Z1,</span>
       <span width="80%" class="title0" style="font-size:15px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>PAN NO : ADDFS1470L.</span></td>
      </tr>
    </table>
    </td>
  </tr>
  <tr>
    <td colspan="3"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr  height="400px" >
        <td width="608" valign="top"><table width="100%" cellpadding="0" cellspacing="0">
	      <tr height="30px" class="style1">
              <td height="30" colspan="4" align="left" class="style1 style4" style="font-size:18px;"><b>&nbsp;</b><strong>To</strong><b>&nbsp;</b></td>
              <td align="center" class="style1"><b>&nbsp;&nbsp;</b></td>
              <td align="center" class="style1"><b>&nbsp;&nbsp;</b></td>
              <td colspan="2" align="center" class="style1"><b>&nbsp;</b><b>&nbsp;</b></td>
              </tr>
	      <tr height="30px">
              <td width="111" height="30" align="left" class="title0" style="font-size:18px;"><b>&nbsp;</b><strong>M/s :</strong></td>
              <td height="30" colspan="3" align="left" class="title1 title1 style4" style="font-size:20px;"><strong><?php  echo $party_name1; ?></strong></td>
              
              <td align="left" class="title0" style="font-size:18px;"><strong>&nbsp;&nbsp;Bill No</strong></td>
              <td colspan="3" align="left"  class="title0 " style="font-size:22px;"><strong>:&nbsp;<?php echo $invoice_no; ?></strong></td>
              </tr>
           
	      <tr height="30px">
	        <td height="30" align="center" >&nbsp;</td>
	        <td height="30" colspan="3" align="left"  class="title1 title0 style4" style="font-size:18px;"><?php  echo $address; ?></td>
	        <td align="left" class="title0" style="font-size:18px;"><strong>&nbsp;&nbsp;Bill Date</strong></td>
	        <td colspan="3" align="left" class="title0 " style="font-size:18px;" >:&nbsp;<?php  echo date("d-m-Y",strtotime($dates)); ?> </td>
	        </tr>
	      <tr height="30px">
              <td height="30" align="center" >&nbsp;</td>
              <td height="30" colspan="2" align="left" class=" title1 title0" style="font-size:18px;">  <?php  echo $city; ?></td>
              <td width="260" height="30" align="left" class="style4 padleft title0" style="font-size:16px;"><strong >GSTIN</strong>&nbsp;:&nbsp; 
			  <?php echo $gst_no; ?></td>
              <td align="left" class=""><b><span class="title0 " style="font-size:18px;"><strong>&nbsp;&nbsp;Job No</strong></span>&nbsp;&nbsp;</b></td>
              <td colspan="3" align="left" class="title0 " style="font-size:18px;"><strong>: <?php $sql_user="select * from fusing_jobcard_sub where invoice_no='$invoice_no' and billing_type='$_GET[billing_type]' and acc_year='$_GET[acc_year]'";
	
$rs_user=mysql_query($sql_user);
	$rscount_fuse=mysql_num_rows($rs_user);
	if($rscount_fuse!=0)
	{
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
echo $jobcard_no=$rsdata_user->jobcard_no.",";
//echo $jobcard_no;
 $jobcard_noss=explode("-",$jobcard_no);
 $jobcard_final=$jobcard_noss[2];

	}
	}
	else
	{
		echo $_GET['job_card_no'];
	}
	?>&nbsp;</strong>&nbsp;<b>&nbsp;</b></td>
              </tr>
	      <tr height="30px">
	        <td height="30" align="center" bgcolor="#CCCCCC" class="style1 style3 style4 title0" style="font-size:14px;"><b>DC NO</b></td>
	        <td colspan="3" align="center" bgcolor="#CCCCCC" class="style1 style3 style4 title0"><b>&nbsp;DESCRIPTION OF PRINT</b></td>
	        <td align="center" bgcolor="#CCCCCC" class="style1 style3 style4 title0"><b>&nbsp;HSN Code</b></td>
	        <td align="center" bgcolor="#CCCCCC" class="style1 style3 style4 title0"><b>QTY</b></td>
	        <td align="center" bgcolor="#CCCCCC" class="style1 style3 style4 title0"><b>RATE&nbsp;</b></td>
	        <td align="center" bgcolor="#CCCCCC" class="style1 style3  title0"><b>AMOUNT&nbsp;</b></td>
	        </tr>
            <?php $job_card_no=$_GET['job_card_no'];
	  
function get_dc_no($jobcard_no,$particulars)
  {
  	//echo "select delivery_no from delivery_challan_sub where job_no='$jobcard_no' and particulars='$particulars' union select delivery_no from sticker_delivery_challan_sub where job_no='$jobcard_no' ";
	$sql_user= "select GROUP_CONCAT(delivery_no) as delivery_no  from delivery_challan_sub where job_no='$jobcard_no' and particulars='$particulars' union select delivery_no from sticker_delivery_challan_sub where job_no='$jobcard_no' and particulars='$particulars' ";
	$rs_user=mysql_query($sql_user);
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
	$delivery_no=$rsdata_user->delivery_no;
	}
	return $delivery_no;
 } 
   function get_freight_charges($jobcard_no)
  {
  	//echo "select frieght_charges as frieght from printer_production_main where job_card_no='$jobcard_no' union select frieght_charges as frieght from fusing_production_main where job_card_no='$jobcard_no'";
   $sql="select frieght_charges as frieght from printer_production_main where job_card_no='$jobcard_no' union select frieght_charges as frieght from fusing_production_main where job_card_no='$jobcard_no'";
 $rs1=mysql_query($sql);
 while($rsdata=mysql_fetch_array($rs1))		
		{
		$frieght_charges=$rsdata['frieght'];
		}
 return $frieght_charges;
 } 
 
  function get_payment_terms($job_card_no)
  {
  	//alert($job_card_no);
  	//echo "select payment_terms as payment_terms from printer_production_main where job_card_no='$job_card_no' union select payment_terms as payment_terms from fusing_production_main where job_card_no='$job_card_no'";
  $sql="select payment_terms as payment_terms from printer_production_main where job_card_no='$job_card_no' union select payment_terms as payment_terms from fusing_production_main where job_card_no='$job_card_no'";
 $rs1=mysql_query($sql);
 while($rsdata=mysql_fetch_array($rs1))		
		{
		$payment_terms=$rsdata['payment_terms'];
		}
 return $payment_terms;
 } 
 
 
 function get_tax_type($job_card_no)
 {
	 $job_card_no = trim($job_card_no);
 
	 $sql = "SELECT tax_type FROM printer_production_main WHERE job_card_no = '$job_card_no'
			 UNION 
			 SELECT tax_type FROM fusing_production_main WHERE job_card_no = '$job_card_no'";
 
	 $rs1 = mysql_query($sql);
	 if (!$rs1) {
		 die("Query Failed: " . mysql_error());
	 }
 
	 $tax_type = ''; 
 
	 while ($rsdata = mysql_fetch_array($rs1)) {
		 if (!empty($rsdata['tax_type'])) {
			 $tax_type = $rsdata['tax_type'];
			 break;
		 }
	 }
 
	 return $tax_type;
 } 
 
 
 $payment_terms1=get_payment_terms($job_card_no);
 $frieght_charges=get_freight_charges($job_card_no);
 //echo $frieght_charges;
 $tax_type=get_tax_type($job_card_no);
 //echo "select * from fusing_jobcard_sub where invoice_no='$invoice_no'  and billing_type='$_GET[billing_type]' and acc_year='$_GET[acc_year]' ";
  $sql_fusing_sub="select * from fusing_jobcard_sub where invoice_no='$invoice_no'  and billing_type='$_GET[billing_type]' and acc_year='$_GET[acc_year]' ";
  $rs_fusing_sub=mysql_query($sql_fusing_sub);
  $count_fusing=mysql_num_rows($rs_fusing_sub);
 if($count_fusing!=0)
 {
  while($rsdata_fusing_sub=mysql_fetch_array($rs_fusing_sub))
  {
  $jobcard_no=$rsdata_fusing_sub['jobcard_no'];
  //echo $jobcard_no;
/*  $sql="select * from jobcard_sublist where jobcard_no='$jobcard_no' and delivery_status='1' ";
*/ 
//echo "select * from jobcard_sublist where jobcard_no='$jobcard_no' ";
 $sql="select * from jobcard_sublist where jobcard_no='$jobcard_no' ";
   $sno=0;
	 $rs=mysql_query($sql);
	 $rscount=mysql_num_rows($rs);
	   $count_sub+=$rscount;
   		while($rsdata=mysql_fetch_array($rs))		
		{
	    $sno=$sno+1;
		$amount=$rsdata['amount'];
		$jobcard_no=$rsdata['jobcard_no'];
		//echo $jobcard_no;
		$conformed_amt=$rsdata['conformed_amt'];
	    $qty =$rsdata['qty'];
		$jobcard_values=$rsdata['jobcard_values'];
		$particulars=$rsdata['particulars'];

		$dc_nos=get_dc_no($jobcard_no,$particulars);
$dc_no=explode(',',$dc_nos);
$dc_number=array();
    foreach ($dc_no as $key_dc) {

      $dc_number[]=$key_dc."<br>";
    }
     $get_dc_number=implode('',$dc_number);
		$delivery_no =$rsdata['delivery_no'];
    $get_hsn_codes=mysql_fetch_array(mysql_query("select hsn_code from fusing_production_main where job_card_no='$jobcard_no'"));
    
    $get_hsn_code=mysql_fetch_array(mysql_query("select hsn_code from printer_production_main where job_card_no='$jobcard_no'"));
    
    $hsn_code=$get_hsn_codes['hsn_code'];
    $hsn_codes=$get_hsn_code['hsn_code'];
		
		?>
        <tr height="15px">
           <td  height="21"  align="left" class=" style31 style32 title0" style="font-size:14px; width:120px; "><?php echo $get_dc_number; ?></td>
           <td  colspan="3" align="left" class="style31 title0 style32 "  >&nbsp; <?php echo $particulars; ?>
           <?php echo "sublimation Printing Charges"; ?> </td>
           <td align="center" class="style31 title0 style32">&nbsp; <?php if($hsn_code!=''){echo $hsn_code; }else{echo $hsn_codes;}?></td>
           <td class="style31  title0 style32" width="104" align="right"><?php echo $qty; ?>&nbsp;</td>
           <td class="style31  title0 style32" width="88" align="right"><span style="color:black;"><?php echo number_format($conformed_amt,2); ?>&nbsp;</span></td>
           <td class="style31  title0 " width="119" align="right" style="color:black"><?php echo number_format($jobcard_values,2); ?>&nbsp;</td>
        </tr>
			
			<?php $total+=$jobcard_values;
			$qtys+=$qty;
			}
			}
			}
			else
			{
			//echo  "select * from jobcard_sublist where jobcard_no='$_GET[job_card_no]'";
   $sql="select * from jobcard_sublist where jobcard_no='$_GET[job_card_no]'";
   $sno=0;
	 $rs=mysql_query($sql);
	 $rscount=mysql_num_rows($rs);
	   $count_sub=$rscount;
   		while($rsdata=mysql_fetch_array($rs))		
		{
	    $sno=$sno+1;
		$amount=$rsdata['amount'];
		$jobcard_no=$rsdata['jobcard_no'];
		$conformed_amt=$rsdata['conformed_amt'];
	    $qty =$rsdata['qty'];
		$jobcard_values=$rsdata['jobcard_values'];
		$particulars=$rsdata['particulars'];
		$hsn_code=$rsdata['hsn_code'];
	    $dc_nos=get_dc_no($jobcard_no,$particulars);
		?>
        <tr height="15px">
           <td colspan="2"  align="left" class=" style31 style32 title0">&nbsp;<?php echo $dc_nos; ?></td>
           <td colspan="2" align="left" class="style31 title0 style32">&nbsp;<?php echo $particulars; ?>&nbsp;<?php echo "sublimation Printing Charges"; ?></td>
           <td align="center" class="style1"><b>&nbsp;<?php echo $hsn_code; ?>&nbsp;</b></td>
           <td class="style31 title0 style32" width="104" align="right"><?php echo $qty; ?>&nbsp;</td>
           <td class="style31 title0 style32" width="88" align="right"><span style="color:black;"><?php echo number_format($conformed_amt,2); ?>&nbsp;</span></td>
           <td class="style31  title0 " width="119" align="right" style="color:black"><?php echo number_format($jobcard_values,2); ?>&nbsp;</td>
        </tr>
			<?php $total+=$jobcard_values;
			$qtys+=$qty;} }
			if($count_sub=='25')
			{
				$height='50px';
				}
				if($count_sub=='24')
			{
				$height='60px';
				}
				if($count_sub=='23')
			{
				$height='70px';
				}
				if($count_sub=='22')
			{
				$height='80px';
				}
				if($count_sub=='21')
			{
				$height='90px';
				}
			
			
			if($count_sub=='20')
			{
				$height='100px';
				}
			if($count_sub=='19')
			{
				$height='100px';
				}
			if($count_sub=='18')
			{
				$height='100px';
				}
			if($count_sub=='17')
			{
				$height='100px';
				}
			if($count_sub=='16')
			{
				$height='120px';
				}
				if($count_sub=='15')
			{
				$height='140px';
				}
			if($count_sub=='14')
			{
				$height='160px';
				}
			if($count_sub=='13')
			{
				$height='180px';
				}
			if($count_sub=='12')
			{
				$height='200px';
				}
			if($count_sub=='11')
			{
				$height='220px';
				}
			if($count_sub=='10')
			{
				$height='220px';
				}
				if($count_sub=='9')
			{
				$height='240px';
				}
			if($count_sub=='8')
			{
				$height='260px';
				}
				if($count_sub=='7')
			{
				$height='300px';
				}	
				if($count_sub=='6')
			{
				$height='315px';
				}	
			if($count_sub=='5')
			{
				$height='325px';
				}	
				if($count_sub=='4')
			{
				$height='345px';
				}	if($count_sub=='3')
			{
				$height='340px';
				}	if($count_sub=='2')
			   {
				$height='385px';
				}	if($count_sub=='1')
			   {
				$height='400px';
				}	
			?>
            <?php if($frieght_charges!='') { ?>
             <tr height="15px">
              <td colspan="2"  align="left" class=" style31 style32 title0"></td>
              <td colspan="2" align="left" class="style31 title0 style32">&nbsp;Freight Charges</td>
              <td class="style31  title0 style32" width="104" align="right"><span>&nbsp;</span></td>
              <td align="center" class="style31  style32"><b>&nbsp;&nbsp;</b></td>
              <td class="style31  title0 style32" width="88" align="right"><span style="color:black;">&nbsp;</span></td>
              <td class="style31  title0 " width="119" align="right" style="color:black"><?php echo number_format($frieght_charges,2); ?>&nbsp;</td>
            </tr> <?php } ?>
          <tr height="<?php echo $height; ?>">
              <td colspan="2"  align="left" class=" style32 title0">&nbsp;</td>
              <td colspan="2" align="left" class="  title0 style32">&nbsp;</td>
              <td class="title0 style32" width="104" align="right"><span>&nbsp;</span></td>
              <td class="title0 style32" width="104" align="right"><span>&nbsp;</span></td>
              <td class="title0 style32" width="88" align="right"><span style="color:black;">&nbsp;</span></td>
              <td class="title0 " width="119" align="right" style="color:black">&nbsp;</td>
            </tr>
              <tr >
                <td colspan="2" rowspan="7"  class=" style32">&nbsp;</td>
                <td colspan="2" align="left" valign="bottom" class="title20 style32 title0" style="font-size: 16px">&nbsp;<?php echo $remark; ?></td>
                <td width="104" rowspan="7" align="left" class="style32  title2 title0 ">&nbsp;</td>
                <td width="104" rowspan="7" align="left" class="style32  title2 title0 ">&nbsp;</td>
                <td width="88" rowspan="7" align="left" class="style32  title2 title0 ">&nbsp;</td>
                
                <td rowspan="7" align="left" class="  title2 title0">&nbsp;</td>
              </tr>
              <tr >
                <td colspan="2" align="left" valign="bottom" class="title20 style32 title0" style="font-size: 16px">&nbsp;<?php echo $desc; ?></td>
              </tr>
              <tr >
        <td align="left" valign="bottom" class="title20 title0" style="font-size: 16px">STYLE No </td>
        <td align="left" valign="bottom" class="title0  style32 title20" style="font-size: 16px">: <?php echo $style_no; ?></td>
        </tr>
              <tr >
                <td width="132" align="left" valign="bottom" class="title20 title0" style="font-size: 16px">COMBO</td>
                <td align="left" valign="bottom" class="title0 title20 style32" style="font-size: 16px">:&nbsp;<?php echo $combo; ?></td>
              </tr>
              <tr >
                <td align="left" valign="bottom" class="title20 title0" style="font-size: 16px">DESIGN NAME</td>
                <td align="left" valign="bottom" class="title20 title0 style32" style="font-size: 16px">:&nbsp;<?php echo $style_name; ?></span></td>
              </tr>
              <tr >
                <td align="left" valign="bottom" class="title20 title0" style="font-size: 16px">PARTY DC No</td>
                <td align="left" valign="bottom" class="title20 title0 style32" style="font-size: 16px">:&nbsp;<?php 
	
function get_inward_dc_no($jobcard_nos)
  {
  	//echo "select customer_dc_no from inward_main where jobcard_no='$jobcard_nos' ";
    $sql_user1="select customer_dc_no from inward_main where jobcard_no='$jobcard_nos' ";
 	$rs_user11=mysql_query($sql_user1);
	while($rsdata_user11=mysql_fetch_object($rs_user11))
	{ 
	 $customer_dc_no=$rsdata_user11->customer_dc_no.",";
	}
return $customer_dc_no;
} 
	//echo 	"select * from fusing_jobcard_sub where invoice_no='$invoice_no' and billing_type='$_GET[billing_type]' and acc_year='$_GET[acc_year]'";	
	 $sql_user="select * from fusing_jobcard_sub where invoice_no='$invoice_no' and billing_type='$_GET[billing_type]' and acc_year='$_GET[acc_year]'";
	$rs_user=mysql_query($sql_user);
	$rscount_fuse=mysql_num_rows($rs_user);
	if($rscount_fuse!=0)
	{
	while($rsdata_user=mysql_fetch_object($rs_user))
	{ 
    $jobcard_nos=$rsdata_user->jobcard_no;
echo	$inward_dc_no = get_inward_dc_no($jobcard_nos);
	}
	
	}
	else
	{
	$jobcard_no=$_GET['job_card_no'];
echo $inward_dc_no = get_inward_dc_no($jobcard_no);		
	}
	 ?>
    </td>
              </tr>
              <tr >
                <td align="left" valign="bottom" class="title20 title0" style="font-size: 16px">Po No</td>
                <td align="left" valign="bottom" class="title20 title0 style32" style="font-size: 16px">:&nbsp;<?php echo $cust_po_no; ?></td>
              </tr>
              <tr>
                <td colspan="2" rowspan="9"  class="style1 style32">&nbsp;</td>
                <td colspan="2" rowspan="9" align="left" valign="top" class="title20 title0 style1 style32"><p><strong>PAYMENT TERMS&nbsp;:&nbsp;<?php echo $payment_terms1; ?></strong><br /> 
                <span style="font-weight:bold; font-size:16px;">BANK DETAILS</span> :<br /> 
                 <span class="title1" style="font-weight:bold; color:#093">Bank Name : HDFC BANK LTD , Account No : 50200072733951 , <br /> IFSC Code : HDFC0000232 &nbsp;</span><br />
                </p></td>
                <td colspan="2" align="right" valign="bottom" class="title0  style1"><p><?php echo number_format($qtys,2);?>&nbsp;&nbsp;</td>
                <td align="right" valign="bottom" class="title0 style32 style1"><b> AMOUNT&nbsp;</b><br></td>
                <td align="right" valign="bottom" class="title0 style1" style="font-weight: bold"><p align="right">&nbsp;&nbsp;
                  
                <?php echo $val_0=number_format($total+$frieght_charges,2);?>&nbsp;&nbsp;</td>
              </tr>
            <?php if($tax_type=='GST 18%'){?> 
              <tr>
              <td colspan="2" align="right" class="  title0"></td>
             <td align="right" class=" style32 title0 "><b>CGST 9%</b>&nbsp;</b></td>
             <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*(9/100));echo $val_1=number_format($a,2);?>&nbsp;&nbsp;</td>
              </tr>
              <tr>
              <td colspan="2" align="right" class="  title0"></td>
              <td align="right" class=" style32 title0"><b>SGST 9%&nbsp;</b></td>
             <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*(9/100));echo $val_1=number_format($a,2);?>&nbsp;&nbsp;</td>
              </tr>
             <?php }  if($tax_type=='GST 5%'){?> 
              <tr>
              <td colspan="2" align="right" class="  title0"></td>
             <td align="right" class=" style32 title0 "><b>CGST 2.5%</b>&nbsp;</b></td>
             <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*(2.5/100));echo $val_1=number_format($a,2);?>&nbsp;&nbsp;</td>
              </tr>
              <tr>
              <td colspan="2" align="right" class="  title0"></td>
              <td align="right" class=" style32 title0"><b>SGST 2.5%&nbsp;</b></td>
             <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*(2.5/100));echo $val_1=number_format($a,2);?>&nbsp;&nbsp;</td>
              </tr>
               <?php }  if($tax_type=='GST 12%'){?> 
              <tr>
              <td colspan="2" align="right" class="  title0"></td>
             <td align="right" class=" style32 title0 "><b>CGST 6%</b>&nbsp;</b></td>
             <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*(6/100));echo $val_1=number_format($a,2);?>&nbsp;&nbsp;</td>
              </tr>
              <tr>
              <td colspan="2" align="right" class="  title0"></td>
              <td align="right" class=" style32 title0"><b>SGST 6%&nbsp;</b></td>
             <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*(6/100));echo $val_1=number_format($a,2);?>&nbsp;&nbsp;</td>
              </tr>
             <?php }
			 
			 if($tax_type=='IGST'){?> 
              <tr>
                <td colspan="2" align="right" class="  title0"></td>
                <td align="right" class=" style32 title0"><b>IGST 5%</b>&nbsp;</b></td>
                <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*(5/100));echo $val_1=number_format($a,2);?>&nbsp;&nbsp;</td>
              </tr>
              <?php } if($tax_type=='IGST 18%'){?> 
              <tr>
                <td colspan="2" align="right" class="  title0"></td>
                <td align="right" class=" style32 title0"><b>IGST 18%</b>&nbsp;</b></td>
                <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*(18/100));echo $val_1=number_format($a,2);?>&nbsp;&nbsp;</td>
              </tr>
              <?php }if($tax_type=='UTGST'){?> 
              <tr>
                <td colspan="2" align="right" class="  title0"></td>
                <td align="right" class=" style32 title0"><b>UTGST 18%</b>&nbsp;</b></td>
                <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*(18/100));echo $val_1=number_format($a,2);?>&nbsp;&nbsp;</td>
              </tr>
              <?php }?>
              <tr>
              <td colspan="2" align="right" class="  title0"></td>
                <td align="right" class=" style32 title0"  style="font-size:14px"><b>ROUND OFF&nbsp;</b></td>
                <td align="right" class="title0 " style="font-weight: bold"><span  style="text-align:right">
                <?php 
		$round=	$total+$frieght_charges+$a+$a;
				
				$ex_total=explode('.',$tot_ex);
				$ex_gst=explode('.',$tot_gst);
				 if(($tax_type=='GST 18%')||($tax_type=='GST 5%')||($tax_type=='GST 12%'))
				 {
				 $total1=number_format($total+$frieght_charges,2);
				 $a1 = explode(".",$total1);
				 $total3=number_format($a,2);
				 $a2 = explode(".",$total3);
				 $round_tots[1]=$a1[1]+$a2[1]+$a2[1];
				 }
				 else
				 { 	
				 $total1=number_format($total+$frieght_charges,2);
				 $a1 = explode(".",$total1);
				 $total3=number_format($a,2);
				 $a2 = explode(".",$total3);
				 $round_tots[1]=$a1[1]+$a2[1];
				 }
			
			 if($round_tots[1]>=150)
            {
				$rnd=$round_tots[1];
				echo   $round_tot="0.".abs(number_format(200-$rnd,2)); 
            }
				 
          else  if(($round_tots[1]>=50)&&($round_tots[1]<=150))
            {
					$rnd=$round_tots[1];
				 echo  $round_tot="0.".abs(number_format(100-$rnd,2)); 
            }
            else if(($round_tots[1]<=49)&&($round_tots[1]!=0)) { echo $round_tot= "- 0.".$round_tots[1]; } else { echo $round_tot= "0.00";  } ?></span>&nbsp;&nbsp;</td>
              </tr>
              <tr><table width="900" align="center" border="0" cellspacing="0" cellpadding="0" class="   "><tr>
                <td  align="center" width="103"   class="style1 style3 title0"><span style="font-weight: bold" >&nbsp;&nbsp;Amount</span></td>
                <td  align="left" valign="bottom" class="title20 title0 style1 style3"><span class="title0 " style="color:black;font-size:16px;">&nbsp;<?php 
				 if(($tax_type=='GST 18%')||($tax_type=='GST 5%')||($tax_type=='GST 12%'))
				 {
					 $fin_tot_amt=($total+$frieght_charges)+($a*2);
				 }
				 else
				 {
					 $fin_tot_amt=($total+$frieght_charges+$a);
			 	 }
				echo convert_number(round($fin_tot_amt));?> <span>Rupees Only</span></span></td>
                <td align="right"width="255" class=" title2 title0 style1 style3"><b>GRAND TOTAL&nbsp;</b></td>
                <td align="right"  class="style1 style3 title2 title0 title4" style="font-weight: bold; border-right:0px !important;"><?php
				
				 if(($tax_type=='GST 18%')||($tax_type=='GST 5%')||($tax_type=='GST 12%'))
				 {
					 $fin_tot_amt=($total+$frieght_charges)+($a*2);
				 }
				 else
				 {
					 $fin_tot_amt=($total+$frieght_charges+$a);
			 	 }
			echo number_format((round($fin_tot_amt)),2);?>&nbsp;&nbsp;</td>
             </tr></table> </tr>
          </table></td>
      </tr>

    </table></td>
  </tr>
  <tr><table width="900" align="center" border="0" cellspacing="0" cellpadding="0" class="   style4"><tr>
       <td colspan="3" class="style3" style="border-top:1px #000000;"> 
             
            <span class="title1 padleft" style="border-left:1px solid;">1.&nbsp;&nbsp;&nbsp;&nbsp;Please check print before stiching and other process </span><br />                  
            <span class="title1 padleft"style="border-left:1px solid;">2.&nbsp;&nbsp;&nbsp;&nbsp;Our responsibility ceases absolutely after goods has been handed over to careers.</span><br />
            <span class="title1 padleft"style="border-left:1px solid;">3.&nbsp;&nbsp;&nbsp;&nbsp;Printing rejection ,color variation acceptable range 8-10% varies according to design and sizes. </span><br />
            <span class="title1 padleft"style="border-left:1px solid;">4.&nbsp;&nbsp;&nbsp;&nbsp;Payment requested only by payees account or demand draft</span><br />
            <span class="title1 padleft"style="border-left:1px solid;">5.&nbsp;&nbsp;&nbsp;&nbsp;Subject to tirupur jurisdiction.</span><br />               </td>
  </tr>
  <tr>
    <td width="312" class="style3" valign="bottom"style="border-left:1px solid;"><span class="title0" style="text-align:inherit"><b>&nbsp;&nbsp;&nbsp;Received by</b></span></td>
    <td width="238" colspan="0"  class="style2 style3" valign="bottom"><span class="title0">&nbsp;&nbsp;&nbsp;&nbsp;<b>Prepared by</b></span></td>
    <td width="298" colspan="0" align="center" class="style2 style3 title0" style="padding-top:10px" ><p style="font-size: 14px;"><b>For</b><span style="color:#000000;font-size:21px;font-weight:bold;">&nbsp;&nbsp;SRI AMMAN DIGITAL PRINTS</span></p>
     <p><br/>
    <span class="title0" style="line-height:25px;text-align:cenetr;" >Authorized Signatory</span></p></td>
 </tr></table></tr></table>