コード例 #1
0
        private void listviewExpenses_DoubleClick(object sender, EventArgs e)
        {
            ListView listView = sender as ListView;

            if (listView.SelectedItems[0].SubItems[5].Text.Contains("R$"))
            {
                // Find the selected item
                Expense item = expenses.SelectById(
                    Convert.ToInt32(listView.SelectedItems[0].SubItems[0].Text));

                // Open the expense editor
                new EditExpenseForm(item).ShowDialog();
            }
            else
            {
                // Find the selected item
                MonthlyFee item = monthlyFees.SelectById(
                    Convert.ToInt32(listView.SelectedItems[0].SubItems[0].Text));

                // Open the expense editor
                new EditMonthlyFeeExpenseForm(monthPicker.Value, item).ShowDialog();
                //new EditMonthlyFeeForm(item).ShowDialog();
            }

            // Update the content
            monthPicker.Value = monthPicker.Value;
        }
コード例 #2
0
        public ActionResult MonthlyFeeSlipPrint(int?id)

        {
            MonthlyFee monthlyfee = db.MonthlyFee.Include(i => i.Student).Include(i => i.ClassSection).Include(i => i.ClassSection.Class).Include(i => i.ClassSection.Section).Single(i => i.MonthlyFeeId == id);

            return(View(monthlyfee));
        }
コード例 #3
0
        public ActionResult Edit([Bind(Include = "MonthlyFeeId,ClassSectionId,StudentId,FeeAmount,Date")] MonthlyFee monthlyfee)
        {
            if (Session["Email"] == null)
            {
                return(View("Login"));
            }
            if (ModelState.IsValid)
            {
                db.Entry(monthlyfee).State = EntityState.Modified;
                db.SaveChanges();



                ViewBag.SuccessMessage = "Monthly Fee Updated Successfully";



                return(View("CurrentMonthlyFee", db.MonthlyFee.Include(i => i.Student).Include(cs => cs.ClassSection).Include(cs1 => cs1.ClassSection.Class).Include(cs1 => cs1.ClassSection.Section).FirstOrDefault(i => i.MonthlyFeeId == monthlyfee.MonthlyFeeId)));
            }

            ViewBag.ClassId        = new SelectList(db.Class, "ClassId", "ClassName", monthlyfee.ClassSection.ClassId);
            ViewBag.SectionId      = new SelectList(db.Section, "SectionId", "SectionName", monthlyfee.ClassSection.SectionId);
            ViewBag.ClassSectionId = new SelectList(db.ClassSections, "ClassSectionId", "ClassSectionId", monthlyfee.ClassSectionId);
            ViewBag.StudentId      = new SelectList(db.Student, "StudentId", "StudentName", monthlyfee.StudentId);
            return(View(monthlyfee));
        }
コード例 #4
0
        /// <summary>
        /// Returns true if MonthlyPrice instances are equal
        /// </summary>
        /// <param name="other">Instance of MonthlyPrice to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(MonthlyPrice other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Interval == other.Interval ||
                     Interval != null &&
                     Interval.Equals(other.Interval)
                     ) &&
                 (
                     MonthlyFee == other.MonthlyFee ||
                     MonthlyFee != null &&
                     MonthlyFee.Equals(other.MonthlyFee)
                 ) &&
                 (
                     Currency == other.Currency ||
                     Currency != null &&
                     Currency.Equals(other.Currency)
                 ) &&
                 (
                     Customers == other.Customers ||
                     Customers != null &&
                     Customers.Equals(other.Customers)
                 ));
        }
コード例 #5
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Interval != null)
         {
             hashCode = hashCode * 59 + Interval.GetHashCode();
         }
         if (MonthlyFee != null)
         {
             hashCode = hashCode * 59 + MonthlyFee.GetHashCode();
         }
         if (Currency != null)
         {
             hashCode = hashCode * 59 + Currency.GetHashCode();
         }
         if (Customers != null)
         {
             hashCode = hashCode * 59 + Customers.GetHashCode();
         }
         return(hashCode);
     }
 }
コード例 #6
0
        // Constructors
        public EditMonthlyFeeExpenseForm(DateTime date, MonthlyFee monthlyFee)
        {
            InitializeComponent();

            // Initialize variables
            this.monthlyFee = monthlyFee;
            this.date       = date;
        }
コード例 #7
0
        public async Task <ActionResult> DeleteConfirmed(int id)
        {
            MonthlyFee monthlyFee = await db.MonthlyFees.FindAsync(id);

            db.MonthlyFees.Remove(monthlyFee);
            await db.SaveChangesAsync();

            return(RedirectToAction("Index"));
        }
コード例 #8
0
        public async Task <ActionResult> Edit([Bind(Include = "MonthId,Date,BillNo,RID,session,TotalFee,Paid,Balance,TimePeriod,status")] MonthlyFee monthlyFee)
        {
            if (ModelState.IsValid)
            {
                db.Entry(monthlyFee).State = EntityState.Modified;
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(monthlyFee));
        }
コード例 #9
0
 public ActionResult BillWise(MonthlyFee Fee, int billno)
 {
     Fee = db.MonthlyFees.FirstOrDefault(x => x.BillNo == billno);
     if (Fee != null)
     {
         return(RedirectToAction("Index", "Invoice", new { id = Fee.BillNo }));
     }
     else
     {
         this.SetNotification("Invalid Bill No", NotificationEnumeration.Error);
         return(View());
     }
 }
コード例 #10
0
        public async Task <ActionResult> Create([Bind(Include = "MonthId,Date,BillNo,RID,session,TotalFee,Paid,Balance,TimePeriod,status")] MonthlyFee monthlyFee)
        {
            if (ModelState.IsValid)
            {
                db.MonthlyFees.Add(monthlyFee);
                await db.SaveChangesAsync();

                TempData["Success"] = "Saved Successfully";
                return(RedirectToAction("Index"));
            }

            return(View(monthlyFee));
        }
コード例 #11
0
        // GET: MonthlyFees/Delete/5
        public async Task <ActionResult> Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MonthlyFee monthlyFee = await db.MonthlyFees.FindAsync(id);

            if (monthlyFee == null)
            {
                return(HttpNotFound());
            }
            return(View(monthlyFee));
        }
コード例 #12
0
        // GET: /MonthlyFee/Delete/5
        public ActionResult Delete(int?id)
        {
            if (Session["Email"] == null)
            {
                return(View("Login"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MonthlyFee monthlyfee = db.MonthlyFee.Include(i => i.Student).Include(i => i.ClassSection).Include(i => i.ClassSection.Class).Include(i => i.ClassSection.Section).Single(i => i.MonthlyFeeId == id);

            if (monthlyfee == null)
            {
                return(HttpNotFound());
            }
            return(View(monthlyfee));
        }
コード例 #13
0
        public ActionResult DeleteConfirmed(int id)
        {
            MonthlyFee m = db.MonthlyFee.Include(i => i.Student).Include(i => i.ClassSection).Include(i => i.ClassSection.Class).Include(i => i.ClassSection.Section).FirstOrDefault(i => i.MonthlyFeeId == id);

            ViewBag.SuccessMessage = "Monthly Fee of " + m.Student.StudentName + " Deleted Successfully";
            //var classid = m.ClassSection.Class.ClassName;
            //var sectionid = m.ClassSection.Section.SectionName;
            //var sname = m.Student.StudentName;;
            if (Session["Email"] == null)
            {
                return(View("Login"));
            }
            MonthlyFee monthlyfee = db.MonthlyFee.Find(id);

            db.MonthlyFee.Remove(monthlyfee);
            db.SaveChanges();

            //m.ClassSection.Class.ClassName = classid;
            //m.ClassSection.Section.SectionName = sectionid;
            //m.Student.StudentName = sname;

            return(View("CurrentMonthlyFee", m));
        }
コード例 #14
0
        // GET: /MonthlyFee/Edit/5


        public ActionResult Edit(int?id)
        {
            if (Session["Email"] == null)
            {
                return(View("Login"));
            }
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MonthlyFee monthlyfee = db.MonthlyFee.Include(i => i.Student).Include(i => i.ClassSection).Include(i => i.ClassSection.Class).Include(i => i.ClassSection.Section).FirstOrDefault(i => i.MonthlyFeeId == id);

            if (monthlyfee == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ClassId        = new SelectList(db.Class, "ClassId", "ClassName", monthlyfee.ClassSection.ClassId);
            ViewBag.SectionId      = new SelectList(db.Section, "SectionId", "SectionName", monthlyfee.ClassSection.SectionId);
            ViewBag.ClassSectionId = new SelectList(db.ClassSections, "ClassSectionId", "ClassSectionId", monthlyfee.ClassSectionId);
            ViewBag.StudentId      = new SelectList(db.Student, "StudentId", "StudentName", monthlyfee.StudentId);

            return(View(monthlyfee));
        }
コード例 #15
0
        public ActionResult Fee(string bill, string date, string totalvalue, string annual, string transport, string pay, string balance, string period, int regno, string discount, string reason, string other, MonthlyFee Month, FeeStructure fee, MasterFee Master)
        {
            try
            {
                string[] array = new string[12];
                array = period.Split(',');
                if (array.Length > 0)
                {
                    double total       = (Convert.ToDouble(totalvalue) / Convert.ToDouble(array.Length));
                    double paymonthly  = (Convert.ToDouble(pay) / Convert.ToDouble(array.Length));
                    double paybal      = (Convert.ToDouble(balance) / Convert.ToDouble(array.Length));
                    double paydiscount = (Convert.ToDouble(discount) / Convert.ToDouble(array.Length));
                    double payother    = (Convert.ToDouble(other) / Convert.ToDouble(array.Length));
                    for (int i = 1; i <= array.Length; i++)
                    {
                        int a = i - 1;
                        Month.Date       = date;
                        Month.BillNo     = Convert.ToInt32(bill);
                        Month.TimePeriod = array[a];
                        Month.Paid       = paymonthly;
                        Month.TotalFee   = total;
                        Month.session    = Session["session"].ToString();
                        Month.Balance    = paybal;
                        Month.status     = "Paid";
                        Month.Discount   = paydiscount;
                        Month.Reason     = reason;
                        Month.Other      = payother;
                        Month.RID        = regno;
                        db.MonthlyFees.Add(Month);
                        db.SaveChanges();
                    }
                    Master.Date       = date;
                    Master.BillNo     = Convert.ToInt32(bill);
                    Master.TimePeriod = period;
                    Master.Paid       = Convert.ToDouble(pay);
                    Master.TotalFee   = Convert.ToDouble(totalvalue);
                    Master.session    = Session["session"].ToString();
                    Master.Balance    = Convert.ToDouble(balance);
                    Master.status     = "Paid";
                    Master.Discount   = Convert.ToDouble(discount);
                    Master.Reason     = reason;
                    Master.Other      = Convert.ToDouble(other);
                    Master.RID        = regno;
                    db.MasterFees.Add(Master);
                    db.SaveChanges();
                }

                var id = db.FeeStructures.Where(x => x.RID == regno).FirstOrDefault().FeeID;
                fee = db.FeeStructures.Find(id);
                if (fee != null)
                {
                    fee.Pay           = (Convert.ToDouble(fee.Pay) + Convert.ToDouble(pay));
                    fee.Discount      = (Convert.ToDouble(fee.Discount) + Convert.ToDouble(discount));
                    fee.AnnualCharges = (Convert.ToDouble(fee.AnnualCharges) + Convert.ToDouble(annual));
                    //fee.AdmissionFee = (Convert.ToDouble(fee.Discount) + Convert.ToDouble(discount));
                    db.Entry(fee).State = EntityState.Modified;

                    db.SaveChanges();
                }



                return(RedirectToAction("Index", "Invoice", new { id = bill }));
            }
            catch
            {
                return(View());
            }
        }
コード例 #16
0
        public ActionResult Create([Bind(Include = "MonthlyFeeId,ClassSectionId,StudentId,FeeAmount,Date")] MonthlyFee monthlyfee)
        {
            if (Session["Email"] == null)
            {
                return(View("Login"));
            }

            var j = db.MonthlyFee.Where(i => i.StudentId == monthlyfee.StudentId && i.Date.Month == monthlyfee.Date.Month && i.Date.Year == monthlyfee.Date.Year).ToList();

            if (j.Count > 0)
            {
                ModelState.AddModelError("Date", "Sorry! Fee of this student is already submited for this month");
            }


            var s = db.Student.FirstOrDefault(i => i.StudentId == monthlyfee.StudentId);



            if (ModelState.IsValid)
            {
                var StudentForFee = db.Student.Find(monthlyfee.StudentId);
                monthlyfee.Student = StudentForFee;
                db.MonthlyFee.Add(monthlyfee);
                string myDir = "C:/MeritInn/Fee Slips/";
                System.IO.Directory.CreateDirectory(myDir);
                Document doc = new Document(PageSize.A4);

                Student st = new Student();
                st = db.Student.Single(k => k.StudentId == monthlyfee.StudentId);

                PdfWriter.GetInstance(doc, new FileStream("C:/MeritInn/Fee Slips/" + st.BayFormNo + " " + st.StudentName + " Year " + monthlyfee.Date.Year + " Month " + monthlyfee.Date.Month + ".pdf", FileMode.Create));
                doc.Open();

                // System.Drawing.Image img = System.Drawing.Image.FromFile(@"C:\Users\zubair Hathora\Desktop\BitsolMeritInSchoolSystem\BitsolMeritInSchoolSystem\Images\MeritInnLogo.png", true);
                //    img.ScaleAbsolute(159f, 159f);

                //img.Height = 1;
                //    img.Width = 100;
                //    iTextSharp.text.Image pic = iTextSharp.text.Image.GetInstance(img, System.Drawing.Imaging.ImageFormat.Png);


                //doc.Add(pic);
                doc.AddHeader("", "THE MERIT SCHOOL");

                PdfPTable table     = new PdfPTable(4);
                PdfPCell  Spanecell = new PdfPCell(new Phrase("Monthly Fee Slip"));
                Spanecell.Colspan             = 4;
                Spanecell.BackgroundColor     = GrayColor.GRAY;
                Spanecell.HorizontalAlignment = Element.ALIGN_CENTER;
                table.AddCell(Spanecell);
                table.AddCell("Name ");
                table.AddCell(st.StudentName);
                table.AddCell("CNIC # ");
                table.AddCell(st.BayFormNo);

                table.AddCell("Paid Amount ");
                table.AddCell(monthlyfee.FeeAmount.ToString());
                table.AddCell("Date # ");
                table.AddCell(monthlyfee.Date.ToString());

                table.HorizontalAlignment = Element.ALIGN_CENTER;
                table.DefaultCell.Border  = Rectangle.NO_BORDER;


                doc.Add(table);

                doc.Close();

                db.SaveChanges();
                ViewBag.SuccessMessage = "Monthly Fee Added Ssuccessfully";
                return(View("CurrentMonthlyFee", db.MonthlyFee.Include(cs => cs.ClassSection).Include(cs1 => cs1.ClassSection.Class).Include(cs1 => cs1.ClassSection.Section).ToList().AsQueryable().Last()));

                //---------------------------------------------------
                //db.MonthlyFee.Add(monthlyfee);
                //db.SaveChanges();
                //return RedirectToAction("Index");
            }

            ViewBag.ClassId   = new SelectList(db.Class, "ClassId", "ClassName");
            ViewBag.SectionId = new SelectList(db.Section.Where(i => i.SectionId == 0).ToList(), "SectionId", "SectionName");

            ViewBag.ClassSectionId = new SelectList(db.ClassSections, "ClassSectionId", "ClassSectionId");
            ViewBag.StudentId      = new SelectList(db.Student.Where(i => i.StudentId == 0), "StudentId", "StudentName");
            return(View(monthlyfee));
        }