Пример #1
0
        public async Task <IList <StudentFee> > GetStudentFee(string AdmissionNo)
        {
            FeesData obj           = new FeesData(csName);
            var      Result        = obj.GetStudentFeeDetail(AdmissionNo);
            var      SchoolFeeList = Mapper.Map <IList <Data.StudentFeeDetail>, IList <Model.StudentFee> >(Result);

            return(SchoolFeeList);
        }
Пример #2
0
        // POST: StudentRecurringFees/Edit/5
        // To protect from overposting attacks, please enable the specific properties you want to bind to, for
        // more details see http://go.microsoft.com/fwlink/?LinkId=317598.

        public ActionResult AddData(FeesData data)
        {
            int?sessionId = db.AspNetClasses.Where(x => x.Id == data.ClassId).FirstOrDefault().SessionID;

            if (ModelState.IsValid)
            {
                var TotalFee = db.AspNetSessions.Where(x => x.Id == SessionID).FirstOrDefault().Total_Fee;

                decimal?TotalFeeOfAllStudents = 0;


                var feetype = Request.Form["feeType"];
                IEnumerable <string> selectedstudents = Request.Form["students"].Split(',');
                int count = selectedstudents.Count();

                for (int i = 1; i <= count; i++)
                {
                    TotalFeeOfAllStudents = TotalFee + TotalFeeOfAllStudents;
                }
                StudentRecurringFee studentRecurringFees = new StudentRecurringFee();
                studentRecurringFees.ClassId   = data.ClassId;
                studentRecurringFees.SessionId = sessionId;
                studentRecurringFees.TutionFee = TotalFee;
                studentRecurringFees.TotalFee  = TotalFee;
                db.StudentRecurringFees.Add(studentRecurringFees);
                db.SaveChanges();

                var Total_Fees = studentRecurringFees.TotalFee;

                if (feetype == "Installment")
                {
                    var CalculatedFee = Total_Fees / 2;
                    foreach (var std in selectedstudents)
                    {
                        AspNetStudent student = db.AspNetStudents.Where(x => x.StudentID == std).FirstOrDefault();

                        var classid = db.AspNetStudents.Where(x => x.Id == student.Id).Select(x => x.ClassID).FirstOrDefault();
                        var Month   = DateTime.Now.ToString("MMMM");

                        for (int i = 0; i <= 3; i++)
                        {
                            var             FirstMonth  = DateTime.Now.ToString("MMMM");
                            StudentFeeMonth stdfeemonth = new StudentFeeMonth();
                            stdfeemonth.StudentId  = student.Id;
                            stdfeemonth.Multiplier = 2;
                            stdfeemonth.SessionId  = sessionId;
                            stdfeemonth.Status     = "Pending";

                            var dddd = DateTime.Now;
                            var d    = dddd.ToString("yyyy-MM-dd");
                            //shahzad   stdfeemonth.IssueDate = d;

                            if (i == 0)
                            {
                                stdfeemonth.Months           = DateTime.Now.ToString("MMMM");
                                stdfeemonth.InstalmentAmount = CalculatedFee;
                                stdfeemonth.FeePayable       = CalculatedFee;
                            }
                            else if (i == 1)
                            {
                                stdfeemonth.InstalmentAmount = 0;
                                stdfeemonth.FeePayable       = 0;
                                stdfeemonth.Months           = DateTime.Now.Date.AddMonths(1).ToString("MMMM");
                            }
                            else if (i == 2)
                            {
                                stdfeemonth.Months           = DateTime.Now.Date.AddMonths(2).ToString("MMMM");
                                stdfeemonth.InstalmentAmount = CalculatedFee;
                                stdfeemonth.FeePayable       = CalculatedFee;
                            }
                            else if (i == 3)
                            {
                                stdfeemonth.InstalmentAmount = 0;
                                stdfeemonth.FeePayable       = 0;
                                stdfeemonth.Months           = DateTime.Now.Date.AddMonths(3).ToString("MMMM");
                            }
                            else
                            {
                                //do nothing
                            }

                            stdfeemonth.FeeType = "Installment";
                            db.StudentFeeMonths.Add(stdfeemonth);
                            db.SaveChanges();
                        }
                    }
                }


                else if (feetype == "PerMonth")
                {
                    foreach (var std in selectedstudents)
                    {
                        var           CalculatedFee = Total_Fees / 4;
                        AspNetStudent student       = db.AspNetStudents.Where(x => x.StudentID == std).FirstOrDefault();

                        var classid = db.AspNetStudents.Where(x => x.Id == student.Id).Select(x => x.ClassID).FirstOrDefault();
                        var Month   = DateTime.Now.ToString("MMMM");

                        for (int i = 0; i <= 3; i++)
                        {
                            var             FirstMonth  = DateTime.Now.ToString("MMMM");
                            StudentFeeMonth stdfeemonth = new StudentFeeMonth();
                            stdfeemonth.StudentId  = student.Id;
                            stdfeemonth.Multiplier = 1;
                            stdfeemonth.SessionId  = sessionId;
                            stdfeemonth.Status     = "Pending";

                            var dddd = DateTime.Now;
                            var d    = dddd.ToString("yyyy-MM-dd");
                            //shahzad  stdfeemonth.IssueDate = d;

                            if (i == 0)
                            {
                                stdfeemonth.Months           = DateTime.Now.ToString("MMMM");
                                stdfeemonth.InstalmentAmount = CalculatedFee;
                                stdfeemonth.FeePayable       = CalculatedFee;
                            }
                            else
                            {
                                stdfeemonth.InstalmentAmount = CalculatedFee;
                                stdfeemonth.FeePayable       = CalculatedFee;
                                stdfeemonth.Months           = DateTime.Now.Date.AddMonths(i).ToString("MMMM");
                            }

                            stdfeemonth.FeeType = "PerMonth";
                            db.StudentFeeMonths.Add(stdfeemonth);
                            db.SaveChanges();
                        }
                    }
                }
                else
                {
                    foreach (var std in selectedstudents)
                    {
                        AspNetStudent student = db.AspNetStudents.Where(x => x.StudentID == std).FirstOrDefault();

                        var classid = db.AspNetStudents.Where(x => x.Id == student.Id).Select(x => x.ClassID).FirstOrDefault();
                        var Month   = DateTime.Now.ToString("MMMM");

                        for (int i = 0; i <= 3; i++)
                        {
                            var             FirstMonth  = DateTime.Now.ToString("MMMM");
                            StudentFeeMonth stdfeemonth = new StudentFeeMonth();
                            stdfeemonth.StudentId  = student.Id;
                            stdfeemonth.Multiplier = 4;
                            stdfeemonth.SessionId  = sessionId; //could be change To SessionID
                            stdfeemonth.Status     = "Pending";

                            var dddd = DateTime.Now;
                            var d    = dddd.ToString("yyyy-MM-dd");
                            //shahzad  stdfeemonth.IssueDate = d;

                            if (i == 0)
                            {
                                stdfeemonth.Months           = DateTime.Now.ToString("MMMM");
                                stdfeemonth.InstalmentAmount = Total_Fees;
                                stdfeemonth.FeePayable       = Total_Fees;
                            }
                            else
                            {
                                stdfeemonth.InstalmentAmount = 0;
                                stdfeemonth.FeePayable       = 0;
                                stdfeemonth.Months           = DateTime.Now.Date.AddMonths(i).ToString("MMMM");
                            }

                            stdfeemonth.FeeType = "Lumsum";
                            db.StudentFeeMonths.Add(stdfeemonth);
                            db.SaveChanges();
                        }
                    }
                }

                var id       = User.Identity.GetUserId();
                var username = db.AspNetUsers.Where(x => x.Id == id).Select(x => x.Name).FirstOrDefault();

                Voucher voucher = new Voucher();
                voucher.Name      = "Student Fee Created";
                voucher.Notes     = "Student Fee Created";
                voucher.Date      = DateTime.Now;
                voucher.Name      = username;
                voucher.CreatedBy = username;
                voucher.SessionID = sessionId;
                int?VoucherObj = db.Vouchers.Max(x => x.VoucherNo);

                voucher.VoucherNo = Convert.ToInt32(VoucherObj) + 1;
                db.Vouchers.Add(voucher);
                db.SaveChanges();

                var Leadger = db.Ledgers.Where(x => x.Name == "Account Receiveable").FirstOrDefault();

                int           AccountRecId   = Leadger.Id;
                decimal?      CurrentBalance = Leadger.CurrentBalance;
                VoucherRecord voucherRecord  = new VoucherRecord();
                decimal?      AfterBalance   = CurrentBalance + TotalFeeOfAllStudents;
                voucherRecord.LedgerId       = AccountRecId;
                voucherRecord.Type           = "Dr";
                voucherRecord.Amount         = TotalFeeOfAllStudents;
                voucherRecord.CurrentBalance = CurrentBalance;
                voucherRecord.AfterBalance   = AfterBalance;
                voucherRecord.VoucherId      = voucher.Id;
                voucherRecord.Description    = "Student Fee debited in Account Receiveable";
                Leadger.CurrentBalance       = AfterBalance;
                db.VoucherRecords.Add(voucherRecord);
                db.SaveChanges();

                //Second;

                VoucherRecord voucherRecord1 = new VoucherRecord();

                var LeadgerStudentFee = db.Ledgers.Where(x => x.Name == "Student Fee").FirstOrDefault();

                decimal?CurrentBalanceOfStudentFee = LeadgerStudentFee.CurrentBalance;
                decimal?AfterBalanceOfStudentFee   = CurrentBalanceOfStudentFee + TotalFeeOfAllStudents;
                voucherRecord1.LedgerId          = LeadgerStudentFee.Id;
                voucherRecord1.Type              = "Cr";
                voucherRecord1.Amount            = TotalFeeOfAllStudents;
                voucherRecord1.CurrentBalance    = CurrentBalanceOfStudentFee;
                voucherRecord1.AfterBalance      = AfterBalanceOfStudentFee;
                voucherRecord1.VoucherId         = voucher.Id;
                voucherRecord1.Description       = "Student Fee Credit in Income";
                LeadgerStudentFee.CurrentBalance = AfterBalanceOfStudentFee;

                db.VoucherRecords.Add(voucherRecord1);
                db.SaveChanges();


                // db.SaveChanges();
            }

            return(RedirectToAction("Index"));
        }
Пример #3
0
        private async void AddData(object obj)
        {
            //_katmodel.KategoriHall = Katname;
            //_katmodel.katNumber = Katnumber;



            if (string.IsNullOrEmpty(FeesVal))
            {
                Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                Visibility = true;
                Message    = " Input wajib di isi ";
                var cs = await delayid();

                if (cs)
                {
                    Visibility = false;
                }
            }
            else
            {
                if (!Regex.IsMatch(FeesVal, "[0-9]"))
                {
                    Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                    Visibility = true;
                    Message    = " Input wajib berupa nomor ";
                    var cs = await delayid();

                    if (cs)
                    {
                        Visibility = false;
                    }
                    return;
                }


                FeesData = (ObservableCollection <FeesModel>)obj;

                var cvd = FeesData.Where(cv => cv.FeesValue.ToString() == FeesVal).Count();

                Console.WriteLine(cvd);

                if (cvd < 1)
                {
                    var dataadd = _services.insertData(Convert.ToInt32(FeesVal));
                    if (dataadd)
                    {
                        FeesModel fe = new FeesModel();
                        getFeesData();
                        Coloring   = new SolidColorBrush(Color.FromRgb(46, 204, 113));
                        Visibility = true;
                        Message    = "data berhasil disimpan";
                        FeesVal    = "";
                        var cs = await delayid();

                        if (cs)
                        {
                            Visibility = false;
                        }
                    }
                    else
                    {
                        Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                        Visibility = true;
                        Message    = "data gagal disimpan";
                        FeesVal    = "";
                        var cs = await delayid();

                        if (cs)
                        {
                            Visibility = false;
                        }
                    }
                }
                else
                {
                    Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                    Visibility = true;
                    Message    = "data sudah ada";
                    FeesVal    = "";
                    var cs = await delayid();

                    if (cs)
                    {
                        Visibility = false;
                    }
                }
            }
        }
Пример #4
0
        private async void Saveedit(object obj)
        {
            if (!Regex.IsMatch(FeesVal.ToString(), "[0-9]"))
            {
                Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                Visibility = true;
                Message    = " Input wajib berupa nomor ";
                var cs = await delayid();

                if (cs)
                {
                    Visibility = false;
                }
                return;
            }

            if (FeesVal.Equals(0))
            {
                Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                Visibility = true;
                Message    = " Input wajib di isi ";
                var cs = await delayid();

                if (cs)
                {
                    Visibility = false;
                }
            }
            else
            {
                FeesData = (ObservableCollection <FeesModel>)obj;

                var dft = FeesData.Where(vf => vf.FeesValue.ToString() == FeesVal).Count();

                if (dft >= 0)
                {
                    var dataadd = _services.EditSave(ids, Convert.ToInt32(FeesVal));
                    if (dataadd)
                    {
                        FeesModel fe = new FeesModel();
                        getFeesData();
                        Coloring   = new SolidColorBrush(Color.FromRgb(46, 204, 113));
                        Visibility = true;
                        Message    = "data berhasil disimpan";
                        FeesVal    = "";
                        var cs = await delayid();

                        if (cs)
                        {
                            Visibility = false;
                        }
                    }
                    else
                    {
                        Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                        Visibility = true;
                        Message    = "data gagal disimpan";
                        FeesVal    = "";
                        var cs = await delayid();

                        if (cs)
                        {
                            Visibility = false;
                        }
                    }
                }
                else
                {
                    Coloring   = new SolidColorBrush(Color.FromRgb(231, 76, 60));
                    Visibility = true;
                    Message    = "data sudah ada";
                    FeesVal    = "";
                    var cs = await delayid();

                    if (cs)
                    {
                        Visibility = false;
                    }
                }
            }
        }