<?php 
$submit_url = $file_name."?page=view_payment&action=$action"; 
$status_submit_url = $file_name."?page=view_payment&name=$name"; 

?>
<div class="box-header" >
	<form action="<?php echo $submit_url;?>" method="post" name="search_form" id="search_form">
		<div class="col-sm-3">
			<label for="Payment Text" class="control-label">Description</label>
			<textarea class="form-control" rows="4" id="payment_text" name="payment_text" required><?php echo stripslashes($payment_text);?></textarea>
		</div>
		<div class="col-sm-3">
			<label for="Payment Date" class="control-label">Date</label>
			<input type="text" class="form-control datepicker" id="payment_date" name="payment_date" value="<?php (isset($payment_date) && $payment_date !="") ? utility::getFormatedDate($payment_date) : utility::getFormatedDate(date($config->dateFormat));?>" required>
			
			<label for="Payment Status" class="control-label">Status</label>
			<? $gsi->getPaymentStatusList("payment_status",$payment_status,"100%",false); ?>
		</div>
		<div class="col-sm-3">
			<label for="Amount" class="control-label">Amount</label>
			<input type="text" class="form-control" id="amount" name="amount" value="<?php echo $amount;?>" required/>
			
			<label for="For Invoice" class="control-label">For Invoice</label>
			<? $gsi->getInvoiceList("invoice_id",$invoice_id,"100%",false,"form-control",$job_id); ?>
		</div>
		<!--<div class="col-sm-3">
			<label for="Job" class="control-label">Job</label>
			<? //$gsi->getEnqQuoteJobList("job_id",$job_id,"100%",false); ?>
		</div>
		<div class="col-sm-3">
			<label for="Consultant" class="control-label">Consultant</label>
			<? //Admin::getAdminList("admin_id",$admin_id,"100%",false); ?>
		</div>-->
		<div class="col-sm-3">
			<div style="clear:both;margin-top:23px;"></div>
			<input type="hidden" id="id" name="id" value="<?php echo $id;?>">
			<input type="hidden" id="job_id" name="job_id" value="<?php echo $job_id;?>">
			<input type="hidden" id="query_string" name="query_string" value="<?php echo $query_string;?>">
			<input type="hidden" id="source" name="source" value="<?php echo $source;?>">
			<button type="submit" name="add_master_data" class="btn btn-primary"><?=$button_value?></button>
		</div>
	</form>
</div>
<script type="text/javascript">
$(function(){
	$("#invoice_id").change(function(){	
		var invoice_id = $(this).val();
		if(invoice_id != ""){
		var form_data   = {'invoice_id':invoice_id};       
			$.ajax({
				async: false,
				type: "POST",
				url: site_url+"/modules/payment_management/index.php?page=ajax_actions&action=get_invoice_price",
				data: form_data,
				success: function(result){          
					var resultObj = jQuery.parseJSON(result); 
					$("#amount").val(resultObj.invoice_amount);
				}
			});
		}else{
			$("#amount").val("");
		}
	});
});
</script>