<?php
$fee_date = $obj->Details_By_Cond("_fee_late_fine","_branch_id='$branchid' AND _dept_id='$lf_dept'");

$fine = $fee_date['_late_fine_amount'];		
$f_date =  $fee_date['_late_fine_date'];
//date("m");
//$section_idd = 1;
$cmonth = sprintf("%02d", $sec['_month']);
$today = date('Y-m-d');
//if($cmonth==date("m")){
//if($today > $f_date){
$fee_head = 'Payment Late Fine ('.$sec['_month'].'-'.$sec['_year'].').';
	if($sec['_status']=='U'){
		$log = $fine;
		$form_data2=array(
				'_br_id'=>$branchid,
				'_month'=>$sec['_month'],
				'_year'=>$sec['_year'],
				'_class_id'=>$sec['_class_id'],
				'_section_id'=>$sec['_section_id'],
				'_std_id'=>$sec['_std_id'],
				'_fee_head'=>$fee_head,
				'_amount'=>$log,
				'_invoice_no'=>$invoice,
				'_type'=>'C',
				'_entry_by'=>$_SESSION['LOGIN_USERID'],
				'_entry_date'=>date("Y:m:d H:i:s")
				);
				$res = $obj->Insert_Data_By_Cond("_fee_details_invoice",$form_data2,"_br_id='$branchid' AND _month='".$sec['_month']."' AND _year='".$sec['_year']."' AND _std_id='".$sec['_std_id']."'  AND _fee_head='Late Fine'");
				if($res){
					$total = $sec['_total_amount'] + $log;
					$total_due = $sec['_due_amount'] + $log;
					$form_up=array(
					'_total_amount'=>$total,
					'_due_amount'=>$total_due,
					'_update_by'=>$_SESSION['LOGIN_USERID']
					);
					$up_res = $obj->Update_Data("_fee_master_invoice",$form_up,"WHERE _br_id='$branchid' AND _invoice_no='$invoice'");

				}
		}
	//}
//}

?>