<?php
include('db_connection.php');
$Mainclass=new DB_Controller();
//$Mainclass->Check_Login();
$Dealer=$_COOKIE['O_Code'];


$SqCheckIndent="select * from gold_indent_master where Order_No='".$_REQUEST['Order_No']."'";
$RsCheckIndent=mysqli_query($Mainclass->dbh,$SqCheckIndent);
$FchIndent=mysqli_fetch_array($RsCheckIndent);



$FetchDealerCon=" Order_Code= '".$FchIndent['Dealer_Code']."'";
$Field_Needed="State,Dealer_Name,Dealership,Dealer_Address_Line1,Dealer_Address_Line2,Dealer_City,Dealer_Pin,Dealer_GST,Dealer_Phone,Dealer_Type";
//$DeaerDtl=$Mainclass->Fetch_needed_data_condition('dealer_master',$Field_Needed,$FetchDealerCon);
$DeaerDtl=$Mainclass->Fetch_individual_data('dealer_master',$Field_Needed,$FetchDealerCon);
?>

<!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>

<script>
 function Print() 
	  { 
	  // alert(1);  
	  
	  $('#print_stn_btn').hide();
	  
	  var divToPrint = document.getElementById('printdiv');              
	  
	  var popupWin = window.open('', '_blank');      
	  
	  popupWin.document.open();
	  
	  popupWin.document.write('<html><body onload="window.print()">' + divToPrint.innerHTML + '</html>');
	  
	  popupWin.document.close();
	  } 
</script>
  <script src="./dist/js/jquery-latest.min.js"></script>
 <script type="text/javascript" src="./dist/js/jquery-barcode.js"></script>

<script type="text/javascript">
  function generateBarcode(per1){
	 
        
		 var value = per1;
		 var renderer = "css";
		 var btype ="code128";
		
        var settings = {
          output:renderer,
        };
       
		$("#barcodeTarget").html("").show().barcode(value, btype, settings);
		
	
      }
	  
</script>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body style="margin:0px; padding:0px;" onload="generateBarcode('<?php echo $FchIndent['Secret_Code']; ?>')">

<div id="printdiv">

<table width="1000" border="0" cellspacing="0" cellpadding="0" align="center">

<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
 <tr>
    <td colspan="2" style="font-family:Arial, Helvetica, sans-serif; text-align:center; font-size:16px; font-weight:600; color:#000000; padding-bottom:10px;">
	<?php
	if(strtoupper($DeaerDtl['Dealer_Type'])=="OWNED")
	{
	  echo "Stock Transfer Note";
	
	}
	else
	{
	   echo "Credit Bill (Tax Invoice)";
	   
	 }
	?>
	</td>
  </tr>
   <tr>
    <td colspan="2"><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:12px; line-height:20px; font-weight:500; color:#000000; padding-right:20px; text-transform:uppercase;">From :<br />
CHANDRANI PEARLS PVT LTD (HO)<br />
2016, RAJDANGA Main Road<br />
Block GA-88, Chandrani house<br />
Kolkata - 700107<br />
West Bengal (19)<br />
Phone : (033) 4031 4444<br />
GST : 19AAECC9607L1Z7<br />
CIN : U74999WB2011PTC165200</td>
    <td width="50%" style="font-family:Arial, Helvetica, sans-serif; text-align:left; font-size:12px; line-height:20px; font-weight:500; color:#000000; text-transform:uppercase;">To : <br />
  <?php echo $DeaerDtl['Dealership']; ?> (<?php echo $FchIndent['Dealer_Code']; ?>)<br />
<?php echo $DeaerDtl['Dealer_Address_Line1']; ?><br />
<?php echo $DeaerDtl['Dealer_Address_Line2']; ?><br />
<?php echo $DeaerDtl['Dealer_City']; ?> - <?php echo $DeaerDtl['Dealer_Pin']; ?>
<?php echo $DeaerDtl['State']; ?> (19)<br />
Phone : <?php echo $DeaerDtl['Dealer_Phone']; ?><br />
<?php echo $DeaerDtl['Dealer_GST']; ?>
</td>
  </tr>
</table>
</td>
  </tr>
  <tr>
    <td colspan="2" style="padding-top:15px; padding-bottom:5px;"><table width="400" border="0" cellspacing="0" cellpadding="0">
	
	<?php
	if($FchIndent['Bill_No']!='')
	{
	?>
  <tr>
    <td width="100" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px; letter-spacing:1px;">Bill No</td>
    <td width="300" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px; letter-spacing:2px;">:&nbsp; <?php echo $FchIndent['Bill_No']; ?></td>
  </tr>
    <?php
	}
	?>
  <tr>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px; letter-spacing:1px;">Date</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px; letter-spacing:2px;">:&nbsp; <?php echo date('d/m/Y',strtotime($FchIndent['Dispatched_Date'])); ?></td>
  </tr>
  <tr>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px; letter-spacing:1px;">Ref No.</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px; letter-spacing:2px;">:&nbsp; <?php echo $FchIndent['STN_NO']; ?> <?php if($FchIndent['Consignment_Stn']==1){ echo "(Consignment Stn)"; } ?></td>
  </tr>
<tr>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px; letter-spacing:1px;">Date</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px; letter-spacing:2px;">:&nbsp; <?php echo date('d/m/Y',strtotime($FchIndent['Dispatched_Date'])); ?></td>
  </tr>
</table></td>
    
  </tr>
</table>


</td>
</tr>
  <tr>
    <td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0" >
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	
	<tr>
	<td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px; letter-spacing:1px;">Gold Rate as on <?php echo date('d/m/Y',strtotime($FchIndent['Dispatched_Date'])); ?> </td>
	</tr>
	
	
  
   <tr>
     <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px; letter-spacing:1px;">
	 <?php
	  $i=1;
	  $SqlGoldRate="Select gold_purity, gold_rate from  gold_indent_details where Order_No='".$_REQUEST['Order_No']."' group by gold_purity";
      $RsGoldRt=mysqli_query($Mainclass->dbh,$SqlGoldRate);
	  $CountGoldRt=mysqli_num_rows($RsGoldRt);
      while($FetchGoldRt=mysqli_fetch_array($RsGoldRt))
     {
	?>
	 <?php echo $FetchGoldRt['gold_purity']; ?>  : Rs. <?php echo $FetchGoldRt['gold_rate']; ?> 
	 
	  <?php
	  
	  if(($CountGoldRt!=$i) && $CountGoldRt>1)
	  {
		  echo "|";
	  }
	  
	  $i++;
	   }
     ?>
	 </td>
   </tr>
   
  
  

 
  <tr>
    <td style="padding-top:10px;"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px; text-transform:capitalize; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000; ">Sl.</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;">Item Code</td>
   <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;">Mfac. Date</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;">HSN Code</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000; ">Qty</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;">Rate</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000; ">Discount</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;">Net Amt</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;">SGST</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;">CGST</td>
	 <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;">IGST</td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;  border-right:1px dashed #000000;">Final Amt</td>
  </tr>
  
  <?php



/*
$SqIndent="select * from order_master where Order_No='".$_REQUEST['Order_No']."'";
$RsCheckIndent=mysqli_query($Mainclass->dbh,$SqIndent);
$FchIndent=mysqli_fetch_array($RsCheckIndent);*/

$Dealer_Name=$FchIndent['Dealer_Name'];


$FetchDealerCon=" Dealer_Name= '".$Dealer_Name."'";
$Field_Needed="Order_Code,Dealer_Credit_Limit";
//$DeaerDtl=$Mainclass->Fetch_needed_data_condition('dealer_master',$Field_Needed,$FetchDealerCon);

$DeaerDtl=$Mainclass->Fetch_individual_data('dealer_master',$Field_Needed,$FetchDealerCon);

$AvailableCr=$DeaerDtl['Dealer_Credit_Limit'];;


$Dealer_Code=$DeaerDtl['Order_Code'];


$condition="Order_No='".$_REQUEST['Order_No']."'";



$condition.=" order by Product_Code";

//$Get_Count=$Mainclass->Dealer_Challan_No('indent_details',$condition);

//$Get_Dealers_Stock=$Mainclass->Challan_det_return('indent_details',$condition);

$Get_Dealers_Stock=$Mainclass->Fetch_multiple_data('gold_indent_details','*',$condition);

/*if($Get_Dealers_Stock>0)

{	*/
$x=1;
$i=1;
$OrderQty=0;
$Rate=0;
$TotalItem=0;
$TotalDiscount=0;
$TotalAmt=0;
$Total_CGST=0;
$Total_SGST=0;
foreach($Get_Dealers_Stock as $stock)

	{
       $Condition=" Product_Code ='".$stock['Product_Code']."' and Dealer_Code='".$Dealer_Code."'"; 
      // $Get_Quantity=$Mainclass->Challan_Details('dealer_stock_master',$Condition);
	   
	   $Get_Quantity=$Mainclass->Fetch_individual_data('dealer_stock_master','*',$Condition);
	   
	   
	   //$PMSDCondition=" Product_Code ='".$stock['Product_Code']."'"; 
	 //  $PMSD_QTY=$Mainclass->Challan_Details('product_master_pmsd ',$PMSDCondition);
	
	
	
         $TotalItem=$TotalItem+$stock['Order_Quantity'];
		 $TotalDiscount=$TotalDiscount+$stock['Discount'];
		 $TotalAmt=$TotalAmt+$stock['Total'];
		 $FinalTotal=$FinalTotal+$stock['Order_Total'];
		 $Total_CGST=$Total_CGST+$stock['CGST'];
		 $Total_SGST=$Total_SGST+$stock['SGST'];
		 $Total_IGST=$Total_IGST+$stock['IGST'];
		 
		 // $Rate=$Rate+$stock['Price'];
?>
  <tr>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px;border-left:1px dashed #000000;"><?php echo $i;?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px; border-left:1px dashed #000000;"><?php echo $stock['Product_Code'];?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px; border-left:1px dashed #000000;"></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px; border-left:1px dashed #000000;"><?php echo $stock['HSN_Code'];?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-left:1px dashed #000000;"><?php echo $stock['Order_Quantity'];?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px; border-left:1px dashed #000000;"><?php echo $stock['Price'];?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-left:1px dashed #000000;"><?php echo $stock['Discount'];?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px; border-left:1px dashed #000000;"><?php echo $stock['Total'];?></td>
     <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-left:1px dashed #000000;"><?php echo $stock['SGST'];?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px; border-left:1px dashed #000000;"><?php echo $stock['CGST'];?></td>
	 <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px; border-left:1px dashed #000000;"><?php echo $stock['IGST'];?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px;border-left:1px dashed #000000; border-right:1px dashed #000000;"><?php echo $stock['Order_Total'];?></td>
  </tr>  
<?php 

$i++;
$x++;
}
?>
  
 
   <!--<tr>
    <td colspan="10" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:5px 0px; letter-spacing:1px;font-weight:600; "><table width="99%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td style="height:1px; background-color:#000000;"></td>
  </tr>
</table></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:5px 0px; letter-spacing:1px; font-weight:600;" >Cont Page......2</td>
  </tr>-->
  
  
  
  
   
   <tr>
    <td colspan="11" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:5px 0px 5px 5px; letter-spacing:1px;font-weight:500; border-left:1px dashed #000000; border-right:1px dashed #000000;  text-transform:uppercase;"><!--Being Goods Sent to CP <?php echo $FchIndent['Dealer_Code']; ?> <br />
THROUGH SHOWROOM PERSON--></td>
  </tr>
  
  <tr>
    <td colspan="4" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px; text-transform:capitalize; border-top:1px dashed #000000; font-weight:600; "></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000;font-weight:600;"><?php echo $TotalItem; ?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; font-weight:600; "></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; font-weight:600;"><?php echo $TotalDiscount; ?></td>
    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; font-weight:600; "><?php echo $TotalAmt; ?></td>
    
            <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; font-weight:600; "><?php  echo $Total_SGST; ?></td>
			    <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; font-weight:600; "><?php echo $Total_CGST; ?></td>
				<td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 3px 3px 0px; border-top:1px dashed #000000; font-weight:600; "><?php echo $Total_IGST; ?></td>
                <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;padding:3px 3px 3px 0px; border-top:1px dashed #000000; font-weight:600; "><?php echo $FinalTotal; ?></td>
  </tr>
  
  <?php
  $Sql_Stk="select sum(id.Order_Total) as Order_Total from gold_indent_details id inner join order_details od where id.Product_Code=od.Product_Code and id.Order_No='".$_REQUEST['Order_No']."' and od.Order_No='".$FchIndent['Ref_Order_No']."'";
  $Rs_Stk=mysqli_query($Mainclass->dbh,$Sql_Stk);
  $FchStk=mysqli_fetch_array($Rs_Stk);
  $StkTotal=$FchStk['Order_Total'];
  
  $SqlOrderDtl="select sum(Order_Price) as DealerOrderTotal from order_details where Order_No='".$FchIndent['Ref_Order_No']."'";
  $RsOrderDtl=mysqli_query($Mainclass->dbh,$SqlOrderDtl);
  $FchOrderDtl=mysqli_fetch_array($RsOrderDtl);
  
  $DealerOrderTotal=$FchOrderDtl['DealerOrderTotal'];
  
  $PerStk=round(($StkTotal/ $DealerOrderTotal)*100);
  
  if($FchIndent['Ref_Order_No']!='')
  {
  ?>
  
  <tr>
    <td colspan="11" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px ; font-weight:500;">Indent Stk Rs.<?php echo $StkTotal; ?> (<?php echo $PerStk; ?>%) Out of Rs.<?php echo $DealerOrderTotal; ?> on MRP</td>
  </tr>
  <?php
  }
  ?>
  
  <tr>
    <td colspan="11" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 0px; text-transform:capitalize; border-bottom:1px dashed #000000; font-weight:600; "> Total</td>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 0px; text-transform:capitalize; border-bottom:1px dashed #000000; font-weight:600; "><?php echo $FinalTotal; ?></td>  
  </tr>
  <?php
   if($FchIndent['Ref_Order_No']!='')
  {
  ?>
    <tr>
    <td colspan="11" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px ; font-weight:500;">(PRO. STN : <?php echo $FchIndent['Temp_Stn_No']; ?>)</td>
  </tr>
  <?php
  }
  ?>
  
  
   
  
</table>
</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  
  <tr>
    <td>
	<table width="200" border="0" cellspacing="0" cellpadding="0">
	
	<tr>
	<td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px; text-transform:capitalize; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000; ">Comp. </td>
	<td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;">Wt </td>
	<td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;padding:3px 3px 3px 0px; border-top:1px dashed #000000; border-bottom:1px dashed #000000; font-weight:600; border-left:1px dashed #000000;  border-right:1px dashed #000000;">Value </td>
	
	</tr>
	
	 <?php
  $SqlTotalGold="Select gold_purity,sum(gold_wt) as total_gold_wt, sum(total_gold_value) as total_gold_value from  gold_indent_details where Order_No='".$_REQUEST['Order_No']."' group by gold_purity";
  $RsTotalGold=mysqli_query($Mainclass->dbh,$SqlTotalGold);
  while($FetchTotalGold=mysqli_fetch_array($RsTotalGold))
  {
  ?>
  <tr>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px;border-left:1px dashed #000000;"><?php echo $FetchTotalGold['gold_purity']; ?> Gold</td>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px;border-left:1px dashed #000000;"><?php echo $FetchTotalGold['total_gold_wt']; ?> g</td>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px;border-left:1px dashed #000000; border-right:1px dashed #000000;"><?php echo $FetchTotalGold['total_gold_value']; ?></td>
  </tr>
  <?php
  }
  $SqlTotalDia="Select diamond_carat, sum(total_diamond_value) as total_diamond_value from  gold_indent_details where Order_No='".$_REQUEST['Order_No']."' and total_diamond_value>0 group by diamond_carat";
  $RsTotalDia=mysqli_query($Mainclass->dbh,$SqlTotalDia);
  while($FetchTotalDia=mysqli_fetch_array($RsTotalDia))
  {
	?>  
	 <tr>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px;border-left:1px dashed #000000;"><?php echo $FetchTotalDia['diamond_carat']; ?>ct Diamond</td>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px;border-left:1px dashed #000000;">-</td>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px;border-left:1px dashed #000000; border-right:1px dashed #000000;"><?php echo $FetchTotalDia['total_diamond_value']; ?></td>
  </tr>

<?php	
  } 
  $SqlTotalDia="Select sum(stone_value) as total_stone_value from  gold_indent_details where Order_No='".$_REQUEST['Order_No']."' and stone_value>0";
  $RsTotalDia=mysqli_query($Mainclass->dbh,$SqlTotalDia);
  while($FetchTotalDia=mysqli_fetch_array($RsTotalDia))
  {
 ?>
 
<tr>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px;border-left:1px dashed #000000;">Stone</td>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px;border-left:1px dashed #000000;">-</td>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px;border-left:1px dashed #000000; border-right:1px dashed #000000;"><?php echo $FetchTotalDia['total_stone_value']; ?></td>
  </tr>
<?php
  }	 
  $SqlTotalDia="Select sum(Solitaire_Value) as total_solitaire_value from  gold_indent_details where Order_No='".$_REQUEST['Order_No']."' and Solitaire_Value>0";
  $RsTotalDia=mysqli_query($Mainclass->dbh,$SqlTotalDia);
  while($FetchTotalDia=mysqli_fetch_array($RsTotalDia))
  {  
  ?>
  <tr>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px;border-left:1px dashed #000000;">Solitaire</td>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:3px 0px;border-left:1px dashed #000000;">-</td>
  <td style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000;  padding:3px 3px 3px 0px;border-left:1px dashed #000000; border-right:1px dashed #000000;"><?php echo $FetchTotalDia['Solitaire_Value']; ?></td>
  </tr>
  
  <?php
  }
  ?>
	
	<tr><td colspan="3" style="border-top:1px dashed #000000;"></td></tr>
	</table>
	</td>
  </tr>
  
  
 
  
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="60%" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:20px 0px 0px; letter-spacing:1px; bfont-weight:600;">Receive Signature with Stamp</td>
    <td width="40%" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:center; color:#000000; padding:20px 0px 0px; letter-spacing:1px; bfont-weight:600;">Signature</td>
  </tr>
</table>
</td>
  </tr>
  
</table></td>
  </tr>
  
</table></td>
   
  </tr>
  <tr>
    <td width="60%"  style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:left; color:#000000; padding:3px 0px ; font-weight:500;"><table width="500" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100">KEY No.<br />
C_<?php echo $FchIndent['Toal_Product_Weight']; ?>(<?php echo $FchIndent['Total_Weight']; ?>)</td>
    <td width="400">&nbsp;<div id="barcodeTarget" class="barcodeTarget"><?php echo $FchIndent['Secret_Code']; ?></div></td>
  </tr>
  <tr>
  <td width="100"><?php echo $FchIndent['Courier_Name']; ?></td>
  <td>
  <?php
if($FchIndent['Shipment_No']!='')
{
  echo "(".$FchIndent['Shipment_No'].")";

}

?>
  </td>
  </tr>
</table></td>
    <td width="40%" style="font-family:Arial, Helvetica, sans-serif; font-size:12px; text-align:right; color:#000000; padding:3px 0px ; font-weight:500; line-height:18px;">Made By : <?php echo $FchIndent['Scan1_By']; ?><br />
Chk By : <?php echo $FchIndent['Scan2_By']; ?><br />
Printed on: <?php echo date('d M, Y H:i:s'); ?></td>
  </tr>
  
  <tr>
    <td colspan="2" style="padding-top:20px; padding-bottom:20px;"><table width="50" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td><input name="" type="button" value="PRINT" onClick="Print()" id="print_stn_btn"/></td>
  </tr>
</table></td>
   
  </tr>
</table>








</div>






</body>
</html>
