Beispiel #1
0
        protected void btnShow_Click(object sender, EventArgs e)
        {
            GrdEditHistoryBooking.DataSource = null;
            GrdEditHistoryBooking.DataBind();
            DataSet dsEditHistory = new DataSet();

            if (radReportFrom.Checked)
            {
                if (txtReportUpto.Text == "")
                {
                    txtReportUpto.Text = txtReportFrom.Text;
                }
                DateTime dt  = DateTime.Parse(txtReportUpto.Text);
                DateTime dt1 = DateTime.Parse(txtReportFrom.Text);
                DateTime dt2 = DateTime.Parse(txtReportUpto.Text);
                strFromDate = txtReportFrom.Text;
                strToDate   = txtReportUpto.Text;
            }
            else if (radReportMonthly.Checked)
            {
                DateTime dt = new DateTime(int.Parse(drpYearList.SelectedItem.Text), int.Parse(drpMonthList.SelectedItem.Value), 1);
                strFromDate = dt.ToString("dd MMM yyyy");
                strToDate   = dt.AddMonths(1).AddDays(-1).ToString("dd MMM yyyy");
            }
            var status = string.Empty;

            if (chkInvoiceNo.Checked)
            {
                status = "BookingNo";
            }
            else
            {
                status = "Date";
            }

            GrdEditHistoryBooking.DataSource = BAL.BALFactory.Instance.Bal_Report.LoadBookingHistoryForBookingNumber(txtBookingNumber.Text.Split('-')[0], Globals.BranchID, status, strFromDate, strToDate);
            GrdEditHistoryBooking.DataBind();

            txtBookingNumber.Text = "";
            txtBookingNumber.Focus();
        }
        protected void btnShow_Click(object sender, EventArgs e)
        {
            GrdEditHistoryBooking.DataSource = null;
            string bookingnumber = string.Empty, branchid = string.Empty;
            var    status = string.Empty;

            GrdEditHistoryBooking.DataBind();

            if (txtBookingNumber.Text.Trim() != "")
            {
                string[] Bookingno = txtBookingNumber.Text.Split('-');
                status = "BookingNo";
                if (Bookingno.Length == 1)
                {
                    bookingnumber = txtBookingNumber.Text.Split('-')[0];
                    branchid      = Globals.BranchID;
                }
                else if (Bookingno.Length == 3)
                {
                    bookingnumber = txtBookingNumber.Text.Split('-')[0];
                    branchid      = txtBookingNumber.Text.Split('-')[2];
                }
                else if (Bookingno.Length == 2)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ScriptRegistration", "setDivMouseOver('Red', '#999999');", true);
                    lblMsg.Text = "Please enter a valid order no.";
                    txtBookingNumber.Focus();
                    txtBookingNumber.Attributes.Add("onfocus", "javascript:select();");
                    return;
                }
            }
            else
            {
                status   = "Date";
                branchid = Globals.BranchID;
            }

            grdHistory.DataSource = null;
            grdHistory.DataBind();
            DataSet dsEditHistory = new DataSet();

            var DateFromAndTo = hdnDateFromAndTo.Value.Split('-');

            strFromDate = DateFromAndTo[0].Trim();
            strToDate   = DateFromAndTo[1].Trim();


            DataSet dsEditHistoy = new DataSet();

            dsEditHistoy = BAL.BALFactory.Instance.Bal_Report.LoadBookingHistoryForBookingNumber(bookingnumber, branchid, status, strFromDate, strToDate);

            if (dsEditHistoy.Tables[0].Rows.Count > 0)
            {
                GrdEditHistoryBooking.DataSource = dsEditHistoy;
                GrdEditHistoryBooking.DataBind();
            }
            else
            {
                if (txtBookingNumber.Text.Trim() != "")
                {
                    DataSet dsInvoiceData = BAL.BALFactory.Instance.Bal_Report.GetInvoiceHistoeyDetails(bookingnumber, branchid, "True", "-1", "");
                    if (dsInvoiceData.Tables[0].Rows.Count > 0)
                    {
                        GrdEditHistoryBooking.DataSource = dsInvoiceData;
                        GrdEditHistoryBooking.DataBind();
                        foreach (GridViewRow row in GrdEditHistoryBooking.Rows)
                        {
                            //  row.Cells[2].Visible = false;
                            LinkButton lnkButton = (LinkButton)row.FindControl("hypBtnShowDetails");
                            lnkButton.Enabled = false;
                        }
                    }
                }
            }


            txtBookingNumber.Text = "";
            txtBookingNumber.Focus();

            grdInvoiceHistory.Visible = false;
            divScreenName.Visible     = false;
            if (GrdEditHistoryBooking.Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "ScriptRegistration", "setDivMouseOver('Red', '#999999');", true);
                lblMsg.Text = "Order not available.";
                txtBookingNumber.Focus();
                txtBookingNumber.Attributes.Add("onfocus", "javascript:select();");
            }
        }