<?php
session_start();
require_once '../../Server/connection.php';

		
	$expCate_id  = $_POST['expCate_id'];
	$currency_id  = $_POST['currency_id'];
	$amountUsed  = $_POST['amountUsed']; 
	$exp_desc  = addslashes($_POST['exp_desc']);
	$date = date("Y-m-d");
	$month1 = date('m', strtotime($date));
	$year = date('Y', strtotime($date));
	
	if($month1==1){
	 $month = 'JAN';
	  }else if($month1==2){
	 $month = 'FEB';	  
	  }else if($month1==3){
	$month = 'MARCH';	  
	  }else if($month1==4){
	$month = 'APR';		  
	  }else if($month1==5){
	$month = 'MAY';	  
	  }else if($month1==6){
	$month = 'JUNE';	  
	  }else if($month1==7){
	$month = 'JULY';	  
	  }else if($month1==8){
	$month = 'AUG';	  
	  }else if($month1==9){
	$month = 'SEPT';	  
	  }else if($month1==10){
	$month = 'OCT';	  
	  }else if($month1==11){
	$month = 'NOV';	  
	  }else{
	$month = 'DEC';	  
	  }
	  
	$sql = "INSERT INTO expenses (expCate_id,amount,exp_desc,currency_id,date,month,year) VALUES ('$expCate_id','$amountUsed','$exp_desc','$currency_id','$date','$month','$year')";			
	$result = $conn->query($sql);
	
		if($result){
			
	$_SESSION['success_message'] = "You have successfully recorded Expenses";
  header("Location: ../recordExpenses.php");
  exit();
			
		}
	

?>