<?php include 'connection.php';
$query2job = "select * from check_month";
$resultjob = mysql_query($query2job,$conn);
while($rowmonth=mysql_fetch_array($resultjob))
{
$check_month = $rowmonth['check_month'];
}



?><!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=iso-8859-1" />
<title>Invoice</title>
<style type="text/css">
#printable { display: ; }
#footer {
    position : absolute;
    bottom : 0;
    
  }
    @media print
    {
    	#non-printable { display: none; }
    	#printable { display: block; }
    }
</style>
<?php 
$month1=date("m");
if($month1>$check_month)
  {
  $currentyear = date("Y");
 $curr_full_year=date("Y");
$curr_short_year=date("y");
$future=$curr_short_year+1;
} else {
$currentyear1 = date("Y");
$currentyear = $currentyear1-1;
$curr_full_year1=date("Y");
 $curr_full_year=$curr_full_year1-1;
 $curr_short_year1=date("y");

$curr_short_year=$curr_short_year1-1;
$future=$curr_short_year+1;
}
?>


<?   $curr_fy=$currentyear .'-'. $future;?>
<?php 

$query2 = "select * from  import_job_main_01 where  final_job_no= '".$_REQUEST['Job_No']."'";
			//echo $query2;
$result2 = mysql_query($query2,$conn);	
while($row=mysql_fetch_array($result2))
	                                              	{
$sub_id = $row['sub_id'];
$sub_party_name = $row['sub_party_name'];
}

$query2 = "select * from  tax_servicetax where inv_no='".$_REQUEST['inv_no']."' and job_no= '".$_REQUEST['Job_No']."'";
			//echo $query2;
$result2 = mysql_query($query2,$conn);	
while($row=mysql_fetch_array($result2))
	                                              	{
$inv_no = $row['inv_no'];
$inv_date = $row['inv_date'];
$Job_No = $row['final_job_no'];
$Job_Dt = $row['final_job_date'];
$job_regautono = $_REQUEST['job_regautono'];
$customer_id  = $_REQUEST['customer_id'];
$importer_name = $row['importer_name'];
$importer_address = $row['importer_address'];
$final_job_no = $row['final_job_no'];
$final_job_date = $row['final_job_date'];
$igm_no = $row['igm_no'];
$igm_date = $row['igm_date'];
$b_e_no = $row['b_e_no'];
$b_e_dt = $row['b_e_dt'];
$mbl_no = $row['mbl_no'];
$mbl_dt = $row['mbl_dt'];
$hbl_no = $row['hbl_no'];
$hbl_dt = $row['hbl_dt'];
$enq_job_no = $row['enq_job_no'];
$enq_job_date = $row['enq_job_date'];
$cntr_no = $row['cntr_no'];
$supply_inv_no = $row['supply_inv_no'];
$no_pkgs = $row['no_pkgs'];
$gross_wt = $row['gross_wt'];
$name_supplier = $row['name_supplier'];
$cleared_on = $row['cleared_on'];
$bond_no = $row['bond_no'];
$net_wt = $row['net_wt'];
$ss_per = $row['ss_per'];
$port_shipment_pod = $row['port_shipment_pod'];
$ass_value = $row['ass_value'];
$duty_value = $row['duty_value'];
$descrition_goods = $row['descrition_goods'];
$customer_id = $row['customer_id'];
$supply_inv_dt = $row['supply_inv_dt'];													
$advance_recv=$row['advance_recv'];													
$billing_address=$row['billing_address'];	
$gst_no = $row['gst_no'];
$state_code = $row['state_code'];
$discount=$row['discount'];

}
													?>
													
<?php												
$query2 = "select * from customer_master where customer_id = '$customer_id'";
$result2 = mysql_query($query2,$conn);	
while($row = mysql_fetch_array($result2))
{
$address_b = $row['billing_address'];
$bgst_no = $row['bgst_no'];
$customer_name = $row['customer_name'];
$bstate_code = $row['bstate_code'];

}


?>
<? if($state_code!='') {
$bstate_code=$state_code;


}?>
<?php												
$queryci = "select * from company_info where name = '".$_REQUEST['our_company_name']."'";
$resultci = mysql_query($queryci,$conn);	
while($row = mysql_fetch_array($resultci))
{
$full_name_com = $row['full_name_com'];
}
?>

<style type="text/css">
<!--
.style1 {
	font-family: arial;
	font-size: 12px;
}
.style3 {font-size: 14px; font-weight: bold; }
.style4 {font-size: 14px; padding:3px; font:Arial, Helvetica, sans-serif;}
.style8 {font-size: 11px}
.style9 {font-size: 14px}
.style10 {font:Arial, Helvetica, sans-serif; padding: 3px;}
.style11 {font: Arial, Helvetica, sans-serif; font-weight: bold; padding: 3px;}
.style12 {padding: 3px}
.style13 {font-size: 12px}
.style16 {font-size: 10px; font-weight: bold; }
-->
</style>
</head>

<body>

<table width="100%" style="border-collapse:collapse">
<tr  class="non-printable"><td><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" class="style10" >
        <input type="hidden" id="inv_no" name="inv_no" value="<? echo $_REQUEST['inv_no'] ?>" >
		<input type="hidden" id="Job_No" name="Job_No" value="<? echo $_REQUEST['Job_No'] ?>" >
						   <input type="hidden" id="customer_id" name="customer_id" value="<? echo $_REQUEST['customer_id'] ?>" >
						   <input type="hidden" id="trans_inv_no" name="inv_date" value="<? echo $_REQUEST['inv_date'] ?>" >
						    <input type="hidden" id="our_company_name" name="our_company_name" value="<? echo $_REQUEST['our_company_name'] ?>" >
							    
        <div class="login-fields" id="non-printable" style="padding-left:5px;">
         <div class="field">
        			 <select name="space_01" id="space_01" class="login username-field input-small" required >
			<option>Select</option>
			<option value="<?php echo $_REQUEST['space_01']?>" selected="selected"><?php echo $_REQUEST['space_01']?></option>
			<option value="Null">Null</option>
			<option value="1">1</option>
			<option value="2">2</option>
    		<option value="3">3</option>
			<option value="4">4</option>
			</select>
			
			<input type="submit" value="Submit"></div></div></form></td>
  <td><div class="non-printable" id="non-printable" style="padding-left:10px;"><a href="index_import.php">Back to Dashbaord </a></div></td>
  </tr>
  <tr>
    <td colspan="2"><div align="center"><?php if($_REQUEST['our_company_name']=='Aashirvadh') {?>
	<img src="header_barA.jpg"/>
	<?php } ?>
	<?php if($_REQUEST['our_company_name']=='Threestar') {?>
	<img src="header_bar.jpg"/>
	<?php } ?>
	<?php if($_REQUEST['our_company_name']=='Vector') {?>
	<img src="header_barV.jpg"/>
	<?php } ?>
    </div>
      <table width="100%" border="2"  style="border-collapse:collapse">
      
      <tr>
        <td height="30" colspan="4" class="style1"><div align="center" class="style3" style="font-size:18px">INVOICE </div>
		
		<div align="center" class="style3" style="font-size:13px"> Subject to Mumbai Jurisdiction </div></td>
      </tr>
      
      <tr>
        <td width="51%" valign="top" class="style1"><table width="100%"   style="border-collapse:collapse">
         <? if($sub_party_name!='') { ?> <tr>
            <td class="style9"><strong>M/S</strong></td>
            <td class="style9"><strong><? echo $sub_party_name?></strong></td>
          </tr><? } ?><? if($_REQUEST['inv_no']!='IMP/1835/18-19' and $_REQUEST['inv_no']!='IMP/1836/18-19' and $_REQUEST['inv_no']!='IMP/1638/18-19' and $_REQUEST['inv_no']!='IMP/1648/18-19' and $_REQUEST['inv_no']!='IMP/1672/18-19' and $_REQUEST['inv_no']!='IMP/1711/18-19') { ?> 
          <tr>
            <td class="style9"><div align="left" style="padding:1px;"><strong> <? if($sub_party_name!='') { ?> Account <? } else { ?>M/S<? } ?></strong></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><?php echo $customer_name?></div></td>
          </tr>
		  <? }?>
          <tr>
            <td width="17%" height="25" valign="top" class="style9"><div align="left" style="padding:1px;"><strong>Add</strong></div></td>
            <td width="83%" valign="top" class="style9"><div align="left" style="padding:1px;"><?php echo $billing_address?>
			
			<? if($billing_address=='')  { echo $address_b; }?></div></td>
          </tr>
          <tr>
            <td height="30" class="style9"><div align="left" style="padding:1px;"><strong>GST No.: </strong></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><?php if($gst_no!=''){ echo $gst_no; }else {echo $bgst_no; }?></div></td>
          </tr>
        </table></td>
        <td width="49%" colspan="3" valign="top" class="style1"><table width="100%"   style="border-collapse:collapse">
          <tr>
            <td width="29%" class="style9"><div align="left" style="padding:1px;"><strong>BILL NO. </strong></div></td>
            <td width="37%" class="style9"><div align="left" style="padding:1px;"><?php echo $_REQUEST['credit_no']?></div></td>
            <td width="12%" class="style9"><div align="left" style="padding:1px;"><strong>Date</strong></div></td>
            <td width="22%" class="style9"><div align="left" style="padding:1px;"><?php echo $_REQUEST['note_date']?></div></td>
          </tr>
          <tr>
            <td class="style9"><div align="left" style="padding:1px;"><strong>REF  No. </strong></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><?php echo $enq_job_no?></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><strong>Date</strong></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><?php echo $enq_job_date?></div></td>
          </tr>
          <tr>
            <td class="style9"><div align="left" style="padding:1px;"><strong>B / E No. </strong></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><?php echo $b_e_no?></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><strong>Date</strong></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><?php echo $b_e_dt?></div></td>
          </tr>
          <tr>
            <td class="style9"><div align="left" style="padding:1px;"><strong>S/B No. </strong></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><?php echo $s_b_no?></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><strong>Date</strong></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><?php echo $s_b_dt?></div></td>
          </tr>
          <tr>
            <td class="style9"><div align="left" style="padding:1px;"><strong>Original Invoice No. </strong></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><?php echo $_REQUEST['inv_no']?></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><strong>Date</strong></div></td>
            <td class="style9"><div align="left" style="padding:1px;"><?php echo $inv_date?></div></td>
          </tr>
        </table></td>
      </tr>
      
      <tr>
        <td colspan="4"><div align="left"  class="style4" style="font-family:Arial, Helvetica, sans-serif"><strong>Description : </strong><?php echo $descrition_goods?></div></td>
        </tr>
      <tr>
        <td colspan="4"><div align="left"  class="style4"  style="font-family:Arial, Helvetica, sans-serif"><strong>Container No.:</strong> <?php echo $cntr_no?></div></td>
      </tr>
      <tr>
        <td colspan="4" class="style1"><table width="100%" border="1" bordercolor="#000000" style="border-collapse:collapse">
          <tr>
            <td width="4%" rowspan="2" class="style9"><div align="left" class="style11">Sr No. </div></td>
            <td colspan="3" class="style9"><div align="center" class="style11">Particular</div></td>
            <td width="7%" class="style9"><div align="center" class="style11">SAC/HSN</div></td>
            <td width="10%" class="style9"><div align="center" class="style11">Expenses</div></td>
            <td width="5%" class="style9"><div align="center" class="style11">TAX</div></td>
            <td colspan="2" class="style9"><div align="center" class="style11">CGST</div></td>
            <td colspan="2" class="style9"><div align="center" class="style11">SGST</div></td>
            <td colspan="2" class="style9"><div align="center" class="style11">IGST</div></td>
          </tr>
          <tr>
            <td width="33%" class="style9"><div align="left" class="style13" style="padding:2px;">Rcpt No. </div></td>
            <td width="7%" class="style9"><div align="left" class="style13" style="padding:2px;">Rcpt Date </div></td>
            <td width="9%" class="style9"><div align="left" class="style13" style="padding:2px;">Rcpt Amt</div></td>
            <td class="style9"><div align="left" style="padding:2px;"></div></td>
            <td class="style9"><div align="center" style="padding:2px;"><strong>Amount</strong></div></td>
            <td class="style9"><div align="center" style="padding:2px;"><strong>Type</strong></div></td>
            <td width="4%" class="style9"><div align="center" style="padding:2px;"><strong>Per</strong></div></td>
            <td width="4%" class="style9"><div align="center" style="padding:2px;"><strong>Amt</strong></div></td>
            <td width="4%" class="style9"><div align="center" style="padding:2px;"><strong>Per</strong></div></td>
            <td width="4%" class="style9"><div align="center" style="padding:2px;"><strong>Amt</strong></div></td>
            <td width="4%" class="style9"><div align="center" style="padding:2px;"><strong>Per</strong></div></td>
            <td width="5%" class="style9"><div align="center" style="padding:2px;"><strong>Amt</strong></div></td>
          </tr>
		<?php 
		
		
	  $i =1; 
	  $querytax = "select * from  job_services where job_no='".$_REQUEST['Job_No']."' and inv_no = '".$_REQUEST['inv_no']."' and type_note='Credit' ORDER BY number ASC";
		//echo $querytax;
		                 $resulttax = mysql_query($querytax,$conn);	
						  while($row=mysql_fetch_array($resulttax))
	                                              	{
													$particular= $row['particular'];
													$paid_by_party = $row['paid_by_party'];
													$non_taxable = $row['non_taxable'];
													$taxable = $row['taxable'];
													$sumnon_taxable +=$non_taxable;
													$sumtaxable += $taxable;
													$sumpaid_by_party += $paid_by_party;
													$rcpt_no = $row['rcpt_no'];
													$rcpt_date = $row['rcpt_date'];
													$rcpt_amt = $row['rcpt_amt'];
													$services_name = $row['services_name'];
													$job_service_no = $row['job_service_no'];
													$CGST = $row['CGST_rate'];
													$SGST = $row['SGST_rate'];
													$IGST = $row['IGST_rate'];
													$HSN_code = $row['HSN_code'];
													$pure_agent=$row['pure_agent'];
													$note_amt = $row['note_amt'];
													$total_amt += $note_amt;
													?> 
	<?php 
	$query21 = "select * from services_master where service_id ='$services_name'";
$result21 = mysql_query($query21,$conn);
while($row=mysql_fetch_array($result21))
{
$services_name = $row['services_name'];
}?>												

          <tr>
            <td rowspan="2" class="style9"><div align="center" style="padding:2px;"><?php echo $i?></div>			</td>
            <td colspan="3" class="style9"><div align="left" style="padding:2px;"><?php echo $services_name?></div></td>
            <td rowspan="2" class="style9"><div align="center" style="padding:2px;"><?php echo $HSN_code?></div>
              <div align="center"></div></td>
            <td rowspan="2" class="style9">
			<div align="right" style="padding:2px;">
			<?php echo number_format($note_amt,2)?>
			</div></td>
            <td rowspan="2" class="style9"><div align="right" style="padding:2px;"><?php if($pure_agent=='YES') { echo "P"; }elseif($paid_by_party!='' and $paid_by_party!=' ') {echo "P"; } elseif($taxable!='' and $taxable!=' ') {echo "T"; } else {echo "NT"; }?></div></td>
            <td rowspan="2" class="style9"><div align="right" style="padding:2px;"><?php if($bstate_code =='27' and $taxable!='' and $taxable!=' ') { echo $CGST; }?></div></td>
            <td rowspan="2" class="style9"><div align="right" style="padding:2px;">
			<?php if($bstate_code =='27' and $taxable!='' and $taxable!=' ') { $taxcgstval = $taxable*$CGST/100; echo round($taxcgstval); $sumCGST+=$taxcgstval;}?></div></td>
            <td rowspan="2" class="style9"><div align="right" style="padding:2px;"><?php if($bstate_code =='27' and $taxable!='' and $taxable!=' ') { echo $SGST; }?></div></td>
            <td rowspan="2" class="style9"><div align="right" style="padding:2px;">
			<?php if($bstate_code =='27' and $taxable!='' and $taxable!=' ') { $taxsgstval = $taxable*$SGST/100; echo round($taxsgstval); $sumSGST+=$taxsgstval; }?></div></td>
            <td rowspan="2" class="style9"><div align="right" style="padding:2px;"><?php if($bstate_code !='27' and $taxable!='' and $taxable!=' ') { echo $IGST; }?></div></td>
            <td rowspan="2" class="style9"><div align="right" style="padding:2px;">
			<?php if($bstate_code !='27' and $taxable!='' and $taxable!=' ') { $taxigstval = $taxable*$IGST/100; echo round($taxigstval); $sumIGST+=$taxigstval;}?></div></td>
          </tr>
		
          <tr>
		    <?php if($rcpt_no!='' and $rcpt_no!=' ' ) {?>
            <td class="style13"><div align="left" class="style16" style="padding:2px;"><?php echo $rcpt_no?></div></td>
            <td class="style13"><div align="left" class="style16" style="padding:2px;"><?php echo $rcpt_date?></div></td>
            <td class="style13"><div align="left" class="style16" style="padding:2px;"><?php echo $rcpt_amt?></div></td>
            <?php } ?>
          </tr>
         
          
          <?php $i++;} ?>
		  <?php if($_REQUEST['space_01']!='' and $_REQUEST['space_01']!='Null') {?>
		  <tr>
		    <td class="style9">&nbsp;</td>
		    <td colspan="3" class="style9"><?php if($_REQUEST['space_01'] == 1) {?>
              <div style="height:200px;"></div>
			  <?php }?>
			  <?php if($_REQUEST['space_01'] == 2) {?>
              <div style="height:300px;"></div>
			  <?php }?>
			  <?php if($_REQUEST['space_01'] == 3) {?>
              <div style="height:400px;"></div>
			  <?php }?>
			  <?php if($_REQUEST['space_01'] == 4) {?>
              <div style="height:450px;"></div>
			  <?php }?>			</td>
		    <td class="style9">&nbsp;</td>
		    <td class="style9">&nbsp;</td>
		    <td class="style9">&nbsp;</td>
		    <td colspan="2" class="style9">&nbsp;</td>
		    <td colspan="2" class="style9">&nbsp;</td>
		    <td colspan="2" class="style9">&nbsp;</td>
		    </tr><?php }?>
		  <tr>
            <td colspan="4" class="style9"><div align="left" class="style13" style="padding:1px;">(T : Taxable P: Pure Agent NT: Non Taxable R: Reverse Charges) </div></td>
            <td class="style9"><div align="right" class="style10"><strong>Total Rs. </strong></div></td>
            <td class="style9"><div align="right" class="style11"><?php echo number_format($total_amt,2)?></div></td>
            <td class="style9">&nbsp;</td>
            <td colspan="2" class="style9"><div align="right" class="style11"><?php if($sumCGST!='') { echo number_format($sumCGST,2); }?></div></td>
            <td colspan="2" class="style9"><div align="right" class="style11"><?php if($sumSGST!='') { echo number_format($sumSGST,2);}?></div></td>
            <td colspan="2" class="style9"><div align="right" class="style11"><?php if($sumIGST!='') {echo number_format($sumIGST,2);}?></div></td>
            </tr>
		  <tr>
		    <td colspan="5" class="style9"><table width="100%" border="1" style="border-collapse:collapse;">
            <?php if($_REQUEST['our_company_name']=='Aashirvadh') {?>
 			<tr>
                <td colspan="2"><div align="left" class="style12" style="line-height:160%;; font: Arial, Helvetica, sans-serif; font-weight: bold;"><strong>GST No. 27AALCA3462C1ZV <br />
			PAN NO. AALCA3462C<br />
			CIN NO. U63000TN2013PTC089530<br />
		    </strong></div></td>
                </tr><?php } ?>
				
				
				 <?php if($_REQUEST['our_company_name']=='Vector') {?>
 			<tr>
                <td colspan="2"><div align="left" class="style12" style="line-height:160%;; font: Arial, Helvetica, sans-serif; font-weight: bold;"><span style="font-weight: bold">GST No. 27AFFPR1089C1ZG <br />
			PAN NO. AFFPR1089C<br />
			CIN NO. U63000TN2013PTC089530</span><br />
		    </div></td>
                </tr>
 			 			<?php } ?>
						
						<?php if($_REQUEST['our_company_name']=='Threestar') {?><tr>
 			  <td width="48%">	<div align="left" class="style12" style="line-height:160%;; font: Arial, Helvetica, sans-serif; font-weight: bold;"><strong>GST No. 27AADCT7763K1ZR&nbsp;<br />
			CIN NO. U74900MH2011PTC214543<br />
			AEO REGISTRATION NO. INAADCT7763KOF182
		    </strong></div></td>
 			  <td width="52%" valign="top">	<div align="left" class="style12" style="line-height:160%;; font: Arial, Helvetica, sans-serif; font-weight: bold;"><strong>			PAN NO. AADCT7763K<br />
			MSME Udyog Aadhar No. MH18E0114637<br />
 			  </strong></div></td>
					</tr>

			  <?php }?>
            </table>			</td>
		    <td colspan="6" valign="top" class="style9"><div align="right" class="style11">Gross Total Rs.<br />Tax Payable On Reverse Charges <? if($discount!='') { ?><br /><br /> Discount Rs <? } ?> <br />
			<br />Advance Recd.  </div></td>
		    <td colspan="2" valign="top" class="style9"><div align="right" class="style11"><?php $grandtotal1 = $total_amt+$sumCGST+$sumSGST+$sumIGST; echo number_format($grandtotal1,0);?> <br /><? if($discount!='') { ?><br /><br /> <? echo $discount; $grandtotal1=$grandtotal1-$discount;?> <? } ?> <br /><br /><? echo  number_format($advance_recv,2);?>
			<? $grandtotal=$grandtotal1-$advance_recv?></div></td>
		    </tr>
		  <tr>
		    <td colspan="5" class="style9"><div align="left" style="padding:3px;; font: Arial, Helvetica, sans-serif; font-weight: bold;"> Amount Chargeable (in words) Rupeess:
		      <? 
   $no = round($grandtotal);
      $point = round($grandtotal - $no, 2) * 100;


   $hundred = null;
   $digits_1 = strlen($no);
   $i = 0;
   $str = array();
   $words = array('0' => '', '1' => 'one', '2' => 'two',
    '3' => 'three', '4' => 'four', '5' => 'five', '6' => 'six',
    '7' => 'seven', '8' => 'eight', '9' => 'nine',
    '10' => 'ten', '11' => 'eleven', '12' => 'twelve',
    '13' => 'thirteen', '14' => 'fourteen',
    '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen',
    '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty',
    '30' => 'thirty', '40' => 'forty', '50' => 'fifty',
    '60' => 'sixty', '70' => 'seventy',
    '80' => 'eighty', '90' => 'ninety');
   $digits = array('', 'hundred', 'thousand', 'lakh', 'crore');
   while ($i < $digits_1) {
     $divider = ($i == 2) ? 10 : 100;
     $finaltotal = floor($no % $divider);
     $no = floor($no / $divider);
     $i += ($divider == 10) ? 1 : 2;
     if ($finaltotal) {
        $plural = (($counter = count($str)) && $finaltotal > 9) ? '' : null;
        $hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
        $str [] = ($finaltotal < 21) ? $words[$finaltotal] .
            " " . $digits[$counter] . $plural . " " . $hundred
            :
            $words[floor($finaltotal / 10) * 10]
            . " " . $words[$finaltotal % 10] . " "
            . $digits[$counter] . $plural . " " . $hundred;
     } else $str[] = null;
  }
  $str = array_reverse($str);
  $result = implode('', $str);
  $points = ($point) ?
    "." . $words[$point / 10] . " " . 
          $words[$point = $point % 10] : '';
 echo $result=ucwords(strtolower($result)); "  "; ?>
		      only</div></td>
		    <td colspan="6" class="style9"><div align="right" class="style11"> Total Rs.<br />
		    </div></td>
		    <td colspan="2" class="style9"><div align="right" class="style11">
		      <?php $grandtotalss = $total_amt+$sumCGST+$sumSGST+$sumIGST; echo number_format($grandtotal,0);
			  $taxamt = $sumCGST+$sumSGST+$sumIGST;
			  
			  ?>
		      </div></td>
		    </tr>
          
        </table></td>
      </tr>
	  
	  
     
	
      <tr>
        <td colspan="4" class="style1"><table width="100%" style="border-collapse:collapse">
          <tr>
            <td width="63%" valign="top"><span class="style8">1. Kindly quotes bill number when making payment<br />
			2. Upcountry Cheques must include present Bank Charges<br />
			3. No alternations should be made without permisssion</span></td>
            <td width="37%" valign="top"><div align="right" class="style3" style="padding:2px; padding-right:5px;">For <?php echo $full_name_com?></div></td>
          </tr>
          
          <tr>
            <td colspan="2" valign="top"><span class="style8"> 
4. Interest 18% will be charged per annum on bills remaining unpaid after week from presentation of bill.<br />
5. Dispute relating to this must be submitted in writting with in one week from  receipt of bill after that No claim will be entertained.</span></td>
            </tr>
          <tr>
            <td width="63%" valign="top"><span class="style8">
6. Good lying in the godown, B.P.T or railway sheds awaiting dispatch  shipments are entirely at owner risk.<br />
7. Our responsibility ceases after the goods have been delivered to the carriers gowdown etc.<br />
8. The owner should insure the goods for all risks.<br />
9. TDS deductions @2% as per sec. 194C only on clearing &amp; forwarding charges</span></td>
            <td valign="top"><div align="right" class="style3" style="padding:2px; padding-right:5px;">Authorised Signatory </div></td>
          </tr>
        </table></td>
      </tr>
    </table></td></tr> <tr><td colspan="2"><center><?php /*?>B35,5th FLOOR,HIT-NIKETAN CHS LTD, J.M.ROAD, KOKAN NAGAR ,BHANDUP (W) MUMBAI- 400 078<?php */?></center></td></tr>
  
</table>

<?php 


$display_type = 'Dr';
$Vch_type = 'Tax Invoices';
$our_company_name= $_REQUEST['our_company_name'];
$particulars = "Tax aginst GST ";
$date = str_replace('/', '-', $inv_date);

$query4d = "select * from ledger_report where Vch_no = '".$_REQUEST['inv_no']."' AND customer_id = '".$_REQUEST['customer_id']."' and display_type='Dr'";
//echo $query4d;
$result4d=mysql_query($query4d,$conn);
$num_rows4d = mysql_num_rows($result4d);

if($num_rows4d=='0')
{
$qryautomod = "insert into ledger_report(date,particulars,display_type,Vch_type,Vch_no,amount,customer_id,customer_name,curr_fy,company_name) values ('$date','$particulars','$display_type','$Vch_type','$inv_no','$grandtotal','$customer_id','$customer_name','$curr_fy','$our_company_name')";
$rauto=mysql_query($qryautomod,$conn);
}
$grandtotal = $total_amt+$sumCGST+$sumSGST+$sumIGST;

$query1fa="update tax_servicetax set IGST_amt ='$sumIGST',CGST_amt='$sumCGST',SGST_amt='$sumSGST',total_gst_amt='$taxamt',gross_amt='$grandtotal',our_company_name='$our_company_name' where inv_no = '".$_REQUEST['inv_no']."' AND customer_id = '".$_REQUEST['customer_id']."'";
$r1fa=mysql_query($query1fa,$conn);
//echo $qryautomod;
?><div align="center" style="font-size:12px;">This is a Computer generated invoice, Signature is not required.</div>
</body>
</html>
