コード例 #1
0
ファイル: frmPayment.cs プロジェクト: kawserkibria/MobileERP
        // public event EventHandler OnSaveButtonClick;



        //public delegate void PassControl(object sender);

        //// Create instance (null)
        //public PassControl passControl;
        //public AGH.MODEL.Payment.Payment btnSave_Click(object sender, EventArgs e)
        //{

        //    //if (OnSaveButtonClick != null)
        //    //    OnSaveButtonClick(this, EventArgs.Empty);

        //     //AGH.MODEL.Payment.Payment payObj = this.PopulatePayment();
        //     //return payObj;
        //}

        private OPDPayment PopulatePayment()
        {
            OPDPayment payObj = new OPDPayment();

            payObj.HCN         = txtPateintNo.Text;
            payObj.PurposeID   = this.purposeID;
            payObj.Advance     = decimal.Parse(txtAdvancePaid.Text);
            payObj.Amount      = decimal.Parse(txtAmount.Text);
            payObj.VAT         = decimal.Parse(txtVATAmount.Text);
            payObj.PreviousDue = decimal.Parse(txtPreviousDue.Text);
            payObj.Discount    = decimal.Parse(txtDiscountAmount.Text);
            payObj.NetAmount   = decimal.Parse(txtNetPayableAmount.Text);
            payObj.AmountGiven = Decimal.Parse(Convert.ToString(Utility.val(txtCash.Text) + Utility.val(txtCreditAmount.Text) + Utility.val(txtDebitAmount.Text) + Utility.val(txtChequeAmount.Text) + Utility.val(txtOthersAmount.Text)));

            //payObj.PaymentDate = DateTime.ParseExact(DateTime.Today, "dd/MM/yyyy", new System.Globalization.CultureInfo("en-GB"));

            payObj.Department     = this.department;
            payObj.ReffDept       = this.reffDepartment;
            payObj.DeptAmount     = this.departmentAmount;
            payObj.ReffDeptAmount = this.reffDepartmentAmount;
            payObj.DepartmentUnit = this.departmentUnit;
            payObj.ReffDeptUnit   = this.reffDepartmentUnit;
            payObj.PaymentType    = this.paymentType;
            payObj.EntryDate      = this.updateDate;
            payObj.ConsultantFee  = this.consultantAmount;

            payObj.discountNote  = txtDiscNote.Text;
            payObj.PaymentString = (txtCash.Text == "" ? "0" : txtCash.Text) + "~" +
                                   (txtCreditAmount.Text == ""?"0":txtCreditAmount.Text) + "~" +
                                   cboBNKNameCreditCard.SelectedValue + "~" +
                                   cboCardTypeCredit.SelectedValue + "~" +
                                   (txtLastDigitCreditCard.Text == "" ? "0" : txtLastDigitCreditCard.Text) + "~" +
                                   (txtDebitAmount.Text == ""?"0":txtDebitAmount.Text) + "~" +
                                   cboBNKDebitCard.SelectedValue + "~" +
                                   cboCardTypeDebit.SelectedValue + "~" +
                                   (txtLastDigitDebitCard.Text == "" ? "0" : txtLastDigitDebitCard.Text) + "~" +
                                   (txtChequeAmount.Text == "" ? "0" : txtChequeAmount.Text) + "~" + cboBankName.SelectedValue + "~" + (txtChequeNo.Text == "" ? "0" : txtChequeNo.Text) + "~" +
                                   (txtOthersAmount.Text == "" ? "0" : txtOthersAmount.Text) + "~" +
                                   (txtOthersRemarks.Text == "" ? " " : txtOthersRemarks.Text) + "~" +
                                   (Utility.val(txtChange.Text) > 0 ? txtChange.Text.ToString() : "0") + "~" + // Added by Mayhedi for due check on 16_01_17
                                   ";";



            //this.updateDate.ToString("dd/MM/yyyy");
            //patObj.DOB = DateTime.ParseExact(txtDOB.Text, "dd/MM/yyyy", new System.Globalization.CultureInfo("en-GB"));
            //patObj.StaffID = (cboStaffID.Items.Count == 0) ? null : cboStaffID.SelectedValue.ToString();
            //patObj.CorporateID = (cboCorporateID.Items.Count == 0) ? null : cboCorporateID.SelectedValue.ToString();


            //patObj.EmergencyPersonRelation = cboEmergenPersonRelationship.SelectedValue.ToString();
            payObj.EntryBy    = Utility.UserId;
            payObj.LocationID = Utility.LocationID;
            payObj.CompanyID  = Utility.CompanyID;
            payObj.MachineID  = Utility.MachineID;
            return(payObj);
        }
コード例 #2
0
        public ActionResult AddPayment(OPDPayment c, List <HttpPostedFileBase> Attachment)
        {
            string fileLocation         = "";
            string ItemUploadFolderPath = "~/DataImages/";

            try
            {
                try
                {
                    if (Attachment.Count > 0)
                    {
                        foreach (HttpPostedFileBase file in Attachment)
                        {
                            try
                            {
                                if (file.ContentLength == 0)
                                {
                                    continue;
                                }

                                if (file.ContentLength > 0)
                                {
                                    fileLocation = HelperFunctions.renameUploadFile(file, ItemUploadFolderPath);
                                    if (fileLocation == "")
                                    {
                                        fileLocation = "";
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                            }

                            if (fileLocation == "" || fileLocation == null)
                            {
                                c.Attachment = c.Attachment;
                            }
                            else
                            {
                                c.Attachment = fileLocation;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
            catch (Exception ex)
            {
            }



            try
            {
                if (dl.InsertOPDPayment_Sp(c) > 0)
                {
                    TempData["PaymentMSG"] = "Data Saved Successfully";
                }
            }
            catch (Exception ex)
            {
                TempData["PaymentMSG"] = "Something went wrong.";
                return(Redirect("/Patient/OPDCharges"));
            }
            TempData["PaymentMSG"] = "Data Saved Successfully.";
            return(Redirect("/Patient/OPDCharges"));
        }
コード例 #3
0
        public ActionResult OPDCharges()
        {
            List <OPDCharge> CategoryList = new List <OPDCharge>();
            Property         p            = new Property();
            DataSet          ds           = new DataSet();

            p.OnTable    = "FetchOPDCharge";
            p.Condition1 = "1";

            ds = dl.FetchOPDCharge_sp(p);

            List <SelectListItem> ChargeTypeinventory = new List <SelectListItem>();

            ChargeTypeinventory.Add(new SelectListItem {
                Text = "Select", Value = ""
            });
            foreach (DataRow dr in ds.Tables[1].Rows)
            {
                ChargeTypeinventory.Add(new SelectListItem {
                    Text = dr["Type"].ToString(), Value = dr["ChargeTypeId"].ToString()
                });
            }
            ViewBag.ChargeTypeinventory = new SelectList(ChargeTypeinventory, "Value", "Text");

            try
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    OPDCharge m = new OPDCharge();

                    m.OPDChargeId    = item["OPDChargeId"].ToString();
                    m.OPDId          = item["OPDId"].ToString();
                    m.PatientId      = item["PatientId"].ToString();
                    m.Date           = item["Date"].ToString();
                    m.Type           = item["Type"].ToString();
                    m.Name           = item["Name"].ToString();
                    m.StandardCharge = item["StandardCharge"].ToString();
                    m.AppliedCharge  = item["AppliedCharge"].ToString();
                    CategoryList.Add(m);
                }
                ViewBag.CategoryList = CategoryList;
            }
            catch (Exception ex)
            {
            }


            OPDCharge info = new RXGOADMIN.Models.OPDCharge();

            try
            {
                info = new RXGOADMIN.Models.OPDCharge()
                {
                    AppliedCharge = ds.Tables[4].Rows[0]["AppliedCharge"].ToString(),
                };
            }
            catch (Exception ex)
            {
            }


            OPDPayment info1 = new RXGOADMIN.Models.OPDPayment();

            try

            {
                info1 = new RXGOADMIN.Models.OPDPayment()
                {
                    Amount = ds.Tables[5].Rows[0]["Amount"].ToString(),
                };
                ViewBag.PaymentInfo = info1;
            }
            catch (Exception ex)
            {
            }



            List <OPDPayment> PaymentList = new List <OPDPayment>();

            p.OnTable = "FetchOPDPayment";
            ds        = dl.FetchOPDPayment_sp(p);
            try
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    OPDPayment m = new OPDPayment();

                    m.PaymentId   = item["PaymentId"].ToString();
                    m.OPDId       = item["OPDId"].ToString();
                    m.PatientId   = item["PatientId"].ToString();
                    m.Date        = item["Date"].ToString();
                    m.Note        = item["Note"].ToString();
                    m.PaymentMode = item["PaymentMode"].ToString();
                    m.Amount      = item["Amount"].ToString();
                    m.Attachment  = item["Attachment"].ToString();
                    PaymentList.Add(m);
                }
                ViewBag.PaymentList = PaymentList;
            }
            catch (Exception ex)
            {
            }

            List <OPDDiagnosis> DiagnosisList = new List <OPDDiagnosis>();

            p.OnTable = "FetchOPDDiagnosis";
            ds        = dl.FetchOPDDiagnosis_sp(p);
            try
            {
                foreach (DataRow item in ds.Tables[0].Rows)
                {
                    OPDDiagnosis m = new OPDDiagnosis();

                    m.DiagnosisId = item["DiagnosisId"].ToString();
                    m.OPDId       = item["OPDId"].ToString();
                    m.PatientId   = item["PatientId"].ToString();
                    m.ReportType  = item["ReportType"].ToString();
                    m.ReportDate  = item["ReportDate"].ToString();
                    m.Description = item["Description"].ToString();
                    m.Attachment  = item["Attachment"].ToString();
                    DiagnosisList.Add(m);
                }
                ViewBag.DiagnosisList = DiagnosisList;
            }
            catch (Exception ex)
            {
            }


            return(View(info));
        }