<?php
if(isset($_POST['s_name'])){
require_once('../../assets/config/config.php');
$obj=new Database();
$s_name=$_POST['s_name'];
$s_id=$_POST['s_id'];
$batch_no=$_POST['batch_no'];
$payment_mode=$_POST['payment_mode'];
$description=$_POST['description'];
$course_name=$_POST['course_name'];
$fee=$_POST['fee'];  
$p_date=date('d-M-Y',strtotime($_POST['p_date']));

$obj->select('setting','*',null,null,null,null);
$result=$obj->getResult();
$f_id=$result[0]['f_id']+1;

$state=$obj->insert('students_fee',['student_name'=>$s_name,'student_id'=>$s_id,'batch_no'=>$batch_no,'payment_mode'=>$payment_mode,'description'=>$description,'amount'=>$fee,'payment_date'=>$p_date,'f_id'=>$f_id]);
if($state==1)
{
   $state=$obj->update('setting',['f_id'=>$f_id]);  
   echo $obj->insert('txn_details',['date'=>$p_date,'f_id'=>$f_id,'batch_no'=>$batch_no,'student_id'=>$s_id,'credit'=>$fee,'voucher_type'=>$course_name]);
}
}
?>
  