private void PopulateAllData()
        {
            ClearAll();
            DataSet       BLDataSet      = new DataSet();
            SettlementBLL oSettlementBLL = new SettlementBLL();

            BLDataSet           = oSettlementBLL.GetSettlementWithBL(hdnBLId.Value.ToInt());
            txtBlNo.Text        = string.Empty;
            lnkCLUpload.Enabled = false;
            lnkRRUpload.Enabled = false;

            if (BLDataSet.Tables[0].Rows.Count > 0)
            {
                fillBLDetail(BLDataSet.Tables[0]);
                LoadBLStatus(BLDataSet.Tables[1]);
                if (hdnSettlementID.Value == "0")
                {
                    fillTotal(BLDataSet.Tables[2]);
                }
                if (hdnOutstanding.Value.ToDecimal() > 0)
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Please Generate M/R before Settlement!');</script>", false);
                    Response.Redirect("~/Transaction/Settlement1.aspx");
                }
                if (BLDataSet.Tables[0].Rows[0]["BLClosed"].ToInt() == 1)
                {
                    btnSave.Visible = false;
                }
            }
        }
        void ClearAll()
        {
            txtBlDate.Text      = string.Empty;
            txtBlNo.Text        = string.Empty;
            txtLine.Text        = string.Empty;
            txtLocation.Text    = string.Empty;
            txtOutstanding.Text = string.Empty;
            //txtSettlementAmount.Text = string.Empty;
            txtSettlementDate.Text = string.Empty;
            //txtTransactionType.Text = string.Empty;

            DataSet       BLDataSet      = new DataSet();
            SettlementBLL oSettlementBLL = new SettlementBLL();

            BLDataSet             = oSettlementBLL.GetSettlementWithBL(0);
            gvwInvoice.DataSource = BLDataSet.Tables[0];
            gvwInvoice.DataBind();
        }
 private void RetriveParameters()
 {
     if (!ReferenceEquals(Request.QueryString["id"], null))
     {
         hdnSettlementID.Value = GeneralFunctions.DecryptQueryString(Request.QueryString["id"].ToString());
         txtBlNo.Enabled       = false;
         DataSet       BLDataSet      = new DataSet();
         SettlementBLL oSettlementBLL = new SettlementBLL();
         BLDataSet             = oSettlementBLL.GetSettlementWithSettlment(hdnSettlementID.Value.ToInt());
         hdnBLId.Value         = BLDataSet.Tables[0].Rows[0]["BLID"].ToString();
         txtSettlementNo.Text  = BLDataSet.Tables[0].Rows[0]["SettlementNo"].ToString();
         txtChequeDate.Text    = BLDataSet.Tables[0].Rows[0]["ChequeDate"].ToString();
         txtPayToRcvdFrom.Text = BLDataSet.Tables[0].Rows[0]["PayRcv"].ToString();
         txtChequeDetail.Text  = BLDataSet.Tables[0].Rows[0]["ChequeDetail"].ToString();
         txtBankName.Text      = BLDataSet.Tables[0].Rows[0]["BankName"].ToString();
         txtPayToRcvdFrom.Text = BLDataSet.Tables[0].Rows[0]["PartyName"].ToString();
         hdnRRPath.Value       = BLDataSet.Tables[0].Rows[0]["RefundRequestFile"].ToString();
         hdnCLPath.Value       = BLDataSet.Tables[0].Rows[0]["ConsigneeLetterFile"].ToString();
         txtPayToRcvdFrom.Text = BLDataSet.Tables[0].Rows[0]["PayRcv"].ToString();
         //hdnFilePath.Value = BLDataSet.Tables[0].Rows[0]["RefundRequestFile"].ToString();
         fillBLDetail(BLDataSet.Tables[0]);
         BLDataSet = oSettlementBLL.GetSettlementWithBL(hdnBLId.Value.ToInt());
         LoadBLStatus(BLDataSet.Tables[1]);
         txtOutstanding.Text = Convert.ToString(Math.Abs(BLDataSet.Tables[2].Rows[0]["TotInv"].ToDecimal() - BLDataSet.Tables[2].Rows[0]["TotMR"].ToDecimal() - BLDataSet.Tables[2].Rows[0]["TotCrn"].ToDecimal()));
         lnkCLUpload.Enabled = true;
         lnkRRUpload.Enabled = true;
         btnSave.Visible     = false;
         RRUpload.Enabled    = false;
         CLUpload.Enabled    = false;
         lblPayable.Text     = "Paid Amount :";
         //PopulateAllData();
     }
     else
     {
         hdnSettlementID.Value = "0";
         lblPayable.Text       = "Payable Amount :";
     }
 }
Example #4
0
        private void LoadSettlement()
        {
            if (!ReferenceEquals(Session[Constants.SESSION_SEARCH_CRITERIA], null))
            {
                SearchCriteria searchCriteria = (SearchCriteria)Session[Constants.SESSION_SEARCH_CRITERIA];
                IUser          user           = (IUser)Session[Constants.SESSION_USER_INFO];

                if (!ReferenceEquals(searchCriteria, null))
                {
                    BuildSearchCriteria(searchCriteria);
                    SettlementBLL commonBll = new SettlementBLL();

                    gvwContainerTran.PageIndex = searchCriteria.PageIndex;
                    if (searchCriteria.PageSize > 0)
                    {
                        gvwContainerTran.PageSize = searchCriteria.PageSize;
                    }

                    gvwContainerTran.DataSource = new SettlementBLL().GetSettlements(searchCriteria, user.UserLocation.Id);
                    gvwContainerTran.DataBind();
                }
            }
        }
        protected void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                //string misc = string.Empty;



                if (txtPayToRcvdFrom.Text != hdnCustName.Value && CLUpload.HasFile == false)
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Consignee Letter Upload is compulsory!');</script>", false);
                    return;
                }

                if (txtChequeDate.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Cheque Date is compulsory!');</script>", false);
                    return;
                }

                if (txtChequeDetail.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Cheque No is compulsory!');</script>", false);
                    return;
                }

                if (txtBankName.Text == "")
                {
                    ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('BankName is compulsory!');</script>", false);
                    return;
                }


                if (RRUpload.HasFile)
                {
                    var fileName = RRUpload.FileName;
                    var filext   = fileName.Substring(fileName.LastIndexOf(".") + 1);
                    if (filext.ToLower() != "pdf")
                    {
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Only pdf file is accepted!');</script>", false);
                        return;
                    }
                    var path        = Server.MapPath("~/Transaction/SettlementDocs");
                    var newFileName = "RR" + txtBlNo;  //  Guid.NewGuid().ToString();

                    if (!string.IsNullOrEmpty(path))
                    {
                        path           += @"\" + newFileName + System.IO.Path.GetExtension(fileName);
                        hdnRRPath.Value = path;
                        RRUpload.PostedFile.SaveAs(path);
                    }
                }

                if (CLUpload.HasFile)
                {
                    var fileName = CLUpload.FileName;
                    var filext   = fileName.Substring(fileName.LastIndexOf(".") + 1);
                    if (filext.ToLower() != "pdf")
                    {
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Only pdf file is accepted!');</script>", false);
                        return;
                    }
                    var path        = Server.MapPath("~/Transaction/SettlementDocs");
                    var newFileName = "CL" + txtBlNo;  //  Guid.NewGuid().ToString();

                    if (!string.IsNullOrEmpty(path))
                    {
                        path           += @"\" + newFileName + System.IO.Path.GetExtension(fileName);
                        hdnCLPath.Value = path;
                        CLUpload.PostedFile.SaveAs(path);
                    }
                }
                ISettlement Settlement = new SettlementEntity();
                BuildSettlementEntity(Settlement);
                long Settlementid = new SettlementBLL().SaveSettlement(Settlement);
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Record saved successfully!');</script>", false);
                if (!ReferenceEquals(Request.QueryString["id"], null))
                {
                    Response.Redirect("~/Transaction/Settlement1.aspx");
                }
                else
                {
                    Response.Redirect("~/Transaction/Settlement1.aspx");
                }
                //ClearAll();

                //if (isedit == true)
                //    Response.Redirect("~/Export/Voyage.aspx");
                //else
                //    clearPage();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('Record could not be saved due to ! " + ex.Message.ToString() + "');</script>", false);
            }
        }
Example #6
0
 private void DeleteSettlement(int SettlementId)
 {
     SettlementBLL.DeleteSettlement(SettlementId, _userId);
     LoadSettlement();
     ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "<script>javascript:void alert('" + ResourceManager.GetStringWithoutName("ERR00010") + "');</script>", false);
 }