Ejemplo n.º 1
0
 //
 // GET: /Practices/Create
 public ActionResult Create()
 {
     Person sperson = Session["person"] as Person;
     ViewBag.PersonID = new SelectList(db.People, "ID", "Title", sperson.ID);
     var person = new Practices { PersonID = sperson.ID };
     return View(person);
 }
Ejemplo n.º 2
0
        public ActionResult Create(Practices practices)
        {
            if (ModelState.IsValid)
            {
                practices.ID = Guid.NewGuid();
                db.Practices.Add(practices);
                db.SaveChanges();
                return Content(Boolean.TrueString);
            }

            ViewBag.PersonID = new SelectList(db.People, "ID", "Title", practices.PersonID);
            return View(practices);
        }
Ejemplo n.º 3
0
        // Creates a WordprocessingDocument.
        public void CreatePackage(string filePath, List<InvoiceDetail> ind, Practices prac)
        {
            InvoiceD = ind;
            pdetail = prac;
            persondetail = db.People.Where(a => a.ID == prac.PersonID).FirstOrDefault();

            InvoiceD.ForEach(invoice => {

                total += System.Convert.ToDecimal(invoice.Appointment.Total.ToString());
            });
            using (WordprocessingDocument package = WordprocessingDocument.Create(filePath, WordprocessingDocumentType.Document))
            {
                CreateParts(package);
            }
        }
Ejemplo n.º 4
0
        public ActionResult InvoicingreportTable(InvoiceDetail vm, string writer, Guid id)
        {
            var abresults = new List<InvoiceDetail>();
            var results = new List<Appointment>();
            var practice = new Practices();
            var name = Session["Person"] as AutoComplete.Models.Person;
            var allAppt = db.Appointments.Where(a => a.Invoiced == false && a.APPID == id).ToList();
            vm.session = new Sessions();
            vm.session = vm.session;
            decimal total = 0;

            foreach (var appt in allAppt)
            {
                vm.PracticeID = appt.PracID;
                vm.startDate = Convert.ToDateTime(appt.startDate);
                vm.endDate = Convert.ToDateTime(appt.endDate);
                vm.Total =Convert.ToDecimal(appt.Total);
                Session["Practice"] = db.Practices.Where(p => p.ID == appt.PracID).FirstOrDefault();
                practice = Session["Practice"] as AutoComplete.Models.Practices;
                if (practice.ID == appt.PracID)
                {
                    appt.sessionDetail = new Sessions();
                    appt.sessionDetail = db.Sessions.Where(a => a.ID == appt.SessID).FirstOrDefault() != null ? db.Sessions.Where(a => a.ID == appt.SessID).FirstOrDefault() : null;
                    results.Add(appt);
                }
            }
            if (results != null)
            {
                foreach (var r in results)
                    abresults.Add(new InvoiceDetail()
                    {

                        InvoicedDate = DateTime.Now,
                        ID = Guid.NewGuid(),
                        Appointment = r,
                        //SessionFees = Convert.ToDecimal(r.sessionDetail.fees) * r.days,
                        SessionFees = Convert.ToDecimal(r.Total),
                        SessionName = r.sessionDetail.Name,
                        totalFees = Convert.ToDecimal(r.Total),

                    });

                //  Generateinvoice docreport = new Generateinvoice();
                //  docreport.CreatePackage(Server.MapPath("\\Reports\\abc.doc"), abresults, practice);
                Session["Allinvoice"] = abresults;
                var report = new Report(abresults.Select(ap => new { ap.InvoicedDate, ap.SessionName, ap.SessionFees }).ToList().ToReportSource());
                // Customize the Text Fields
                report.TextFields.Header = string.Format(@"<table  width='100%'><tr><td align='left'>
                &nbsp To : {0}
                 Website :  {1}
                 City :  {2}
                 Street Address :  {3}
                 Contact no. :  {4}
                <span style='color:red'>Email</span> :  {5}</td>

            <td align=''>
             From Dr. : {6}
             City :    {7}
              Country :    {8}
               Contact no.:  {9}
             Email : {10} </td></tr></table>", practice.Name, practice.cWebsite, practice.city, practice.streetAdd, practice.cphone, practice.cEmail, name.FirstName, name.city, name.country, name.phone, name.Email);
                report.TextFields.Title = "Invoicing For " + db.Practices.Where(p => p.ID == vm.PracticeID).FirstOrDefault() == null ? "Not Found" : db.Practices.Where(p => p.ID == vm.PracticeID).FirstOrDefault().Name;
                report.TextFields.SubTitle = " From : " + vm.startDate + " End : " + vm.endDate;
                report.TextFields.Footer = string.Format(@"<table width='80%'><tr><td align='right'> Total Fees {0}</td></tr></table>", Convert.ToString(vm.Total));
                // Render hints allow you to pass additional hints to the reports as they are being rendered
                report.RenderHints.BooleanCheckboxes = true;
                report.RenderHints.BooleansAsYesNo = true;
                report.RenderHints.FreezeRows = 20;
                report.RenderHints.FreezeColumns = 10;
                Session["Report"] = report;

                if (writer == "excel") return new ReportResult(report, new DoddleReport.Writers.ExcelReportWriter());

            }
            return View(abresults);
            //return Json(abresults.Select(ap => new { ap.PatientId, ap.TestDateTime,ap.Age, ap.Gender,  ap.TestName, ap.Technician, ap.Result, ap.NormalRange, ap.Name }).ToList(), JsonRequestBehavior.AllowGet);
        }
Ejemplo n.º 5
0
 public ActionResult Edit(Practices practices)
 {
     if (ModelState.IsValid)
     {
         db.Entry(practices).State = EntityState.Modified;
         db.SaveChanges();
         return Content(Boolean.TrueString);
     }
     ViewBag.PersonID = new SelectList(db.People, "ID", "Title", practices.PersonID);
     return View(practices);
 }