
 <?php extract($_POST);
$PageSecurity = 1;
 
global $db;?>

<?php 

 $Vendor_Quot_No=$_REQUEST['VQuotesId'];


 ?>
 <form action="" method="post">
<?php 
if($_REQUEST['idfy_quotes']=='QUOT')
{
     $sql_po = "Select * from venderquotations where id='".$_GET['VQuotesId']."'";

	
	
	$result=DB_query($sql_po,$db);
	$myrow=DB_fetch_array($result);
	//echo "<pre>";
	//print_r($myrow);
	
	$date1=$myrow['date1'];
	$date2=$myrow['date2'];
	$sitecode= $myrow['sitecode'];
	$mst_supplierno =$myrow['mst_supplierno'];
	$sitename= $myrow['site'];
	$vernder_quotation=$myrow['vernder_quotation'];
	$event=$myrow['event'];
	$billingType=$myrow['billingType'];
	$party_no=$myrow['party_no'];
	$party_date=$myrow['party_date'];
	$payment_term=  $s->GetFieldValue('paymentterms',"termsindicator ='".$myrow['payment_term']."'" ,'terms');
	$quotationcategory=$myrow['quotationcategory'];
	$basis=$myrow['basis'];
	$warramtydetails=$myrow['warramtydetails'];
	$deliveryterms=$myrow['deliveryterms'];
	$payment_mode=  $s->GetFieldValue('paymentmethods',"paymentid ='".$myrow['payment_mode']."'" ,'paymentname');
	$validtill=$myrow['validtill'];
	$remarks=$myrow['remarks'];
	$warramtydetails =$myrow['warramtydetails '];
	$site_sql="Select * from locations where loccode='".$sitecode."'";
	$site_res=DB_query($site_sql,$db);
	$site_row=DB_fetch_array($site_res);
	$vendor_detail = "Select * from suppliers where id='".$mst_supplierno."'";
	$result_vendor=DB_query($vendor_detail,$db);
	$myrow_vendor=DB_fetch_array($result_vendor);
	$vendor_code=$myrow_vendor['vendor_code'];
	$vendor_name=$myrow_vendor['vendor_name'];
	$phone1=$myrow_vendor['phone1'];  
	$adrress1=$myrow_vendor['adrress1'];
	$adrress2=$myrow_vendor['adrress2'];
	$address3=$myrow_vendor['address3'];
	$phone2=$myrow_vendor['phone2'];  
	$mobile=$myrow_vendor['mobile'];
	$tin_no=$myrow_vendor['tin_no'];  
	$fax=$myrow_vendor['fax'];
    $email=$myrow_vendor['email'];	                           
	$vendor_quotation_no=$myrow['vendor_quotation_no'];
	$dateprinted=$myrow['dateprinted'];
	$stat_comment=$myrow['stat_comment'];
	$vendor_payment_terms=$myrow_vendor['payterms'];
}
else
{
	$sql_ammend = "Select * from vendor_quotes_ammendment where id='".$_GET['VQuotesId']."'";
	$ammend_result=DB_query($sql_ammend,$db);
	$recEditrow=DB_fetch_array($ammend_result);
	 
	$sitecode=$recEditrow['sitecode'];
	$sitename=$recEditrow['sitename'];
	$date1=$recEditrow['quotation_date'];
	$vernder_quotation=$recEditrow['vernder_quotation'];
	$vendor_code=$recEditrow['vendor_code'];
	$vendor_name=$recEditrow['vendor_name'];
	$mst_supplierno=$recEditrow['mst_supplierno'];
	$basis=$recEditrow['basis'];
	$requisition_id=$recEditrow['requisition_id'];
	$requisition_no=$myrow2['requisition_no'];;
	$date2= $myrow2['requisition_date'];
	$pay_terms=$recEditrow['pay_terms'];
	$payment_mode=$recEditrow['payment_mode'];
	$party_quotation_no=$recEditrow['party_quotation_no'];
	$party_quotation_date=$recEditrow['party_quotation_date'];
	$total_amount=$recEditrow['total_amount'];
	$surcharge_amount=$recEditrow['surcharge_amount'];
	$freight=$recEditrow['freight'];
	$pkg_charges=$recEditrow['pkg_charges'];
	$additional_charges=$recEditrow['additional_charges'];
	$round_off=$recEditrow['round_off'];
	$grand_total=$recEditrow['grand_total'];
	$VenderQutation_TermCondition=$recEditrow['VenderQutation_TermCondition'];
}
 ?>
<link rel="stylesheet" href="css/new_mxerp.css">
<div class="body_contain">
<div class="tab_div">
<h1>View Vendor Quotation</h1>
 <table width="100%" border="0" cellpadding="3" cellspacing="0">
  <tr class="row1">
    <td class="tabledata1" ><strong>Site Code </strong></td>
    <td><?php echo $sitecode;?>&nbsp;</td>
    <td class="tabledata1" ><strong>Site Name </strong></td>
    <td><?php echo $sitename?>&nbsp;</td>
	 <td class="tabledata1" ><strong>Quotation No.</strong></td>
    <td><?php echo $vernder_quotation?></td>
	 <td class="tabledata1" ><strong>Quotation Date </strong></td>
    <td><?php echo ConvertSQLDate($date1)?></td>
  </tr>
<tr class="row1">
    <td class="tabledata1" ><strong>Vendor Code </strong></td>
    <td><?php echo $vendor_code?>&nbsp;</td>
    <td class="tabledata1" ><strong>Vendor Name </strong></td>
   <td><?php echo $vendor_name?>&nbsp;</td>
    <td class="tabledata1" ><strong>Requisition No</strong></td>
    <td><?php echo $vendor_code?></td>
    <td class="tabledata1" ><strong>Requisition Date </strong></td>
    <td><?php echo ConvertSQLDate($date2)?></td>
  </tr>
<tr class="row1">
    <td class="tabledata1" ><strong>Category</strong></td>
    <td><?php echo $quotationcategory?></td>
    <td class="tabledata1" ><strong>Basis</strong></td>
    <td><?php echo $basis?></td>
    <td class="tabledata1" ><strong>Valid Date </strong></td>
    <td><?php echo ConvertSQLDate($validtill)?></td>
    <td class="tabledata1" ><strong>Waranty Details </strong></td>
    <td><?php echo $warramtydetails?></td>
  </tr>
<tr class="row1">
    <td class="tabledata1" ><strong>Payment Terms </strong></td>
    <td><?php echo $payment_term?></td>
    <td class="tabledata1" ><strong>Payment Mode </strong></td>
    <td><?php echo $payment_mode?></td>
    <td class="tabledata1" ><strong>Party Number</strong></td>
    <td><?php echo $party_no?></td>
    <td class="tabledata1" ><strong>Party Date</strong></td>
    <td><?php echo ConvertSQLDate($party_date);?></td>
  </tr>
<tr class="row1">
    <td class="tabledata1" ><strong>Remark</strong></td>
    <td><?php echo $remarks?></td>
   <td class="tabledata1" ><strong>Delivery Terms</strong></td>
    <td><?php echo $deliveryterms?></td>
    <td class="tabledata1" ><strong>Event</strong></td>
    <td><?php echo $event?></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
 <tr class="row1">
 	<td colspan="8">Item Details</td>
 </tr>
  <tr class="row1">
 	<td colspan="8">
	<div style="width:858px; overflow:auto; margin-left:auto; margin-right:auto;">	 
  	<table width="100%" border="0" cellpadding="5">
    <tr>
      <th><strong>Item Code</strong></th>
      <th><strong>Item Name</strong></th>
      <th><strong>Item No</strong></th>
      <th><strong>Make</strong></th>
      <th><strong>Color</strong></th>
      <th><strong>Grade</strong></th>
      <th><strong>Unit</strong></th>
	  <th><strong>Length</strong></th>
 	  <th><strong>Width </strong></th>
	  <th><strong>Origanal/Local</strong></th>
	  <th><strong>Quality </strong></th>
      <th><strong>Quantity</strong></th>
      <th><strong>Rate</strong></th>
      <th><strong>Discount Type</strong></th>
      <th><strong>Discount</strong></th>
      <th><strong>Discount Amount</strong></th>
       <th><strong>SubTotal</strong></th>
	 	<th><strong>SPECIAL DISCOUNT Type</strong></th>
	   <th><strong>Special <br />Discount<br />Per</strong></th>
	   <th><strong>Special <br />Discount<br />Amount</strong></th>
	 <th ><strong>BASIC AMOUNT</strong></th>
	<th ><strong>Tax Type</strong></th>
	<th><strong>Excise</strong></th>
					<th><strong>E-Cess</strong></th>
					
					<th><strong>SAH-E Cess</strong></th>
					
					<th><strong>Taxable Amount </strong></th>
										
					<TH><strong>TOTAL AMOUNT</strong></TH>
					

     
    </tr>
			<?php 
		if($_REQUEST['idfy_quotes']=='QUOT')
{	 
 $vend_sql="SELECT * FROM venderquotations WHERE id='".$Vendor_Quot_No."'";
 
}
else {
	 $vend_sql="SELECT * FROM vendor_quotes_ammendment WHERE id='".$Vendor_Quot_No."'";
	
	}
$result_vend=DB_query($vend_sql,$db);
$myrowvender=DB_fetch_array($result_vend);
//echo "<pre>";
//print_r($myrowvender);
if($_REQUEST['idfy_quotes']=='QUOT')
{
$basic_amt  =$myrowvender['basic_amt'];
$ExcisePercentage  =$myrowvender['ExcisePercentage'];
$Excise_Duty_value  =$myrowvender['Excise_Duty_value'];
$Edu_Cess_perc  =$myrowvender['Edu_Cess_perc'];
$Edu_Cess  =$myrowvender['Edu_Cess'];
$SHE_Cess_perc  =$myrowvender['SHE_Cess_perc'];
$SHE_Cess  =$myrowvender['SHE_Cess'];
$taxable_amt  =$myrowvender['taxable_amt'];
$taxname  =$myrowvender['taxname'];
$taxvalue  =$myrowvender['taxvalue'];
$sur_oct_perc  =$myrowvender['sur_oct_perc'];
$sur_oct_amt  =$myrowvender['sur_oct_amt'];
$totalcharge  =$myrowvender['totalcharge'];
$pkg_charges  =$myrowvender['pkg_charges'];
$add_charges  =$myrowvender['add_charges'];
$vat_cst_amount=$myrowvender['vat_cst_amount'];
$vat_cst_per=$myrowvender['vat_cst_per'];
$grand_total   = $myrowvender['grand_total']; 
$totalamount  = $myrowvender['total_amt'];

$billingType= $myrowvender['billingType'];
}
else {
$basic_amt  =$myrowvender['basic_amt'];
$ExcisePercentage  =$myrowvender['ExcisePercentage'];
$Excise_Duty_value  =$myrowvender['Excise_Duty_value'];
$Edu_Cess_perc  =$myrowvender['Edu_Cess_perc'];
$Edu_Cess  =$myrowvender['Edu_Cess'];
$SHE_Cess_perc  =$myrowvender['SHE_Cess_perc'];
$SHE_Cess  =$myrowvender['SHE_Cess'];
$taxable_amt  =$myrowvender['taxable_amt'];
$taxname  =$myrowvender['taxname'];
$sur_oct_amt  =$myrowvender['sur_oct_amt'];
$taxvalue  =$myrowvender['taxvalue'];
$sur_oct_perc  =$myrowvender['sur_oct_perc'];

$totalcharge  =$myrowvender['freight'];
$pkg_charges  =$myrowvender['pkg_charges'];
$add_charges  =$myrowvender['additional_charges'];
$vat_cst_amount=$myrowvender['vat_cst_amount'];
$vat_cst_per=$myrowvender['vat_cst_per'];
$grand_total   = $myrowvender['grand_total']; 
$totalamount  = $myrowvender['total_item_amount'];

$billingType= $myrowvender['billingType'];
}

  // $Vendor_Quot_No=$s->GetFieldValue('comprative_detail',"comprative_id='".$_REQUEST['CPID']."'",'Vendor_Quot_No');
  //SELECT * FROM vendorquotationdetails WHERE quotation_no='".$Vendor_Quot_No."' and   FIND_IN_SET( mst_productid,'$ITEMLIST' );
if($_REQUEST['idfy_quotes']=='QUOT'){
$sql="SELECT * FROM vendorquotationdetails WHERE quotation_no='".$Vendor_Quot_No."' ";
}else{
$sql="SELECT * FROM vendor_quotes_ammendment_details WHERE vendor_quotes_ammendment_id='".$Vendor_Quot_No."'  ";

}

$result=DB_query($sql,$db);
$i=1;
while($myrow=DB_fetch_array($result))
{
//echo "<pre>";
//print_r($myrow);
if($i%2==0)
{$bg="#CCCCCC";}
else
$bg="#C8BECB";
?>
  <tr bgcolor="<?php echo $bg;?>">
    <td><?php if($_REQUEST['idfy_quotes']=='QUOT'){  echo $myrow['prod_id']; ?>
        <input type="hidden" name="ProductID[<?php echo $i;?>]2" size="10" value="<?php echo $myrow['prod_id'];?>" readonly />
    <?php } else { echo $myrow['item_code'];?>
    <input type="hidden" name="ProductID[<?php echo $i;?>]2" size="10" value="<?php echo $myrow['item_code'];?>" readonly />
  	<?php }?>
    </td>
    <td><?php if($_REQUEST['idfy_quotes']=='QUOT'){  echo $myrow['prod_dec']; ?>
    	
        <input type="hidden" name="ProductDes[<?php echo $i;?>]2" size="45" value="<?php echo $myrow['prod_dec'];?>" readonly />
         <?php } else { echo $myrow['item_name'];?>
          <input type="hidden" name="ProductDes[<?php echo $i;?>]2" size="45" value="<?php echo $myrow['item_name'];?>" readonly />
       
         <?php } ?>
        </td>
    <td><?php echo $myrow['item_no']; ?></td>
    <td><?php 
	  $makename=$s->getField('product_manufacture','id',$myrow['make'],'manufacturer');
	  echo $makename;?>
        <input type="hidden" name="make[<?php echo $i;?>]2" size="45" value="<?php echo $myrow['make'];?>" readonly /></td>
    <td><?php 
	  $colorname=$s->getField('product_color','id',$myrow['color'],'color');
	  echo $colorname;?>
        <input type="hidden" name="color[<?php echo $i;?>]2" size="45" value="<?php echo $myrow['color'];?>" readonly /></td>
    <td><?php 
	  $gradename=$s->getField('product_grade','id',$myrow['grade'],'grade');
	  echo $gradename;?>
        <input type="hidden" name="grade[<?php echo $i;?>]2" size="45" value="<?php echo $myrow['grade'];?>" readonly /></td>
      <td><?php 
	  $unitname=$s->getField('unitsofmeasure','unitid',$myrow['uom'],'unitname');
	  echo $unitname;?>
        <input type="hidden" name="unit[<?php echo $i;?>]2" size="45" value="<?php echo $myrow['uom'];?>" readonly /></td>
    <?php $query_item=DB_query("select * from item_master where StockID='".$myrow['prod_id']."'", $db);
		  	$item_row=DB_fetch_array($query_item);
		   ?>
    <td><?php echo $item_row['length'];?> </td>
    <td><?php echo $item_row['width'];?> </td>
    <td><?php echo $item_row['orig_local'];?> </td>
    <td><?php echo $item_row['quality'];?> </td>
    <td><input type="hidden" name="quantity[<?php echo $i;?>]2" size="5" value="<?php echo $myrow['quantity'];?>" id="quantity[<?php echo $i;?>]" readonly />
        <?php echo $myrow['quantity'];?></td>
    <td><?php echo $myrow['rate'];?>
        <input type="hidden" name="Rate[<?php echo $i;?>]2" id="Rate[<?php echo $i;?>]" value="<?php echo $myrow['rate'];?>" size="4" readonly/>
    </td>
    <td><?php
      if($_REQUEST['idfy_quotes']=='AMD')
	  {if($myrow['discount_per']=='0')
	  echo "N/A";
	  else
	  	{
	  echo $myrow['discount'];
	    $discounttype=$myrow['discount'];
		}
	  }	
else { 
	  if($myrow['discount']=='0')
	  echo "N/A";
	  else
	  	{
	  echo $myrow['discount_type'];
	  $discounttype=$myrow['discount_type'];
		}
	  }
	  ?>
        <input type="hidden" name="discount_type[<?php echo $i;?>]2" id="discount_type[<?php echo $i;?>]" value="<?php echo $discounttype;?>" readonly/>
    </td>
    <td><?php 
     if($_REQUEST['idfy_quotes']=='AMD')
	 {
	 if($myrow['discount']=="PercentAmt")
  {?>
        <?php echo $myrow['discount_per'];?>%
      <input type="hidden" name="Discount[<?php echo $i;?>]2" id="Discount[<?php echo $i;?>]" value="<?php echo $myrow['discount_per'];?>" onblur="DiscountAmount(this.value,<?php echo $i;?>)" size="8" readonly />
        <?php 	 }
else 
{?>
        <?php echo $myrow['discount_pe'];?>
        <input type="hidden" name="Discount[<?php echo $i;?>]2" id="Discount[<?php echo $i;?>]" value="<?php echo $myrow['discount_per'];?>" onblur="DiscountAmount(this.value,<?php echo $i;?>)" size="8" readonly />
        <?php }	
	 }
	 else
	  {
	if($myrow['discount_type']=="PercentAmt")
  {?>
        <?php echo $myrow['discount'];?>%
      <input type="hidden" name="Discount[<?php echo $i;?>]2" id="Discount[<?php echo $i;?>]" value="<?php echo $myrow['discount'];?>" onblur="DiscountAmount(this.value,<?php echo $i;?>)" size="8" readonly />
        <?php 	 }
else 
{?>
        <?php echo $myrow['discount'];?>
        <input type="hidden" name="Discount[<?php echo $i;?>]2" id="Discount[<?php echo $i;?>]" value="<?php echo $myrow['discount'];?>" onblur="DiscountAmount(this.value,<?php echo $i;?>)" size="8" readonly />
        <?php } } ?></td>
    <td><?php echo $myrow['discount_amount'];?>
        <input type="hidden" id="discount_amount[<?php echo $i;?>]" name="discount_amount[<?php echo $i;?>]2" value="<?php echo $myrow['discount_amount'];?>" readonly/></td>
         <td><?php echo $myrow['sub_total'];?></td> 
      <td><?php echo $myrow['specialdis_type']; ?></td>
     <td><?php echo $myrow['specialdiscount']; ?></td>
       <td><?php echo $myrow['specialdiscount_amount']; ?>
        <input type="hidden" id="specialdiscount_amount[<?php echo $i;?>]" name="specialdiscount_amount[<?php echo $i;?>]2" value="<?php echo $myrow['specialdiscount_amount'];?>" size="8" readonly/></td>
     <td><?php if($_REQUEST['idfy_quotes']=='QUOT'){ echo $myrow['basic_amt']; } else { echo $myrow['basic_amount']; } ?></td>
     <td><?php echo $myrow['tax_type']; ?></td>
     <td>
     	<?php if($_REQUEST['idfy_quotes']=='QUOT'){  echo $myrow['Excise_Duty_value']; } else { echo $myrow['excise_value'];}?>
    	
     	</td>
     <td><?php if($_REQUEST['idfy_quotes']=='QUOT'){  echo $myrow['Edu_Cess']; } else { echo $myrow['ecess_value'];}?>
    	     	
     	</td>
     <td><?php if($_REQUEST['idfy_quotes']=='QUOT'){  echo $myrow['SHE_Cess']; } else { echo $myrow['sah_ecess_value'];}?>
    	 
     	</td>
     <td>
     	<?php if($_REQUEST['idfy_quotes']=='QUOT'){  echo $myrow['taxable_amt']; } else { echo $myrow['taxable_amount'];}?>
    	 
     	</td>
     
    
   
    <td><?php echo $myrow['total_amount']; ?></td>
    <?php 
	  
	    
$i++;
}?>
    <input type="hidden" name="PO_count2" value="<?php echo $i;?>" />
  </tr>
</table>
	</div>
</td>
 </tr>
 <tr class="row1">
 	<td colspan="8">
		<table width="100%" cellpadding="3" cellspacing="0">
			<tr class="row1">
				<td width="50%">&nbsp;</td>
				<td width="50%">
				<table width="100%" cellpadding="3" cellspacing="0">
					<tr class="row1">
					    <td class="tabledata1" ><strong>TOTAL AMOUNT</strong></td>
					   <td ><?php echo $totalamount ;?></td>
					</tr>
					<tr class="row1">
                    	 <td class="tabledata1" ><strong>Pkg Charges</strong></td>
                  		 <td><?php echo $pkg_charges ;?></td>
                	</tr>
				<tr class="row1">
                 <td class="tabledata1" >Vat/Cst (description)</td>		
				 <td><?php $val1=$s->getField('service_tax_master','id',$vat_cst_per,'tax_code');
						$val2= $s->getField('service_tax_master','id',$vat_cst_per,'taxrate');
						echo $val1 ."---".$val2; ?>		
				</td>
				</tr>
		<tr class="row1">
		<td class="tabledata1" >Vat/Cst Amount</td>
		<td><?php echo $vat_cst_amount; ?> </td>	
			</tr>
		<tr class="row1">
                 <td class="tabledata1" ><strong>Surcharge Amount</strong></td>
                  <td><?php echo $sur_oct_amt ;?></td>
        </tr>
		<tr class="row1">
                  <td class="tabledata1" ><strong>Freight</strong></td>
                  <td><?php echo $totalcharge; ?></td>
       </tr>
        <tr class="row1">
                  <td class="tabledata1" ><strong>Additional Charges</strong></td>
                  <td><?php echo $add_charges;?></td>
         </tr>
			
			<tr class="row1">
			<td class="tabledata1" >Grand Total</th>
			<td><?php echo $grand_total; ?></td>
		</tr>
				
			</table>
				</td>
			</tr>
		</table>
	</td>
 </tr>
</table>
 </form>
 </div>
 </div>