<?php $ReqType =''; 
$CompanyAddress = '';
$dt = new DateTime('now', new DateTimeZone('Asia/Kolkata'));				
$CurrentDate =  $dt->format('Y-m-d');
$MaxPoDate = '';
$AvlAmount = 0;
if(!empty($MaxPODate))
{
    foreach ($MaxPODate as $date)
    {
		$MaxPoDate = $date->PODate;		
	}
}
if(!empty($CompanyDetails))
{
    foreach ($CompanyDetails as $Req)
    {
		$CompanyAddress = $Req->Address;
	}
}
if(!empty($AvlBudAmt))
{
   
		$AvlAmount = $AvlBudAmt;		
	
}
?>
<style>
            .modal
{
	padding-right:25% ! important;
}
.dataTables_paginate
{
	    margin-top: -5%;
}
.dataTables_wrapper {
    padding-bottom: 0px;
}
.select2{
	width:100% ! important;
}
</style>

<script>
 $(document).ready(function(){

        //Initialize Select2 Elements
		$("#drpSupplier").select2();
     	$("#Reqnumber").select2();
     	$("#CapitalCostCenter").select2();
		$("#MaterialCode").select2();
		 $("#currencytype").select2();
	 
         $("#PODate").datepicker({
            //minDate : d,
            maxDate : 'now',
            dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
        });
        $("#Deliverydt").datepicker({
            minDate : 'now',
            dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
        });
		$('#Date').click(function () {
                    //for Date range selection
                    $('#Schedulediv').hide();
                    $('#Deliverydtdiv').show();
                });
                $('#Schedule').click(function () {
                    //for schedule range selection
                    $('#Deliverydtdiv').hide();
                    $('#Schedulediv').show();
                });

    });
</script>
<div class="content-wrapper">
         <?php
                      $attributes = array('class' => 'form-label-left ImportPO ','name'  => 'ImportPO','id'  => 'ImportPO');
                        
                        echo form_open($this->config->base_url().'/purchaseorder/addPO/',$attributes); ?>
 
 
	 <section class="content">
	  
	 <div style="border:2px solid #333">
			<div class="col-md-12">
				 
				 <center><b><h2>Siddharth Industries - Capital Purchase Order</h2></b></center>
				 
				<!-- <div class="col-md-1"><br/>
				 <a class="btn btn-info" href="<?php echo base_url(); ?>purchaseorder/CreatecapitalPOPrint" target="_blank">Print</a>
				</div> -->
			</div>
         <div class="container-fluid">
		<div class="row">
	<div class="col-md-12">
	<div class="col-md-3">
		<div class="col-md-12">
		<label>Requistion No</label>						 						
							 <?php
							 
							  $options = array("0"=>'Selected Requisition Numbers'); 
								 if(!empty($ReqList))
						{
						foreach ($ReqList as $SID):
						  
					  // print_r($SID->ReqNo);
						   $options[$SID->ReqNo] = $SID->ReqNo ."-". $SID->ReqBy;
                           $ReqType = $SID->ReqType;
						endforeach;
						}	
							echo form_multiselect('RequistionNo', $options,set_value('RequistionNo'),'id="RequistionNo"' , 'required="true"');

							?>
		</div>
		<div class="col-md-12">
				<label>Currency Type</label> 
                <div class="form-group">                     
					 


 <?php
                                $options = array("0"=>'Select Currency Type ');
                                //print_r(  $options);

                                if(!empty($Currency))
                                {
                      
                                    foreach ($Currency as $Cur):

                                        $options[$Cur->CurrencyCode] =  $Cur->CurrencyCode.' '.' - '.' '.$Cur->CurrencyName;

                                    endforeach;
                                }

                                echo form_dropdown('currencytype', $options,set_value('currencytype'),'id="currencytype"','class="form-control select2"' , 'required="true"');

                                ?>	
                     
                </div>
		</div>	
		<div class="col-md-12">
			<a href="http://www.xe.com/" target="_blank"><u>Click here to check Today's Foreign Exchange value</u></a>		
		</div>				 
	</div>
	<div class="col-md-9">
		<div class="col-md-4">
			<div class="col-md-12">
				<label>Supplier</label>
					 
						 <?php
						$options = array("0"=>'Select Supplier');     
						//print_r(  $options);
						
						if(!empty($Suplist))
						{
						foreach ($Suplist as $SID):
						  
					   
						  $options[$SID->SupplierID] =  $SID->SupplierID.' '.' - '.' '.$SID->SupplierName;

						endforeach;
						}										
			
						echo form_dropdown('drpSupplier', $options,set_value('drpSupplier'),'id="drpSupplier"'  ,'required="true"' ,'class="form-control select2');

						?>						 
					 
			</div>
			<div class="col-md-12"><br/>
				<label>Address</label>
					<div class="form-group">
								<?php
						 $data = array('name' => 'SupAddress','value' => set_value('SupAddress'),'id'=>'SupAddress',  'class' => 'form-control' ,'readonly' => 'true','rows' => '3', 'cols' => '40');
						echo Form_textarea($data);
						?>   
					</div>
			</div>
			<div class="col-md-12">
				<label>Exchange Rate </label> 
				<div class="form-group">
					<?php
					$data = array('name' => 'ExchangeRt','value' => set_value('ExchangeRt'),'id'=>'ExchangeRt',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
					echo form_input($data);
					?>
				</div>
				 
			</div>
		</div>
		<div class="col-md-4">
			<div class="col-md-12">
				 <label>Purchase Order Type</label>
						<div class="form-group">
						
									<?php
							 $data = array('name' => 'POType','value' => set_value('POType',CAPITAL),'id'=>'POType',  'class' => 'form-control' ,'readonly' => 'true');
							echo form_input($data);
							?>   
						</div>
			</div>
			<div class="col-md-12">
				 <label>Delivery Address</label>
					<div class="form-group">
								<?php
						 $data = array('name' => 'DeliveryAddr','value' => set_value('DeliveryAddr',$CompanyAddress),'id'=>'DeliveryAddr',  'class' => 'form-control' ,'required' => 'true', 'rows' => '3', 'cols' => '40');
						echo Form_textarea($data);
						?>   
					</div>
			</div>
			<div class="col-md-12">
				<label>Purchase Order Date</label>
						<div class="form-group">
									<?php
							 $data = array('name' => 'PODate','value' => set_value('PODate',$CurrentDate),'id'=>'PODate',  'class' => 'form-control' ,'required' => 'true', 'onkeypress'=>'return false;');
							echo form_input($data);
							?>   
						</div>
			</div>
		</div>
		<div class="col-md-4">
			<div class="col-md-12">

                            <b><u>Select Delivery By</u></b><br/>
                            <tr>
                                <td>
                                    <?php echo form_label('Date', 'Date') ."&nbsp;&nbsp;". form_radio(array("name"=>"DateRange", "id"=>"Date", "value"=>"0", 'checked'=>set_radio('DateRange', '0', TRUE))); ?>&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                <td>
                                    <?php echo form_label('Schedule', 'Schedule') ."&nbsp;&nbsp;". form_radio(array("name"=>"DateRange", "id"=>"Schedule", "value"=>"1", 'checked'=>set_radio('DateRange', '1', FALSE))); ?>

                                </td>
                            </tr>
                        </div>
            
				<div class="col-md-12" id="Schedulediv" style="display:none;"><br/>
						<label >Schedule :</label>
						 
						<?php
						$data = array('name' => 'Scheduleby','value' => set_value('Scheduleby'),'id'=>'Scheduleby',  'class' => 'form-control' ,'required' => 'true' ,'rows' => '3', 'cols' => '40');
						echo Form_textarea($data);
						?>

				</div>
				<div class="col-md-12" id="Deliverydtdiv"><br/>
                            <label>Delivery Date</label>
                             
                                <?php
                                $data = array('name' => 'Deliverydt','value' => set_value('Deliverydt',$CurrentDate),'id'=>'Deliverydt',  'class' => 'form-control'  ,'required' => 'true');
                                echo form_input($data);
                                ?>
                             
                </div>
			 
		</div>
		
	</div>
	</div>	   
    </div>
         </div>
		 <div class="col-md-12">
		<div align="right">
<a data-toggle="modal" ><button type="submit"  onclick="myFunction();" class="btn btn-primary" id="abcd" >Select Line Item</button> </a> 
		</div>
<br>
  </div>
	 <div class="box-body">
              <table id="serviceTax" class="table table-bordered table-hover" style="background-color:#fff;font-size:12px;">
                <thead style="background-color:#ddf">
                <tr>
					<th>SNo</th>
					<th>Requisition No</th>
					<th>Item Name</th>
					<th>Quantity</th>
					<th>UOM</th>
					<th>Rate</th>
					<th>Basic Amount</th>
				    <th>Tax Amount</th>
					<th>Total Order Amount</th>
					<th>Action</th>
                </tr>
                </thead>				
               
             <tbody id='ImportAppend'>     
    
			</tbody>
              </table>
            </div>
          <div class="container-fluid">  
 	 <table class="table table-bordered" style="border:1px solid #333">
  <div align="right" style="padding-right:10px">
<div align="right">
   
  
     <div class="modal fade" id="CAPITAL" role="dialog">
                            <div class="modal-dialog">
                                <!-- Modal content-->
                                <form>
                                    <div class="modal-content" style="width:900px;">
                                        <div class="modal-header" style="background-color: #3c8dbc;color:#fff;">
                                            <button type="button" class="close" data-dismiss="modal">&times;</button>
                                            <center><h4>Add Capital Purchase Order Item </h4></center>
                                        </div>
                                        <div align="left">
                                            <div class="col-md-12">											 
												<div class="col-md-12">
													<div class="col-md-5">
														<div class="col-md-6">
															<label>Req No</label>
															<div>
																
                                                                                    <?php
											$RL = array("0"=>'Select Req No');     
											if(!empty($RequistionDetails))
											{
											foreach ($RequistionDetails as $SID):			   
												$RL[$SID->ReqNo] =  $SID->ReqNo.' '.' - '.' '.$SID->DepartmentName;
											endforeach;
											}
							
											echo form_dropdown('Reqnumber', $RL,set_value('Reqnumber'),'id="Reqnumber"' ,'class="form-control select2 required"');

										?>	



															</div>
														</div>
														<div class="col-md-6">
															<label>Department Name</label>
																<div>
																	<?php
																	$data = array('name' => 'CapitalDepartmentName','value' => set_value('CapitalDepartmentName'),'id'=>'CapitalDepartmentName',  'class' => 'form-control' ,'readonly' => 'true');
																	echo form_input($data);
																	?>
																</div>
														</div>
													</div>
													<div class="col-md-5">
														<div class="col-md-6">
															<label>Cost Center Name</label>
																<div>
																	<?php
																														
																	 $data = array('name' => 'CostCenter','value' => set_value('CostCenter'),'id'=>'CostCenter',  'class' => 'form-control' ,'readonly' => 'true');
																	echo form_input($data);

																	?>
																</div>
														</div>
														<div class="col-md-6">
															<label>Avail Bud Amount</label>
															<div class="form-group">
																<?php
																$data = array('name' => 'CapitalbudAmt','value' => set_value('CapitalbudAmt'),'id'=>'CapitalbudAmt',  'class' => 'form-control' ,'readonly' => 'true');
																echo form_input($data);
																?>
															</div>
														</div>
													</div>
													<div class="col-md-2">
														<label> Exchange Rate</label> 
                                                    <div class="form-group">
                                                        <?php
                                                        $data = array('name' => 'ExchangeRtModal','value' => set_value('ExchangeRtModal'),'id'=>'ExchangeRtModal',  'class' => 'form-control' ,'readonly' => 'true');
                                                        echo form_input($data);
                                                        ?>
                                                    </div>
													</div>
												</div>
                                            </div>
                                            <div class="col-md-12">
											<div class="col-md-12">
                                                <div class="col-md-2">
                                                    <label>Item Code</label>                                                     
                                                        <div>                                                        
														<?php
                                                        $options = array("0"=>'Item Code');
                                                        echo form_dropdown('MaterialCode', $options,set_value('MaterialCode'),'id="MaterialCode"' ,'class="form-control select2"');
                                                        ?>
														</div> 
                                                </div>
                                                <div class="col-md-2">
                                                    <label>Item Name</label>
                                                    <div class="form-group">
                                                        <?php
                                                        $data = array('name' => 'CapitalItemName','value' => set_value('ICapitalItemName'),'id'=>'CapitalItemName',  'class' => 'form-control' ,'readonly' => 'true');
                                                        echo form_input($data);
                                                        ?>
                                                    </div>
                                                </div>
                                                <div class="col-md-2">
                                                    <label>UOM</label>
                                                    <div class="form-group">
                                                        <?php
                                                        $data = array('name' => 'CPUOM','value' => set_value('CPUOM'),'id'=>'CPUOM',  'class' => 'form-control' ,'readonly' => 'true');
                                                        echo form_input($data);
                                                        ?>
                                                    </div>
                                                </div>
                                                <div class="col-md-2">
                                                    <label>Quantity</label>
                                                    <div class="form-group">
                                                        <?php
                                                        $data = array('name' => 'CPQuantity','value' => set_value('CPQuantity'),'id'=>'CPQuantity',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Ratechange();');
                                                        echo form_input($data);
                                                        ?>
                                                    </div>
                                                </div>
                                                <div class="col-md-2">
                                                    <label>Rate(in US $ /Ton)</label>
                                                    <div class="form-group">
                                                        <?php
                                                        $data = array('name' => 'CPRate','value' => set_value('CPRate'),'id'=>'CPRate',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);','onchange'=>'Ratechange();' );
                                                        echo form_input($data);
                                                        ?>
                                                    </div>
                                                </div>
                                                <div class="col-md-2">
                                                    <label>Basic value in INR</label>
                                                    <div class="form-group">
                                                        <?php
                                                        $data = array('name' => 'CPTotalAmount','value' => set_value('CPTotalAmount'),'id'=>'CPTotalAmount',  'class' => 'form-control'  ,'readonly' => 'true');
                                                        echo form_input($data);
                                                        ?>
                                                    </div>
                                                </div>
												</div>
                                            </div>
                                            <div class="col-md-12">											
												<div class="col-md-12"  style="border:1px solid #000;padding:0px;">
													<div class="col-md-5">
														<div class="col-md-6">
															Service Tax ( ST ) @ 14% :
															 <div class="form-group">
																			<?php
																	 $data = array('name' => 'AfterServiceTax','value' => set_value('AfterServiceTax'),'id'=>'AfterServiceTax',  'class' => 'form-control' ,'placeholder' => 'After Service Tax','readonly' => 'true');
																	echo form_input($data);
																	?>   
																</div>	
														</div>
														<div class="col-md-6">
															Education cess @2% on ST : 
															<div class="form-group">
																<?php
																 $data = array('name' => 'AfterEduCess','value' => set_value('AfterEduCess'),'id'=>'AfterEduCess',  'class' => 'form-control' ,'placeholder' => 'After Edu. cess','readonly' => 'true');
																echo form_input($data);
																?>   
															</div>
														</div>
													</div>
													<div class="col-md-5">
														<div class="col-md-6">
															Sec. & Higher Edu. cess @1 % on ST  :			  
															<div class="form-group">
																		<?php
																 $data = array('name' => 'AfterSecHighTax','value' => set_value('AfterSecHighTax'),'id'=>'AfterSecHighTax',  'class' => 'form-control' ,'placeholder' => 'After High Edu. cess','readonly' => 'true');
																echo form_input($data);
																?>   
															</div>
														</div>
														<div class="col-md-6">
															Krishi Kalyan tax  @.5 % on Basic Account(BA):			  
																<div class="form-group">
																			<?php
																	 $data = array('name' => 'AfterKrishiTax','value' => set_value('AfterKrishiTax'),'id'=>'AfterKrishiTax',  'class' => 'form-control' ,'placeholder' => 'After Krishi Kalyan tax.','readonly' => 'true');
																	echo form_input($data);
																	?>   
																</div>
														</div>
													</div>
													<div class="col-md-2">
													 Swachh Bharat tax @.5 % on BA:			  
														<div class="form-group">
																	<?php
															 $data = array('name' => 'AfterSwachhTax','value' => set_value('AfterSwachhTax'),'id'=>'AfterSwachhTax',  'class' => 'form-control' ,'placeholder' => 'After Swatchh Bhart Tax.','readonly' => 'true');
															echo form_input($data);
															?>   
														</div>	
													</div>
												</div>
												<div class="col-md-12" style="padding:1%;" ></div>
                                                <div class="col-md-12"  style="border:1px solid #000;padding:0px;">
                                                    <br/>
                                                    <div class="col-md-6" style="padding:0px;">
                                                        <div class="col-md-12">
                                                            <div class="col-md-4" >
                                                                Basic Price:
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'BasicPriceTax','value' => set_value('BasicPriceTax'),'id'=>'BasicPriceTax',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AfterBasicPriceTax','value' => set_value('AfterBasicPriceTax'),'id'=>'AfterBasicPriceTax',  'class' => 'form-control' ,'readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                Landing charge
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'LandingCharge','value' => set_value('LandingCharge'),'id'=>'LandingCharge',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);' ,'onchange'=>'Ratechange();');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AfterLandingCharge','value' => set_value('AfterLandingCharge'),'id'=>'AfterLandingCharge',  'class' => 'form-control'  ,'readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                High seas sales charge
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'Highseas ','value' => set_value('Highseas'),'id'=>'Highseas',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);' , 'onchange'=>'Ratechange();');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AfterHighseas','value' => set_value('AfterHighseas'),'id'=>'AfterHighseas',  'class' => 'form-control' ,'readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                Custom duty : (a)
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'Customduty','value' => set_value('Customduty'),'id'=>'Customduty',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AfterCustomduty','value' => set_value('AfterCustomduty'),'id'=>'AfterCustomduty',  'class' => 'form-control' ,'readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                Excise duty : (b)
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'ExcisedutyTax','value' => set_value('ExcisedutyTax'),'id'=>'ExcisedutyTax',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AfterExcisedutyTax','value' => set_value('AfterExcisedutyTax'),'id'=>'AfterExcisedutyTax',  'class' => 'form-control' ,'readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                Excise duty ED_cess : (C)
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'ExcisedutyEDcess','value' => set_value('ExcisedutyEDcess'),'id'=>'ExcisedutyEDcess',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AfterExcisedutyEDcess','value' => set_value('AfterExcisedutyEDcess'),'id'=>'AfterExcisedutyEDcess',  'class' => 'form-control','readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                Excise duty S & H cess :(d)
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'ExcisedutySHcess','value' => set_value('ExcisedutySHcess'),'id'=>'ExcisedutySHcess',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AfterExcisedutySHcess','value' => set_value('AfterExcisedutySHcess'),'id'=>'AfterExcisedutySHcess',  'class' => 'form-control' ,'readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                Custom ED_cess : (e)
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'CustomEDcess','value' => set_value('CustomEDcess'),'id'=>'CustomEDcess',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AfterCustomEDcess','value' => set_value('AfterCustomEDcess'),'id'=>'AfterCustomEDcess',  'class' => 'form-control' ,'readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                Custom S & H cess : (f)
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'CustomSHcess','value' => set_value('CustomSHcess'),'id'=>'CustomSHcess',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AfterCustomSHcess','value' => set_value('AfterCustomSHcess'),'id'=>'AfterCustomSHcess',  'class' => 'form-control' ,'readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                    <div class="col-md-6" style="padding:0px;">
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                Additional Excise duty : (g)
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AdditionalExciseduty ','value' => set_value('AdditionalExciseduty'),'id'=>'AdditionalExciseduty',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AfterAdditionalExciseduty','value' => set_value('AfterAdditionalExciseduty'),'id'=>'AfterAdditionalExciseduty',  'class' => 'form-control' ,'readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-8">
                                                                Gross duty payable
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'Grossdutypayable ','value' => set_value('Grossdutypayable'),'id'=>'Grossdutypayable',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-8">
                                                                Available Modvat set-off on import :
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'AvailableModvat','value' => set_value('AvailableModvat'),'id'=>'AvailableModvat',  'class' => 'form-control' ,'readonly' => 'true');
                                                                    echo form_input($data);
                                                                    ?>   (b + c + d + g)
                                                                </div>
                                                            </div>

                                                        </div>
                                                        <div class="col-md-12">

                                                            <div class="col-md-8">
                                                                Gross expenses due to custom duty:
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'Grossexpenses','value' => set_value('Grossexpenses'),'id'=>'Grossexpenses',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                        </div>

                                                        <div class="col-md-12">
                                                            <center> <label>Cost of the product Per KG</label></center>
                                                            <hr/>
                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                purchase rate [Basic]
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'purchaserate','value' => set_value('purchaserate'),'id'=>'purchaserate',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>
                                                            <div class="col-md-4"  style="margin-top: -4.8%">
                                                                <span>Quantity</span>
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'PurQuantity','value' => set_value('PurQuantity'),'id'=>'PurQuantity',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>

                                                        </div>
                                                        <div class="col-md-12">

                                                            <div class="col-md-4">
                                                                Custom Duty Expenses
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'CustomDutyExpenses ','value' => set_value('CustomDutyExpenses'),'id'=>'CustomDutyExpenses',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>

                                                        </div>
                                                        <div class="col-md-12">
                                                            <div class="col-md-4">
                                                                RMC Including Customers
                                                            </div>
                                                            <div class="col-md-4">
                                                                <div class="form-group">
                                                                    <?php
                                                                    $data = array('name' => 'RMCIncludingCustomers','value' => set_value('RMCIncludingCustomers'),'id'=>'RMCIncludingCustomers',  'class' => 'form-control' ,'onkeypress'=>'return isNumberKey(event);');
                                                                    echo form_input($data);
                                                                    ?>
                                                                </div>
                                                            </div>


                                                        </div>


                                                    </div>
                                                </div>
                                            </div>

                                        </div>
                                        <div class="modal-footer">
                                            <a class="btn btn-info font AddCapital"  ID="AddCapital"  ><i class="fa fa-plus"></i>&nbsp;&nbsp;<span class="bold">Add Capital</span></a>
                                            <a class="btn btn-info" data-dismiss="modal"  value="Cancel">Cancel</a>

                                        </div>
                                    </div>
                                </form>

                            </div>
                        </div>		  
  </div>
</div>
   
   
   <br/>
    	
	   
  </table>
       
				<div class="col-md-12"  style="border: 1px solid;">			
					<div class="col-md-4">
						 Service Tax @14% :					  
						 <div class="form-group">
											<?php
									 $data = array('name' => 'TotalAfterServiceTax','value' => set_value('TotalAfterServiceTax'),'id'=>'TotalAfterServiceTax',  'class' => 'form-control' ,'placeholder' => 'After Service Tax','readonly' => 'true');
									echo form_input($data);
									?>   
								</div>			  
					</div>			  
					<div class="col-md-4">
						Education cess @2% on service Tax : 
						<div class="form-group">
							<?php
							 $data = array('name' => 'TotalAfterEduCess','value' => set_value('TotalAfterEduCess'),'id'=>'TotalAfterEduCess',  'class' => 'form-control' ,'placeholder' => 'After Edu. cess','readonly' => 'true');
							echo form_input($data);
							?>   
						</div>
					</div>
					<div class="col-md-4">
						Sec. & Higher Edu. cess @1 % on service Tax  :			  
						<div class="form-group">
									<?php
							 $data = array('name' => 'TotalAfterSecHighTax','value' => set_value('TotalAfterSecHighTax'),'id'=>'TotalAfterSecHighTax',  'class' => 'form-control' ,'placeholder' => 'After High Edu. cess','readonly' => 'true');
							echo form_input($data);
							?>   
						</div>
					</div>
					<div class="col-md-4">
							Krishi Kalyan tax  @.5 % on Basic Amount:			  
							<div class="form-group">
										<?php
								 $data = array('name' => 'TotalAfterKrishiTax','value' => set_value('TotalAfterKrishiTax'),'id'=>'TotalAfterKrishiTax',  'class' => 'form-control' ,'placeholder' => 'After Krishi Kalyan tax.','readonly' => 'true');
								echo form_input($data);
								?>   
							</div>
					</div>
					<div class="col-md-4">
						Swachh Bharat tax @.5 % on Basic Amount:			  
						<div class="form-group">
									<?php
							 $data = array('name' => 'TotalAfterSwachhTax','value' => set_value('TotalAfterSwachhTax'),'id'=>'TotalAfterSwachhTax',  'class' => 'form-control' ,'placeholder' => 'After Swatchh Bhart Tax.','readonly' => 'true');
							echo form_input($data);
							?>   
						</div>			 
					</div>
				</div>
					<div class="col-md-12" style="padding:1%;" ></div>
		<div class="col-md-12" style="border: 1px solid;padding:1% 0%;">
			 
            <div class="col-md-4">
              <label >Total Landing Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotallanding','value' => set_value('txttotallanding'),'id'=>'txttotallanding',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>

            <div class="col-md-4">
              <label >Total High seas sales Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalhighseas','value' => set_value('txttotalhighseas'),'id'=>'txttotalhighseas',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>

            <div class="col-md-4">
              <label >Total Custom Duty Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalcustom','value' => set_value('txttotalcustom'),'id'=>'txttotalcustom',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>

            <div class="col-md-4">
              <label >Total Excise duty  Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalexcise','value' => set_value('txttotalexcise'),'id'=>'txttotalexcise',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>

            <div class="col-md-4">
              <label >Total Excise duty ED_cess Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalexciseED','value' => set_value('txttotalexciseED'),'id'=>'txttotalexciseED',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>


            <div class="col-md-4">
              <label >Total Excise duty S & H cess  Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalexciseSH','value' => set_value('txttotalexciseSH'),'id'=>'txttotalexciseSH',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>

            <div class="col-md-4">
              <label >Total Custom ED_cess Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalcustomED','value' => set_value('txttotalcustomED'),'id'=>'txttotalcustomED',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>

            <div class="col-md-4">
              <label >Total Custom S & H cess Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalcustomSH','value' => set_value('txttotalcustomSH'),'id'=>'txttotalcustomSH',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>

            <div class="col-md-4">
              <label >Total Additional Excise duty Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalAdditionalExciseduty','value' => set_value('txttotalAdditionalExciseduty'),'id'=>'txttotalAdditionalExciseduty',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>


            <div class="col-md-4">
              <label >Total Gross duty payable Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalgrossduty','value' => set_value('txttotalgrossduty'),'id'=>'txttotalgrossduty',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>

             <div class="col-md-4">
              <label >Total Available Modvat set-off on import Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalavlmodvat','value' => set_value('txttotalavlmodvat'),'id'=>'txttotalavlmodvat',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>


            <div class="col-md-4">
              <label >Total Gross expenses due to custom duty Charge  :</label> 
                                            
                            <?php
                         $data = array('name' => 'txttotalgrossexpense','value' => set_value('txttotalgrossexpense'),'id'=>'txttotalgrossexpense',  'class' => 'form-control'   ,'readonly' => 'true','style'=>'text-align:right;');
                        echo form_input($data);
                        ?>                      
            </div>
        

           

                    <div  class="col-md-4">
                            <label>Total Order Value :</label>  <?php
                         $data = array('name' => 'txtToatlOrder','value' => set_value('txtToatlOrder'),'id'=>'txtToatlOrder',  'class' => 'form-control' ,'required' => 'true','readonly' => 'true');
                        echo form_input($data);
                        ?>   
                    </div>
                
                      <div class="col-md-12">
                            <label>Comments for Special Instructions :</label>  <?php
                         $data = array('name' => 'txtSpcialInstruction','value' => set_value('txtSpcialInstruction'),'id'=>'txtSpcialInstruction',  'class' => 'form-control','rows' => '3', 'cols' => '40' );
                        echo form_textarea($data);
                        ?>   
                      </div>   
                      
					<!-- <div align="right" style="padding-right:10px">

					<div class="col-md-3 col-md-offset-9"><br/>
							<input type="hidden" name="txtPoRange" id="txtPoRange" /> 
							<input type="hidden" name="isEdit" id="isEdit" value="0" /> 
							<input type="hidden" name="txtStatus" id="txtStatus" /> 
							<input type="hidden" name="txtRowCount" id="txtRowCount" />
							<input type="hidden" name="txtDeletedRow" id="txtDeletedRow" />   
							<a class="btn btn-primary Save"  ID="Save" onclick="Save(0)" >&nbsp;&nbsp;<span class="bold">Save</span></a> 
							<a class="btn btn-primary Submit"  ID="Submit" onclick="Save(1)" >&nbsp;&nbsp;<span class="bold">Submit</span></a> 
						<input type="reset" class="btn btn-primary" value="Reset">
					  
					  </div>
            </div>  -->
			
         
		</div>
      
		  
	    <div align="right" style="padding:1% 0%;"> 
				<a class="btn btn-primary Save"  ID="Save" >&nbsp;&nbsp;<span class="bold">Save</span></a> 
				<a class="btn btn-primary Submit"  ID="Submit" >&nbsp;&nbsp;<span class="bold">Submit</span></a> 
				<input type="reset" class="btn btn-primary" value="Reset">
    
			</div>
         <br/>
	 </div>
         </div>
    </section>   
</div>
 <script src="<?php echo base_url(); ?>assets/js/CreatePOValidation.js" type="text/javascript"></script>
<script>
var RequistQuantity = '';
var AvilBudAmt = '';
 var POMaxDate = '<?php echo $MaxPoDate;?>';
  var d = new Date(POMaxDate);
   var SelectedMaterialCode = [];
 var CollIndex = 0;
  var SelectedMaterialList = {
    Mat: []
};
 $(function() {  
 
 $("#PODate").datepicker({
	minDate : d,
	maxDate : 'now',
	dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,yearRange: '-100:+0'
});
 $("#Deliverydt").datepicker({
	minDate : 'now',	
	dateFormat: 'mm/dd/yy',changeMonth: true, changeYear: true,yearRange: '0:+10'
});	  
	
$('#drpSupplier').change(function() {
    
 var id = $('#drpSupplier').val();

 $("#SupAddress").val('');
 
		if(id != '0')
		{
			var y = <?php echo json_encode($Suplist, JSON_PRETTY_PRINT) ?>;

	 			
		$.each(y, function(idx, obj) {
			if(obj.SupplierID === id)
			{
				$("#SupAddress").val(obj.Address);
				
			}
			
		});
			
		}
		else
		{
			alert('Please select the SupplierID');
			return false;
		}
  
});	

$('#Reqnumber').change(function() {
var ExchangeRate='';
    var ExchangeRate = $('#ExchangeRt').val();
 var id = $('#Reqnumber').val();

 $("#CapitalbudAmt").val('');
$("#ExchangeRtModal").val(ExchangeRate);

  $("#MaterialCode").empty();
  $("#CapitalDepartmentName").val('');
 $("#CPUOM").val('');
$("#CPQuantity").val('');
$("#CapitalItemName").val('');
$("#CPTotalAmount").val('');
$("#txtBasicValue").val('');
 $("#CostCenter").val('');
 clearTaxField();
		if(id != '0')
		{

			var y = <?php echo json_encode($RequistionDetails, JSON_PRETTY_PRINT) ?>;
			
			var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
			var AvlBudAmt = '<?php echo $AvlAmount ?>'; 
			
		// For Binding DepartmentName	           			
		$.each(y, function(idx, obj) {
			if(obj.ReqNo === id)
			{
				$("#CapitalDepartmentName").val(obj.DepartmentName);
				$("#CostCenter").val(obj.CostCenterCode);
				
			}			
		});
		$("#CapitalbudAmt").val(AvlBudAmt);	
			
			
		// For Binding Material list center for the selected Requistion Number	
		$("#MaterialCode").append( $('<option></option>').val("0").html("Select Material Code") );
		var isAdded = "0";
		 for(i=0;i<Material.length;i++)
		{
		$.each(Material[i], function(idx, obj) {
			
				if(obj.ReqNo === id )
				{
									   
						$.each(SelectedMaterialList.Mat, function(idx1, el){															
							if (id == el.ReqNo )
							{
															
								if(el.materialCode == obj.MaterialCode)
								{
										isAdded  = "1";
										return false;																		
								}
								else
								{
									isAdded  = "0";
								}
								
							}
					});
					
					 
						if(isAdded  == "0")
						{
							
							$("#MaterialCode").append( $('<option></option>').val(obj.MaterialCode).html(obj.MaterialCode + "-" + obj.MaterialName));
						}
												
				}
			
			
		});
		}
		}
		else
		{
			alert('Please select the Requisition Number');
			return false;
		}
		id = '';
  
});	
$('#MaterialCode').change(function() {
    
 var id = $('#MaterialCode').val();
  $("#CapitalItemName").val('');
$("#CPUOM").val('');
$("#CPQuantity").val('');
$("#CPTotalAmount").val('');
 RequistQuantity = '';
 clearTaxField();
		if(id != '0')
		{
			var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
			
	 for(i=0;i<Material.length;i++)
		{
		$.each(Material[i], function(idx, obj) {
			if(obj.MaterialCode === id)
			{
				$("#CapitalItemName").val(obj.MaterialName);
				$("#CPUOM").val(obj.UOM);
				$("#CPQuantity").val(obj.Quantity);
				RequistQuantity	= 	obj.Quantity;		
			}			
		});			
		}
		}
		else
		{
			alert('Please select the MaterialCode');
			return false;
		}
  
});


$('#EditMaterialCode').change(function() {

    
 var id = $('#EditMaterialCode').val();
 $("#EditItemName").val('');
$("#EditUOM").val('');
$("#EditQuantity").val('');
$("#EditRate").val('');
$("#txtEditBasicValue").val('');
 RequistQuantity = '';
 clearEditTaxField();
		if(id != '0')
		{
			var Material = <?php echo json_encode($MaterialList, JSON_PRETTY_PRINT) ?>;
			
	  for(i=0;i<Material.length;i++)
		{
		$.each(Material[i], function(idx, obj) {
			if(obj.MaterialCode === id)
			{
				$("#EditItemName").val(obj.MaterialName);
				$("#EditUOM").val(obj.UOM);
				$("#EditQuantity").val(obj.Quantity);
				RequistQuantity	= 	obj.Quantity;		
			}			
		});			
		}
		
		}
		else
		{
			alert('Please select the MaterialCode');
			return false;
		}
  
});


});
function clearTaxField()
{
	$('#CPTotalAmount').val('');
	$('#AfterServiceTax').val('');
	$('#AfterEduCess').val('');
	$('#AfterSecHighTax').val('');
	$('#AfterKrishiTax').val('');
	$('#AfterSwachhTax').val('');
	$('#BasicPriceTax ').val('');
	$('#AfterBasicPriceTax').val('');
	
	$("#LandingCharge").val('');
	$("#AfterLandingCharge").val('');
	$("#Highseas").val('');
$("#AfterHighseas").val('');
$("#Customduty").val('');
$("#AfterCustomduty").val('');
$("#ExcisedutyTax").val('');
$("#AfterExcisedutyTax").val('');
$("#ExcisedutyEDcess").val('');
$("#AfterExcisedutyEDcess").val('');
$("#ExcisedutySHcess").val('');
$("#AfterExcisedutySHcess").val('');
$("#CustomEDcess").val('');
$("#AfterCustomEDcess").val('');
$("#CustomSHcess").val('');
$("#AfterCustomSHcess").val('');
$("#AdditionalExciseduty").val('');
$("#AfterAdditionalExciseduty").val('');
$("#Grossdutypayable").val('');
$("#AvailableModvat").val('');
$("#Grossexpenses").val('');
$("#purchaserate").val('');
$("#CustomDutyExpenses").val('');
$("#RMCIncludingCustomers").val('');
$("#PurQuantity").val('');

	RequistQuantity	= 	'';	
	
}
/*

This function is used to validate all field

*/
function Ratechange(){
	 
		if($('#Reqnumber').val() == "0")
		 {
			 alert('Please select the Requisition Number');
			 $('#ReqNo').focus();
			 return false;
		 }
		 else if($('#MaterialCode').val() == "0")
		 {
			alert('Please select the Material Code');
			$('#MaterialCode').focus();
		   return false;
		 }
		 else if($('#CostCenter').val() == "0")
		 {
				alert('Please select the CostCenterCode');
				$('#CostCenter').focus();
			return false;
		 }
	 ExceedQuantityCheck();

      if(ExceedQuantityCheck()){
         
	  
	 if($('#CPQuantity').val() != '' && $('#CPRate').val() != ''  && $('#ExchangeRtModal').val() != '')
	 {	 
   
      var txtQuantity = parseFloat( $('#CPQuantity').val());
      var txtExchangeRate = parseFloat( $('#ExchangeRtModal').val());
      var RatePerTon = parseFloat( $('#CPRate').val());
	  //var txtUnitPrice = parseFloat($('#Rate').val());
	  var Tot =  txtQuantity * txtExchangeRate * RatePerTon
	  $('#CPTotalAmount').val(Tot);
	  
	 //Service Tax calculation
	    	 
        
	$('#AfterServiceTax').val(calculateServiceTax($('#CPTotalAmount').val())); 	 
	
	 //Edu. cess @2% on service Tax
	  $('#AfterEduCess').val( calculateEduess($('#AfterServiceTax').val()));
	
	 //Sec. & Higher Edu. cess @1 % on service Tax 
	
	$('#AfterSecHighTax').val(calculateHigherEdu($('#AfterServiceTax').val())); 
	 //Krishi Kalyan tax 
	
	$('#AfterKrishiTax').val(calculateKrishiKalyantax($('#CPTotalAmount').val())); 
	 //Swachh Bharat tax
	
	$('#AfterSwachhTax').val(calculateSwachhBharattax($('#CPTotalAmount').val()));
    
         // This is for import basic price
       
     $('#AfterBasicPriceTax').val(Math.round($('#CPTotalAmount').val()));

      if($('#LandingCharge').val()!='' && $('#AfterBasicPriceTax').val()!=''){
 $('#AfterLandingCharge').val(calculateLandingCharge($('#LandingCharge').val(),$('#AfterBasicPriceTax').val()));


if($('#Highseas').val()!='' && $('#AfterLandingCharge').val()!=''){
 $('#AfterHighseas').val(calculateHighseasCharge($('#AfterLandingCharge').val(),$('#AfterBasicPriceTax').val(),$('#Highseas').val()));

      }


       }
else{
alert('Please Enter Landing Charge ')
} 

 

      
	 
	 calculateTotalOrdervalue();
	 
	 var res = ExceedBudget($('#TotalOrderValue').val(), $('#CapitalbudAmt').val());
      if(!res)
	  {
		 $('#CPRate').focus();
		 return false;
	  }
	 }
}
else{
clearTaxField();
}
	 
}


/* This function used to check quantity exceeding or not */

function ExceedQuantityCheck()
 {
	var EnterQuantity =   $("#CPQuantity").val()== '' ? "0.00" :  parseFloat($("#CPQuantity").val());
	var ReqQuantity = parseFloat(RequistQuantity);
	//alert(ReqQuantity);
	if(EnterQuantity > ReqQuantity)
	{
		 alert('Your exceeding the Quantity from the Requisition Quantity:'+ RequistQuantity  +'.Please adjust the Quantity to proceed further.');
		
		  $('#Quantity').focus();
		 return false;
	}
	else {
		return true;
	}
 } 
/*
This function is used to calculate tax
*/
function calculateServiceTax(varBasicValue)
 {

	
		 var basicValue = parseFloat(varBasicValue);
			 
		 var ServiceTaxValue = 0.0;  
		 
		 ServiceTaxValue = <?php echo SERVICETAX_SERVICETAX_14PERCENT; ?>;
		
	     var TAXval =  parseFloat(ServiceTaxValue).toFixed(2);
	 
		return   TAXval;//  $('#AfterServiceTax').val(TAXval); 
		 
 }
  function calculateEduess(varAfterServiceTax)
 {
		 var ServiceTaxAmount = parseFloat(varAfterServiceTax);
			 
		 var ServiceTaxValue = 0.0;  
		 
		 ServiceTaxValue = <?php echo SERVICETAX_EDUCESS_2PERCENT; ?>;
		
	     var TAXval =  parseFloat(ServiceTaxValue).toFixed(2);
	 
		 return TAXval;// $('#AfterEduCess').val(TAXval); 
 }
   function calculateHigherEdu(varAfterServiceTax)
 {
	     var ServiceTaxAmount = parseFloat(varAfterServiceTax);
			 
		 var ServiceTaxValue = 0.0;  
		 
		 ServiceTaxValue = <?php echo SERVICETAX_HIGHEREDUCESS_1PERCENT; ?>;
		
	     var TAXval =  parseFloat(ServiceTaxValue).toFixed(2);
	 
		  return TAXval;//$('#AfterSecHighTax').val(TAXval); 
 }
 function calculateKrishiKalyantax(varBasicValue)
 {
	     var basicValue = parseFloat(varBasicValue);
			 
		 var ServiceTaxValue = 0.0;  
		 
		 ServiceTaxValue = <?php echo SERVICETAX_KRISHIKALYAN; ?>;
		
	     var TAXval =  parseFloat(ServiceTaxValue).toFixed(2);
	 
		 return TAXval;//$('#AfterKrishiTax').val(TAXval); 
 }
 function calculateSwachhBharattax(varBasicValue)
 {
		var basicValue = parseFloat(varBasicValue);
			 
		 var ServiceTaxValue = 0.0;  
		 
		 ServiceTaxValue = <?php echo SERVICETAX_SWACHHBHARAT; ?>;
		
	     var TAXval =  parseFloat(ServiceTaxValue).toFixed(2);
	 
		return TAXval; //$('#AfterSwachhTax').val(TAXval); 
 }
 
 /*
Calculate Landing charge
 */

 function calculateLandingCharge(landingCharge,basicValue){
  var landCharge = parseFloat(landingCharge);
  var basicPrice = parseFloat(basicValue);
afterLandingCharge = <?php echo Capital_Landing_Charge; ?>;

return parseFloat(afterLandingCharge).toFixed(2);


}
/*Calculate Highseas Charge*/
function calculateHighseasCharge(AfterLanding,basicPrice,Highseas){
var afterLandingCharge = AfterLanding;
var basicPrice = basicPrice;
var highSeas = Highseas;
alert(afterLandingCharge);
alert(basicPrice);
alert(highSeas);
var karthi = (afterLandingCharge+basicPrice) * (highSeas/100);
alert(karthi);
afterHighseasCharge = <?php echo Capital_Highseas_Charge; ?>;

return parseFloat(afterHighseasCharge).toFixed(2);

}
	
/*
This is used to calculate Total order value
*/
function calculateTotalOrdervalue()
 {
	var basicValue = parseFloat($('#CPTotalAmount').val());
	var ServiceTaxAmount = parseFloat($('#AfterServiceTax').val());
	var EduCessTaxAmount = parseFloat($('#AfterEduCess').val());
	var SecHighTaxAmount = parseFloat($('#AfterSecHighTax').val());
	var KrishiTaxAmount = parseFloat($('#AfterKrishiTax').val());
	var SwachhTaxAmount = parseFloat($('#AfterSwachhTax').val());

	var TotAmt = basicValue + ServiceTaxAmount+ EduCessTaxAmount + SecHighTaxAmount+ KrishiTaxAmount + SwachhTaxAmount;

	$('#TotalOrderValue').val( parseFloat(TotAmt).toFixed(2));   
		 
 }
</script>
