コード例 #1
0
        protected void btnApprove_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtBBReferenceNo.Text))
            {
                //oLien.UserDetails = ucUserDet.UserDetail;
                SaleStatementReconDAL    oSaleStatementReconDAL    = new SaleStatementReconDAL();
                SalesStatementReconciled oSalesStatementReconciled = new SalesStatementReconciled();
                oSalesStatementReconciled.ReconSaleStatementReferenceNo = txtBBReferenceNo.Text;
                //get User Details
                oSalesStatementReconciled.UserDetails = ucUserDet.UserDetail;

                Result oResult = (Result)oSaleStatementReconDAL.Approve(oSalesStatementReconciled);
                if (oResult.Status)
                {
                    TotalClear();
                    ucMessage.OpenMessage(Constants.MSG_SUCCESS_APPROVE, Constants.MSG_TYPE_SUCCESS);
                }
                else
                {
                    ucMessage.OpenMessage(Constants.MSG_ERROR_APPROVE, Constants.MSG_TYPE_ERROR);
                }
            }
            else
            {
                ucMessage.OpenMessage(Constants.MSG_ERROR_APPROVE, Constants.MSG_TYPE_ERROR);
            }
        }
コード例 #2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            SalesStatementReconciled oSalesStatementReconciled = (SalesStatementReconciled)Session[Constants.SES_SALES_CLAIM_RECON];

            if (oSalesStatementReconciled != null)
            {
                oSalesStatementReconciled.ReconSaleStatementTransNo     = hdnReconSaleStatTransNo.Value.Equals("") ? "-1" : hdnReconSaleStatTransNo.Value;
                oSalesStatementReconciled.ReconSaleStatementReferenceNo = txtBBReferenceNo.Text.Trim().ToUpper();
                oSalesStatementReconciled.SPType.SPTypeID  = ddlSpType.SelectedValue;
                oSalesStatementReconciled.DebitDate        = Util.GetDateTimeByString(txtDebitDate.Text);
                oSalesStatementReconciled.DebitedFaceValue = Util.GetDecimalNumber(txtTtlDrAmnt.Text);

                oSalesStatementReconciled.UserDetails = ucUserDet.UserDetail;

                SaleStatementReconDAL oSaleStatmentReconDAL = new SaleStatementReconDAL();
                Result oResult = oSaleStatmentReconDAL.Save(oSalesStatementReconciled);
                if (oResult.Status)
                {
                    TotalClear();
                    LoadPreviousList();
                    ucMessage.OpenMessage(Constants.MSG_SUCCESS_SAVE, Constants.MSG_TYPE_SUCCESS);
                }
                else
                {
                    if (oResult.Message.Equals("A"))
                    {
                        ucMessage.OpenMessage("This BB Reference No. already used. Please check..", Constants.MSG_TYPE_ERROR);
                    }
                    else
                    {
                        ucMessage.OpenMessage(Constants.MSG_ERROR_SAVE, Constants.MSG_TYPE_ERROR);
                    }
                }
            }
        }
コード例 #3
0
        protected void gvClaim_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            //get the row
            GridViewRow gvRow = (GridViewRow)((Button)e.CommandSource).NamingContainer;

            //gvClaim.RowStyle.CssClass = "odd";
            //gvRow.BackColor = Color.Blue;

            if (((Button)e.CommandSource).Text.Equals("Select"))
            {
                PopulateSalesStatementIssueDetailsGrid(gvRow);
                SetReconciliationDetails(gvRow);
                btnAdd.Focus();
            }
            else if (((Button)e.CommandSource).Text.Equals("Remove"))
            {
                SalesStatementReconciled oSalesStatementReconciled = (SalesStatementReconciled)Session[Constants.SES_SALES_CLAIM_RECON];

                if (oSalesStatementReconciled != null)
                {
                    oSalesStatementReconciled.DtClaimDetails.Rows.RemoveAt(gvRow.RowIndex);

                    gvClaim.DataSource = oSalesStatementReconciled.DtClaimDetails;
                    gvClaim.DataBind();

                    //Store in Session
                    Session[Constants.SES_SALES_CLAIM_RECON] = oSalesStatementReconciled;

                    if (gvRow.Cells[2].Text.Equals(txtReferenceNo.Text.Trim()))
                    {
                        ClearSalesClaimSection();
                    }

                    //Set Values
                    txtNoOfClaim.Text = oSalesStatementReconciled.DtClaimDetails.Rows.Count.ToString();
                    object obj = oSalesStatementReconciled.DtClaimDetails.Compute("SUM(ClaimAmount)", "");
                    txtTtlCalimAmnt.Text = !DBNull.Value.Equals(obj) ? Convert.ToDecimal(obj).ToString() : "0";
                    obj = oSalesStatementReconciled.DtClaimDetails.Compute("SUM(DebitAmount)", "");
                    txtTtlDrAmnt.Text = !DBNull.Value.Equals(obj) ? Convert.ToDecimal(obj).ToString() : "0";
                }
            }
        }
コード例 #4
0
        private void SetObject(SalesStatementReconciled oSSRecon)
        {
            Session[Constants.SES_SALES_CLAIM_RECON] = oSSRecon;

            if (oSSRecon != null)
            {
                ddlSpType.Text                = oSSRecon.SPType.SPTypeID;
                ddlYear.Text                  = oSSRecon.DebitDate.Year.ToString();
                txtDebitDate.Text             = oSSRecon.DebitDate.ToString(Constants.DATETIME_FORMAT);
                txtBBReferenceNo.Text         = oSSRecon.ReconSaleStatementReferenceNo;
                hdnReconSaleStatTransNo.Value = oSSRecon.ReconSaleStatementTransNo;

                //Set user details
                if (SEARCH_FROM.Equals(1))//if viewed from Temp By Maker
                {
                    ucUserDet.UserDetail = oSSRecon.UserDetails;
                }
                else if (SEARCH_FROM.Equals(2))//if viewed from Temp By Checker
                {
                    UserDetails oUserDetails = ucUserDet.UserDetail;
                    oUserDetails.MakeDate = oSSRecon.UserDetails.MakeDate;
                    oUserDetails.MakerID  = oSSRecon.UserDetails.MakerID;
                    ucUserDet.UserDetail  = oUserDetails;
                }

                gvClaim.DataSource = oSSRecon.DtClaimDetails;
                gvClaim.DataBind();
                //Set a background color as Selected
                //gvClaim.Rows[0].BackColor = Color.Blue;
                SetClaimSatementDetailSectionValue(oSSRecon.DtClaimDetails);

                if (gvClaim.Rows.Count > 0)
                {
                    PopulateSalesStatementIssueDetailsGrid(gvClaim.Rows[0]);
                }
            }
        }
コード例 #5
0
        protected void btnReject_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtBBReferenceNo.Text))
            {
                SalesStatementReconciled oSalesStatementReconciled = new SalesStatementReconciled();
                oSalesStatementReconciled.ReconSaleStatementReferenceNo = txtBBReferenceNo.Text;
                SaleStatementReconDAL oSaleStatementReconDAL = new SaleStatementReconDAL();
                oSalesStatementReconciled.UserDetails = ucUserDet.UserDetail;

                Result oResult = (Result)oSaleStatementReconDAL.Reject(oSalesStatementReconciled);
                if (oResult.Status)
                {
                    ucMessage.OpenMessage(Constants.MSG_SUCCESS_REJECT, Constants.MSG_TYPE_SUCCESS);
                }
                else
                {
                    ucMessage.OpenMessage(Constants.MSG_ERROR_REJECT, Constants.MSG_TYPE_ERROR);
                }
            }
            else
            {
                ucMessage.OpenMessage(Constants.MSG_ERROR_REJECT, Constants.MSG_TYPE_ERROR);
            }
        }
コード例 #6
0
        protected void txtReferenceNo_TextChanged(object sender, EventArgs e)
        {
            bool   isRefNoFrmtOk = false;
            string sRefNo        = txtReferenceNo.Text.Trim();

            //string[] aRefNo = sRefNo.Split('/');
            //if (aRefNo.Length.Equals(4))
            //{
            //    isRefNoFrmtOk = true;
            //}
            if (!string.IsNullOrEmpty(ddlSpType.SelectedValue) && !string.IsNullOrEmpty(ddlYear.SelectedValue))
            {
                //sRefNo = ddlSpType.SelectedValue + "/ABC/" + sRefNo + "/" + ddlYear.SelectedValue;
                txtReferenceNo.Text = sRefNo;
                isRefNoFrmtOk       = true;
            }
            if (isRefNoFrmtOk)
            {
                int iIndx = -1;
                SalesStatementReconciled oSSRecon = (SalesStatementReconciled)Session[Constants.SES_SALES_CLAIM_RECON];
                if (oSSRecon != null)
                {
                    DataTable dtClaimDetails = oSSRecon.DtClaimDetails;
                    //For Each dr As DataRow In dt.Select("query")
                    DataRow[] rows = dtClaimDetails.Select("RefNo='" + txtReferenceNo.Text + "'");
                    foreach (var vClaimDtl in rows)
                    {
                        iIndx = dtClaimDetails.Rows.IndexOf(vClaimDtl);
                        if ((gvClaim.Rows.Count > iIndx))
                        {
                            GridViewRow gvRow = gvClaim.Rows[iIndx];
                            SetReconciliationDetails(gvRow);
                        }
                        break;
                    }
                }
                if (iIndx.Equals(-1))
                {
                    SaleStatementReconDAL oSaleStatmentReconDAL = new SaleStatementReconDAL();
                    Config oConfig = (Config)Session[Constants.SES_USER_CONFIG];
                    Result oResult = oSaleStatmentReconDAL.GetSalesStatementDataByRefNo(txtReferenceNo.Text, oConfig.DivisionID);
                    if (oResult.Status)
                    {
                        DataTable dtSaleStatement = oResult.Return as DataTable;
                        if (dtSaleStatement.Columns.Count.Equals(1))
                        {
                            ucMessage.OpenMessage("This reference number already reconciled !!", Constants.MSG_TYPE_INFO);
                            ScriptManager.RegisterStartupScript(this.UpdatePanel5, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
                            ClearSalesClaimSection();
                        }
                        else if (dtSaleStatement.Rows.Count > 0)
                        {
                            //DDListUtil.Assign(ddlSpType, DB.GetDBValue(dtSaleStatement.Rows[0]["SPTypeID"]));
                            txtClaimBBDate.Text     = (Date.GetDateTimeByString(dtSaleStatement.Rows[0]["StatementDate"].ToString())).ToString(Constants.DATETIME_FORMAT);
                            txtClaimFromDate.Text   = (Date.GetDateTimeByString(dtSaleStatement.Rows[0]["FromDate"].ToString())).ToString(Constants.DATETIME_FORMAT);
                            txtClaimToDate.Text     = (Date.GetDateTimeByString(dtSaleStatement.Rows[0]["ToDate"].ToString())).ToString(Constants.DATETIME_FORMAT);
                            txtClaimAmount.Text     = DB.GetDBValue(dtSaleStatement.Rows[0]["TotalFaceValue"]);
                            txtDebitAmount.Text     = DB.GetDBValue(dtSaleStatement.Rows[0]["TotalFaceValue"]);
                            txtClaimComment.Text    = string.Empty;
                            hdnSaleStatTrnsNo.Value = DB.GetDBValue(dtSaleStatement.Rows[0]["SaleStatementTransNo"]);
                        }
                        else
                        {
                            ucMessage.OpenMessage("Invalid reference number!!", Constants.MSG_TYPE_INFO);
                            ScriptManager.RegisterStartupScript(this.UpdatePanel5, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
                            ClearSalesClaimSection();
                        }
                    }
                }

                btnAdd.Focus();
            }
            else
            {
                ucMessage.OpenMessage("Please select SP Type and Year.", Constants.MSG_TYPE_INFO);
                ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
                ClearSalesClaimSection();
            }
        }
コード例 #7
0
        protected void btnAdd_Click(object sender, EventArgs e)
        {
            SalesStatementReconciled oSalesStatementReconciled = (SalesStatementReconciled)Session[Constants.SES_SALES_CLAIM_RECON];

            if (oSalesStatementReconciled == null)
            {
                oSalesStatementReconciled = new SalesStatementReconciled();
            }

            // SaleStatement List
            DataTable dtClaimDetails = oSalesStatementReconciled.DtClaimDetails;

            if (dtClaimDetails.Columns.Count <= 0)
            {
                dtClaimDetails.Columns.Add(new DataColumn("RefNo", typeof(string)));
                dtClaimDetails.Columns.Add(new DataColumn("ClaimDateBB", typeof(string)));
                dtClaimDetails.Columns.Add(new DataColumn("ClaimDateFrom", typeof(string)));
                dtClaimDetails.Columns.Add(new DataColumn("ClaimDateTo", typeof(string)));
                dtClaimDetails.Columns.Add(new DataColumn("ClaimAmount", typeof(decimal)));
                dtClaimDetails.Columns.Add(new DataColumn("DebitAmount", typeof(decimal)));
                dtClaimDetails.Columns.Add(new DataColumn("Comment", typeof(string)));
                //saving in DB purpose. This is hidden is design
                dtClaimDetails.Columns.Add(new DataColumn("SaleStatementTransNo", typeof(string)));
            }
            DataRow[] rows = dtClaimDetails.Select("RefNo='" + txtReferenceNo.Text + "'");

            if (rows.Length <= 0)
            {
                DataRow rowClaimDetails = dtClaimDetails.NewRow();
                rowClaimDetails["RefNo"] = txtReferenceNo.Text;
                DateTime parsedDate;
                DateTime.TryParseExact(txtClaimBBDate.Text, Constants.DateTimeFormats, null, DateTimeStyles.None, out parsedDate);
                //parsedDate = Convert.ToDateTime(txtClaimBBDate.Text);
                rowClaimDetails["ClaimDateBB"] = parsedDate.ToString(Constants.DATETIME_dd_MMM_yyyy);//txtClaimBBDate.Text;
                DateTime.TryParseExact(txtClaimFromDate.Text, Constants.DateTimeFormats, null, DateTimeStyles.None, out parsedDate);
                //parsedDate = Convert.ToDateTime(txtClaimFromDate.Text);
                rowClaimDetails["ClaimDateFrom"] = parsedDate.ToString(Constants.DATETIME_dd_MMM_yyyy);//txtClaimFromDate.Text;
                DateTime.TryParseExact(txtClaimToDate.Text, Constants.DateTimeFormats, null, DateTimeStyles.None, out parsedDate);
                //parsedDate = Convert.ToDateTime(txtClaimToDate.Text);
                rowClaimDetails["ClaimDateTo"]          = parsedDate.ToString(Constants.DATETIME_dd_MMM_yyyy);//txtClaimToDate.Text;
                rowClaimDetails["ClaimAmount"]          = txtClaimAmount.Text;
                rowClaimDetails["DebitAmount"]          = txtDebitAmount.Text;
                rowClaimDetails["Comment"]              = txtClaimComment.Text;
                rowClaimDetails["SaleStatementTransNo"] = hdnSaleStatTrnsNo.Value;

                dtClaimDetails.Rows.Add(rowClaimDetails);
            }
            else
            {
                int iRowIndex = -1;
                foreach (var vClaimDtl in rows)
                {
                    iRowIndex = dtClaimDetails.Rows.IndexOf(vClaimDtl);
                    break;
                }

                if (iRowIndex != -1)
                {
                    dtClaimDetails.Rows[iRowIndex]["DebitAmount"] = txtDebitAmount.Text;
                    dtClaimDetails.Rows[iRowIndex]["Comment"]     = txtClaimComment.Text.ToUpper();
                }
            }

            //Store in Session
            oSalesStatementReconciled.DtClaimDetails = dtClaimDetails;
            Session[Constants.SES_SALES_CLAIM_RECON] = oSalesStatementReconciled;

            gvClaim.DataSource = dtClaimDetails;
            gvClaim.DataBind();

            //Set Values
            SetClaimSatementDetailSectionValue(dtClaimDetails);
            ClearSalesClaimSection();
            txtReferenceNo.Focus();
        }