protected void btnAdd_Click(object sender, EventArgs e)
    {
        Procurement_CTableAdapters.VIEW_PO_INSP_REQUEST_DTTableAdapter insp = new Procurement_CTableAdapters.VIEW_PO_INSP_REQUEST_DTTableAdapter();

        CheckBox cb;
        decimal  mat_id;
        string   insp_qty;
        decimal  po_qty, rel_qty;

        try
        {
            foreach (GridDataItem item in itemsGrid.Items)
            {
                cb = ((CheckBox)item["checkCol"].FindControl("checkItems"));

                if (cb.Checked)
                {
                    mat_id   = WebTools.GetMatId(item["MAT_CODE1"].Text, decimal.Parse(Session["PROJECT_ID"].ToString()));
                    insp_qty = (item["BAL_QTY"].FindControl("BAL_QTYTextBox") as TextBox).Text;
                    insp.InsertQuery(decimal.Parse(Request.QueryString["RFI_ID"]), item["PO_ITEM_NO"].Text, mat_id, decimal.Parse(insp_qty),
                                     null);
                }
            }
            Master.ShowMessage("Selected Items Added.");
        }
        catch (Exception ex)
        {
            Master.ShowError(ex.Message);
        }
        finally {
            insp.Dispose();
            itemsGrid.Rebind();
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {

        decimal mat_id = WebTools.GetMatId(txtAutoCompltMatList.Entries[0].Text, Decimal.Parse(Session["PROJECT_ID"].ToString()));
        if (mat_id == -1)
        {
            Master.show_error("There are two materials with the same code! try to use the unique one.");
            return;
        }
        else if (mat_id == 0)
        {
            Master.show_error("Material Code not found!");
            return;
        }

        VIEW_MATERIAL_REQUEST_DTTableAdapter items = new VIEW_MATERIAL_REQUEST_DTTableAdapter();

        try
        {
            items.InsertQuery(decimal.Parse(Request.QueryString["MAT_REQ_ID"]), mat_id, decimal.Parse(txtReqQty.Text), 
                DateTime.Parse(txtReqDate.SelectedDate.ToString()), txtRqrdAtLocation.Text, txtRemarks.Text);
            Master.show_success(txtAutoCompltMatList.Entries[0].Text + " Saved!");

        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
        }
        finally
        {
            items.Dispose();
        }

    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Procurement_CTableAdapters.VIEW_PO_BATCH_PLAN_DTTableAdapter batch = new Procurement_CTableAdapters.VIEW_PO_BATCH_PLAN_DTTableAdapter();
        CheckBox cb;
        decimal  mat_id;
        string   batch_qty;

        try
        {
            string po_id = WebTools.GetExpr("PO_ID", "PIP_PO_BATCH_PLAN", " WHERE BATCH_ID='" + Request.QueryString["BATCH_ID"] + "'");
            foreach (GridDataItem item in itemsGrid.Items)
            {
                cb = ((CheckBox)item["checkCol"].FindControl("checkItems"));
                if (cb.Checked)
                {
                    string po_item_id = WebTools.GetExpr("PO_ITEM_ID", "PIP_PO_DETAIL", " WHERE PO_ID='" + po_id + "' AND PO_ITEM='" + item["PO_ITEM_NO"].Text + "'");
                    mat_id    = WebTools.GetMatId(item["MAT_CODE1"].Text, decimal.Parse(Session["PROJECT_ID"].ToString()));
                    batch_qty = (item["BAL_QTY"].FindControl("BAL_QTYTextBox") as TextBox).Text;
                    batch.InsertQuery(decimal.Parse(Request.QueryString["BATCH_ID"]), decimal.Parse(po_item_id), decimal.Parse(batch_qty), null, decimal.Parse(po_id), mat_id, item["PO_ITEM_NO"].Text);
                }
            }
            Master.ShowMessage("Selected Items Added.");
        }
        catch (Exception ex)
        {
            Master.ShowError(ex.Message);
        }
        finally
        {
            //   insp.Dispose();
            itemsGrid.Rebind();
        }
    }
Beispiel #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        decimal mat_id = WebTools.GetMatId(txtMatCode.Text, Decimal.Parse(Session["PROJECT_ID"].ToString()));

        if (mat_id == -1)
        {
            Master.ShowWarn("There are two materials with the same code! try to use the unique one.");
            return;
        }
        else if (mat_id == 0)
        {
            Master.ShowWarn("Material Code not found!");
            return;
        }
        string bal_qty = WebTools.GetExpr("BAL_QTY", "VIEW_TOTAL_PIPE_REM", "REM_ID=" + ddRemains.SelectedValue.ToString());

        if (bal_qty.Trim() != "" && bal_qty.Trim() != "0")
        {
            decimal bal_qty_dec = decimal.Parse(bal_qty);
            if (bal_qty_dec < decimal.Parse(txtQty.Text))
            {
                Master.ShowWarn("Remain Balance Qty is not enough!");
                return;
            }
        }
        else
        {
            Master.ShowWarn("Remain Balance Qty is not enough!");
            return;
        }
        VIEW_ADD_ISSUE_REMTableAdapter items = new VIEW_ADD_ISSUE_REMTableAdapter();

        try
        {
            items.InsertQuery(
                decimal.Parse(Request.QueryString["ADD_ISSUE_ID"]),
                decimal.Parse(ddRemains.SelectedValue),
                decimal.Parse(txtQty.Text), string.Empty);
            returnGridView.DataBind();
            Master.ShowMessage("New item created successfully.");
        }
        catch (Exception ex)
        {
            Master.ShowWarn(ex.Message);
        }
        finally
        {
            items.Dispose();
        }
    }
Beispiel #5
0
 protected void txtMatCode_TextChanged(object sender, EventArgs e)
 {
     if (IsPostBack)
     {
         decimal mat_id = WebTools.GetMatId(txtMatCode.Text, Decimal.Parse(Session["PROJECT_ID"].ToString()));
         ddRemains.Items.Clear();
         ddRemains.Items.Add(new ListItem("(Select Remain)", "-1"));
         if (mat_id == -1)
         {
             Master.ShowWarn("There are two materials with the same code! try to use the unique one.");
         }
         else if (mat_id == 0)
         {
             Master.ShowWarn("Material Code not found!");
         }
         matIdField.Value = mat_id.ToString();
     }
 }
Beispiel #6
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        dsMaterialCTableAdapters.VIEW_ADP_SUBSTITUTE_DTTableAdapter substitu = new dsMaterialCTableAdapters.VIEW_ADP_SUBSTITUTE_DTTableAdapter();
        string old_mat_id, old_mat_qty;

        old_mat_id  = WebTools.GetExpr("MAT_ID", "PIP_BOM", "BOM_ID=" + ddBomItem.SelectedValue.ToString());
        old_mat_qty = WebTools.GetExpr("NET_QTY", "PIP_BOM", "BOM_ID=" + ddBomItem.SelectedValue.ToString());
        decimal new_mat_id = WebTools.GetMatId(txtItemCode.Text, decimal.Parse(Session["PROJECT_ID"].ToString()));

        if (new_mat_id == 0)
        {
            Master.show_error("Material Not Found");
            return;
        }
        try
        {
            substitu.InsertQuery(decimal.Parse(Request.QueryString["REQ_ID"]), decimal.Parse(ddBomItem.SelectedValue.ToString()),
                                 decimal.Parse(old_mat_id), decimal.Parse(old_mat_qty),
                                 new_mat_id, decimal.Parse(txtNewQty.Text), txtRemarks.Text);

            string count = WebTools.CountExpr("1", "PIP_MAT_SUBSTITUTE_DETAIL", "  WHERE  BOM_ID=" + ddBomItem.SelectedValue.ToString());
            //if (count == "1")
            //{
            //    //NEW  ADDITION
            //    string sql1 = "UPDATE  PIP_BOM  SET  OLD_MAT_ID=" + old_mat_id + "  WHERE BOM_ID=" + ddBomItem.SelectedValue.ToString();
            //    WebTools.exec_non_qry(sql1);
            //}
            string sql3 = "UPDATE  PIP_BOM  SET  NET_QTY=" + txtNewQty.Text + "  WHERE  BOM_ID=" + ddBomItem.SelectedValue.ToString();
            string sql2 = "UPDATE  PIP_BOM  SET  MAT_ID=" + new_mat_id.ToString() + "  WHERE  BOM_ID=" + ddBomItem.SelectedValue.ToString();
            WebTools.exec_non_qry(sql3);
            WebTools.exec_non_qry(sql2);
            Master.show_success("New Item Added.");
        }
        catch (Exception ex)
        {
            Master.show_error(ex.Message);
            return;
        }
        finally
        {
            substitu.Dispose();
        }
    }
Beispiel #7
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        decimal mat_id = WebTools.GetMatId(ddlMatCode.Text, Decimal.Parse(Session["PROJECT_ID"].ToString()));

        if (mat_id == -1)
        {
            //Master.ShowWarn("There are two materials with the same code! try to use the unique one.");
            RadWindowManager1.RadAlert("There are two materials with the same code! try to use the unique one.", 400, 150, "Warning", "");
            return;
        }
        else if (mat_id == 0)
        {
            // Master.ShowWarn("Material Code not found!");
            RadWindowManager1.RadAlert("Material Code not found!", 400, 150, "Warning", "");
            return;
        }

        VIEW_MATERIAL_REQUEST_DTTableAdapter items = new VIEW_MATERIAL_REQUEST_DTTableAdapter();

        try
        {
            items.InsertQuery(decimal.Parse(Request.QueryString["MAT_REQ_ID"]), decimal.Parse(txtMrItem.Text),
                              mat_id, ddlHeatNo.SelectedValue, txtCabledrum.SelectedValue, decimal.Parse(txtReqQty.Text), txtReqDate.SelectedDate, txtRqrdAtLocation.Text,
                              null, null, txtRemarks.Text, decimal.Parse(ddlPO.SelectedValue));
            RadGrid1.DataBind();
            //Master.ShowMessage(txtMatCode.Text + " Saved!");
            RadWindowManager1.RadAlert("Material Added.", 400, 150, "Success", "");
            decimal mr_item_no = WebTools.DMax("MR_ITEM_NO", "MATERIAL_REQUEST_DETAIL", " WHERE MAT_REQ_ID='" + Request.QueryString["MAT_REQ_ID"] + "'");
            txtMrItem.Text = (mr_item_no + 1).ToString();
        }
        catch (Exception ex)
        {
            //Master.ShowWarn(ex.Message);
            RadWindowManager1.RadAlert("Access denied.", 400, 150, "Warning", "");
        }
        finally
        {
            items.Dispose();
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Procurement_CTableAdapters.VIEW_PUNCHLIST_MASTER_DTTableAdapter punchlist_dt = new Procurement_CTableAdapters.VIEW_PUNCHLIST_MASTER_DTTableAdapter();

        CheckBox cb;
        //decimal discipline;
        decimal mat_id;
        string  punch_qty;

        try
        {
            foreach (GridDataItem item in itemsGrid.Items)
            {
                cb = ((CheckBox)item["checkCol"].FindControl("checkItems"));

                if (cb.Checked)
                {
                    mat_id    = WebTools.GetMatId(item["MAT_CODE1"].Text, decimal.Parse(Session["PROJECT_ID"].ToString()));
                    punch_qty = (item["PUNCH_QTY"].FindControl("PO_QTYTextBox") as TextBox).Text;
                    string cat        = (item["CAT"].FindControl("ddlCAT") as RadDropDownList).SelectedValue;
                    string punch_desc = (item["Punch_Desc"].FindControl("txtPunchDesc") as TextBox).Text;
                    punchlist_dt.InsertQuery(decimal.Parse(Request.QueryString["PUNCH_ID"]), decimal.Parse(item["PO_ITEM_ID"].Text), cat, decimal.Parse(punch_qty), punch_desc, mat_id, (item["PUNCH_DATE"].FindControl("txtDate") as RadDatePicker).SelectedDate, null);
                }
            }
            Master.ShowMessage("Selected Items Added.");
        }
        catch (Exception ex)
        {
            Master.ShowError(ex.Message);
        }
        finally
        {
            punchlist_dt.Dispose();
            itemsGrid.Rebind();
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            //////////////////////////////////

            CheckBox cb;
            decimal  mir_item = WebTools.DMax("MIR_ITEM_NUM", "VIEW_ADAPTER_MIR_DT", " WHERE MIR_ID=" + Request.QueryString["MIR_ID"]);
            foreach (GridDataItem item in itemsGrid.Items)
            {
                cb = ((CheckBox)item["checkCol"].FindControl("checkItems"));
                if (cb.Checked)
                {
                    /////////////////////////////////////////////////


                    string tc_id = "";
                    /////////////////////////////////get values////////////////////////////////////
                    string  po_item      = item["PO_ITEM"].Text;
                    string  mat_code1    = item["MAT_CODE1"].Text;
                    string  rfi_id       = WebTools.GetExpr("RFI_ID", "PRC_MAT_INSP", " MIR_ID= '" + Request.QueryString["MIR_ID"] + "'");
                    decimal mat_id       = WebTools.GetMatId(mat_code1, decimal.Parse(Session["PROJECT_ID"].ToString()));
                    string  tc_no        = (item["MTC_NO"].FindControl("txtMTCNo") as TextBox).Text;
                    string  bal_mrir_qty = WebTools.GetExpr("BAL_MRIR_QTY", "VIEW_MRIR_BAL_FROM_RFI", " WHERE RFI_ID = '" + rfi_id + "' AND PO_ITEM='" + po_item +
                                                            "' AND MAT_ID='" + mat_id + "'");
                    //string bal_mrir_qty = (item["BAL_MRIR_QTY"].FindControl("BAL_MRIR_QTYTextBox") as TextBox).Text;
                    string receive_qty   = item["INSP_QTY"].Text;
                    string mrir_qty      = item["MRIR_QTY"].Text;
                    string cable_drum_no = (item["CABLE_DRUM_NO"].FindControl("ddlCableNo") as RadDropDownList).SelectedValue;
                    string heat_no       = (item["HEAT_NO"].FindControl("txtHeatNo") as TextBox).Text;
                    string excess        = (item["EXCESS"].FindControl("txtExcess") as TextBox).Text;
                    string shortage      = (item["SHORTAGE"].FindControl("txtShortage") as TextBox).Text;
                    string damage        = (item["DAMAGE"].FindControl("txtDamage") as TextBox).Text;

                    string substore      = (item["SUBSTORE"].FindControl("ddlsubstore") as RadDropDownList).SelectedValue;
                    string paint_sys     = (item["PAINT_SYS"].FindControl("txtPaintSys") as TextBox).Text;
                    string pl_qty        = (item["PL_QTY"].FindControl("txtPLQty") as TextBox).Text;
                    string unit_wt       = (item["UNIT_WT"].FindControl("txtUnitWt") as TextBox).Text;
                    string remarks       = (item["REMARKS"].FindControl("txtRemarks") as TextBox).Text;
                    string sub_warehouse = (item["SUB_WAREHOUSE"].FindControl("txtSubWarehouse") as TextBox).Text;
                    string line_no       = (item["LINE_NO"].FindControl("txtLineNo") as TextBox).Text;
                    string rack_no       = (item["RACK_NO"].FindControl("txtRackNo") as TextBox).Text;
                    string shelf_no      = (item["SHELF_NO"].FindControl("txtShelfNo") as TextBox).Text;
                    string pieces        = (item["BAL_PIECES"].FindControl("BAL_PIECESTextBox") as TextBox).Text;
                    if (pieces == "N/A" || pieces == "")
                    {
                        pieces = "0";
                    }

                    ////////////////////////////////get values///////////////////////////////////////
                    tc_id = WebTools.GetExpr("TC_ID", "PIP_TEST_CARDS", " UPPER(TC_CODE) = '" + tc_no.ToUpper() + "'");

                    if (tc_id.Trim().Length == 0)
                    {
                        string po_id = WebTools.GetExpr("PO_ID", "PRC_MAT_INSP", " MIR_ID='" + Request.QueryString["MIR_ID"] + "'");
                        //Register New MTC Code.
                        string sql = "INSERT INTO PIP_TEST_CARDS (PROJECT_ID, TC_CODE, PO_ID) VALUES ('" + Session["PROJECT_ID"].ToString() + "', '" +
                                     tc_no.Trim().ToUpper() + "','" + po_id + "')";
                        WebTools.ExeSql(sql);

                        //Get TC_ID for New MTC Code
                        tc_id = WebTools.GetExpr("TC_ID", "PIP_TEST_CARDS", " UPPER(TC_CODE) = '" + tc_no.ToUpper() + "'");
                    }

                    //string mat_id = WebTools.GetExpr("MAT_ID", "PIP_MAT_STOCK", " MAT_CODE1='" + mat_code1 + "'");
                    string itemid = WebTools.GetExpr("ITEM_ID", "PIP_MAT_STOCK", " MAT_ID= " + mat_id);

                    if (decimal.Parse(bal_mrir_qty) > (decimal.Parse(receive_qty) - decimal.Parse(mrir_qty)))
                    {
                        RadWindowManager1.RadAlert("Accepted quantity cannot be more than Inspection qty. <br/>Please re-check and enter valid value.", 300, 150, "Warning", "");
                        return;
                    }

                    //decimal? substore_id = null;
                    //string sub_store_id=   WebTools.GetExpr("SUBSTORE_ID", "STORES_SUB", " STORE_L1= '" + substore+"'");
                    //   if (sub_store_id.Trim().Length == 0)
                    //   {
                    //       RadWindowManager1.RadAlert("Enter Valid Sub Store", 300, 150, "Warning", "");
                    //       return;
                    //   }

                    string sql1 = "";
                    sql1  = "INSERT INTO PRC_MAT_INSP_DETAIL(MIR_ID, PO_ITEM, MIR_ITEM, MAT_ID, RCV_QTY, ACPT_QTY, HEAT_NO, PAINT_SYS, TC_ID, SUBSTORE_ID, REMARKS,CABLE_DRUM_NO, AS_PER_PL_QTY,SUB_WAREHOUSE,LINE_NO,RACK_NO,SHELF_NO,EXC_QTY,SH_QTY,DAMAG_QTY,PIECES) ";
                    sql1 += "VALUES('" + Request.QueryString["MIR_ID"].ToString() + "', '" + po_item + "','" + (++mir_item) + "','" + mat_id + "','";
                    sql1 += bal_mrir_qty + "','" + bal_mrir_qty + "','" + heat_no + "','" + paint_sys + "','" + tc_id + "','" + substore + "','";
                    sql1 += remarks + "','" + cable_drum_no + "', '" + pl_qty + "','" + sub_warehouse + "','" + line_no + "','" + rack_no + "','" + shelf_no + "','" + excess + "','" + shortage + "','" + damage + "','" + pieces + "')";
                    // Master.show_success(sql1);
                    WebTools.ExeSql(sql1);
                }
            }
            Master.ShowMessage("Selected Items Added.");
            itemsGrid.Rebind();
        }
        catch (Exception ex)
        {
            Master.ShowError("Please enter MTC No:" + ex.Message);
        }
    }
Beispiel #10
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        Procurement_BTableAdapters.VIEW_PO_IRN_DETAILTableAdapter irn = new Procurement_BTableAdapters.VIEW_PO_IRN_DETAILTableAdapter();

        CheckBox cb;
        decimal  mat_id;
        string   insp_qty, rel_qty, pieces;
        decimal  po_qty, released_qty;
        int      count          = 0;
        int      success_cnt    = 0;
        string   err_po_item_no = "";
        string   po_id          = WebTools.GetExpr("PO_ID", "PIP_PO_IRN", " WHERE IRN_ID = '" + Request.QueryString["IRN_ID"] + "'");

        try
        {
            foreach (GridDataItem item in itemsGrid.Items)
            {
                cb = ((CheckBox)item["checkCol"].FindControl("checkItems"));

                if (cb.Checked)
                {
                    //Label lbl1 = (Label)item.FindControl("PO_QTY");
                    // po_qty = decimal.Parse(lbl1.Text);
                    //Label lbl2 = (Label)item.FindControl("REL_QTY");
                    //released_qty = decimal.Parse(lbl2.Text);

                    mat_id = WebTools.GetMatId(item["MAT_CODE1"].Text, decimal.Parse(Session["PROJECT_ID"].ToString()));
                    string bal_qty_left = WebTools.GetExpr("BAL_REL_QTY", "VIEW_PO_IRN_BAL", " WHERE PO_ID = '" + decimal.Parse(po_id) + "' AND PO_ITEM_NO='" + item["PO_ITEM_NO"].Text + "'");
                    insp_qty = (item["BAL_REL_QTY"].FindControl("BAL_REL_QTYTextBox") as TextBox).Text;
                    rel_qty  = (item["BAL_REL_QTY"].FindControl("BAL_REL_QTYTextBox") as TextBox).Text;
                    pieces   = (item["BAL_PIECES"].FindControl("BAL_PIECESTextBox") as TextBox).Text;
                    if (pieces == "N/A")
                    {
                        pieces = "0";
                    }

                    if (bal_qty_left == "" || bal_qty_left == string.Empty)
                    {
                        bal_qty_left = "0";
                    }

                    if (rel_qty == "" || rel_qty == string.Empty)
                    {
                        rel_qty = "0";
                    }

                    //   ELECTRICAL==2
                    po_qty       = decimal.Parse(WebTools.GetExpr("PO_QTY", "PIP_PO_DETAIL", " WHERE PO_ID = '" + decimal.Parse(po_id) + "' AND PO_ITEM='" + item["PO_ITEM_NO"].Text + "'"));
                    released_qty = WebTools.DSum("RELEASE_QTY", "PIP_PO_IRN_DETAIL", " WHERE PO_ID=" + decimal.Parse(po_id) + " AND PO_ITEM='" + item["PO_ITEM_NO"] + "'");
                    string discipline     = WebTools.GetExpr("DISCIPLINE_ID", "PIP_PO", " WHERE PO_ID=" + decimal.Parse(po_id));
                    string chk_discipline = WebTools.GetExpr("DISCIPLINE_ID", "PIP_PO_DISCIPLINE", " WHERE DISCIPLINE_ID=" + discipline);

                    if ((decimal.Parse(bal_qty_left) >= decimal.Parse(rel_qty) && decimal.Parse(rel_qty) > 0) || (chk_discipline != string.Empty))
                    {
                        if (decimal.Parse(bal_qty_left) < decimal.Parse(rel_qty))
                        {
                            err_po_item_no += item["PO_ITEM_NO"].Text + " , ";
                        }
                        irn.InsertQuery(decimal.Parse(Request.QueryString["IRN_ID"]), item["PO_ITEM_NO"].Text, mat_id, decimal.Parse(rel_qty), decimal.Parse(insp_qty), decimal.Parse(po_id), decimal.Parse(pieces));
                        success_cnt++;
                    }
                    else
                    {
                        count++;
                        err_po_item_no += item["PO_ITEM_NO"].Text + " , ";
                    }
                }
            }

            string msg = "";

            if (err_po_item_no.Length > 0)
            {
                msg += "Rel Qty greater than PO Qty for Po Item No : " + err_po_item_no + "<br/> ";
            }
            if (success_cnt > 0)
            {
                msg = "Selected Item(s) Imported, <br/> ";
                Master.ShowSuccess("Selected Item(s) Imported");
            }
            else
            {
                Master.ShowWarn(msg);
            }
        }
        catch (Exception ex)
        {
            Master.ShowError(ex.Message);
        }
        finally {
            irn.Dispose();
            itemsGrid.Rebind();
        }
    }
Beispiel #11
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (itemsGrid.SelectedIndexes.Count == 0)
        {
            Master.ShowMessage("Select Material to Add.");
            return;
        }
        string mrr_no;
        string mat_code1;

        string acpt_qty;
        string presv_qty;
        string bal_to_presv;
        string mir_item_id;

        dsPreservationTableAdapters.VIEW_PRESERVATION_MAT_DETAILTableAdapter presv_item = new dsPreservationTableAdapters.VIEW_PRESERVATION_MAT_DETAILTableAdapter();
        string sql = string.Empty;

        try
        {
            foreach (GridDataItem item in itemsGrid.SelectedItems)
            {
                mir_item_id  = item["MIR_ITEM_ID"].Text;
                mat_code1    = item["MAT_CODE1"].Text;
                acpt_qty     = item["ACPT_QTY"].Text;
                presv_qty    = item["PRESV_QTY"].Text.Trim();
                bal_to_presv = ((item["BAL_TO_PRESERV"].FindControl("BAL_TO_PRESERVLabel")) as RadTextBox).Text;

                if (decimal.Parse(acpt_qty) >= ((presv_qty.Trim() == "" ? 0 : decimal.Parse(presv_qty)) + decimal.Parse(bal_to_presv)))
                {
                    presv_item.InsertQuery(decimal.Parse(Session["PROJECT_ID"].ToString()), decimal.Parse(Request.QueryString["PRESERV_ID"]), decimal.Parse(mir_item_id), WebTools.GetMatId(mat_code1, decimal.Parse(Session["PROJECT_ID"].ToString())),
                                           decimal.Parse(bal_to_presv), null);
                }
                else
                {
                    Master.ShowError("Preservation quantity cannot be more than Accepted qty.");
                }
            }
            Master.ShowSuccess("Selected Items added to Preservation");
        }
        catch (Exception ex)
        {
            Master.ShowError(ex.Message);
        }
    }
Beispiel #12
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (itemsGrid.SelectedIndexes.Count == 0)
        {
            Master.ShowMessage("Select Material to Add.");
            return;
        }
        string mrr_no;
        string mat_code1;

        string rcv_qty;
        string insp_qty;
        string bal_to_insp;
        string rcv_item_id;

        dsMaterialETableAdapters.VIEW_MAT_INSP_REQUEST_DTTableAdapter rfi_item = new dsMaterialETableAdapters.VIEW_MAT_INSP_REQUEST_DTTableAdapter();
        string sql = string.Empty;

        try
        {
            foreach (GridDataItem item in itemsGrid.SelectedItems)
            {
                mrr_no      = item["MAT_RCV_NO"].Text;
                rcv_item_id = item["RCV_ITEM_ID"].Text;
                mat_code1   = item["MAT_CODE1"].Text;
                rcv_qty     = item["RCV_QTY"].Text;
                insp_qty    = item["INSP_QTY"].Text.Trim();
                bal_to_insp = ((item["BAL_TO_INSP"].FindControl("BAL_TO_INSPLabel")) as RadTextBox).Text;

                string pieces = (item["BAL_TO_INSP_PIECES"].FindControl("BAL_TO_INSP_PIECESLabel") as RadTextBox).Text;
                if (pieces == "N/A" || pieces == "")
                {
                    pieces = "0";
                }

                if (decimal.Parse(rcv_qty) >= ((insp_qty.Trim() == "" ? 0 : decimal.Parse(insp_qty)) + decimal.Parse(bal_to_insp)))
                {
                    rfi_item.InsertQuery(decimal.Parse(Request.QueryString["RFI_ID"]), WebTools.GetMatId(mat_code1, decimal.Parse(Session["PROJECT_ID"].ToString())),
                                         decimal.Parse(bal_to_insp), null, "XXX", null, decimal.Parse(rcv_item_id), decimal.Parse(pieces));
                    Master.ShowSuccess("Selected Items added to RFI");
                }
                else
                {
                    Master.ShowError("Inspection quantity cannot be more than received qty.");
                }
            }
            itemsGrid.Rebind();
        }
        catch (Exception ex)
        {
            Master.ShowError(ex.Message);
        }
    }