<?php

include('db_connection.php');
$Mainclass=new DB_Controller();

$Order_ID = base64_decode($_REQUEST['Order']);

$Order_Master_Details = $Mainclass->Fetch_individual_data("gold_billing_order_master","*","Order_No='".$Order_ID."'");


$condition_quan="Order_No='".$Order_ID."' and Product_Type!='' and Cart_Complete='Yes'";
$Quantity_Num=$Mainclass->num_check('gold_billing_order_details',"SLN",$condition_quan);

$Get_Customer_Details=$Mainclass->Fetch_individual_data('order_address_master_gold',"*","Order_No='".$Order_ID."'");//customer data//
$Condition_Dealer=" Order_Code='".$Order_Master_Details['Dealer_Code']."'";
$Get_Dealer_Info=$Mainclass->Fetch_individual_data('dealer_master',"*",$Condition_Dealer);//dealer data//
$GST_Number=$Get_Dealer_Info['Dealer_GST'];
if(strtoupper($_COOKIE['Type'])=='ADMIN')
{
	$Copy="DUPLICATE COPY";
}
else
{
	$Copy="ORIGINAL BUYER'S COPY";
}
function AmountConvervrtToWord($amount)
{
  $number = $amount;
   $no = round($number);
   $point = round($number - $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;
     $number = floor($no % $divider);
     $no = floor($no / $divider);
     $i += ($divider == 10) ? 1 : 2;
     if ($number) {
        $plural = (($counter = count($str)) && $number > 9) ? 's' : null;
        $hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
        $str [] = ($number < 21) ? $words[$number] .
            " " . $digits[$counter] . $plural . " " . $hundred
            :
            $words[floor($number / 10) * 10]
            . " " . $words[$number % 10] . " "
            . $digits[$counter] . $plural . " " . $hundred;
     } else $str[] = null;
  }
  $str = array_reverse($str);
  $result = implode('', $str);
  $points = ($point) ?
    "." . $words[$point / 10] . " " .
          $words[$point = $point % 10] : '';
  return ucwords($result)." Only";
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<title>Chandrani Pearls</title>
</head>
<script>
	function print_invoice()
	{
		//alert(11111);
		$('#prnt-but').hide();
		$('#cancel').hide();
		
           var divToPrint = document.getElementById('printdiv1');
              
           var popupWin = window.open('', '_blank');
        
           popupWin.document.open();
           popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
           popupWin.document.close();
	}
</script>
<script>
function cancel_invoice()
{
	window.parent.location.href='billing.php';
}
</script>
<script>
function cancel_invoice1()
{
	window.parent.location.href='view-order-new.php';
}
</script>
<body>
<table width="900" height="500" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td><div id="printdiv1">
	<?php
	if($Quantity_Num<='5')
	{
		?>
<table width="900" height="500" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:15px; color:#000000; font-weight:600;">TAX INVOICE</td>
      </tr>
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50%" valign="top" style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:14px; color:#000000; font-weight:600;">No : <?php echo $Order_Master_Details['Invoice_Id'];?> &nbsp; &nbsp; Date : <?php echo date('d/m/Y',strtotime($Order_Master_Details['Order_Date']));?></td>
    <td width="50%" style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:14px; color:#000000; font-weight:600; line-height:17px;"><span style="font-size:10px;">ORIGINAL BUYER'S COPY</span>
</td>
  </tr>
</table>
</td>
      </tr>
      <tr>
        <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:500;">
        
        
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="33%" valign="top" style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:12px; color:#000000; font-weight:500; text-transform:uppercase; line-height:18px; padding-bottom:10px; padding-top:10px;"><strong><?php echo ucwords(strtolower($Get_Customer_Details['Salutation']));?><?php echo ucwords($Get_Customer_Details['Customer_Name']);?></strong><?php if($Get_Customer_Details['Customer_Gst']!='' && $Get_Customer_Details['Customer_Gst']!='undefined'){echo "(GST :".$Get_Customer_Details['Customer_Gst'].")";}?><br />
<?php 
if($Get_Customer_Details['Building_No']!='')
{
	?>
	<?php echo ucwords($Get_Customer_Details['Building_No']);?> ,
    <?php
	 }
	 ?>
<?php 
if($Get_Customer_Details['Street_Name']!='')
{
	?>
	<?php echo ucwords($Get_Customer_Details['Street_Name']);?><br />
    <?php
	 }
	 ?>
<?php if($Get_Customer_Details['Address_Line1']!=''){?><?php echo ucwords($Get_Customer_Details['Address_Line1']);?><br /><?php }?>
<?php if($Get_Customer_Details['Address_Line2']!=''){?><?php echo ucwords($Get_Customer_Details['Address_Line2']);?><br/><?php }?>
<?php if($Get_Customer_Details['City']!=''){?><?php echo ucwords($Get_Customer_Details['City']);?> - <?php echo ucwords($Get_Customer_Details['Pin']);?><br /><?php }?>
<?php if($Get_Customer_Details['State']!=''){?><?php echo ucwords($Get_Customer_Details['State']);?><br /><?php }?>
<?php if($Get_Customer_Details['DOB']!='0000-00-00'&& date('d-m',strtotime($Get_Customer_Details['DOB']))!='01-01'){?><?php echo "DOB :".date('d-m-Y',strtotime($Get_Customer_Details['DOB']));?><br /><?php }?>
<?php if($Get_Customer_Details['Anniversary_Date']!='0000-00-00'){?><?php echo "DOM :".date('d M',strtotime($Get_Customer_Details['Anniversary_Date']));?><br /><?php }?>
Phone : <?php echo $Get_Customer_Details['Contact'];?>
<?php if($Get_Customer_Details['Member_Id']!=''){?><br/>Membership No : <?php echo $Get_Customer_Details['Member_Id'];?><?php }?>
</td>
    <td width="33%" valign="top" style="padding-bottom:10px;"><img src="dist/img/logo-web.png" width="250"  /><br />
    <!--Billed By - 
 <span style=" font-size:17px; font-weight:600;"><?php echo $Get_Dealer_Info['Dealer_Name'];?></span>--></td>
    <td width="34%" valign="top" style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:12px; color:#000000; font-weight:500; padding-top:10px;">
   <br />
		<span style=" font-size:12px; font-weight:600;"><?php echo $Get_Dealer_Info['Dealership'];?></span><br/>
		<?php
		if($Get_Dealer_Info['Dealer_Type']!="Owned")
		{
			?>
        (Auth. Dealer of Chandrani Pearls Pvt. Ltd.)<br />
			<?PHP
		}
		?>
		
<?php echo $Get_Dealer_Info['Dealer_Address_Line1'];?><br />
<?php echo $Get_Dealer_Info['Dealer_Address_Line2'];?><br />
<?php echo $Get_Dealer_Info['Dealer_City'];?> <?php if($Get_Dealer_Info['Dealer_City']!=''){echo" - ";};?> <?php echo $Get_Dealer_Info['Dealer_Pin'];?> <?php if($Get_Dealer_Info['Dealer_Phone']!=''){echo"Phone :";}?> <?php echo $Get_Dealer_Info['Dealer_Phone'];?><br />
<?php if($Get_Dealer_Info['Whatsapp_No']!=''){echo"WhatsApp :";}?> <?php echo $Get_Dealer_Info['Whatsapp_No'];?><br />		
(Goods Sold & Delivered At the Above Address)<br />
<br /></td>
  </tr>
</table>
        
        
        
        
        
        
</td>
      </tr>
		

<?php  

$date = date('Y-m-d',strtotime($Order_Master_Details['Order_Date']));

$karat_loop = $Mainclass->Fetch_multiple_data("gold_billing_order_details","gold_purity,gold_rate","Order_No='".$Order_ID."' GROUP BY gold_purity asc");	

$loop_array = "";		
		

?>

      
      <tr><td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; ">
		  
		  
<?php 
		
foreach ($karat_loop as $karat_loop){
	
echo $loop_array =$karat_loop['gold_purity']." : ".$karat_loop['gold_rate']." | ";	
	
} 
		
?>
		  
		  
		  </td></tr>
      
      <tr>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:12px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">SLN.</td>
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:left; color:#000000; line-height:12px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000; padding-left:5px;">Description
of Goods</td>
            
            <!-- <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Product Code</td> -->
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">HSN Code</td>
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Making
Charges</td>
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Purity
(Kt)</td>
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Qty</td>
            
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Gold Gms Value</td>

			<td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Dia Ct Value</td>

			<td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Sol Ct Value</td>


			<td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Stone Val
</td>
			  
			  <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Net Wt
(Gms)</td>
            
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Pre
Dis
Value
</td>
            
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">Promo
Dis</td>
            
            
<!--
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">CGST%</td>
			
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-right:1px solid #000000; border-top:1px solid #000000;">CGST</td>-->
           
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align: right; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000; border-top:1px solid #000000;">Value After
disc</td>
          </tr>
          <?php
	//$condition=" Order_No='".$Order_ID."' and Product_Catagory!='Consumable' order by SLN asc";
	$condition=" Order_No='".$Order_ID."' and Product_Type!='' order by Price_Rate desc";
          $Order_Details=$Mainclass->Fetch_multiple_data('gold_billing_order_details',"*",$condition);
		  $i=1;
		
	$total_pre_disc_val = 0;
	$total_disc_amt = 0;
	$total_value_disc = 0;
		
	foreach($Order_Details as $det)
{
		$Order_Master_Details1=$Mainclass->Fetch_individual_data('gold_billing_order_master',"*",$det['Order_No']);//billing order master data//
		//echo 'xx='.$Order_Master_Details1['Membership_Discount'];
		
		/*if($Order_Master_Details1['Membership_Discount']!='0.00')
		{
			$MemberShip_Discount=($det['Price'] * 10)/100;
		}
		else
		{
			$MemberShip_Discount='0.00';
		}*/
		$MemberShip_Discount=$det['Member_Discount'];
		$Get_Product=$Mainclass->product_det('product_master',$det['Product_Code']);
		//$Net_Price=$det['Total_Price'] - $Order_Master_Details1['Membership_Discount'] - $det['GST'];
		$Net_Price=$det['Price'] - $MemberShip_Discount - $det['Dealer_Discount'];
		//$GST_Rate=$Mainclass->Get_GST_Product('product_gst_master',$det['HSN_Code']);
		$GST_Rate=$det['GST_Rate'];
		$Gst_Rate=$det['GST'];
		
		$CGST_Rate=$GST_Rate['GST_Rate']/2;
		$CGST_Value=$det['GST']/2;
		$SGST_Rate=$GST_Rate['GST_Rate']/2;
		$SGST_Value=$det['GST']/2;
		
		$Net=$det['Total_Price'] - $det['GST'];
		//$Item_Total=$Net_Price + $det['GST'];
		$Item_Total=$det['Total_Price'];
		
		if($det['Product_Discount']>0)
    	{
      $Discount=$det['Product_Discount'];      
    	}
   		 else if($det['Sale_Discount']>0)
		{
       $Discount=$det['Sale_Discount'];
   		 }
		 else
		 {
			$Discount="0.00"; 
		 }


		 $pre_disc_val = $det['Discounted_Amount'] + $Discount;
		
		
					if($det['making_charge_type']=="Rate per gram"){
	    
	    $making_type = $det['making_charge_val']."/gram";
	    
	}
	
		if($det['making_charge_type']=="Flat"){
	    
	      $making_type = $det['making_charge_type'];
	    
	}
	
			if($det['making_charge_type']=="Percentage"){
			    
			    $making_type = $det['making_charge_val']."%";
	    
	    
	}
	
		
		  ?>
          <tr>
            <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $i;?></td>

            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:left; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000; padding-left:5px; padding-bottom:8px;"><?php echo strtoupper($det['Product_Code']);?><br /><?php if(strtoupper($det['Product_Type'])=="SILVER"){echo "(Silver 92.5%)";}?>              <?php if($det['Product_Catagory']=='Consumable' && $det['Product_Type']=='Free Gift'){echo "Free Gift";} else if($det['Product_Catagory']!='Consumable'){echo $det['Product_Catagory']."<br>"."IGI No:".$det['IGINo'];} else{echo "";}?></td>
            
               <!-- <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $det['Product_Code'];?></td> -->


            <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $det['HSN_Code'];?></td>

            <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $det['total_making_charge'];?><br> (<?php echo $making_type;?>)</td>


            <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $det['gold_purity'];?></td>

            <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo round($det['Quantity'],0);?></td>
            
            <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $det['gold_wt']; ?> Gm <br><?php echo $det['Total_Gold_Value']; ?></td>
			
			<td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $det['Diamond_Carat']; ?>  <br><?php echo $det['diamond_price']; ?></td>

						<td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $det['sollitaire_Carat']; ?><br><?php echo $det['solitaire_price']; ?></td>
			
			<td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $det['stone_price']; ?></td>
			  
			  <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $det['gold_wt']; ?></td>
			
            
            <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo number_format($pre_disc_val,2); ?>
      
            <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $Discount;?></td>

            <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:right; color:#000000; line-height:16px; font-weight:500; "><?php echo number_format($det['Discounted_Amount'],2);?></td>
                
                
                
            
            
            
          </tr>
          <?php
		
	$total_pre_disc_val+=$pre_disc_val;
	$total_disc_amt+=$Discount;
	$total_value_disc+=$det['Discounted_Amount'];
		
		
		  $i++;
		  }
		  ?>
          <?php


$total_cond = "Order_No ='".$Order_ID."'";

		  $Get_Price_Sum=$Mainclass->get_sum_field('gold_billing_order_details','Price',$total_cond);
			$Get_Advance=$Mainclass->get_sum_field('gold_billing_order_master','Advance_Received',$total_cond);
			$Get_Discount_Sum=$Mainclass->get_sum_field('gold_billing_order_master','Membership_Discount',$total_cond);
			$Get_Voucher_Discount=$Mainclass->get_sum_field('gold_billing_order_master','Voucher_Discount_Value',$total_cond);
			$Get_Dealer_Discount_Sum=$Mainclass->get_sum_field('gold_billing_order_master','Dealer_Discount',$total_cond);
			$Get_Total_Price=$Mainclass->get_sum_field('gold_billing_order_details','Total_Price',$total_cond);
			$Get_Gst_Sum=$Mainclass->get_sum_field('gold_billing_order_details','GST',$total_cond);
			$Return=$Mainclass->get_sum_field('gold_billing_order_master','Return_Adjusted',$total_cond);
		$Total_Making_Charge=$Mainclass->get_sum_field('gold_billing_order_details','total_making_charge',$total_cond);
		$Total_Stone_Price=$Mainclass->get_sum_field('gold_billing_order_details','stone_price',$total_cond);

			$Order_Master_Det1=$Mainclass->Fetch_individual_data('gold_billing_order_master',"*",$total_cond);
			$condition_Bday=" Order_No='".$Order_ID."'";
			$Get_Birthday_Discount=$Mainclass->get_sum_field('gold_billing_order_details','Birthday_Discount',$condition_Bday);
			$Get_Aniversary_Discount=$Mainclass->get_sum_field('gold_billing_order_details','Aniversary_Discount',$condition_Bday);
			$Get_Additional_Discount=$Mainclass->get_sum_field('gold_billing_order_details','Additional_Discount_Amt',$Cond_Details);



	   /*if($Order_Master_Det1['Product_Discount']>0)
    	{
			$Discount=$Order_Master_Det1['Product_Discount']; 
    	}
   		 else if($Order_Master_Det1['Sale_Discount']>0)
		{
          $Discount=$Order_Master_Det1['Sale_Discount'];
   		 }
		 else
		 {
			 $Discount="0.00";
		 }*/
		 
		 if($Order_Master_Det1['Product_Discount']>0 || $Order_Master_Det1['Sale_Discount']>0)
	     {
	       $Discount=$Order_Master_Det1['Product_Discount']+$Order_Master_Det1['Sale_Discount'];
	
	     }
		  else
		 {

			$Discount="0.00"; 

		 }
		 
		 
		 
			$Total_SGST=$Get_Gst_Sum/2;
			$Total_CGST=$Get_Gst_Sum/2;
			$Net_Total_Final=$Get_Price_Sum - $Get_Discount_Sum - $Get_Dealer_Discount_Sum;
			$Total_Net=$Get_Total_Price - $Get_Gst_Sum;
		$Donation=$Order_Master_Details['Donation'];
			//$Gross=$Net_Total_Final + $Get_Gst_Sum;
			$Gross=$Get_Total_Price;
			//$Gross1=$Gross - $Get_Voucher_Discount - $Return -$Get_Advance;
		$Gross1=$Gross - $Get_Voucher_Discount - $Return -$Get_Advance + $Donation;
			$Round=round($Gross1);
			$Round_Diff=-($Gross1 - $Round);
		
		$Member_Save=($Total_Net*10)/100;
		
		  ?>
          <tr>
            <td colspan="3"  style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;">Total</td>
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"><?php echo $Total_Making_Charge;?></td>
             <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"></td>
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"></td>
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"></td>
			<td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"></td>
            
            
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"></td>
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"><?php echo number_format($Total_Stone_Price,2) ;?></td>
			  
          <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"></td>  
            
            
            <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"><?php echo number_format($total_pre_disc_val,2);?></td>
			  
<td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"><?php echo number_format($total_disc_amt,2);?></td>
       
            
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; line-height:24px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"><?php echo number_format($total_value_disc,2);?></td>        
            
          </tr>
        </table></td>
      </tr>
      <tr>
        <td style="padding-top:8px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="41%" style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:14px; color:#000000; font-weight:600; line-height:18px;">GST No. : <?php echo $GST_Number;?></td>
    <td width="25%" style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;">Item Total</td>
    <td width="34%" style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;"><?php echo number_format($total_value_disc,2);?></td>
  </tr>
<?php
	if($Bdiscount!=0.00)
	{
		?>
<tr>
  
    <td>&nbsp;</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;">(-)Bday.Disc</td>
    
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; "><?php echo number_format($Bdiscount,2);?></td>
  </tr>
  <?php
	}
	?>
    
    <?php
	if($Anvdiscount!=0.00)
	{
		?>
<tr>
  
    <td>&nbsp;</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;">(-)Anv.Disc</td>
    
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; "><?php echo number_format($Anvdiscount,2);?></td>
  </tr>
  <?php
	}
	?>
  
  <tr>
    <?php
	if($Get_Voucher_Discount!=0.00)
	{
		?>
    <td>&nbsp;</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;">(-)Vou.Disc</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; "><?php echo number_format($Get_Voucher_Discount,2);?></td>
  </tr>
  <?php
	}
	?>
  <tr>
  <?php
	if($Return!=0.00)
	{
		?>
    <td>&nbsp;</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;">(-)Ret.Adjust</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; "><?php echo number_format($Return,2);?></td>
  </tr>
  <?php
	}
	?>
     <tr>
  <?php
	if($Get_Advance!=0.00)
	{
		?>
    <td>&nbsp;</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;">(-)Adv.</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; "><?php echo number_format($Get_Advance,2);?></td>
  </tr>
  <?php
	}
	?>

	<tr>
    <td>&nbsp;</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;">GST</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;"><?php echo number_format($Order_Master_Details['GST'],2);?></td>
  </tr>		
	    <?php
		if($Donation!=0.00)
		{
			?>
					
	<tr>
    <td>&nbsp;</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;">Donation</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;"><?php echo number_format($Donation,2);?></td>
  </tr>
			<?php
		}
		?>	
  <tr>
    <td>&nbsp;</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px;">Round Off</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; border-bottom:1px solid #000000;"><?php echo number_format($Round_Diff,2);?></td>
  </tr>
		
			
  <tr>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; ">Rs. <?php echo AmountConvervrtToWord($Round);?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; ">Bill Amount</td>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; border-bottom:1px solid #000000; padding-top:5px;"><?php echo number_format($Round,2);?></td>
  </tr>
  
  <?php 
  $CC=" Order_No='".$Order_ID."'";
  $Paymode=$Mainclass->Fetch_individual_data('gold_payment_master','*',$CC);
$Return=explode('-',$Paymode['Return_Amount']);
$Cash_Amt=$Paymode['Cash_Amount'] + $Return[1];
if($Return[1]=='')
{
	$Amt_Return='0.00';
}
else
{
	$Amt_Return=$Return[1];
}
  
  ?>
  <tr>
    <td colspan="3" style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:12px; color:#000000; font-weight:600; line-height:18px; text-transform:capitalize; padding-bottom:5px; border-bottom:1px solid #000000;">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50%"><strong>Amount Tendered :</strong> <?php if($Cash_Amt>0){?>Cash ( <?php echo $Cash_Amt;?>) <?php } ?><?php if($Paymode['Bank_Amount']!='0.00'){?> Card ( <?php echo $Paymode['Bank_Amount'];?>)<?php }?> <?php if($Paymode['Other_Payment_Name']!=''){?><?php echo $Paymode['Other_Payment_Name'];?> (<?php echo $Paymode['Other_Payment_Amount'];?>)<?php }?> <?php if($Paymode['Other_Payment_Name2']!=''){?><?php echo $Paymode['Other_Payment_Name2'];?>(<?php echo $Paymode['Other_Payment_Amount2'];?>)<?php }?> Total : <?php echo $Paymode['Amount_Tendered'];?></td>
    <td width="50%" style="text-align:right;"><!--Amount Tendered : <?php echo $Paymode['Amount_Tendered'];?>--> &nbsp; &nbsp; Amount Returned : <?php echo $Amt_Return;?></td>
  </tr>
</table>
    
    
    
    
    </td>
    </tr>
  
  
</table>
</td>
      </tr>
      <tr>
        <td valign="top">
      <?php
	  $condition_return=" Order_No='".$Order_ID."'";
	  $Get_Return_Product=$Mainclass->Fetch_multiple_data('return_adjustment_details','Product_Code',$condition_return);
	  ?>  
        
        <table width="400" border="0" cellspacing="0" cellpadding="0">
<?php
if($Get_Return_Product!='')
{
	?>
  <tr>
    <td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:14px; color:#000000; font-weight:600; line-height:18px;">Product Returned : 
		<?php
		foreach($Get_Return_Product as $Return)
		
		{
			?>
		<?php echo strtoupper($Return['Product_Code']).",";?>
	  <?php
		}
	?>
	  </td>
  </tr>
<?php
}
?>
</table>
        
        
        
         <table width="450" border="0" cellspacing="0" cellpadding="0" align="right">
  <tr>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000;padding-top:4px; ">HSN</td>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000;padding-top:4px; ">QTY</td>
    
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000;padding-top:4px; ">Taxable Val</td>
    

   
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000;padding-top:4px; ">SGST%</td>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000;padding-top:4px; ">SGST</td>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000;padding-top:4px; ">CGST%</td>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:600; border-bottom:1px solid #000000;padding-top:4px;">CGST</td>
    
  </tr>
  <?php
		$Hsn_Qty=0;
		$Tot_Tax_Val=0;
		$Tot_Cgst=0;
		$Tot_Sgst=0;
   $Condition=" Order_No='".$Order_ID."' and Product_Catagory!='Consumable'";
   $Order_Details1=$Mainclass->Fetch_distinct_datas('gold_billing_order_details','HSN_Code',$Condition);
	foreach($Order_Details1 as $det1)
{
	$Condition1=" HSN_Code='".$det1['HSN_Code']."' and Order_No='".$Order_ID."'";
	$Get_Order_Details=$Mainclass->Challan_Details('gold_billing_order_details',$Condition1);
	$Condition2=" HSN_Code='".$det1['HSN_Code']."' and Order_No='".$Order_ID."'";
	$Get_Total=$Mainclass->get_sum_field('gold_billing_order_details','Total_Price',$Condition2);
	$Get_GST=$Mainclass->get_sum_field('gold_billing_order_details','GST',$Condition2);
	$Taxable_Value=$Get_Total - $Get_GST;
		$CGST_Rate1=$Get_Order_Details['GST_Rate']/2;
		$CGST_Value1=$Get_GST/2;
		$SGST_Rate1=$Get_Order_Details['GST_Rate']/2;
		$SGST_Value1=$Get_GST/2;
	$condition_tax=" Order_No='".$Order_ID."' and HSN_Code='".$det1['HSN_Code']."'";	
	$HSN_Qty=$Mainclass->get_sum_field('gold_billing_order_details','Quantity',$condition_tax);	
		
		$Hsn_Qty=$Hsn_Qty+$HSN_Qty;
		$Tot_Tax_Val=$Tot_Tax_Val+$Taxable_Value;
		$Tot_Cgst=$Tot_Cgst+$CGST_Value1;
		$Tot_Sgst=$Tot_Sgst+$SGST_Value1;	
		
  ?>
  <tr>
    <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $det1['HSN_Code'];?></td>
    <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo round($HSN_Qty,0);?></td>
    
    <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo number_format($Taxable_Value,2);?></td>
	  

    
    <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $SGST_Rate1;?>%</td>
    <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo round($SGST_Value1,2);?></td>
    <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; border-right:1px solid #000000;"><?php echo $CGST_Rate1;?>%</td>
    <td valign="top" style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:16px; font-weight:500; "><?php echo round($CGST_Value1,2);?></td>
   
    
  </tr>
  <?php
  }
  ?>
  
  <tr>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:20px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;">&nbsp;</td>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:11px; text-align:center; color:#000000; line-height:20px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"><?php echo round($Hsn_Qty,0);?></td>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:20px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"><?php echo number_format($Tot_Tax_Val,2);?></td>

    
   
   
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:20px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;">&nbsp;</td>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:20px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"><?php echo round($Tot_Sgst,2);?></td>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:20px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;">&nbsp;</td>
    <td style=" font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; line-height:20px; font-weight:600; border-bottom:1px solid #000000;  border-top:1px solid #000000;"><?php echo round($Tot_Cgst,2);?></td>
   
  </tr>
</table>
</td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>

      <tr>
        <td style="padding:5px 0px; border-bottom:1px solid #000000;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="50%" style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:13px; color:#000000; font-weight:500; line-height:18px;">Sale Made By <?php echo strtoupper($Order_Master_Details['Sold_By']);?></td>
    <td width="50%" style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:500; line-height:18px;">Bill Made By <?php echo strtoupper($Order_Master_Details['Bill_Generated_By']);?></td>
  </tr>
<tr>
 
<?php
/*$condition=" Order_No='".$Order_ID."'";
$Points_Earned=$Mainclass->Fetch_individual_data('customer_point_master','Points,Expiry_Date',$condition);
$Total_Points=$Mainclass->get_sum('customer_point_master','Points',$condition);*/
?>
    <!--<td colspan="2"  style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:13px; color:#000000; font-weight:600; line-height:18px;">Points Earned : <?php if($Points_Earned['Points']!=''){echo $Points_Earned['Points'];}else{ echo "0";}?> &nbsp; &nbsp; <?php if($Points_Earned['Points']>0){?>Valid Upto : <?php echo date('d-m-Y',strtotime($Points_Earned['Expiry_Date']));?><?php } ?></td>-->
  </tr>
</table>
</td>
      </tr>
		<?php
		/*$Show_no_exchange=$Mainclass->show_exchange_policy(date('Y-m-d',strtotime($Order_Master_Details['Order_Date'])),$Order_Master_Details['Dealer_Code']);
		if($Show_no_exchange=='Yes')
		{*/
		?>
      <!--<tr>
        <td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:14px; color:#000000; font-weight:600; line-height:18px;">*** NO EXCHANGE OR NO RETURN ***</td>
      </tr>-->
		<?php
		//}
		?>
<?php 
if($Get_Customer_Details['Member']==0 && strtoupper($det['Product_Code'])!='CPNEW')
{
	?>
      <tr>
        <td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:11px; color:#000000; font-weight:700; line-height:15px; padding-top:5px;">* Become a  Pearl Value Member. Pay Rs. 100 and get 10% off on all Pearl and Silver purchase for one year</td>
      </tr>
		<tr>
        
			<td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:11px; color:#000000; font-weight:700; line-height:15px; padding-top:5px;">This purchase entitles you to become a member of Chandrani Pearls. You can enjoy double points and yearlong discounts. T&C apply. Call the showroom at <?php echo $Get_Dealer_Info['Dealer_Phone'];?> for details.</td>
      </tr>
		
<?php
}
?>
		<?php
		if($Donation!=0.00)
		{
			?>
		<tr>
		<td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:11px; color:#000000; font-weight:700; line-height:15px; padding-top:5px;">Thank you for donating your kind donation to our udan. </td>
		</tr>
		<?php
		}
	?>
<?php
if(strtoupper($det['Product_Code'])=='CPNEW')
{
	$cond=" Phone='".$Get_Customer_Details['Contact']."'";
	$Get_New_Member_Detail=$Mainclass->Fetch_individual_data('temp_member_master','Member_Id,Activation_Date,Membership_Expiry_Date',$cond);
?>
<tr>
<td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:11px; color:#000000; font-weight:500; line-height:15px; padding-top:5px;">Your Membership Number Is <b><?php echo $Get_New_Member_Detail['Member_Id'];?></b>.
</td>
       
      </tr>

<tr>
 <td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:11px; color:#000000; font-weight:500; line-height:15px; padding-top:5px;">* Your Membership will get activated from <b><?php echo date('d-M-Y',strtotime($Get_New_Member_Detail['Activation_Date']));?></b> and will be valid till <b><?php echo date('d-M-Y',strtotime($Get_New_Member_Detail['Membership_Expiry_Date']));?></b>. You can renew it after the membership expires.
</td>
<?php
}
?>
<?php
if(strtoupper($det['Product_Code'])=='CPRNEW')
{
	$cond=" Phone='".$Get_Customer_Details['Contact']."' and Member_Id!=''";
	$Get_ReNew_Member_Detail=$Mainclass->Fetch_individual_data('member_master','Membership_Expiry_Date',$cond);
	?>
<td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:11px; color:#000000; font-weight:500; line-height:15px; padding-top:5px;">* Your Membership will be valid till <b><?php echo date('d-M-Y',strtotime($Get_ReNew_Member_Detail['Membership_Expiry_Date']));?></b>. You can renew it after the membership expires.
</td>
<?php
}
?>
</tr>
      <tr>
        <td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:11px; color:#000000; font-weight:500; line-height:15px; padding-top:5px;">All pearls are genuine fresh water pearls and guarantee if proved fake or imitation we shall reward you a sum of Rs. 10,000 (Rupees Ten Thousand Only). No guarantee of colour on colour pearls and on polish on the metal. The pearls in the mala clip and in the center of bangle frame and in the top jhuri are not real pearls.
			<?php
		/*$Show_no_exchange=$Mainclass->show_exchange_policy(date('Y-m-d',strtotime($Order_Master_Details['Order_Date'])),$Order_Master_Details['Dealer_Code']);
		if($Show_no_exchange=='No')
		{*/
		?>
			<!--<br><br>
			<b>Exchange Policy:</b><br>
		  1. &nbsp;All Exchange items are subject to check & verification by Chandrani Pearls to check and 	  verify that the goods offered for exchange are the same as mentioned in the Cash Memo       &nbsp;&nbsp;&nbsp;&nbsp;above.Chandrani Pearls reserves the right to reject the same in case of any doubt & the decision by Chandrani Pearls is final.<br>
          2. &nbsp;Chandrani Pearls offers 100% exchange for the value paid within <b>14 days</b> of purchase at the same showroom.No tags should be removed from the product and original packaging &nbsp;&nbsp;&nbsp;&nbsp;must be intact and returned along with this bill in original.<br>
			3. &nbsp;All  goods  in  all  exchange  must  not  be  in  damaged  condition  and  Chandrani  Pearls  reserve  the  right  to  refuse  exchange  if  not  so after verification.-->
			<?php
		//}
		?>
		  </td>
        
        
        
         
      </tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tbody>
    <tr>
      <td style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:11px; color:#000000; font-weight:500; line-height:15px; padding-top:8px; border-top:1px solid #000000;">Web : www.chandranipearls.net |  Facebook : facebook.com/pearlsandyou |  Twitter : twitter.com/chandranipearl1<br>
		  * &nbsp;All disputes subject to Kolkata Jurisdiction only.<br>
		  * &nbsp;Its a computer generate invoice, it does not require any signature OR stamp.<br>
		   * &nbsp;Gold Purity & Weight: The gold used is hallmarked, and its purity and weight are mentioned on the bill.<br>
		  * &nbsp;Diamond Certification: Lab-grown diamonds come with certification for authenticity.<br>
		  
		   * &nbsp;Returns & Exchanges: Items can be exchanged within 7 days, subject to our exchange policy. Refunds are not applicable.<br>
		  * &nbsp;Pricing: Gold rate is based on the daily rate on the date of purchase. Making charges and taxes are additional.<br>
		   * &nbsp;Damage & Repairs: Chandrani Pearls is not responsible for damage caused by improper use. Repairs may incur additional costs.<br>
		  * &nbsp;Warranty: Warranty is limited to manufacturing defects only.<br>
		
		</td>
      <td style="font-family:Arial, Helvetica, sans-serif; text-align:right; font-size:11px; color:#000000; font-weight:500; line-height:15px; padding-top:8px; border-top:1px solid #000000;"><!--Printed On <?php echo date('d-m-y h:i:s a');?>--></td>
    </tr>
  </tbody>
</table></td>
</tr>
      
    
    
      
    </table></td>
  </tr>
</table>
<?php
	}
	
	?>
</div></td>
</tr>
	

<tr>
<td><table width="250" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>

<!--     <input name="print" type="button" value="Print" id="prnt-but"  onclick="print_invoice()"/>

    <input name="cancel" type="button" value="Cancel" id="cancel" style="margin-left:10px;"  onclick="cancel_invoice1()"/> -->

</td>
  </tr>
</table></td>
</tr>
</table>
</body>
</html>