I have a query:
$paymentList = DB::table('tbl_student_payment_sub_head_details')
->if($Class, 'class_name', "=", $Class)
->if($Group, 'group_name', "=", $Group)
->if($BranchShiftVersion, 'institute_branch_version_id', "=", $BranchShiftVersion)
->if($Year, 'acc_year', "=", $Year)
->orderBy('id')
->lists('name', 'id');
which returns following array.
Array
(
[1] => Tuition Fee
[2] => Session Fees
[3] => Diary, Syllabus, Calendar, ID Card
[4] => ICT Fee
[5] => Exam Fee Half Yearly
[6] => Exam Fee Annual
[7] => Mid Term Fee
[11] => Delay Fine
[12] => Absence fine
[13] => TC Fee
[14] => Other Fee
[15] => Admission Fee
[16] => Arear Due
[17] => Delay Fine 2
[18] => Delay Fine 3
[19] => Delay Fine 4
)
I have another table named tbl_received_student_payment_sub_heads which stores student payment information of some category from above. Columns that this table have:
'id' (pk), 'student_payment_id' (fk), 'payment_amount', 'student_id' (fk), 'create_time'.
Now i am looking for a query, which will return the total payment of every category of each students for last 6 months/given range. It also should return 0 if a student did not pay anything for a category. Can anything help me out with that?
(Note: My application is developed in laravel 5.1)
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire