<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: 17px;}
.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 ;}
.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)
  {
	  $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)
  {
	$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)
  {
	$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)
  {
	  $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'];
	$invoice_no=$_GET['invoice_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'];
			    $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'];
}
?>
<table width="900" align="center" border="0" cellspacing="0" cellpadding="0" class="style1 style2  style4">
  <tr>
    <td height="165" colspan="3"><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>TIN NO : 33826412977,</span>
       <span width="80%" class="title0" style="font-size:15px;font-family:Verdana, sans-serif; font-weight:bold"><b></b>CST NO : 33826412977/12.09.16, </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 colspan="2" align="center" class="style1"><b>&nbsp;</b><b>&nbsp;</b></td>
              </tr>
	      <tr height="30px">
              <td width="98" 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="2" 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="2" 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="421" height="30" align="left" class="style4 padleft title0" style="font-size:18px;"><strong >Tin No</strong>&nbsp;:&nbsp; <?php echo $tin_no; ?></td>
              <td align="left" class="title0 " style="font-size:18px;"><strong>&nbsp;&nbsp;Job No</strong></td>
              <td colspan="2" align="left"  class=" title0" style="font-size:18px;">:&nbsp;<?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.",";
 $jobcard_noss=explode("-",$jobcard_no);
 $jobcard_final=$jobcard_noss[2];

	}
	}
	else
	{
		echo $_GET['job_card_no'];
	}
	?>&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>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)
  {
	$sql_user="select * from 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)
  {
   $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)
  {
  $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)
  {
  $sql="select tax_type as tax_type from printer_production_main where job_card_no='$job_card_no' union select tax_type as tax_type from fusing_production_main where job_card_no='$job_card_no'";
 $rs1=mysql_query($sql);
 while($rsdata=mysql_fetch_array($rs1))		
		{
		$tax_type=$rsdata['tax_type'];
		}
 return $tax_type;
 } 
 
 
 $payment_terms1=get_payment_terms($job_card_no);
 $frieght_charges=get_freight_charges($job_card_no);
 $tax_type=get_tax_type($job_card_no);
 
  $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'];
/*  $sql="select * from jobcard_sublist where jobcard_no='$jobcard_no' and delivery_status='1' ";
*/  $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'];
		$conformed_amt=$rsdata['conformed_amt'];
	    $qty =$rsdata['qty'];
		$jobcard_values=$rsdata['jobcard_values'];
		$particulars=$rsdata['particulars'];
	    $dc_nos=get_dc_no($jobcard_no,$particulars);
		$delivery_no =$rsdata['delivery_no'];
		
		?>
        <tr height="15px">
           <td height="21"  align="left" class=" style31 style32 title0" style="font-size:14px;">&nbsp;<?php echo $dc_nos; ?></td>
           <td colspan="3" align="left" class="style31 title0 style32">&nbsp; <?php echo $jobcard_no." - ".$particulars; ?> <?php echo "- SUBLIMATION PRINTING CHARGES"; ?></td>
           <td class="style31  title0 style32" width="89" align="right"><?php echo $qty; ?>&nbsp;</td>
           <td class="style31  title0 style32" width="82" align="right"><span style="color:black;"><?php echo number_format($conformed_amt,2); ?>&nbsp;</span></td>
           <td class="style31  title0 " width="79" align="right" style="color:black"><?php echo number_format($jobcard_values,2); ?>&nbsp;</td>
        </tr>
			
			<?php $total+=$jobcard_values;
			$qtys+=$qty;
			}
			}
			}
			else
			{  
   $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'];
	    $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 $jobcard_no." - ".$particulars; ?> <?php echo "- SUBLIMATION PRINTING CHARGES"; ?></td>
           <td class="style31  title0 style32" width="89" align="right"><?php echo $qty; ?>&nbsp;</td>
           <td class="style31  title0 style32" width="82" align="right"><span style="color:black;"><?php echo number_format($conformed_amt,2); ?>&nbsp;</span></td>
           <td class="style31  title0 " width="79" 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">&nbsp;</td>
              <td colspan="2" align="left" class="style31   title0 style32">&nbsp;Freight Charges</td>
              <td class="style31  title0 style32" width="89" align="right"><span>&nbsp;</span></td>
              <td class="style31  title0 style32" width="82" align="right"><span style="color:black;">&nbsp;</span></td>
              <td class="style31  title0 " width="79" 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="89" align="right"><span>&nbsp;</span></td>
              <td class="  title0 style32" width="82" align="right"><span style="color:black;">&nbsp;</span></td>
              <td class="  title0 " width="79" 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="89" rowspan="7" align="left" class="style32  title2 title0 ">&nbsp;</td>
                <td width="82" 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="126" 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)
  {

    $sql_user1="select customer_dc_no from inward_sub_list 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;
} 
			
	$sql_user="select * from fusing_jobcard_sub where invoice_no='$invoice_no' and billing_type='$_GET[billing_type]' ";
	$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="4"  class="style1 style32">&nbsp;</td>
                <td colspan="2" rowspan="4" align="left" valign="top" class="title20 title0 style1 style32"><strong>PAYMENT TERMS&nbsp;:&nbsp;<?php echo $payment_terms1; ?></strong></td>
                <td 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 number_format($total+$frieght_charges,2);
				
				 $sev_perc=(($total+$frieght_charges)*(70/100));?>&nbsp;&nbsp;</td>
              </tr>
             
              <tr>
                <?php if(($tax_type!="NILL")) {  if(($tax_type=="VAT")){ ?> <td colspan="2" align="right" class=" style32 title0"><b>70% OF MATERIAL USAGE-Rs.</b><?php echo number_format($sev_perc,2); ?><b> @5% VAT&nbsp;</b></td>
                <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*((70/100)*(5/100)));
			    $c=number_format($a,2); 
			    echo number_format($a,2);?>&nbsp;&nbsp;</td> <?php } } ?>
              </tr>
             
          
              <tr><?php if(($tax_type!="NILL")) {  if($tax_type=="CST") { ?><td colspan="2" align="right" class=" style32 title0"><b>70% OF MATERIAL USAGE @2% CST&nbsp;</b></td>
                <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*((70/100)*(2/100)));$c=number_format($a,2); 
			    echo number_format($a,2);?>&nbsp;&nbsp;</td> <?php } } ?>
                
                 <?php if(($tax_type!="NILL")) {  if($tax_type=="CST 5%") { ?><td colspan="2" align="right" class=" style32 title0"><b>70% OF MATERIAL USAGE @5% CST&nbsp;</b></td>
                <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*((70/100)*(5/100)));$c=number_format($a,2); 
			    echo number_format($a,2);?>&nbsp;&nbsp;</td> <?php } } ?>
                
                 <?php if(($tax_type!="NILL")) {  if($tax_type=="GST") { ?><td colspan="2" align="right" class=" style32 title0"><b>@2% GST&nbsp;</b></td>
                <td align="right" class="title0"  style="font-weight: bold"><?php $a=(($total+$frieght_charges)*((70/100)*(2/100)));$c=number_format($a,2); 
			    echo number_format($a,2);?>&nbsp;&nbsp;</td> <?php } } ?>
                
              </tr>
              
              
             
              <tr>
                <td colspan="2" 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_tots1=number_format(($total+$frieght_charges+$a),2);
			$round_tots=explode(".",$round_tots1);
			
			 if($round_tots[1]>=101)
            {
				$rnd=$round_tots[1];
				echo   $round_tot="0.".abs(number_format(200-$rnd,2)); 
            }
				 
          else  if(($round_tots[1]>=50)&&($round_tots[1]<=100))
            {
					$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>
                <td colspan="2" align="center"  class=" style32 style1 style3 title0"><span style="font-weight: bold" >&nbsp;&nbsp;Amount</span></td>
                <td colspan="2" align="left" valign="bottom" class="title20 title0 style1 style3"><span class="title0 " style="color:black;font-size:16px;">&nbsp;<?php echo convert_number(round(($total+$frieght_charges)+$a));?> <span>Rupees Only</span></span></td>
                <td colspan="2" align="right" class=" title2 title0 style1 style3 style32"><b>GRAND TOTAL&nbsp;</b></td>
                <td align="right" class="style1 style3 title2 title0 title4" style="font-weight: bold"><?php echo number_format((round(($total+$frieght_charges)+$a)),2);?>&nbsp;&nbsp;</td>
              </tr>
          </table></td>
      </tr>

    </table></td>
  </tr>
  <tr>
       <td colspan="3" class="style3" style="border-top:1px #000000;"> 
            <span class="title1 padleft">1.&nbsp;&nbsp;&nbsp;&nbsp;Please check print before stiching and other process </span><br />                  
            <span class="title1 padleft">2.&nbsp;&nbsp;&nbsp;&nbsp;Our responsibility ceases absolutely after goods has been handed over to careers.</span><br />
            <span class="title1 padleft">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">4.&nbsp;&nbsp;&nbsp;&nbsp;Payment requested only by payees account or demand draft</span><br />
            <span class="title1 padleft">5.&nbsp;&nbsp;&nbsp;&nbsp;Subject to tirupur jurisdiction.</span><br />                   </td>
  </tr>
  <tr>
    <td width="312" class="style3" valign="bottom"><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>