protected void DDLCustomer_SelectedIndexChanged(object sender, EventArgs e)
    {
        frdate = txtFromDate.Text.Split('/')[2] + "/" + txtFromDate.Text.Split('/')[1] + "/" + txtFromDate.Text.Split('/')[0];
        todate = txttoDate.Text.Split('/')[2] + "/" + txttoDate.Text.Split('/')[1] + "/" + txttoDate.Text.Split('/')[0];

        tdt = Convert.ToDateTime(todate);
        fdt = Convert.ToDateTime(frdate);

        // Rptrpending.DataSource = CreditNote.GetCNNo_byCust(Convert.ToInt32(DDLCustomer.SelectedValue));
        RptrCN.DataSource = CreditNote.GetCNNo_byCust(Convert.ToInt32(strFY), (DDLCustomer.SelectedValue), "All", fdt, tdt);
        RptrCN.DataBind();

        //RptrCN2.DataSource = CreditNote.GetCNNo_byCust((DDLCustomer.SelectedValue), "Manual");
        //RptrCN2.DataBind();

        RptrCN.Visible = true;
        // RptrCN2.Visible = true;
        PnlPrint.Visible = false;
        Pnl2.Visible     = true;

        //DataTable dt = new DataTable();
        //dt = DCReturnBook.GetCustAddress((DDLCustomer.SelectedValue), "CNCustlist").Tables[0];
        //if (dt.Rows.Count > 0)
        //{
        //    lblCustName.Text = dt.Rows[0]["CustName"].ToString();
        //    lblCustAddress.Text = dt.Rows[0]["Address"].ToString();
        //}

        if (DDLCustomer.SelectedIndex == 0)
        {
            Pnl2.Visible     = false;
            PnlPrint.Visible = false;
        }
    }
Exemple #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // CustCode = txtcustomer.Text.ToString().Split(':')[0].Trim();
        //CustCode = Convert.ToInt32(DDLCustomer.SelectedValue)

        if (Session["FY"] != null)
        {
            strFY = Session["FY"].ToString();
        }
        else
        {
            Session.Clear();
        }
        //Response.Write(strFY);


        if (!Page.IsPostBack)
        {
            btnPrint.Visible = false;

            Pnl2.Visible     = true;
            PnlPrint.Visible = false;
            // BindDDlCust();
            fdt = Convert.ToDateTime("1900/01/01");
            tdt = Convert.ToDateTime("1900/01/01");
            RptrCN.DataSource = C_CreditNote.C_GetCNNo_Bydt(Convert.ToInt32(strFY), fdt, tdt);
            RptrCN.DataBind();
            //txtcustomer.Focus();
        }
        else
        {
        }
    }
    protected void btngetcust_Click(object sender, EventArgs e)
    {
        Pnl2.Visible     = false;
        PnlPrint.Visible = false;

        frdate = txtFromDate.Text.Split('/')[2] + "/" + txtFromDate.Text.Split('/')[1] + "/" + txtFromDate.Text.Split('/')[0];
        todate = txttoDate.Text.Split('/')[2] + "/" + txttoDate.Text.Split('/')[1] + "/" + txttoDate.Text.Split('/')[0];

        tdt = Convert.ToDateTime(todate);
        fdt = Convert.ToDateTime(frdate);

        if (tdt >= fdt)
        {
            if (RdbtnSelect.SelectedValue == "CN")
            {
                Pnl1.Visible = false;

                RptrCN.DataSource = CreditNote.GetCNNo_Bydt(Convert.ToInt32(strFY), fdt, tdt);
                RptrCN.DataBind();

                RptrCN.Visible = true;
                // RptrCN2.Visible = true;
                PnlPrint.Visible = false;
                Pnl2.Visible     = true;
            }
            else if (RdbtnSelect.SelectedValue == "CustomerwiseCN")
            {
                DataSet ds = new DataSet();
                ds = CreditNote.GetCustlist_Bydt(Convert.ToInt32(strFY), fdt, tdt);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    DDLCustomer.DataSource = CreditNote.GetCustlist_Bydt(Convert.ToInt32(strFY), fdt, tdt);
                    DDLCustomer.DataBind();
                    DDLCustomer.Items.Insert(0, new ListItem("-Select Customer-", "0"));
                    Pnl1.Visible = true;
                }
                else
                {
                    MessageBox("Records Not Available ");
                }
            }
        }
        else
        {
            MessageBox("From Date is greater than To Date");
        }
        //else
        //if (Convert.ToDateTime(todate) == Convert.ToDateTime(frdate))
        //{
        //    MessageBox("From Date and To Date are similar");
        //}
    }