예제 #1
0
        public static int AddFuneralPayments(FuneralPaymentsModel model)
        {
            decimal amountPaid = model.AmountPaid.ToString().Contains(",") == true?Convert.ToDecimal((model.AmountPaid / 100).ToString().Replace(",", ".")) : model.AmountPaid;

            DbParameter[] ObjParam = new DbParameter[7];
            ObjParam[0] = new DbParameter("@FuneralID", DbParameter.DbType.Int, 0, model.FuneralID);//pIntFnrlID
            ObjParam[1] = new DbParameter("@AmountPaid", DbParameter.DbType.Decimal, 0, amountPaid);
            ObjParam[2] = new DbParameter("@RecievedBy", DbParameter.DbType.VarChar, 0, model.RecievedBy);
            ObjParam[3] = new DbParameter("@PaidBy", DbParameter.DbType.VarChar, 0, model.PaidBy);
            ObjParam[4] = new DbParameter("@Notes", DbParameter.DbType.VarChar, 0, model.Notes);
            ObjParam[5] = new DbParameter("@parlourid", DbParameter.DbType.UniqueIdentifier, 0, model.ParlourId);
            ObjParam[6] = new DbParameter("@ModifiedUser", DbParameter.DbType.VarChar, 0, model.UserName);

            return(Convert.ToInt32(DbConnection.GetScalarValue(CommandType.StoredProcedure, "AddFuneralPayments", ObjParam)));
        }
예제 #2
0
        protected void btnPay_Click(object sender, EventArgs e)
        {
            try
            {
                Int32  intMethod = 0;
                string strMethod = "";
                //wsSMS.API SMS = new wsSMS.API();

                string strMsg = string.Empty;
                if (string.IsNullOrEmpty(txtReceivedBy.Text))
                {
                    Common.WebMsgBox.Show("Incorrect data provided");
                    txtReceivedBy.Focus();
                    return;
                }
                if (txtMemberStauts.Text == "Lapsed" & !txtMohthPaid.Text.Contains("Reinstate Policy") & !txtMohthPaid.Text.Contains("Rejoin Policy"))
                {
                    Common.WebMsgBox.Show("This policy has Lapsed, please take the corrective action.");
                    return;
                }
                if (ddlNoOfMonths.SelectedIndex == -1 & !blnFuneralPayment & btnPay.Text != "Add Reversal" & !txtMohthPaid.Text.Contains("Joining Fee") & !txtMohthPaid.Text.Contains("Reinstate Policy") & !txtMohthPaid.Text.Contains("Rejoin Policy"))
                {
                    Common.WebMsgBox.Show("Select Number of Months");
                    ddlNoOfMonths.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(txtMohthPaid.Text))
                {
                    Common.WebMsgBox.Show("Incorrect data provided");
                    txtMohthPaid.Focus();
                    return;
                }
                if (btnPay.Text != "Add Reversal")
                {
                    txtMohthPaid.Text = ddlMethod.SelectedItem.Text + " - " + txtMohthPaid.Text;
                }

                intMethod = Strings.InStr(txtMohthPaid.Text, "Cash", CompareMethod.Text);
                strMethod = ddlMethod.SelectedItem.Text;
                //Remain
                //if (txtMohthPaid.Text.Contains("Reinstate Policy") | txtMohthPaid.Text.Contains("Rejoin Policy"))
                //{
                //    //SupervisorLogin frmSupervisorLogin = default(SupervisorLogin);

                //    //blnAuthenticated = false;
                //    //frmSupervisorLogin = new SupervisorLogin();
                //    //frmSupervisorLogin.ShowDialog();

                //    //if (!blnAuthenticated)
                //    //{
                //    //    break; // TODO: might not be correct. Was : Exit Try
                //    //}
                //}
                Guid         ParlID    = new Guid(Request.QueryString["ParlourId"]);
                MembersModel objmember = client.GetMemberByID(MemberId, ParlID);

                if (!blnFuneralPayment)
                {
                    if (btnPay.Text != "Add Reversal" & !string.IsNullOrEmpty(txtTotalPremium.Text) & !txtMohthPaid.Text.Contains("Joining Fee"))
                    {
                        if (Convert.ToDouble(hdnAmount.Value.Replace(Currency.Trim() + " ", "")) < Convert.ToDouble(txtTotalPremium.Text.Replace(Currency.Trim() + " ", "")))
                        {
                            ShowMessage(ref lblMessage, MessageType.Danger, "Payment cannot be less than premium amount.");
                            Common.WebMsgBox.Show("Payment cannot be less than premium amount.");
                            return;
                        }
                    }
                    if (btnPay.Text == "Add Payment")
                    {
                        MembersPaymentDetailsModel objPayment = new MembersPaymentDetailsModel();
                        objPayment.pkiMemberID        = MemberId;
                        objPayment.Amount             = Convert.ToDecimal(hdnAmount.Value.Replace(Currency.Trim() + " ", ""));
                        objPayment.LatePaymentPenalty = Convert.ToDecimal(txtLatePenalty.Text.Replace(Currency.Trim() + " ", ""));
                        objPayment.ReceivedBy         = txtReceivedBy.Text.ToString();
                        objPayment.Notes           = txtMohthPaid.Text.ToString();
                        objPayment.MethodOfPayment = strMethod;
                        objPayment.MemeberNumber   = txtMemberNo.Text.ToString();
                        objPayment.PaymentDate     = Convert.ToDateTime(txtNextPaymentDate.Text);
                        objPayment.NextPaymentDate = Convert.ToDateTime(hdnLastpaymentDate.Value).AddMonths(Convert.ToInt32(ddlNoOfMonths.SelectedValue));
                        objPayment.Branch          = objmember.MemberBranch;
                        objPayment.parlourid       = ParlID;
                        bool IsJoiningFee = false;
                        IsJoiningFeePaid(out IsJoiningFee);
                        int PaymentID = client.AddPayments(objPayment, IsJoiningFee);
                        if (PaymentID != 0)
                        {
                            Common.WebMsgBox.Show("Payment not added successfully.");
                        }
                        else
                        {
                            Common.WebMsgBox.Show("Payment added successfully.");
                            PrintPayment(objPayment);
                            PaymentRemindersms(objPayment);
                            bindMemberPlanDetailsWithBalance();
                        }
                    }
                    else
                    {
                        if (Interaction.MsgBox("You are about to make a REVERSAL PAYMENT. Continue?", MsgBoxStyle.YesNo) == MsgBoxResult.Yes)
                        {
                            //MembersPaymentDetailsModel objPayment = new MembersPaymentDetailsModel();
                            //objPayment.pkiMemberID = MemberId;
                            //objPayment.Amount = Convert.ToDecimal(hdnAmount.Value.Replace("R ", ""));
                            //objPayment.LatePaymentPenalty = Convert.ToDecimal(txtLatePenalty.Text.Replace("R ", ""));
                            //objPayment.ReceivedBy = txtReceivedBy.Text.ToString();
                            //objPayment.Notes = txtMohthPaid.Text.ToString();
                            //objPayment.MethodOfPayment = strMethod;
                            //objPayment.MemeberNumber = txtMemberNo.Text.ToString();
                            //objPayment.PaymentDate = Convert.ToDateTime(txtNextPaymentDate.Text);
                            //objPayment.NextPaymentDate = Convert.ToDateTime(hdnLastpaymentDate.Value).AddMonths(Convert.ToInt32(ddlNoOfMonths.SelectedValue));
                            ////
                            //objPayment.Branch = objmember.MemberBranch;
                            //objPayment.parlourid = ParlID;

                            //int PaymentID = client.AddReversalPayments(objPayment);
                            //if (PaymentID != 0)
                            //{
                            //    Common.WebMsgBox.Show("Reversal added successfully.");
                            //}
                            //else
                            //{
                            //    Common.WebMsgBox.Show("Reversal not added successfully.");
                            //}
                        }
                    }


                    //ReturnMemberPayment - Done
                    //FuneralPaymentsModel[] objFuneralPaymentModel = client.ReturnMemberPayment(Convert.ToString(MemberId));
                    //gvInvoices.DataSource = objFuneralPaymentModel;
                    //gvInvoices.DataBind();
                }
                else
                {
                    if (btnPay.Text == "Add Payment")
                    {
                        FuneralPaymentsModel funeralPayment = new FuneralPaymentsModel();
                        funeralPayment.FuneralID  = FuneralId;
                        funeralPayment.AmountPaid = Convert.ToDecimal(hdnAmount.Value.Replace(Currency.Trim() + " ", ""));
                        funeralPayment.RecievedBy = txtReceivedBy.Text.ToString();
                        funeralPayment.Notes      = txtMohthPaid.Text.ToString();
                        funeralPayment.ParlourId  = new Guid(Request.QueryString["ParlourId"]);
                        funeralPayment.UserName   = HttpContext.Current.User.Identity.Name;
                        int FuneralID = client.AddFuneralPayments(funeralPayment);
                        if (FuneralID != 0)
                        {
                            Common.WebMsgBox.Show("Payment added successfully.");
                            //ReadFuneralInvoiceIntoDatatable - Remain.

                            btnPrint.Enabled = true;
                        }
                        else
                        {
                            Common.WebMsgBox.Show("Payment not added successfully.");
                        }
                    }
                    else
                    {
                        //CheckUserAccess - Remain.
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "goToTab5", "confirm('You are about to make a REVERSAL PAYMENT. Continue?')", true);
                        if (Interaction.MsgBox("You are about to make a REVERSAL PAYMENT. Continue?", MsgBoxStyle.YesNo) == MsgBoxResult.Yes)
                        {
                            FuneralPaymentsModel objFunerals = new FuneralPaymentsModel();
                            objFunerals.FuneralID  = FuneralId;
                            objFunerals.AmountPaid = Convert.ToDecimal(hdnAmount.Value.Replace(Currency.Trim() + " ", ""));
                            objFunerals.RecievedBy = txtReceivedBy.Text.ToString();
                            objFunerals.Notes      = txtMohthPaid.Text.ToString();
                            objFunerals.ParlourId  = new Guid(Request.QueryString["ParlourId"]);
                            objFunerals.UserName   = HttpContext.Current.User.Identity.Name;
                            int FuneralID = client.AddFuneralPayments(objFunerals);
                        }
                        else
                        {
                            Interaction.MsgBox("Reversal not added successfully", MsgBoxStyle.Information);
                        }
                    }
                    //ReturnFuneralPayments - Done
                    //FuneralPaymentsModel[] objFuneralPaymentModel = client.ReturnFuneralPayments(Convert.ToString(0));
                    //gvInvoices.DataSource = objFuneralPaymentModel;
                    //gvInvoices.DataBind();
                }
                Guid ParlourId = new Guid(Request.QueryString["ParlourId"]);
                bindInvoices(ParlourId, MemberId);
                txtAmount.Text    = "";
                hdnAmount.Value   = "";
                txtMohthPaid.Text = "";

                ddlMethod.Enabled     = true;
                ddlNoOfMonths.Enabled = true;
            }
            catch (Exception ex)
            {
                Common.WebMsgBox.Show(ex.Message.ToString());
                //this.Cursor = Cursors.Default;
                //Interaction.MsgBox("Error:- " + ex.Message, MsgBoxStyle.Information, strAppName);
            }
        }
예제 #3
0
 public static int AddFuneralPayments(FuneralPaymentsModel model)
 {
     return(MemberPaymetsDAL.AddFuneralPayments(model));
 }