public ChooseFromList SetConditionCFLWareHouse() { TicketDAO lObjTicketDAO = new TicketDAO(); string lStrWareHouse = lObjTicketDAO.GetWareHouse(DIApplication.Company.UserSignature.ToString()); List <string> lLstWareHouse = lObjTicketDAO.GetWareHousePather(lStrWareHouse).ToList(); SAPbouiCOM.ChooseFromListCollection lObjCFLs = null; ChooseFromList lObjCFL = null; SAPbouiCOM.Conditions lObjCons = new Conditions(); SAPbouiCOM.Condition lObjCon = null; lObjCFL = lObjCFLs.Item("CFL_Ware"); int i = 1; foreach (string lStrWareHousePather in lLstWareHouse) { lObjCon = lObjCons.Add(); lObjCon.Alias = "WhsCode"; lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; lObjCon.CondVal = lStrWareHousePather; if (lLstWareHouse.Count() > i) { lObjCon.Relationship = BoConditionRelationship.cr_OR; } i++; } lObjCFL.SetConditions(lObjCons); return(lObjCFL); }
///<summary> Creates the matrix. </summary> ///<remarks> Amartinez, 08/05/2017. </remarks> public SAPbouiCOM.Matrix CreateMatrix(SAPbouiCOM.IItem pObjItem, SAPbouiCOM.ChooseFromListCollection pObjCFLs) { SAPbouiCOM.Matrix lObjMatrix; lObjMatrix = ((SAPbouiCOM.Matrix)(pObjItem.Specific)); lObjMatrix.Layout = SAPbouiCOM.BoMatrixLayoutType.mlt_Normal; lObjMatrix.SelectionMode = SAPbouiCOM.BoMatrixSelect.ms_Auto; lObjMatrix.ValidateBefore += lObjMatrix_ValidateBefore; lObjMatrix.ValidateAfter += lObjMatrix_ValidateAfter; SAPbouiCOM.ChooseFromListCreationParams lObjCFLCreationParams; SAPbouiCOM.Conditions oCons = null; SAPbouiCOM.Condition oCon = null; lObjCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)SAPbouiCOM.Framework.Application.SBO_Application.CreateObject(BoCreatableObjectType.cot_ChooseFromListCreationParams); //Adding a choosefromlist for the column lObjCFLCreationParams.MultiSelection = false; lObjCFLCreationParams.ObjectType = "4"; lObjCFLCreationParams.UniqueID = "CFL1"; SAPbouiCOM.ChooseFromList lObjCFL = pObjCFLs.Add(lObjCFLCreationParams); //Add Conditon Rcordova 19-10-2017 oCons = lObjCFL.GetConditions(); oCon = oCons.Add(); oCon.Alias = "SellItem"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "Y"; lObjCFL.SetConditions(oCons); //Add Conditon Rcordova 19-10-2017 //Adding a choosefromlist for the column lObjCFLCreationParams.MultiSelection = false; lObjCFLCreationParams.ObjectType = "64"; lObjCFLCreationParams.UniqueID = "CFL_Ware"; pObjCFLs.Add(lObjCFLCreationParams); // SAPbouiCOM.UserDataSource udsCardCode = this.UIAPIRawForm.DataSources.UserDataSources.Add("UdsCardCd", BoDataType.dt_SHORT_TEXT, 10); return(lObjMatrix); }
public static void clsSupplierPurchaseHistory_ItemEvent(ref SAPbouiCOM.Application oApplication, ref SAPbobsCOM.Company oCompany, SAPbouiCOM.Form oSetupForm, ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent) { if (oForm != null) { oForm = oSetupForm; SAPbouiCOM.Grid oGrid; oGrid = (SAPbouiCOM.Grid)oForm.Items.Item("4").Specific; oMatrix = (SAPbouiCOM.Matrix)oSOForm.Items.Item("38").Specific; if (pVal.BeforeAction) { switch (pVal.EventType) { //case BoEventTypes.et_FORM_CLOSE: // BubbleEvent = false; // oForm.Visible = false; // break; case BoEventTypes.et_DOUBLE_CLICK: if (pVal.ItemUID == "4") { string strSelCol = ""; strSelCol = oGrid.Columns.Item(pVal.ColUID).TitleObject.Caption.ToString(); string[] words = strSelCol.Split('-'); string[] words1; if (words.Length == 2) { oForm.Freeze(true); for (int i = 0; i < oGrid.Rows.Count; i++) { if (oGrid.DataTable.GetValue(strSelCol, i).ToString().Trim() != "") { if (oGrid.DataTable.GetValue(strSelCol, i).ToString().Trim() != "0") { words1 = oGrid.DataTable.GetValue(strSelCol, i).ToString().Trim().Split(' '); if (words1[0].Trim() != "") { oGrid.DataTable.SetValue("Order Qty", i, words1[0].Trim()); } } } } oForm.Freeze(false); } } break; case BoEventTypes.et_ITEM_PRESSED: if (pVal.ItemUID == "2") { BubbleEvent = false; oForm.Visible = false; } if (pVal.ItemUID == "3") { flushAll(); BubbleEvent = false; oForm.Visible = false; return; oMatrix.Clear(); int j = oMatrix.RowCount; if (j == 0) { oMatrix.AddRow(1, -1); } j = oMatrix.RowCount; for (int i = 0; i < oGrid.Rows.Count; i++) { if (oGrid.DataTable.GetValue("Order Qty", i).ToString().Trim() != "") { if (oGrid.DataTable.GetValue("Order Qty", i).ToString().Trim() != "0") { string strItemCode = oGrid.DataTable.GetValue("ItemCode", i).ToString().Trim(); string strQty = oGrid.DataTable.GetValue("Order Qty", i).ToString().Trim(); string strPrice = oGrid.DataTable.GetValue("Current Purchase Price", i).ToString().Trim(); string strUoM = oGrid.DataTable.GetValue("UoM", i).ToString().Trim(); try { ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1").Cells.Item(j).Specific).Value = strItemCode; ((SAPbouiCOM.EditText)oMatrix.Columns.Item("11").Cells.Item(j).Specific).Value = strQty; try { ((SAPbouiCOM.EditText)oMatrix.Columns.Item("1470002145").Cells.Item(j).Specific).Value = strUoM; } catch (Exception) { } try { ((SAPbouiCOM.EditText)oMatrix.Columns.Item("14").Cells.Item(j).Specific).Value = strPrice; } catch (Exception) { } j++; } catch (Exception) { j++; } } } } //oForm.Close(); oForm.Visible = false; } break; case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST: if (pVal.ItemUID == "4") { if (pVal.ColUID == "UoM") { if (oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim() != "") { string squery = "Select T2.\"UomCode\",T2.\"UomName\" From OITM T0 Inner Join UGP1 T1 On T0.\"UgpEntry\" = T1.\"UgpEntry\" Inner Join OUOM T2 On T1.\"UomEntry\" = T2.\"UomEntry\" Where T0.\"ItemCode\" = '" + oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim() + "'"; Utilities.UtilitiesCls.CFLConditionQuery(ref oApplication, ref oCompany, oForm, ref pVal, squery, "UomCode", "10010198", "UomCode", false, true, "4", "UoM", false); } } if (pVal.ColUID == "ItemCode") { SAPbouiCOM.ChooseFromListCollection oCFLs = null; SAPbouiCOM.Conditions oCons = null; SAPbouiCOM.Condition oCon = null; oCFLs = oForm.ChooseFromLists; SAPbouiCOM.ChooseFromList oCFL = null; oCFL = oCFLs.Item("CFL_2"); oCons = new Conditions(); oCFL.SetConditions(oCons); oCons = oCFL.GetConditions(); oCon = oCons.Add(); oCon.Alias = "PrchseItem"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "Y"; oCon.Relationship = BoConditionRelationship.cr_AND; oCon = oCons.Add(); oCon.Alias = "frozenFor"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL; oCon.CondVal = "Y"; int intCnt = 2; for (int i = 0; i < oGrid.Rows.Count; i++) { if (oGrid.DataTable.GetValue("ItemCode", i).ToString().Trim() != "") { if (intCnt > 0) { oCon.Relationship = BoConditionRelationship.cr_AND; } oCon = oCons.Add(); oCon.Alias = "ItemCode"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_EQUAL; oCon.CondVal = oGrid.DataTable.GetValue("ItemCode", i).ToString().Trim(); intCnt += 1; } } oCFL.SetConditions(oCons); } } break; default: break; } } else if (pVal.BeforeAction == false) { switch (pVal.EventType) { case BoEventTypes.et_ITEM_PRESSED: break; case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST: if (oForm.Mode != SAPbouiCOM.BoFormMode.fm_FIND_MODE) { if (pVal.ItemUID == "4") { if (pVal.ColUID == "ItemCode") { oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); string strQry = ""; string strItemCode = ""; oDataTable = UtilitiesCls.DataTable(ref oApplication, ref oCompany, oForm, ref pVal); if (oDataTable != null) { strItemCode = oDataTable.GetValue("ItemCode", 0).ToString(); } if (strItemCode != "") { strQry = " Exec EJ_LoadBPItemDetails '" + ((SAPbouiCOM.EditText)oForm.Items.Item("6").Specific).Value.Trim() + "', '" + strItemCode + "'"; oRecordSet.DoQuery(strQry); if (!oRecordSet.EoF) { oGrid.DataTable.SetValue("ItemCode", pVal.Row, strItemCode); oGrid.DataTable.SetValue("ItemName", pVal.Row, oRecordSet.Fields.Item("ItemName").Value.ToString()); oGrid.DataTable.SetValue("Order Qty", pVal.Row, ""); oGrid.DataTable.SetValue("UoM", pVal.Row, oRecordSet.Fields.Item("UoM").Value.ToString()); oGrid.DataTable.SetValue("Current Purchase Price", pVal.Row, oRecordSet.Fields.Item("Current Price").Value.ToString()); } } oGrid.DataTable.SetValue("ItemCode", pVal.Row, strItemCode); int j = oGrid.Rows.Count; if (j == oGrid.Rows.Count) { oGrid.DataTable.Rows.Add(); } } if (pVal.ColUID == "UoM") { oRecordSet = (SAPbobsCOM.Recordset)oCompany.GetBusinessObject(BoObjectTypes.BoRecordset); string strUoMCode = ""; oDataTable = UtilitiesCls.DataTable(ref oApplication, ref oCompany, oForm, ref pVal); if (oDataTable != null) { strUoMCode = oDataTable.GetValue("UomCode", 0).ToString(); } oGrid.DataTable.SetValue("UoM", pVal.Row, strUoMCode); string strQry = " Exec EJ_LoadUoMPrice '" + ((SAPbouiCOM.EditText)oForm.Items.Item("6").Specific).Value.Trim() + "','" + oGrid.DataTable.GetValue("ItemCode", pVal.Row).ToString().Trim() + "' ,'" + strUoMCode + "'"; oRecordSet.DoQuery(strQry); if (!oRecordSet.EoF) { oGrid.DataTable.SetValue("Current Purchase Price", pVal.Row, oRecordSet.Fields.Item("Current Price").Value.ToString()); } } } } break; case BoEventTypes.et_COMBO_SELECT: break; case BoEventTypes.et_FORM_CLOSE: oForm = null; break; default: break; } } } }
///<summary> Initializes the choose from lists. </summary> ///<remarks> Amartinez, 08/05/2017. </remarks> ///<param name="pbol"> True to pbol. </param> ///<param name="pStrType"> Type of the string. </param> ///<param name="pStrID"> Identifier for the string. </param> ///<returns> A ChooseFromList. </returns> public ChooseFromList initChooseFromLists(bool pbol, string pStrType, string pStrID, SAPbouiCOM.ChooseFromListCollection pObjCFLs) // { SAPbouiCOM.ChooseFromList lObjoCFL = null; try { SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams = null; oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)UIApplication.GetApplication().CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams); // Adding 2 CFL, one for the button and one for the edit text. oCFLCreationParams.MultiSelection = pbol; oCFLCreationParams.ObjectType = pStrType; oCFLCreationParams.UniqueID = pStrID; lObjoCFL = pObjCFLs.Add(oCFLCreationParams); } catch (Exception ex) { LogService.WriteError("[RemoveTicketDetail]: " + ex.Message); LogService.WriteError(ex); UIApplication.ShowMessageBox(string.Format("InitCustomerChooseFromListException: {0}", ex.Message)); } return(lObjoCFL); }
public ChooseFromList InitChooseFromLists(bool pbolMultiselecction, string pStrType, string pStrID, SAPbouiCOM.ChooseFromListCollection pObjCFLs) // { SAPbouiCOM.ChooseFromList lObjoCFL = null; try { SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams = null; oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)UIApplication.GetApplication().CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams); oCFLCreationParams.MultiSelection = pbolMultiselecction; oCFLCreationParams.ObjectType = pStrType; oCFLCreationParams.UniqueID = pStrID; lObjoCFL = pObjCFLs.Add(oCFLCreationParams); this.UIAPIRawForm.DataSources.UserDataSources.Add(pStrID, SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 254); } catch (Exception ex) { UIApplication.ShowMessageBox(string.Format("InitCustomerChooseFromListException: {0}", ex.Message)); LogService.WriteError("frmSearchRefunds (InitChooseFromLists) " + ex.Message); LogService.WriteError(ex); } return(lObjoCFL); }
public SAPbouiCOM.ChooseFromList InitChooseFromLists(bool pbol, string pStrType, string pStrID, SAPbouiCOM.ChooseFromListCollection pObjCFLs) // { SAPbouiCOM.ChooseFromList lObjoCFL = null; try { SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams = null; oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)UIApplication.GetApplication().CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams); oCFLCreationParams.MultiSelection = pbol; oCFLCreationParams.ObjectType = pStrType; oCFLCreationParams.UniqueID = pStrID; lObjoCFL = pObjCFLs.Add(oCFLCreationParams); this.UIAPIRawForm.DataSources.UserDataSources.Add(pStrID, SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 254); } catch (Exception ex) { HandleException(ex, "InitCustomerChooseFromListException"); } return(lObjoCFL); }