Exemplo n.º 1
0
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            Result oResult = null;

            try
            {
                if (string.IsNullOrEmpty(hdnClaimTransNo.Value))
                {
                    ucMessage.OpenMessage("Please select a valid Commission Claim for delete.", Constants.MSG_TYPE_INFO);
                    ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
                }
                else
                {
                    CommissionClaimDAL iClaimDAL = new CommissionClaimDAL();
                    oResult = iClaimDAL.DeleteCommissionClaim(hdnClaimTransNo.Value);

                    if (oResult.Status)
                    {
                        ucMessage.OpenMessage("Commission Claim data deleted successfully.", Constants.MSG_APPROVED_SAVE_DATA);
                        ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
                        btnReset_Click(sender, e);
                    }
                    else
                    {
                        ucMessage.OpenMessage("Error: " + oResult.Message, Constants.MSG_TYPE_INFO);
                        ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
                    }
                }
            }
            catch (Exception ex)
            {
                ucMessage.OpenMessage("Error: " + ex.Message, Constants.MSG_TYPE_INFO);
                ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
            }
        }
Exemplo n.º 2
0
        public bool SaveAndPreviewAction()
        {
            Config oConfig = (Config)Session[Constants.SES_USER_CONFIG];

            if (oConfig != null)
            {
                if (!txtStatementDate.Text.Equals(DateTime.Now.ToString(Constants.DATETIME_FORMAT)))
                {
                    ucMessage.OpenMessage("Statement Date cannot be greater than or less than todays date.", Constants.MSG_TYPE_INFO);
                    ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
                }
                if (txtReferenceNo.Text.Equals(string.Empty))
                {
                    if (!IsValidateData())
                    {
                        return(false);
                    }
                }


                if (txtReferenceNo.Text.Equals(string.Empty))
                {
                    CalculateCommissionClaim();

                    #region     01.  GetObject    ... Get Value

                    SBM_BLC1.Entity.Claim.CommissionClaim oCommClaim = GetObject();
                    DataTable dtCommClaim = GetDataTable();

                    #endregion

                    #region     02. Call and varify..
                    CommissionClaimDAL commClaimDAL = new CommissionClaimDAL();
                    Result             oResult      = commClaimDAL.InsertData(oCommClaim, dtCommClaim);
                    if (oResult.Status)
                    {
                        txtReferenceNo.Text = Convert.ToString(oResult.Return);
                        //ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS);
                    }
                    else
                    {
                        ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR);
                        return(false);
                    }
                    #endregion

                    #region     03. for preview
                    Preview(oCommClaim);
                    #endregion
                }

                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        private void SetToDate()
        {
            Config oConfig = (Config)Session[Constants.SES_USER_CONFIG];

            string sCondtion = " WHERE (((b.SaleStatementTransNo) Is Null)";

            sCondtion += " AND ((a.SPTypeID) = '" + ddlSpType.SelectedValue + "') AND a.IsClaimed = 'False' )";
            sCondtion += " AND (a.DivisionID = '" + oConfig.DivisionID + "' AND a.BankID = '" + oConfig.BankCodeID + "')";

            CommissionClaimDAL commClaimDAL = new CommissionClaimDAL();
            Result             oResult      = commClaimDAL.SetToDate(sCondtion);

            ddlDateTo.DataSource     = oResult.Return;
            ddlDateTo.DataTextField  = "DisplayMember";
            ddlDateTo.DataValueField = "ValueMember";
            ddlDateTo.DataBind();
        }
Exemplo n.º 4
0
        private DataTable GetDataTable()
        {
            CommissionClaimDAL commClaimDAL      = new CommissionClaimDAL();
            DataTable          dtCommissionClaim = new DataTable("dtCommissionClaim");

            dtCommissionClaim.Columns.Add(new DataColumn("SaleStatementTransNo", typeof(string)));
            dtCommissionClaim.Columns.Add(new DataColumn("TotalFaceValue", typeof(string)));
            dtCommissionClaim.Columns.Add(new DataColumn("TotalOrgCommission", typeof(string)));
            dtCommissionClaim.Columns.Add(new DataColumn("TotalNonOrgCommission", typeof(string)));

            string saleTransNos = "";

            foreach (GridViewRow gvr in gvData.Rows)
            {
                CheckBox chk = (CheckBox)gvr.FindControl("chkSelected");
                if (chk != null)
                {
                    if (chk.Checked)
                    {
                        saleTransNos += "," + (gvr.FindControl("hdnSalesStatementTranNo") as HiddenField).Value;
                    }
                }
            }

            if (!string.IsNullOrEmpty(saleTransNos))
            {
                saleTransNos = saleTransNos.Substring(1);
                Result oResult;
                oResult = commClaimDAL.LoadReferenceDetailsData(saleTransNos);
                if (oResult.Status)
                {
                    dtCommissionClaim = oResult.Return as DataTable;
                }
            }

            return(dtCommissionClaim);
        }
Exemplo n.º 5
0
        private void FillReferenceDetailGrid(string sCommissionClaimTransNo)
        {
            CommissionClaimDAL commClaimDAL = new CommissionClaimDAL();
            Config             oConfig      = (Config)Session[Constants.SES_USER_CONFIG];
            Result             oResult      = commClaimDAL.LoadReferenceDetailsData(ddlSpType.SelectedValue, Util.GetDateTimeByString(txtDateFrom.Text), Util.GetDateTimeByString(ddlDateTo.SelectedValue), sCommissionClaimTransNo, oConfig.DivisionID, oConfig.BankCodeID);

            if (oResult.Status)
            {
                DataTable dtCommClaim = oResult.Return as DataTable;

                if (dtCommClaim != null && dtCommClaim.Rows.Count > 0)
                {
                    dtCommClaim.Columns.Remove("OrgCount");

                    gvData.DataSource = dtCommClaim;
                    gvData.DataBind();

                    if (!string.IsNullOrEmpty(sCommissionClaimTransNo))
                    {
                        foreach (GridViewRow gvr in gvData.Rows)
                        {
                            CheckBox chk = (CheckBox)gvr.FindControl("chkSelected");
                            if (chk != null)
                            {
                                chk.Checked = true;
                                chk.Enabled = false;
                            }
                        }
                        CalculateCommissionClaim();
                    }
                    else
                    {
                        LoadCurrencyData();
                    }
                }
            }
        }
Exemplo n.º 6
0
        private void LoadDurationData()
        {
            if (ddlSpType.SelectedIndex > 0)
            {
                //to do...
                string sSPCurrency = ViewState[_SPTYPE_CUREENCY] as string;
                DDListUtil.Assign(ddlConversionCurrency, sSPCurrency);
            }
            SetToDate();

            if (ddlDuration.SelectedIndex > 0)
            {
                CommissionClaimDAL commClaimDAL = new CommissionClaimDAL();
                Result             oResult      = null;
                Config             oConfig      = (Config)Session[Constants.SES_USER_CONFIG];
                string             sCriteria    = string.Empty;

                if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Daily)))
                {
                    oResult = commClaimDAL.GetCommissionClaimToDateSource(sCriteria, txtDateFrom.Text);

                    if (oResult.Status)
                    {
                        ddlDateTo.DataSource = null;

                        DataTable dtDateTo = (DataTable)oResult.Return;
                        ddlDateTo.DataSource     = dtDateTo;
                        ddlDateTo.DataTextField  = "DisplayMember";
                        ddlDateTo.DataValueField = "ValueMember";
                        ddlDateTo.DataBind();
                        if (dtDateTo.Rows.Count == 2)
                        {
                            ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString();
                        }
                        ddlDateTo.Enabled = false;
                    }
                }
                else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Date_Range)))
                {
                    /*
                     * If Me.chkFource.Checked Then
                     *  cboToDate.DataSource = Nothing
                     *  cboToDate.DataSource = Me.cOCommon.GetCommissionClaimToDateSource(Nothing, Format(CDate(txtFromDate.Text.Trim), modCommon.DateFormat))
                     * End If
                     */
                    gvData.DataSource = null;
                    gvData.DataBind();
                    txtTotalFaceValue.Text         = "0.00";
                    txtTotalNonOrgCommission1.Text = "0.00";
                    txtTotalNonOrgCommission2.Text = "0.00";
                    txtTotalOrgCommission1.Text    = "0.00";
                    txtTotalOrgCommission2.Text    = "0.00";
                    txtTotalCommissionClaim.Text   = "0.00";
                    if (ddlConversionCurrency.Items.Count > 0)
                    {
                        ddlConversionCurrency.SelectedIndex = 0;
                    }
                    ddlConversionCurrency.Enabled = false;
                    txtConversionRate.Text        = "0.0000";
                    ddlDateTo.SelectedIndex       = 0;
                    ddlDateTo.Enabled             = true;
                }
                else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Half_Yearly)))
                {
                    DateTime dtFromDate = DateTime.Now;
                    DateTime dtToDate   = DateTime.Now;

                    if (!string.IsNullOrEmpty(txtDateFrom.Text))
                    {
                        dtFromDate = Util.GetDateTimeByString(txtDateFrom.Text);
                        if (dtFromDate.Month >= 1 && dtFromDate.Month <= 6)
                        {
                            dtFromDate = new DateTime(dtFromDate.Year, 1, 1);
                            dtToDate   = new DateTime(dtFromDate.Year, 6, 30);
                        }
                        else if (dtFromDate.Month >= 7)
                        {
                            dtFromDate = new DateTime(dtFromDate.Year, 7, 1);
                            dtToDate   = new DateTime(dtFromDate.Year, 12, 31);
                        }
                        txtDateFrom.Text     = dtFromDate.ToString(Constants.DATETIME_FORMAT);
                        ddlDateTo.DataSource = null;
                        oResult = commClaimDAL.GetCommissionClaimToDateSource(sCriteria, dtToDate.ToString(Constants.DATETIME_FORMAT));
                        if (oResult.Status)
                        {
                            DataTable dtDateTo = (DataTable)oResult.Return;
                            ddlDateTo.DataSource     = dtDateTo;
                            ddlDateTo.DataTextField  = "DisplayMember";
                            ddlDateTo.DataValueField = "ValueMember";
                            ddlDateTo.DataBind();
                            if (dtDateTo.Rows.Count == 2)
                            {
                                ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString();
                            }
                            ddlDateTo.Enabled = false;
                        }
                    }
                }

                /*
                 * ElseIf cboDuration.SelectedValue = CStr(modCommon.enmDurationType.Monthly) Then
                 *  Dim dtFromDate As Date
                 *  Dim dtToDate As Date
                 *  If Me.txtFromDate.Text <> "" Then
                 *      dtFromDate = CDate(Me.txtFromDate.Text)
                 *      dtFromDate = New Date(dtFromDate.Year, dtFromDate.Month, 1)
                 *      dtToDate = DateAdd(DateInterval.Month, 1, dtFromDate)
                 *      dtToDate = DateAdd(DateInterval.Day, -1, dtToDate)
                 *  End If
                 *  txtFromDate.Text = Format(dtFromDate, modCommon.DateFormat)
                 *  cboToDate.DataSource = Nothing
                 *  cboToDate.DataSource = Me.cOCommon.GetCommissionClaimToDateSource(Nothing, Format(dtToDate, modCommon.DateFormat))
                 * End If
                 */

                else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Monthly)))
                {
                    DateTime dtFromDate = DateTime.Now;
                    DateTime dtToDate   = DateTime.Now;

                    if (!string.IsNullOrEmpty(txtDateFrom.Text))
                    {
                        dtFromDate = Util.GetDateTimeByString(txtDateFrom.Text);
                        dtFromDate = new DateTime(dtFromDate.Year, dtFromDate.Month, 1);
                        int iNoOfDays = System.DateTime.DaysInMonth(dtFromDate.Year, dtFromDate.Month);
                        dtToDate = dtFromDate.AddDays(iNoOfDays - 1);
                        //dtToDate.Add(dtFromDate.i

                        txtDateFrom.Text     = dtFromDate.ToString(Constants.DATETIME_FORMAT);
                        ddlDateTo.DataSource = null;
                        oResult = commClaimDAL.GetCommissionClaimToDateSource(sCriteria, dtToDate.ToString(Constants.DATETIME_FORMAT));
                        if (oResult.Status)
                        {
                            DataTable dtDateTo = (DataTable)oResult.Return;
                            ddlDateTo.DataSource     = dtDateTo;
                            ddlDateTo.DataTextField  = "DisplayMember";
                            ddlDateTo.DataValueField = "ValueMember";
                            ddlDateTo.DataBind();
                            if (dtDateTo.Rows.Count == 2)
                            {
                                ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString();
                            }
                            ddlDateTo.Enabled = false;
                        }
                    }
                }
                if (ddlDateTo.Items.Count > 1)
                {
                    ddlDateTo.SelectedIndex = 1;
                }
                FillReferenceDetailGrid("");
                ddlConversionCurrency.Enabled = true;
            }
            else
            {
                gvData.DataSource = null;
                gvData.DataBind();
                txtTotalFaceValue.Text         = "0.00";
                txtTotalNonOrgCommission1.Text = "0.00";
                txtTotalNonOrgCommission2.Text = "0.00";
                txtTotalOrgCommission1.Text    = "0.00";
                txtTotalOrgCommission2.Text    = "0.00";
                txtTotalCommissionClaim.Text   = "0.00";
                if (ddlConversionCurrency.Items.Count > 0)
                {
                    ddlConversionCurrency.SelectedIndex = 0;
                }
                ddlConversionCurrency.Enabled = false;
                txtConversionRate.Text        = "0.0000";
                ddlDateTo.SelectedIndex       = -1;
                ddlDateTo.Enabled             = true;
            }
        }
Exemplo n.º 7
0
        private void LoadDurationData()
        {
            gvData.DataSource = null;
            gvData.DataBind();
            txtTotalFaceValue.Text = "0.00";

            if (ddlDuration.SelectedIndex > 0)
            {
                CommissionClaimDAL commClaimDAL = new CommissionClaimDAL();
                Result             oResult      = null;
                if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Daily)))
                {
                    //ddlDateTo.Text = Util.GetDateTimeByString(txtDateFrom.Text).ToString(Constants.DATETIME_dd_MMM_yyyy);//for the time being
                    oResult = commClaimDAL.GetCommissionClaimToDateSource("", txtDateFrom.Text);
                    if (oResult.Status)
                    {
                        ddlDateTo.DataSource = null;

                        DataTable dtDateTo = (DataTable)oResult.Return;
                        ddlDateTo.DataSource     = dtDateTo;
                        ddlDateTo.DataTextField  = "DisplayMember";
                        ddlDateTo.DataValueField = "ValueMember";
                        ddlDateTo.DataBind();
                        if (dtDateTo.Rows.Count == 2)
                        {
                            ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString();
                        }
                    }
                    ddlDateTo.Enabled = false;
                    FillRegistrationDetailGrid("");
                }
                else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Date_Range)))
                {
                    SetToDate(Util.GetDateTimeByString(txtDateFrom.Text));
                    ddlDateTo.Enabled = true;
                    if (ddlDateTo.Items.Count > 0)
                    {
                        ddlDateTo.SelectedIndex = 0;
                    }
                }
                else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Half_Yearly)))
                {
                    DateTime dtFromDate = DateTime.Now;
                    DateTime dtToDate   = DateTime.Now;

                    if (!string.IsNullOrEmpty(txtDateFrom.Text))
                    {
                        dtFromDate = Util.GetDateTimeByString(txtDateFrom.Text);
                        if (dtFromDate.Month > 1 && dtFromDate.Month <= 6)
                        {
                            dtFromDate = new DateTime(dtFromDate.Year, 1, 1);
                            dtToDate   = new DateTime(dtFromDate.Year, 6, 30);
                        }
                        else if (dtFromDate.Month >= 7)
                        {
                            dtFromDate = new DateTime(dtFromDate.Year, 7, 1);
                            dtToDate   = new DateTime(dtFromDate.Year, 12, 31);
                        }
                        txtDateFrom.Text     = dtFromDate.ToString(Constants.DATETIME_FORMAT);
                        ddlDateTo.DataSource = null;
                        oResult = commClaimDAL.GetCommissionClaimToDateSource("", dtToDate.ToString(Constants.DATETIME_FORMAT));
                        if (oResult.Status)
                        {
                            DataTable dtDateTo = (DataTable)oResult.Return;
                            ddlDateTo.DataSource     = dtDateTo;
                            ddlDateTo.DataTextField  = "DisplayMember";
                            ddlDateTo.DataValueField = "ValueMember";
                            ddlDateTo.DataBind();
                            if (dtDateTo.Rows.Count == 2)
                            {
                                ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString();
                            }
                            ddlDateTo.Enabled = false;
                        }

                        FillRegistrationDetailGrid("");
                    }
                }
                else if (ddlDuration.SelectedValue.Equals(Convert.ToString((int)SBM_BLV1.baseCommon.enmDurationType.Monthly)))
                {
                    DateTime dtFromDate = DateTime.Now;
                    DateTime dtToDate   = DateTime.Now;

                    if (!string.IsNullOrEmpty(txtDateFrom.Text))
                    {
                        dtFromDate = Util.GetDateTimeByString(txtDateFrom.Text);
                        dtFromDate = new DateTime(dtFromDate.Year, dtFromDate.Month, 1);
                        int iNoOfDays = System.DateTime.DaysInMonth(dtFromDate.Year, dtFromDate.Month);
                        dtToDate = dtFromDate.AddDays(iNoOfDays - 1);

                        txtDateFrom.Text     = dtFromDate.ToString(Constants.DATETIME_FORMAT);
                        ddlDateTo.DataSource = null;
                        oResult = commClaimDAL.GetCommissionClaimToDateSource("", dtToDate.ToString(Constants.DATETIME_FORMAT));
                        if (oResult.Status)
                        {
                            DataTable dtDateTo = (DataTable)oResult.Return;
                            ddlDateTo.DataSource     = dtDateTo;
                            ddlDateTo.DataTextField  = "DisplayMember";
                            ddlDateTo.DataValueField = "ValueMember";
                            ddlDateTo.DataBind();
                            if (dtDateTo.Rows.Count == 2)
                            {
                                ddlDateTo.Text = dtDateTo.Rows[1]["ValueMember"].ToString();
                            }
                            ddlDateTo.Enabled = false;
                        }

                        FillRegistrationDetailGrid("");
                    }
                }
            }
            else
            {
                ddlDateTo.SelectedIndex = -1;
                ddlDateTo.Enabled       = true;
            }
        }