<?php include("header.php"); ?>
<!--for datepicker-->
<script type="text/javascript" charset="utf-8">
jQuery(function($){
$(".date").datepicker();
});
</script>

<?php
$exp_id = $_POST['id'];
?>

<?php $exps = mysql_query("SELECT * FROM expenses where exp_id = '$exp_id'") or die(mysql_error());  ?>

			<?php $exp = mysql_fetch_array($exps);
				$id = $exp['exp_id'];
				$exp_name = $exp['exp_name'];
				$exp_type = $exp['exp_type'];
				$quantity = $exp['quantity'];
				$cost = $exp['cost'];
				$date = $exp['date'];
			?>
			
<!--the content-->

<title>Modify Expense Activity</title>
</head>
<body class="add_employee standard">
<div class="wrapper">

	<div class="header">
	<h1>Lifeguard Archangels Security Corporation</h1>
	</div>
	<?php include("main_menu.php"); ?>
	<div class="right_nav">
	<h1>Records</h1>
	<?php include("records_sidebar.php"); ?>
	</div>
	<div class="content">
	<div class="title_page">
	</div>
	
	<div class="actions">
	<div class="form label-inline uniform" id="shadow" style="width: 700px; margin:0 auto;" >
	<h2>Modify Expense Activity</h2>
	<!--for history log-->
			<input type="hidden" class="pc_date" name="pc_date"/>
		<input type="hidden" class="pc_time" name="pc_time" />
	<input type="hidden" value="<?php echo $_SESSION['user_name']; ?>" name="user">
	<!--begin form-->
	<input class="id" value="<?php echo $exp['exp_id']; ?>"  name="id" size="30" type="hidden"/>
	<div class="field"><label>Expense Activity </label> <input class="exp_name" value="<?php echo $exp_name; ?>" name="exp_name" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Expense Type </label>
		<select class="exp_type" name="exp_type" >
		<option> Default Purchase Expense </option>
<option>Advertising Expense</option>
<option>Amortization Expense</option>
<option>Auto Expense</option>
<option>Bad Debt Expense</option>
<option>Bank Fees</option>
<option>Cash Over and Short</option>
<option>Charitable Contributions Expense</option>
<option>Commissions and Fees Expense</option>
<option>Depreciation Expense</option>
<option>Dues and Subscriptions Expense</option>
<option>Employee Benefit Expense, Health Insurance</option>
<option>Employee Benefit Expense, Profit Sharing Plan</option>
<option>Employee Benefit Expense, Other</option> 
<option>Freight Expense</option>
<option>Gifts Expense</option>
<option>Income Tax Expense, State</option>
<option>Income Tax Expense, Local</option>
<option>Insurance Expense, Product Liability</option>
<option>Insurance Expense, Vehicle</option>
<option>Interest Expense</option>
<option>Legal and Professional Expense</option>
<option>Licenses Expense</option>
<option>Maintenance Expense</option>
<option>Meals and Entertainment Expense</option>
<option>Office Expense</option>
<option>Payroll Tax Expense</option>
<option>Penalties and Fines Expense</option>
<option>Other Taxesv</option>
<option>Postage Expense</option>
<option>Rent or Lease Expense</option>
<option>Repair and Maintenance Expense, Office</option>
<option>Repair and Maintenance Expense, Vehicle</option>
<option>Supplies Expense, Office</option>
<option>Telephone Expense</option>
<option>Training Expense</option>
<option>Travel Expense</option>
<option>Salaries Expense, Officers</option>
<option>Wages Expense</option>
<option>Utilities Expense</option>
<option>Other Expenses</option>
<option>Gain/Loss on Sale of Assets</option>


		</select></div>
	<div class="field"><label>Quantity </label> <input class="quantity" value="<?php echo $quantity; ?>" name="quantity" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Cost </label> <input class="cost" value="<?php echo $cost; ?>" name="cost" size="30" type="text" class="medium" /></div>
	<div class="field"><label>Date</label><input class="date"  value="<?php echo $date; ?>" name="date" size="30" type="text" class="medium" /><img src="images/calendar.png"></div>
	<div class="field"><button id="updateemp" name="SubmitOne">Save Changes</button></div>
	</div>
	</div>
	</div>
<?php include("footer.php"); ?>
</div>
</body>
</html>
<script type="text/javascript">
jQuery(document).ready( function () {
/* amo ni*/
var myDate = new Date();
var pc_date = (myDate.getMonth()+1) + '/' + (myDate.getDate()) + '/' + myDate.getFullYear();
var pc_time = myDate.getHours()+':'+myDate.getMinutes()+':'+myDate.getSeconds();
jQuery(".pc_date").val(pc_date);
jQuery(".pc_time").val(pc_time);
/*asta d*/
jQuery('#updateemp').click( function(){
	
		var id = $(".id").val();
		var exp_name = $(".exp_name").val();
		var exp_type = $(".exp_type").val();
		var quantity = $(".quantity").val();
		var cost = $(".cost").val();
		var date = $(".date").val();
		var pc_date = $(".pc_date").val();
		var pc_time = $(".pc_time").val();
		var user = $(".user").val();
if (exp_name && exp_type && quantity && cost && date){		
		jQuery.ajax({
		type: "POST",
		data: ({id:id,exp_name: exp_name,exp_type: exp_type,quantity: quantity,cost: cost, date: date,pc_time:pc_time,pc_date:pc_date,user:user}),
		url:"update_exp.php",
		success: function(msg) {
		showNotification({
message: "Expense Activity Successfully Updated",
type: "success", // type of notification is error/success/warning/information,
autoClose: true, // auto close to true
duration: 5 // message display duration
});
<!--redirection -->
		 var delay = 3000;
		setTimeout(function(){ window.location = 'view_exp_list.php';}, delay);  
<!--redirection end -->	
}
});
} else {
alert('All fields are required!');
return false;
}
});


});

</script>