コード例 #1
0
        public RedirectResult AddProductLineItem(int invoiceId)
        {
            InvoiceItem lineItem = new InvoiceItem();
            lineItem.Invoice = new InvoiceRepository().Get(invoiceId);
            lineItem.IsActive = true;
            lineItem.Product = new ProductRepository().Get(1);
            lineItem.Quantity = 1;

            new InvoiceRepository().AddLineItem(lineItem);
            return new RedirectResult("/Billing/Edit/" + invoiceId);
        }
コード例 #2
0
ファイル: Invoice.cs プロジェクト: sivarajankumar/openehs
 /// <summary>
 /// Remove an invoice item from the list of items on this invoice
 /// </summary>
 /// <param name="item">Invoice item to remove from the list</param>
 public virtual void RemoveLineItem(InvoiceItem item)
 {
     Items.Remove(item);
 }
コード例 #3
0
ファイル: Invoice.cs プロジェクト: sivarajankumar/openehs
 /// <summary>
 /// Add new invoice item to the list of items on this invoice
 /// </summary>
 /// <param name="item">Invoice item that contains details for the invoice</param>
 public virtual void AddLineItem(InvoiceItem item)
 {
     Items.Add(item);
 }
コード例 #4
0
        /// <summary>
        /// Add an item to the patient's invoice.
        /// </summary>
        /// <returns>The Jason object so it can be immediately displayed.</returns>
        public JsonResult AddInvoiceItem()
        {
            try
            {
                //Build Line Item objects
                InvoiceItem lineItem = new InvoiceItem();

                //Get patient object
                int patientID = int.Parse(Request.Form["patientID"]);
                PatientRepository patientRepo = new PatientRepository();
                var patient = patientRepo.Get(patientID);

                //Get current open patient checkin
                var query = from checkin in patient.PatientCheckIns
                            where checkin.CheckOutTime == DateTime.MinValue
                            select checkin;
                PatientCheckIn openCheckIn = query.First<PatientCheckIn>();

                //Invoice Repository
                InvoiceRepository invoiceRepo = new InvoiceRepository();

                //Product Repository
                ProductRepository productRepo = new ProductRepository();

                //Service Repository
                ServiceRepository serviceRepo = new ServiceRepository();

                //Quantity
                if (Request.Form["quantity"] != "")
                {
                    lineItem.Quantity = int.Parse(Request.Form["quantity"]);
                    lineItem.Invoice = openCheckIn.Invoice;
                    lineItem.IsActive = true;

                    //Product
                    if (Request.Form["product"] != "")
                    {
                        lineItem.Product = productRepo.Get(int.Parse(Request.Form["product"]));
                        lineItem.Service = null;
                        invoiceRepo.AddLineItem(lineItem);
                        UnitOfWork.CurrentSession.Flush();
                        return Json(new
                        {
                            error = "false",
                            lineItem.Product.Name,
                            lineItem.Quantity

                        });
                    } //Service
                    else if (Request.Form["service"] != "")
                    {
                        lineItem.Service = serviceRepo.Get(int.Parse(Request.Form["service"]));
                        lineItem.Product = null;
                        invoiceRepo.AddLineItem(lineItem);
                        UnitOfWork.CurrentSession.Flush();
                        return Json(new
                        {
                            error = "false",
                            lineItem.Service.Name,
                            lineItem.Quantity
                        });
                    }
                }

                return Json(new
                {
                    error = "false"
                });
            }
            catch (Exception e)
            {
                return Json(new
                {
                    error = "true",
                    status = e.Message
                });
            }
        }
コード例 #5
0
 public ActionResult Service(InvoiceItem lineItem)
 {
     //add save code here?
     try
     {
         BillingEditViewModel invoice = new BillingEditViewModel(lineItem.Invoice.Id);
         invoice.Save();
         return RedirectToAction("Edit");
     }
     catch
     {
         return RedirectToAction("Index");
     }
 }
コード例 #6
0
        public ActionResult Service(int invoiceId)
        {
            var lineItem = new InvoiceItem();
            var repo = new InvoiceRepository();
            lineItem.Service = new ServiceRepository().Get(1);
            lineItem.Invoice = repo.Get(invoiceId);
            lineItem.IsActive = true;
            repo.AddLineItem(lineItem);

            return View(lineItem);
        }
コード例 #7
0
ファイル: Invoice.cs プロジェクト: sivarajankumar/openehs
 /// <summary>
 /// Remove an invoice item from the list of items on this invoice
 /// </summary>
 /// <param name="item">Invoice item to remove from the list</param>
 public virtual void RemoveLineItem(InvoiceItem item)
 {
     Items.Remove(item);
 }
コード例 #8
0
ファイル: Invoice.cs プロジェクト: sivarajankumar/openehs
 /// <summary>
 /// Add new invoice item to the list of items on this invoice
 /// </summary>
 /// <param name="item">Invoice item that contains details for the invoice</param>
 public virtual void AddLineItem(InvoiceItem item)
 {
     Items.Add(item);
 }
コード例 #9
0
 /// <summary>
 /// Adds an InvoiceItem to the database.
 /// </summary>
 /// <param name="lineItem">The item to be added.</param>
 public void AddLineItem(InvoiceItem lineItem)
 {
     Session.SaveOrUpdate(lineItem);
 }
コード例 #10
0
 /// <summary>
 /// Removes an InvoiceItem from the database.
 /// </summary>
 /// <param name="lineItem">the InvoiceItem to be removed.</param>
 public void RemoveLineItem(InvoiceItem lineItem)
 {
     Session.Delete(lineItem);
 }