protected void btnNewRevision_Click(object sender, EventArgs e)
    {
        Procurement_CTableAdapters.VIEW_LATEST_BATCH_PLAN_REVTableAdapter batch_rev = new Procurement_CTableAdapters.VIEW_LATEST_BATCH_PLAN_REVTableAdapter();
        try
        {
            string uname    = Session["USER_NAME"].ToString().ToUpper();
            string user_id  = WebTools.GetExpr("USER_ID", "USERS", " WHERE UPPER(USER_NAME)='" + uname + "'");
            string batch_id = WebTools.GetExpr("BATCH_ID", "PIP_PO_BATCH_PLAN", " WHERE PO_ID='" + ddlPOList.SelectedValue + "' AND BATCH_NO='" + txtRevBatchNo.Text + "'");
            if (batch_id == "" || batch_id == string.Empty)
            {
                RadWindowManager1.RadAlert("Please Create Batch First", 400, 150, "Warning", "");
                return;
            }
            batch_rev.InsertQuery(decimal.Parse(batch_id), decimal.Parse(txtRevNo.Text), txtRevCreateDate.SelectedDate, decimal.Parse(user_id),
                                  txtPIMInitial.SelectedDate, txtPIMForecast.SelectedDate, txtPIMActual.SelectedDate,
                                  txtManuIntial.SelectedDate, txtManuForecast.SelectedDate, txtManuActual.SelectedDate,
                                  txtFATInitial.SelectedDate, txtFATForecast.SelectedDate, txtFATActual.SelectedDate,
                                  txtDeliveryBase.SelectedDate, txtDeliveryForecast.SelectedDate, txtDeliveryActual.SelectedDate,
                                  txtReceivedExworksInitial.SelectedDate, txtReceivedExworksForecast.SelectedDate, txtReceivedExworksActual.SelectedDate,
                                  txtReceivedPortInitial.SelectedDate, txtReceivedPortForecast.SelectedDate, txtReceivedPortActual.SelectedDate,
                                  txtReceivedSiteInitial.SelectedDate, txtReceivedSiteForecast.SelectedDate, txtReceivedSiteActual.SelectedDate, txtRevRemarks.Text, ddlRevStatus.SelectedText);

            Master.show_success("Batch No " + txtBatchNo.Text + "Revision Created Successfully.");
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
        finally
        {
            batch_rev.Dispose();
            GC.Collect();
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        Procurement_CTableAdapters.VIEW_LATEST_BATCH_PLAN_REVTableAdapter batch_rev = new Procurement_CTableAdapters.VIEW_LATEST_BATCH_PLAN_REVTableAdapter();
        try
        {
            string uname   = Session["USER_NAME"].ToString().ToUpper();
            string user_id = WebTools.GetExpr("USER_ID", "USERS", " WHERE UPPER(USER_NAME)='" + uname + "'");

            batch_rev.InsertQuery(decimal.Parse(Request.QueryString["BATCH_ID"]), decimal.Parse(txtRevNo.Text), txtCreateDate.SelectedDate, decimal.Parse(user_id),
                                  txtPIMInitial.SelectedDate, txtPIMForecast.SelectedDate, txtPIMActual.SelectedDate,
                                  txtManuIntial.SelectedDate, txtManuForecast.SelectedDate, txtManuActual.SelectedDate,
                                  txtFATInitial.SelectedDate, txtFATForecast.SelectedDate, txtFATActual.SelectedDate,
                                  txtDeliveryBase.SelectedDate, txtDeliveryForecast.SelectedDate, txtDeliveryActual.SelectedDate,
                                  txtReceivedExworksInitial.SelectedDate, txtReceivedExworksForecast.SelectedDate, txtReceivedExworksActual.SelectedDate,
                                  txtReceivedPortInitial.SelectedDate, txtReceivedPortForecast.SelectedDate, txtReceivedPortActual.SelectedDate,
                                  txtReceivedSiteInitial.SelectedDate, txtReceivedSiteForecast.SelectedDate, txtReceivedSiteActual.SelectedDate, txtRevRemarks.Text, ddlRevStatus.SelectedText);

            Master.show_success("Batch No " + txtBatchNo.Text + "Revision Created Successfully.");
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
        finally {
            batch_rev.Dispose();
            GC.Collect();
        }
    }