コード例 #1
0
        /// <summary>
        /// Adds the pay control.
        /// </summary>
        private void AddPayControl(Hashtable ht)
        {
            //
            string  controlName = ht["ControlName"].ToString();
            Control payControl  = base.LoadControl(controlName);

            payBillControl = payControl as IPayment;
            if (phPayMethod.HasControls())
            {
                Control oldControl = phPayMethod.Controls.OfType <Control>().DefaultIfEmpty(null).FirstOrDefault();
                if (oldControl != null)
                {
                    oldControl.Dispose();
                    phPayMethod.Controls.Remove(oldControl);
                }
            }

            if (payBillControl != null)
            {
                DiscountPlan plan = (DiscountPlan)ht["DiscountPlan"];

                _oldControl = payControl;
                payBillControl.AmountDue      = this.AmountDue;
                payBillControl.BillAmount     = this.BillAmount;
                payBillControl.BillLocationId = Convert.ToInt32(HLocationID.Value);
                payBillControl.PatientId      = this.PatientId;
                payBillControl.UserId         = this.UserId;
                payBillControl.BillId         = this.BillId;
                payBillControl.PaymentMode    = (PaymentMethod)ht["PaymentMode"];
                payBillControl.AmountToPay    = (decimal)ht["AmountToPay"];
                payBillControl.BillPayOption  = this.BillPayOption;
                payBillControl.HasTransaction = this.HasTransaction;
                if (plan != null)
                {
                    payBillControl.SelectedDiscountPlan = plan;
                }


                ItemsToPay itemsToPay = new ItemsToPay(initializeItemsToPay);
                payBillControl.ItemForPay = itemsToPay;

                //phPayMethod.Controls.Clear();
                phPayMethod.Controls.Add(payControl);

                payBillControl.Rebind();
                this.DisplayMode("PAY");

                Session["PayControl"]          = ht;
                payBillControl.ExecutePayment += new CommandEventHandler(payBillControl_ExecutePayment);
                payBillControl.ErrorOccurred  += new CommandEventHandler(payBillControl_ErrorOccurred);
                payBillControl.NotifyCommand  += new CommandEventHandler(payBillControl_NotifyCommand);
                payBillControl.PayComplete    += new CommandEventHandler(payBillControl_PayComplete);
                payBillControl.CancelCompute  += new CommandEventHandler(payBillControl_CancelCompute);
            }
        }
コード例 #2
0
        ///<summary>Updates one DiscountPlan in the database.</summary>
        public static void Update(DiscountPlan discountPlan)
        {
            string command = "UPDATE discountplan SET "
                             + "Description    = '" + POut.String(discountPlan.Description) + "', "
                             + "FeeSchedNum    =  " + POut.Long(discountPlan.FeeSchedNum) + ", "
                             + "DefNum         =  " + POut.Long(discountPlan.DefNum) + ", "
                             + "IsHidden       =  " + POut.Bool(discountPlan.IsHidden) + " "
                             + "WHERE DiscountPlanNum = " + POut.Long(discountPlan.DiscountPlanNum);

            Db.NonQ(command);
        }
コード例 #3
0
 private static int DiscountPlanComparer(DiscountPlan plan1, DiscountPlan plan2)
 {
     if (!plan1.IsHidden && plan2.IsHidden)
     {
         return(-1);
     }
     else if (plan1.IsHidden && !plan2.IsHidden)
     {
         return(1);
     }
     return(plan1.Description.CompareTo(plan2.Description));
 }
コード例 #4
0
ファイル: DiscountPlanT.cs プロジェクト: ChemBrain/OpenDental
        ///<summary></summary>
        public static DiscountPlan CreateDiscountPlan(string description, long defNum = 0, long feeSchedNum = 0, bool isHidden = false)
        {
            DiscountPlan discountPlan = new DiscountPlan()
            {
                Description = description,
                DefNum      = defNum,
                FeeSchedNum = feeSchedNum,
                IsHidden    = isHidden,
            };

            DiscountPlans.Insert(discountPlan);
            return(discountPlan);
        }
コード例 #5
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (IsSelectionMode)
     {
         if (gridMain.GetSelectedIndex() == -1)
         {
             MsgBox.Show(this, "Please select an entry.");
             return;
         }
         SelectedPlan = (DiscountPlan)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag;
     }
     DialogResult = DialogResult.OK;
 }
コード例 #6
0
        private void butChangePlanFrom_Click(object sender, EventArgs e)
        {
            FormDiscountPlans FormDPs = new FormDiscountPlans();

            FormDPs.IsSelectionMode = true;
            if (FormDPs.ShowDialog() == DialogResult.OK)
            {
                _planFrom = FormDPs.SelectedPlan;
                textDescriptionFrom.Text = _planFrom.Description;
                textFeeSchedFrom.Text    = FeeScheds.GetDescription(_planFrom.FeeSchedNum);
                textAdjTypeFrom.Text     = Defs.GetName(DefCat.AdjTypes, _planFrom.DefNum);
            }
            CheckUIState();
        }
コード例 #7
0
ファイル: DiscountPlanCrud.cs プロジェクト: royedwards/DRDNet
 ///<summary>Inserts one DiscountPlan into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(DiscountPlan discountPlan)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(discountPlan, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             discountPlan.DiscountPlanNum = DbHelper.GetNextOracleKey("discountplan", "DiscountPlanNum");                  //Cacheless method
         }
         return(InsertNoCache(discountPlan, true));
     }
 }
コード例 #8
0
 private void butMerge_Click(object sender, EventArgs e)
 {
     if (!MsgBox.Show(this, MsgBoxButtons.YesNo, "Merge the Discount Plan at the bottom into the Discount Plan shown at the top?"))
     {
         return;                //The user chose not to merge.
     }
     Cursor = Cursors.WaitCursor;
     DiscountPlans.MergeTwoPlans(_planInto, _planFrom);
     Cursor = Cursors.Default;
     MsgBox.Show(this, "Plans merged successfully.");
     _planFrom = null;
     textDescriptionFrom.Text = "";
     textFeeSchedFrom.Text    = "";
     textAdjTypeFrom.Text     = "";
     CheckUIState();
 }
コード例 #9
0
        private void gridMain_CellDoubleClick(object sender, UI.ODGridClickEventArgs e)
        {
            SelectedPlan = (DiscountPlan)gridMain.ListGridRows[gridMain.GetSelectedIndex()].Tag;
            if (IsSelectionMode)
            {
                DialogResult = DialogResult.OK;
                return;
            }
            FormDiscountPlanEdit FormDPE = new FormDiscountPlanEdit();

            FormDPE.DiscountPlanCur = SelectedPlan.Copy();
            if (FormDPE.ShowDialog() == DialogResult.OK)
            {
                FillGrid();
            }
        }
コード例 #10
0
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <DiscountPlan> TableToList(DataTable table)
        {
            List <DiscountPlan> retVal = new List <DiscountPlan>();
            DiscountPlan        discountPlan;

            foreach (DataRow row in table.Rows)
            {
                discountPlan = new DiscountPlan();
                discountPlan.DiscountPlanNum = PIn.Long(row["DiscountPlanNum"].ToString());
                discountPlan.Description     = PIn.String(row["Description"].ToString());
                discountPlan.FeeSchedNum     = PIn.Long(row["FeeSchedNum"].ToString());
                discountPlan.DefNum          = PIn.Long(row["DefNum"].ToString());
                discountPlan.IsHidden        = PIn.Bool(row["IsHidden"].ToString());
                retVal.Add(discountPlan);
            }
            return(retVal);
        }
コード例 #11
0
 /// <summary>
 /// Handles the ItemDataBound event of the ddlDiscountPlan control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="Telerik.Web.UI.RadComboBoxItemEventArgs"/> instance containing the event data.</param>
 protected void ddlDiscountPlan_ItemDataBound(object sender, Telerik.Web.UI.RadComboBoxItemEventArgs e)
 {
     try
     {
         e.Item.Attributes.Clear();
         DiscountPlan plan = e.Item.DataItem as DiscountPlan;
         e.Item.Text = plan.Name;
         e.Item.Attributes.Add("rate", plan.Rate.ToString("{0:N}"));
         e.Item.Attributes.Add("startdate", plan.StartDate.ToString("dd-MMM-yyyy"));
         e.Item.Attributes.Add("enddate", plan.EndDate.HasValue ? plan.EndDate.Value.ToString("dd-MMM-yyyy") : "00-000-0000");
         //plan.EndDate.ToString("dd-MMM-yyyy"));
     }
     catch (Exception ex)
     {
         this.showErrorMessage(ref ex);
     }
 }
コード例 #12
0
        ///<summary>Updates one DiscountPlan in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(DiscountPlan discountPlan, DiscountPlan oldDiscountPlan)
        {
            string command = "";

            if (discountPlan.Description != oldDiscountPlan.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(discountPlan.Description) + "'";
            }
            if (discountPlan.FeeSchedNum != oldDiscountPlan.FeeSchedNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "FeeSchedNum = " + POut.Long(discountPlan.FeeSchedNum) + "";
            }
            if (discountPlan.DefNum != oldDiscountPlan.DefNum)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "DefNum = " + POut.Long(discountPlan.DefNum) + "";
            }
            if (discountPlan.IsHidden != oldDiscountPlan.IsHidden)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHidden = " + POut.Bool(discountPlan.IsHidden) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE discountplan SET " + command
                      + " WHERE DiscountPlanNum = " + POut.Long(discountPlan.DiscountPlanNum);
            Db.NonQ(command);
            return(true);
        }
コード例 #13
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.InsPlanEdit))
            {
                return;
            }
            DiscountPlan discountPlan = new DiscountPlan();

            discountPlan.IsNew = true;
            FormDiscountPlanEdit FormDPE = new FormDiscountPlanEdit();

            FormDPE.DiscountPlanCur = discountPlan;
            if (FormDPE.ShowDialog() == DialogResult.OK)
            {
                SelectedPlan = discountPlan;
                FillGrid();
            }
        }
コード例 #14
0
		} // ValidateSchedule

		/// <summary>
		/// Returns a string that represents the current object.
		/// </summary>
		/// <returns>
		/// A string that represents the current object.
		/// </returns>
		public override string ToString() {
			var os = new StringBuilder();

			os.Append("\tLoan calculation model - begin:\n");

			os.AppendFormat("\tLoan history ({0}) - begin:\n", Grammar.Number(LoanHistory.Count, "item"));

			os.AppendFormat("\t{0}\n", string.Join("\n\t", LoanHistory));

			os.AppendFormat("\tLoan history ({0}) - end.\n", Grammar.Number(LoanHistory.Count, "item"));

			if (DiscountPlan.Count > 0) {
				os.AppendFormat(
					"\tDiscount plan: {0}.\n",
					string.Join(", ", DiscountPlan.Select(x => x.ToString("P1", Library.Instance.Culture)))
				);
			} else
				os.Append("\tNo discount plan.\n");

			if (Repayments.Count > 0)
				os.AppendFormat("\tRepayments:\n\t\t{0}.\n", string.Join("\n\t\t", Repayments));
			else
				os.Append("\tNo repayments.\n");

			if (Fees.Count > 0)
				os.AppendFormat("\tFees:\n\t\t{0}.\n", string.Join("\n\t\t", Fees));
			else
				os.Append("\tNo fees.\n");

			if (BadPeriods.Count > 0)
				os.AppendFormat("\tBadPeriods:\n\t\t{0}.\n", string.Join("\n\t\t", BadPeriods));
			else
				os.Append("\tNo BadPeriods.\n");

			if (FreezePeriods.Count > 0)
				os.AppendFormat("\t FreezePeriods:\n\t\t{0}.\n", string.Join("\n\t\t", FreezePeriods));
			else
				os.Append("\tNo FreezePeriods.\n");

			os.Append("\tLoan calculation model - end.\n");

			return os.ToString();
		} // ToString
コード例 #15
0
 ///<summary>Returns true if Update(DiscountPlan,DiscountPlan) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(DiscountPlan discountPlan, DiscountPlan oldDiscountPlan)
 {
     if (discountPlan.Description != oldDiscountPlan.Description)
     {
         return(true);
     }
     if (discountPlan.FeeSchedNum != oldDiscountPlan.FeeSchedNum)
     {
         return(true);
     }
     if (discountPlan.DefNum != oldDiscountPlan.DefNum)
     {
         return(true);
     }
     if (discountPlan.IsHidden != oldDiscountPlan.IsHidden)
     {
         return(true);
     }
     return(false);
 }
コード例 #16
0
        /// <summary>
        /// Handles the Click event of the buttonSubmit control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void buttonSubmit_Click(object sender, EventArgs e)
        {
            if (buttonSubmit.CommandName == "NEW")
            {
                try
                {
                    bool valid = ValidateTextBox(textDiscountName);

                    if (!valid)
                    {
                        this.NotifyAction("Name of the discount plan is required", "Validation", true);
                        this.discountPopup.Show();
                        return;
                    }
                    string strdiscountName = textDiscountName.Text;
                    valid = ValidateTextBox(textDiscountName);

                    if (!valid)
                    {
                        this.NotifyAction("Discount Rate is required", "Validation", true);
                        this.discountPopup.Show();
                        return;
                    }
                    decimal _rate = decimal.Parse(textRate.Text.Trim()) / 100.0M;

                    /*   valid = ValidateDropDownList(ddlPaymentMode);
                     * if (!valid)
                     * {
                     *
                     *     this.NotifyAction("Please select the payment method for this discount", "Validation", true);
                     *     this.discountPopup.Show();
                     *     return;
                     * }
                     *
                     * string _paymentName = ddlPaymentMode.SelectedItem.Text;
                     * int _paymentID = int.Parse(ddlPaymentMode.SelectedValue);
                     */
                    valid = ValidateTextBox(textStartDate);

                    if (!valid)
                    {
                        this.NotifyAction("Discount StartDate is required", "Validation", true);
                        this.discountPopup.Show();
                        return;
                    }

                    DateTime strStartDate = DateTime.Parse(textStartDate.Text.Trim());;
                    DateTime?strEndDate   = null;
                    if (textEndDate.Text != "")
                    {
                        valid = ValidateTextBox(textEndDate);

                        if (!valid)
                        {
                            this.NotifyAction("Discount EndDate is required", "Validation", true);
                            this.discountPopup.Show();
                            return;
                        }
                        strEndDate = DateTime.Parse(textEndDate.Text.Trim());
                    }
                    if (rblStatus.SelectedIndex == -1)
                    {
                        this.NotifyAction("Discount Plan Status is required", "Validation", true);
                        this.discountPopup.Show();
                        return;
                    }
                    bool Active = rblStatus.SelectedValue == "1";

                    IBilling bMGr = (IBilling)ObjectFactory.CreateInstance("BusinessProcess.Billing.BBilling, BusinessProcess.Billing");

                    DiscountPlan thePlan = new DiscountPlan()
                    {
                        Name      = strdiscountName,
                        Active    = Active,
                        EndDate   = strEndDate,
                        StartDate = strStartDate,
                        Rate      = _rate
                                    //DiscountedPayMethod = null}new PaymentMethod() { ID = _paymentID, Name = _paymentName }
                                    //  DiscountedPayMethod = null
                    };
                    bMGr.AddDiscountPlan(thePlan, this.UserId);

                    this.NotifyAction("New discount plan  addedd successfully", string.Format("{0} {1} ", "Adding discount plan", strdiscountName), false);
                }
                catch (Exception ew)
                {
                    this.NotifyAction(ew.Message, "Error", true);
                }
            }
            else if (buttonSubmit.CommandName == "UPDATE")
            {
            }
        }
コード例 #17
0
        /// <summary>
        /// Buttons the proceed.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        protected void buttonProceed_Click(object sender, EventArgs e)
        {
            string selectedMethod = ddlPaymentMode.SelectedValue;

            string[] method        = selectedMethod.Split('|');
            string   paymethodName = ddlPaymentMode.SelectedItem.Text;

            //List<IQCare.CustomReportConfig.PayMethodElement> lx =
            //       IQCare.CustomReportConfig.PaymentMethodConfig.PayMethodAvailable;
            //PayMethodElement selectedElement = IQCare.CustomReportConfig.PaymentMethodConfig.GetPayMethodConfigElement(paymethod);

            string controlName = method[1].ToString();

            //PaymentConfigHelper.GetHandlerNameByPayMethod(paymethod);
            //if (string.IsNullOrEmpty(selectedHandler))
            //{
            //    selectedHandler = this.DefaultPaymentHandler;
            //    //return;
            //}
            //string controlName = PaymentConfigHelper.HandlerControlName(selectedHandler);
            if (string.IsNullOrEmpty(controlName))
            {
                return;
            }
            ;
            controlName = ("~/billing/" + controlName);

            PaymentMethod payMode = new PaymentMethod()
            {
                Id = Convert.ToInt32(method[0]), Name = paymethodName, ControlName = controlName
            };

            DiscountPlan plan         = null;
            string       g            = ddlDiscountPlan.SelectedValue;
            string       SelectedPlan = HDiscountPlan.Value;

            if (SelectedPlan != "")
            {
                ListItem item  = ddlDiscountPlan.SelectedItem;
                string[] parts = SelectedPlan.Split(':');

                decimal  rate    = decimal.Parse(parts[1]);
                int      planId  = int.Parse(parts[0]);
                DateTime dtStart = DateTime.Parse(parts[2]);
                DateTime?dtEnd   = null;
                if (parts[3] != "00-000-0000")
                {
                    dtEnd = DateTime.Parse(parts[3]);
                }

                plan           = new DiscountPlan();
                plan.PlanId    = planId;
                plan.Name      = HDiscountPlanText.Value;
                plan.Rate      = rate;
                plan.StartDate = dtStart;
                plan.EndDate   = dtEnd;
                //plan.DiscountedPayMethod = payMode;
                plan.Active = true;

                //payBillControl.SelectedDiscountPlan = plan;
            }


            decimal SelectedAmountToPay = 0.0M;

            foreach (GridViewRow gridRow in this.grdPayItems.Rows)
            {
                if (gridRow.RowType == DataControlRowType.DataRow)
                {
                    CheckBox chk    = gridRow.FindControl("chkBxItem") as CheckBox;
                    decimal  amount = decimal.Parse(grdPayItems.DataKeys[gridRow.RowIndex].Values["amount"].ToString());
                    if (chk != null && chk.Checked)
                    {
                        SelectedAmountToPay += amount;
                    }
                }
            }
            ;
            //May132015
            if (SelectedAmountToPay == 0 || SelectedAmountToPay > this.AmountDue)
            {
                SelectedAmountToPay = this.AmountDue;
            }

            Hashtable ht = new Hashtable()
            {
                { "ControlName", controlName },
                { "AmountDue", this.AmountDue },
                { "BillAmount", this.BillAmount },
                { "BillLocationId", Convert.ToInt32(HLocationID.Value) },
                { "PatientID", this.PatientId },
                { "UserID", this.UserId },
                { "BillID", this.BillId },
                { "PaymentMode", payMode },  //new PaymentMethod() { ID = Convert.ToInt32(ddlPaymentMode.SelectedValue), Name = paymethod }},
                { "DiscountPlan", plan },
                { "AmountToPay", SelectedAmountToPay }
            };

            Session["PayControl"] = ht;
            this.AddPayControl(ht);

            //  ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Highlightor", "highlight();", true);
        }
コード例 #18
0
 ///<summary>Inserts one DiscountPlan into the database.  Returns the new priKey.</summary>
 public static long Insert(DiscountPlan discountPlan)
 {
     return(Insert(discountPlan, false));
 }