Ejemplo n.º 1
0
        public JsonResult SaveAdvancePayment(Payment payment)
        {
            using (PaymentRepository repository = new PaymentRepository())
            {
                payment.UserId = GetLoggedinUserInfo().UserId;


                payment = repository.Insert(payment);
                repository.Commit();
                // CreatePatientService(invoice.Id, patientServices);
            }

            return(Json("Payment successfull"));
        }
Ejemplo n.º 2
0
        public JsonResult CreatePayment(Payment payment, List <InvoicePayment> invoicePaymentList, List <Payment> advancePayment, double reconcileAmount)
        {
            if (payment.Amount > 0)
            {
                using (PaymentRepository repository = new PaymentRepository())
                {
                    payment.UserId = GetLoggedinUserInfo().UserId;
                    foreach (InvoicePayment item in payment.InvoicePayments)
                    {
                        item.UserId = GetLoggedinUserInfo().UserId;
                    }

                    payment = repository.Insert(payment);
                    repository.Commit();
                    // CreatePatientService(invoice.Id, patientServices);
                }
            }
            if (reconcileAmount > 0)
            {
                using (Repository <InvoicePayment> repository = new Repository <InvoicePayment>())
                {
                    foreach (InvoicePayment item in invoicePaymentList)
                    {
                        item.UserId = GetLoggedinUserInfo().UserId;
                        repository.Insert(item);
                    }


                    repository.Commit();
                    // CreatePatientService(invoice.Id, patientServices);
                }

                using (Repository <Payment> repository = new Repository <Payment>())
                {
                    foreach (Payment item in advancePayment)
                    {
                        item.UserId = GetLoggedinUserInfo().UserId;
                        repository.Update(item);
                    }


                    repository.Commit();
                    // CreatePatientService(invoice.Id, patientServices);
                }
            }

            return(Json("Payment successfull"));
        }
Ejemplo n.º 3
0
        public JsonResult SaveRecieptPayment(ReceiptPayment receipt)
        {
            Payment payment = receipt.Payment;

            receipt.Payment = null;
            ReceiptPayment        onlyReceipt         = new ReceiptPayment();
            List <PatientService> onlyPatientServices = new List <PatientService>();


            onlyPatientServices     = receipt.PatientServices.ToList();
            receipt.PatientServices = null;

            List <PatientService> pService = onlyPatientServices;


            using (PaymentRepository repository = new PaymentRepository())
            {
                payment.UserId = GetLoggedinUserInfo().UserId;

                payment = repository.Insert(payment);
                repository.Commit();
                // CreatePatientService(invoice.Id, patientServices);
            }

            receipt.PaymentId = payment.Id;

            using (Repository <ReceiptPayment> repository = new Repository <ReceiptPayment>())
            {
                onlyReceipt.UserId = GetLoggedinUserInfo().UserId;
                onlyReceipt        = repository.Update(receipt);
                repository.Commit();
            }

            using (Repository <PatientService> repository = new Repository <PatientService>())
            {
                foreach (PatientService item in pService)
                {
                    item.Item   = null;
                    item.UserId = GetLoggedinUserInfo().UserId;
                    repository.Update(item);
                    repository.Commit();
                }
            }
            onlyReceipt.PatientServices = onlyPatientServices;

            return(Json(onlyReceipt, JsonRequestBehavior.AllowGet));
        }