private void loadMenu(string lang) { SAPbouiCOM.Menus mnus = oApplication.Menus; if (mnus.Exists("mnu_DRSC")) { mnus.RemoveEx("mnu_DRSC"); } mnus.Item("2048").SubMenus.Add("mnu_DRSC", "Reschedule Reserve Invoice", BoMenuType.mt_STRING, 47646); }
public override void etAfterActClick(ref ItemEvent pVal, ref bool BubbleEvent) { base.etAfterActClick(ref pVal, ref BubbleEvent); if (pVal.ItemUID == "btFinal") { int confirm = oApplication.MessageBox("Are you sure you want to post stock?", 2, "Yes", "No"); if (confirm == 1) { int postingStatus = -1; int trsnsferResult = -1; int selRow = mtSelRow(mtDocs); if (selRow > 0) { string strCode = Convert.ToString(dtDoc.GetValue("OT", selRow - 1)); string dn = Convert.ToString(dtDoc.GetValue("DE", selRow - 1)); string docType = Convert.ToString(dtDoc.GetValue("DT", selRow - 1)); if (docType == "Offer for Inspection") { string strProdNum = "SELECT \"U_B1_QA_INSP_PN\" FROM \"OIGN\" WHERE \"DocEntry\" ='" + dn + "'"; System.Data.DataTable dtProdNum = Program.objHrmsUI.getDataTable(strProdNum, "ProdNum"); if (dtProdNum != null && dtProdNum.Rows.Count > 0) { if (dtProdNum.Rows[0]["U_B1_QA_INSP_PN"] != DBNull.Value && Convert.ToInt32(dtProdNum.Rows[0]["U_B1_QA_INSP_PN"]) > 0) { postingStatus = ReleaseInspaction(dn); } } } else { postingStatus = PostTransfer(strCode, dn); } string strDocCode = strCode + "-" + dn; if (strCode.Trim() != "" && postingStatus != -1) { string strInsert = "UPDATE \"@B1_QA_DOC\" SET \"U_Date\" = '" + DateTime.Now.ToString("yyyyMMdd") + "' , \"U_Final\"='Y' , \"U_WTRentry\" = '" + postingStatus + "' WHERE \"Code\" = '" + strDocCode + "'"; Program.objHrmsUI.ExecQuery(strInsert, "Finalllizing Inspaction"); } } // _iniForm(); getDocs(); } } if (pVal.ItemUID == "btPrint") { SAPbouiCOM.Menus mnus = oApplication.Menus; if (mnus.Exists(printMenuId) && printMenuId != "") { int selRow = mtSelRow(mtDocs); string strCode = Convert.ToString(dtDoc.GetValue("OT", selRow - 1)); string dn = Convert.ToString(dtDoc.GetValue("DE", selRow - 1)); mnus.Item(printMenuId).Activate(); SAPbouiCOM.Form prmForm = oApplication.Forms.ActiveForm; EditText objType = (SAPbouiCOM.EditText)prmForm.Items.Item("1000003").Specific; EditText DocKey = (SAPbouiCOM.EditText)prmForm.Items.Item("1000009").Specific; SAPbouiCOM.Button ok = (SAPbouiCOM.Button)prmForm.Items.Item("1").Specific; // SAPbouiCOM.Button cancel = (SAPbouiCOM.Button)prmForm.Items.Item("2").Specific; objType.Value = strCode; DocKey.Value = dn; prmForm.ActiveItem = ok.Item.UniqueID; objType.Item.Enabled = false; // DocKey.Item.Enabled = false; ok.Item.Click(); // prmForm.Select(); // cancel.Item.Click(); } else { oApplication.MessageBox("Please upload \"Inspection Report\" in production report menu"); } } if (pVal.ItemUID == "txAtt") { try { // txAtt.ClickPicker(); System.Diagnostics.Process.Start(dtHead.GetValue("Att", 0).ToString()); } catch (Exception ex) { string errmsg = ex.Message; } } if (pVal.ItemUID == btAtt.Item.UniqueID) { string strFileName = Program.objHrmsUI.addAttacment(""); if (strFileName != "") { dtHead.SetValue("Att", 0, strFileName); int selRow = mtSelRow(mtDocs); string strCode = Convert.ToString(dtDoc.GetValue("OT", selRow - 1)); string dn = Convert.ToString(dtDoc.GetValue("DE", selRow - 1)); string strDocCode = strCode + "-" + dn; string strInsert = "UPDATE \"@B1_QA_DOC\" SET \"U_Att\" = '" + strFileName + "' WHERE \"Code\" = '" + strDocCode + "'"; Program.objHrmsUI.ExecQuery(strInsert, "Finalllizing Inspaction"); } } if (pVal.ItemUID == "1000001") { string RC = Convert.ToString(dtHead.GetValue("RC", 0)); string SBC = Convert.ToString(dtHead.GetValue("SBC", 0)); string strCode = RC + "-" + SBC; saveReport(strCode); } if (pVal.ItemUID == mtDocs.Item.UniqueID && pVal.Row > 0 && pVal.Row <= mtDocs.RowCount) { mtDocs.SelectRow(pVal.Row, true, false); int selRow = pVal.Row; if (selRow > 0) { string strCode = Convert.ToString(dtDoc.GetValue("OT", selRow - 1)); string dn = Convert.ToString(dtDoc.GetValue("DE", selRow - 1)); string tbl = Convert.ToString(dtDoc.GetValue("Tbl", selRow - 1)); if (strCode.Trim() != "") { string strDocCode = strCode + "-" + dn; string strExist = "SELECT * from \"@B1_QA_DOC\" where \"Code\" = '" + strDocCode + "'"; System.Data.DataTable dtExist = Program.objHrmsUI.getDataTable(strExist, "DocDetExist"); if (dtExist.Rows.Count == 0) { string strInsert = "INSERT INTO \"@B1_QA_DOC\" (\"Code\",\"Name\",\"U_ObjType\",\"U_DocEntry\",\"U_Date\")"; strInsert += " VALUES ('" + strDocCode + "','" + strDocCode + "','" + strCode + "','" + dn + "','" + DateTime.Now.ToString("yyyyMMdd") + "')"; Program.objHrmsUI.ExecQuery(strInsert, "Rpt Doc Entry into UDT"); } else { dtHead.SetValue("Att", 0, dtExist.Rows[0]["U_Att"].ToString()); } getRows(tbl, dn); } } else { oApplication.MessageBox("Please select a document before inspaction"); } } if (pVal.ItemUID == mtDocRows.Item.UniqueID && pVal.Row > 0 && pVal.Row <= mtDocRows.RowCount) { mtDocRows.SelectRow(pVal.Row, true, false); int selRow = pVal.Row;// mtSelRow(mtDocRows); if (selRow > 0) { string strCode = Convert.ToString(dtRow.GetValue("ItemCode", selRow - 1)); string MM = Convert.ToString(dtRow.GetValue("MM", selRow - 1)); string OBT = Convert.ToString(dtRow.GetValue("OBT", selRow - 1)); string LN = Convert.ToString(dtRow.GetValue("LN", selRow - 1)); string ItemCode = Convert.ToString(dtRow.GetValue("ItemCode", selRow - 1)); string Qty = Convert.ToString(dtRow.GetValue("Quantity", selRow - 1)); int DocselRow = mtSelRow(mtDocs); string DE = Convert.ToString(dtDoc.GetValue("DE", DocselRow - 1)); dtHead.SetValue("RC", 0, OBT + "-" + DE + "-" + LN); dtHead.SetValue("MM", 0, MM); dtHead.SetValue("OBT", 0, OBT); dtHead.SetValue("LN", 0, LN); dtHead.SetValue("DE", 0, DE); dtHead.SetValue("Qty", 0, Qty); dtHead.SetValue("ItemCode", 0, ItemCode); if (strCode.Trim() != "") { getAttributes(strCode); fillSerilaOrBatch(Qty, DE, LN, OBT, MM); } } else { oApplication.MessageBox("Please select an item before inspaction"); } } if (pVal.ItemUID == mtSB.Item.UniqueID && pVal.Row > 0 && pVal.Row <= mtSB.RowCount) { mtSB.SelectRow(pVal.Row, true, false); int selRow = pVal.Row;// mtSelRow(mtSB); if (selRow > 0) { string RC = Convert.ToString(dtHead.GetValue("RC", 0)); string MM = Convert.ToString(dtHead.GetValue("MM", 0)); string OBT = Convert.ToString(dtHead.GetValue("OBT", 0)); string LN = Convert.ToString(dtHead.GetValue("LN", 0)); string DE = Convert.ToString(dtHead.GetValue("DE", 0)); string ItemCode = Convert.ToString(dtHead.GetValue("ItemCode", 0)); string Qty = Convert.ToString(dtHead.GetValue("Qty", 0)); string strCode = Convert.ToString(dtSB.GetValue("Code", selRow - 1)); string strQty = Convert.ToString(dtSB.GetValue("Qty", selRow - 1)); dtHead.SetValue("SBC", 0, strCode); getReport(RC + "-" + strCode, OBT, DE, LN, MM, strQty, ItemCode, strCode); } } }