Click here to Skip to main content
14,355,397 members
Rate this:
Please Sign up or sign in to vote.
See more:
declare @in_current_sum int, @in_total_sum int , @re_total_sum  int = 0;

set @in_current_sum = (select sum(invoice.Amount) from invoice where invoice.Student_id = 2 and invoice.month = 'December-2019')

set @in_total_sum = (select sum(invoice.Amount) from invoice where invoice.Student_id = 2)

set @re_total_sum = (select sum(Recipt.Paid_amount) from Recipt where Recipt.Student_id = 2)
select isnull(@in_total_sum,0) - isnull(@in_current_sum,0) - isnull(@re_total_sum,0) as dues

select distinct  invoice.invoice_id, student.Student_id as [A/c #], student.Student_Name, parent.father_name,class.class_numeric,
invoice.Fee_description, invoice.Amount, invoice.issue_date, invoice.month
                            from student							
                            join parent on
                            student.father_nic = parent.father_nic
                            allocate_class on
                            student.Student_id = allocate_class.Student_id
                            class on 
                            class.class_id = allocate_class.class_id
                            session on
                            allocate_class.session_id = session.session_id
                            join invoice on 
                            student.Student_id = invoice.Student_id
							where session.session_id=  1 AND student.status = 'active' AND  student.Student_id = 2

What I have tried:

i want to create one store procedure from the above queries in order to get the report of fee reciept..
i am stuck here from the last week help me out and thanks in advance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100