private void InitiallizeForm() { Program.objHrmsUI.loadSettings(); oForm.Freeze(true); dtHead = oForm.DataSources.DataTables.Item("dtHead"); dtSetting = oForm.DataSources.DataTables.Item("dtSetting"); dtSetting.Rows.Add(1); mtAddon = (SAPbouiCOM.Matrix)oForm.Items.Item("mtAddon").Specific; txDfltExp = (SAPbouiCOM.EditText)oForm.Items.Item("txDfltExp").Specific; txUID = (SAPbouiCOM.EditText)oForm.Items.Item("txUID").Specific; txPWD = (SAPbouiCOM.EditText)oForm.Items.Item("txPWD").Specific; txINCCode = (SAPbouiCOM.EditText)oForm.Items.Item("txINCCode").Specific; txLTDCode = (SAPbouiCOM.EditText)oForm.Items.Item("txLTDCode").Specific; txINCDB = (SAPbouiCOM.EditText)oForm.Items.Item("txINCDB").Specific; txLTDDB = (SAPbouiCOM.EditText)oForm.Items.Item("txLTDDB").Specific; txTax = (SAPbouiCOM.EditText)oForm.Items.Item("txTax").Specific; cflDE = oForm.ChooseFromLists.Item("cflDE"); fillAddons(); fillSettings(); filtertocfl(); oForm.Freeze(false); }
/// <summary> /// Fill choose from list. /// </summary> private void LoadChoosesFromList() { SAPbouiCOM.ChooseFromList lObjCFLItem = InitChooseFromLists(false, "4", "CFL_Item", this.UIAPIRawForm.ChooseFromLists); AddConditionCFL(lObjCFLItem, "CFL_Item"); SAPbouiCOM.ChooseFromList lObjCFLWhs = InitChooseFromLists(false, "64", "CFL_Whs", this.UIAPIRawForm.ChooseFromLists); AddConditionCFL(lObjCFLWhs, "CFL_Whs"); SetChooseFromListToTxt(); }
/// <summary> /// preenche campos Tela / Código e Nome e lista de outros campos /// </summary> /// <param name="formUID">formUid do evento</param> /// <param name="pVal">pVal do evento</param> /// <param name="idCampoChoose">Id do campo onde esta o choosefromlist</param> /// <param name="idChoose">Id do ChooseFromList</param> /// <param name="idCampoChooseNome">Id do campo onde deve ser preenchido o nome / retorna o campo 13 padrao / primeiro campo de cadastro de usuarios</param> /// <param name="mensagemErro">Mensagem de erro a ser apresentada se der algum problema</param> /// <param name="listaCampos">Lista contendo os demais campos a serem preenchidos quando selecionado o choose</param> /// <param name="idCampoNomeDataTable">Id para buscar o nome a ser preenchido / como padrão retornara o 13</param> public static void PreencheCampos(string formUID, ItemEvent pVal, string idCampoChoose, string idChoose, string idCampoChooseNome, string mensagemErro, List <CamposPreencimento> listaCampos, int idCampoNomeDataTable = 13) { try { if (pVal.ItemUID == idCampoChoose) { Form oForm = B1AppDomain.Application.Forms.Item(formUID); IChooseFromListEvent oCFLEvento = (IChooseFromListEvent)pVal; string sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.ChooseFromList oCFL = oForm.ChooseFromLists.Item(sCFL_ID); DataTable oDataTable = oCFLEvento.SelectedObjects; EditText oEditText; try { if (oCFL.UniqueID == idChoose) { foreach (CamposPreencimento campo in listaCampos) { oEditText = oForm.Items.Item(campo.idCampo).Specific; var valor = oDataTable.GetValue(campo.idDataTable, 0).ToString(); if (typeof(DateTime) == valor.GetType()) { oEditText.Value = InternalUtils.FormataData(valor); } else { oEditText.Value = valor.ToString(); } } oEditText = oForm.Items.Item(idCampoChooseNome).Specific; oEditText.Value = oDataTable.GetValue(idCampoNomeDataTable, 0).ToString(); oEditText = oForm.Items.Item(idCampoChoose).Specific; oEditText.Value = oDataTable.GetValue(0, 0).ToString(); } } catch { } if (oForm.Mode != BoFormMode.fm_ADD_MODE) { oForm.Mode = BoFormMode.fm_UPDATE_MODE; } } } catch (Exception ex) { //B1Exception.throwException(mensagemErro, ex); } }
private void InitiallizeForm() { oForm.Freeze(true); initiallizing = true; dtHead = oForm.DataSources.DataTables.Item("dtHead"); dtList = oForm.DataSources.DataTables.Item("dtList"); dtA = oForm.DataSources.DataTables.Item("dtA"); dtS = oForm.DataSources.DataTables.Item("dtS"); dtAW = oForm.DataSources.DataTables.Item("dtAW"); dtSW = oForm.DataSources.DataTables.Item("dtSW"); mtA = (SAPbouiCOM.Matrix)oForm.Items.Item("mtA").Specific; mtS = (SAPbouiCOM.Matrix)oForm.Items.Item("mtS").Specific; mtAW = (SAPbouiCOM.Matrix)oForm.Items.Item("mtAW").Specific; mtSW = (SAPbouiCOM.Matrix)oForm.Items.Item("mtSW").Specific; mtList = (SAPbouiCOM.Matrix)oForm.Items.Item("mtList").Specific; dtHead.Rows.Add(1); txCode = (SAPbouiCOM.EditText)oForm.Items.Item("txCode").Specific; txName = (SAPbouiCOM.EditText)oForm.Items.Item("txName").Specific; btAdd = (SAPbouiCOM.Button)oForm.Items.Item("btAdd").Specific; btAddA = (SAPbouiCOM.Button)oForm.Items.Item("btAddA").Specific; btDelA = (SAPbouiCOM.Button)oForm.Items.Item("btDelA").Specific; btAddW = (SAPbouiCOM.Button)oForm.Items.Item("btAddW").Specific; btDelW = (SAPbouiCOM.Button)oForm.Items.Item("btDelW").Specific; cbPWHS = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbPWHS").Specific; cflCode = (SAPbouiCOM.ChooseFromList)oForm.ChooseFromLists.Item("cflCode"); // oForm.Items.Item("btUpd").Enabled = false; oForm.Freeze(false); initiallizing = false; getCodes(); }
private void InitiallizeForm() { oForm.Freeze(true); initiallizing = true; dtA = oForm.DataSources.DataTables.Item("dtA"); dtHead = oForm.DataSources.DataTables.Item("dtHead"); dtS = oForm.DataSources.DataTables.Item("dtS"); dtList = oForm.DataSources.DataTables.Item("dtList"); mtA = (SAPbouiCOM.Matrix)oForm.Items.Item("mtA").Specific; mtS = (SAPbouiCOM.Matrix)oForm.Items.Item("mtS").Specific; mtList = (SAPbouiCOM.Matrix)oForm.Items.Item("mtList").Specific; dtHead.Rows.Add(1); txCode = (SAPbouiCOM.EditText)oForm.Items.Item("txCode").Specific; txName = (SAPbouiCOM.EditText)oForm.Items.Item("txName").Specific; btAdd = (SAPbouiCOM.Button)oForm.Items.Item("btAdd").Specific; btAddA = (SAPbouiCOM.Button)oForm.Items.Item("btAddA").Specific; btDelA = (SAPbouiCOM.Button)oForm.Items.Item("btDelA").Specific; opI = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opI").Specific; opG = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opG").Specific; cflCode = (SAPbouiCOM.ChooseFromList)oForm.ChooseFromLists.Item("cflCode"); cflGroup = (SAPbouiCOM.ChooseFromList)oForm.ChooseFromLists.Item("cflGroup"); opG.GroupWith("opI"); opG.Selected = true; // oForm.Items.Item("btUpd").Enabled = false; oForm.Freeze(false); initiallizing = false; getCodes(); }
/// <summary> /// preenche campos da matrix / Código e Nome /// </summary> /// <param name="formUID">formUid do evento</param> /// <param name="pVal">pVal do evento</param> /// <param name="idMatrix">id da Matrix / Não pode ser grid</param> /// <param name="colunaChoose">Id da coluna onde esta o botão ChooseFromList</param> /// <param name="idChoose">Id do ChooseFromList</param> /// <param name="colunaChooseNome">Id da coluna onde deve ser preenchido o nome / retorna o campo 13 padrao / primeiro campo de cadastro de usuarios</param> /// <param name="mensagemErro">Mensagem de erro a ser apresentada se der algum problema</param> public static void PreencheCampos(string formUID, ItemEvent pVal, string idMatrix, string colunaChoose, string idChoose, string colunaChooseNome, string mensagemErro) { try { if (pVal.ItemUID == idMatrix && pVal.ColUID == colunaChoose) { Form oForm = B1AppDomain.Application.Forms.Item(formUID); IChooseFromListEvent oCFLEvento = (IChooseFromListEvent)pVal; string sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.ChooseFromList oCFL = oForm.ChooseFromLists.Item(sCFL_ID); DataTable oDataTable = oCFLEvento.SelectedObjects; Matrix oMatrix; EditText oEditText; try { oMatrix = oForm.Items.Item(idMatrix).Specific; if (pVal.ColUID == colunaChoose && oCFL.UniqueID == idChoose) { oEditText = oMatrix.Columns.Item(colunaChooseNome).Cells.Item(pVal.Row).Specific; oEditText.Value = oDataTable.GetValue(1, 0).ToString(); oEditText = oMatrix.Columns.Item(colunaChoose).Cells.Item(pVal.Row).Specific; oEditText.Value = oDataTable.GetValue(0, 0).ToString(); } } catch { } if (oForm.Mode != BoFormMode.fm_ADD_MODE) { oForm.Mode = BoFormMode.fm_UPDATE_MODE; } } } catch (Exception ex) { //B1Exception.throwException(mensagemErro, ex); } }
private void AddConditionCFL(SAPbouiCOM.ChooseFromList pCFL, string pCFLID) { SAPbouiCOM.Condition lObjCon = null; SAPbouiCOM.Conditions lObjCons = new SAPbouiCOM.Conditions(); if (pCFLID == "CFL_Whs") { lObjCon = lObjCons.Add(); lObjCon.Alias = "location"; lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; lObjCon.CondVal = "1"; } else if (pCFLID == "CFL_Item") { lDicNonLockedItems = lObjDistributionDAO.GetNonLockeditems(); try { int i = 1; if (lDicNonLockedItems.Count() > 0) { foreach (string itemCode in lDicNonLockedItems.Keys) { lObjCon = lObjCons.Add(); lObjCon.Alias = "ItemCode"; lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; lObjCon.CondVal = itemCode; if (lDicNonLockedItems.Count() > i) { lObjCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_OR; } i++; } } pCFL.SetConditions(lObjCons); } catch (Exception ex) { HandleException(ex, "AddConditionChoseFromList"); } } pCFL.SetConditions(lObjCons); }
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); }
/// <summary> /// preenche campos Tela / Código e Nome /// </summary> /// <param name="formUID">formUid do evento</param> /// <param name="pVal">pVal do evento</param> /// <param name="idCampoChoose">Id do campo onde esta o choosefromlist</param> /// <param name="idChoose">Id do ChooseFromList</param> /// <param name="idCampoChooseNome">Id do campo onde deve ser preenchido o nome / retorna o campo 13 padrao / primeiro campo de cadastro de usuarios</param> /// <param name="mensagemErro">Mensagem de erro a ser apresentada se der algum problema</param> /// <param name="idCampoNomeDataTable">Id para buscar o nome a ser preenchido / como padrão retornara o 13</param> public static void PreencheCampos(string formUID, ItemEvent pVal, string idCampoChoose, string idChoose, string idCampoChooseNome, string mensagemErro, int idCampoNomeDataTable = 13) { try { if (pVal.ItemUID == idCampoChoose) { Form oForm = B1AppDomain.Application.Forms.Item(formUID); IChooseFromListEvent oCFLEvento = (IChooseFromListEvent)pVal; string sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.ChooseFromList oCFL = oForm.ChooseFromLists.Item(sCFL_ID); DataTable oDataTable = oCFLEvento.SelectedObjects; EditText oEditText; try { if (oCFL.UniqueID == idChoose) { oEditText = oForm.Items.Item(idCampoChooseNome).Specific; oEditText.Value = oDataTable.GetValue(idCampoNomeDataTable, 0).ToString(); oEditText = oForm.Items.Item(idCampoChoose).Specific; oEditText.Value = oDataTable.GetValue(0, 0).ToString(); } } catch { } if (oForm.Mode != BoFormMode.fm_ADD_MODE) { oForm.Mode = BoFormMode.fm_UPDATE_MODE; } } } catch { } }
private void cflcardcode(SAPbouiCOM.ChooseFromList oCFL, string uID) { try { SAPbouiCOM.ChooseFromListCollection oCFLs; SAPbouiCOM.Conditions oCons; SAPbouiCOM.Condition oCon; oCFLs = oForm.ChooseFromLists; SAPbouiCOM.ChooseFromListCreationParams oCFLCreationParams; oCFLCreationParams = (SAPbouiCOM.ChooseFromListCreationParams)oApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams); oCFLCreationParams.MultiSelection = false; oCFLCreationParams.ObjectType = "2"; oCFLCreationParams.UniqueID = uID; ocflCard = oCFLs.Add(oCFLCreationParams); oCons = ocflCard.GetConditions(); oCon = oCons.Add(); oCon.Alias = "CardType"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "S"; ocflCard.SetConditions(oCons); } catch (Exception ex) { // MsgBox(Err.Description) } }
///<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); }
///<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); }
private void InitiallizeForm() { oForm.Freeze(true); // Program.objHrmsUI.ExecQuery("Update B1_SCHMDT set u_upd='Y' where isnull(u_upd,'N') = 'N'", "Finalizing temp"); Program.objHrmsUI.ExecQuery("delete from [@B1_SCHMDT] where isnull(u_upd,'N') = 'N'", "Finalizing temp"); Program.objHrmsUI.ExecQuery("delete from [@B1_SCHMDY] where isnull(u_upd,'N') = 'N'", "Finalizing temp"); Program.objHrmsUI.ExecQuery("delete from [@B1_SO] where isnull(u_upd,'N') = 'N'", "Finalizing temp"); Program.objHrmsUI.ExecQuery("delete from [@B1_SCHOT] where isnull(u_upd,'N') = 'N'", "Finalizing temp"); cardCFL = (SAPbouiCOM.ChooseFromList)oForm.ChooseFromLists.Item("cflCRD"); SAPbouiCOM.Conditions oCons = cardCFL.GetConditions(); SAPbouiCOM.Condition oCon = oCons.Add(); oCon.Alias = "CardType"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "C"; cardCFL.SetConditions(oCons); dtHead = oForm.DataSources.DataTables.Item("dtHead"); dtItem = oForm.DataSources.DataTables.Item("dtItem"); dtDate = oForm.DataSources.DataTables.Item("dtDate"); dtDays = oForm.DataSources.DataTables.Item("dtDays"); dtOSCN = oForm.DataSources.DataTables.Item("dtOSCN"); dtOT = oForm.DataSources.DataTables.Item("dtOT"); mtItem = (SAPbouiCOM.Matrix)oForm.Items.Item("mtItem").Specific; mtDate = (SAPbouiCOM.Matrix)oForm.Items.Item("mtDate").Specific; mtDay = (SAPbouiCOM.Matrix)oForm.Items.Item("mtDays").Specific; mtOSCN = (SAPbouiCOM.Matrix)oForm.Items.Item("mtOSCN").Specific; mtOT = (SAPbouiCOM.Matrix)oForm.Items.Item("mtOT").Specific; dtHead.Rows.Add(1); dtHead.SetValue("tsActive", 0, "Y"); txCode = (SAPbouiCOM.EditText)oForm.Items.Item("txCode").Specific; txName = (SAPbouiCOM.EditText)oForm.Items.Item("txName").Specific; txCT = (SAPbouiCOM.EditText)oForm.Items.Item("txCT").Specific; txOTDT = (SAPbouiCOM.EditText)oForm.Items.Item("txOTDT").Specific; txICode = (SAPbouiCOM.EditText)oForm.Items.Item("txICode").Specific; txOMDT = (SAPbouiCOM.EditText)oForm.Items.Item("txOMDT").Specific; txOICODE = (SAPbouiCOM.EditText)oForm.Items.Item("txOICODE").Specific; imgImage = (SAPbouiCOM.PictureBox)oForm.Items.Item("imgImage").Specific; txSL = (SAPbouiCOM.EditText)oForm.Items.Item("txSL").Specific; cbSP = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbSP").Specific; cbDays = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbDays").Specific; cbWeeks = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbWeeks").Specific; cbHH = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbHH").Specific; cbMM = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbMM").Specific; cbAP = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbAP").Specific; cbEWN = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbEWN").Specific; cbOTHH = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbOTHH").Specific; cbOTMM = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbOTMM").Specific; cbOTAP = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbOTAP").Specific; opOD = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opOD").Specific; opOW = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opOW").Specific; opOM = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opOM").Specific; OMDY = (SAPbouiCOM.OptionBtn)oForm.Items.Item("OMDY").Specific; OMDT = (SAPbouiCOM.OptionBtn)oForm.Items.Item("OMDT").Specific; opOW.GroupWith("opOD"); opOM.GroupWith("opOD"); OMDY.GroupWith("OMDT"); opOD.Selected = true; OMDT.Selected = true; tbSO = (SAPbouiCOM.Folder)oForm.Items.Item("tbSO").Specific; tbTS = (SAPbouiCOM.Folder)oForm.Items.Item("tbTS").Specific; tbTS.Select(); fillCBs(); oForm.Freeze(false); txCode.Active = true; }
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> /// CFL Customer Code /// </summary> private void CFL_FixDisc_CustCode(string formUID, ref ItemEvent pVal, ref bool bubbleEvent, ref IChooseFromListEvent oCFLEvent) { if (bubbleEvent) { Form oForm = null; Conditions oCons = null; ICondition oCon = null; SAPbouiCOM.ChooseFromList oCFL = null; DataTable oDataTable = null; BusinessPartners oBp = null; DBDataSource oDBSource_H = null; Matrix oMtx1 = null; Matrix oMtx2 = null; try { oForm = oSBOApplication.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount); oBp = oSBOCompany.GetBusinessObject(BoObjectTypes.oBusinessPartners); oMtx1 = oForm.Items.Item("mt_1").Specific; oMtx2 = oForm.Items.Item("mt_2").Specific; DBDataSource fixDisc_D1 = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_D1"); DBDataSource fixDisc_D2 = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_D2"); if (oCFLEvent.BeforeAction == true) { if (oForm.Mode == BoFormMode.fm_ADD_MODE || oForm.Mode == BoFormMode.fm_OK_MODE || oForm.Mode == BoFormMode.fm_UPDATE_MODE) { oForm.Freeze(true); oCFL = oForm.ChooseFromLists.Item("CFL_CUST"); oCFL.SetConditions(null); oCons = oCFL.GetConditions(); oCon = oCons.Add(); oCon.Alias = "CardType"; oCon.Operation = BoConditionOperation.co_EQUAL; oCon.Relationship = BoConditionRelationship.cr_AND; oCon.CondVal = "C"; oCon = oCons.Add(); oCon.Alias = "validFor"; oCon.Operation = BoConditionOperation.co_EQUAL; oCon.CondVal = "Y"; oCFL.SetConditions(oCons); } } else if (oCFLEvent.BeforeAction == false && oCFLEvent.ActionSuccess == true && oCFLEvent.SelectedObjects != null && oCFLEvent.FormMode != 0) { oForm.Freeze(true); oDataTable = oCFLEvent.SelectedObjects; if (oBp.GetByKey(oDataTable.GetValue("CardCode", 0))) { oDBSource_H = oForm.DataSources.DBDataSources.Item("@SOL_FIXDISC_H"); oDBSource_H.SetValue("U_SOL_CARDCODE", 0, oBp.CardCode); oDBSource_H.SetValue("U_SOL_CARDNAME", 0, oBp.CardName); // Generate Code string code = GenerateCode(oBp.CardCode); oDBSource_H.SetValue("Code", 0, code); if (oForm.Mode != BoFormMode.fm_ADD_MODE) { oForm.Mode = BoFormMode.fm_UPDATE_MODE; } if (oMtx1.RowCount <= 0 || oMtx2.RowCount <= 0) { fixDisc_D1.InsertRecord(fixDisc_D1.Size); fixDisc_D2.InsertRecord(fixDisc_D2.Size); fixDisc_D1.Offset = fixDisc_D1.Size - 1; fixDisc_D1.SetValue("LineId", fixDisc_D1.Size - 1, fixDisc_D1.Size.ToString()); fixDisc_D2.Offset = fixDisc_D2.Size - 1; fixDisc_D2.SetValue("LineId", fixDisc_D2.Size - 1, fixDisc_D2.Size.ToString()); oForm.Items.Item("mt_1").Specific.LoadFromDataSource(); oForm.Items.Item("mt_2").Specific.LoadFromDataSource(); } } } } catch (Exception ex) { bubbleEvent = false; oSBOApplication.MessageBox(ex.Message + " : " + ex.StackTrace); } finally { if (oForm != null) { oForm.Freeze(false); } Utils.releaseObject(oForm); Utils.releaseObject(oCons); Utils.releaseObject(oCon); Utils.releaseObject(oCFL); Utils.releaseObject(oDataTable); Utils.releaseObject(oBp); Utils.releaseObject(oDBSource_H); } } }
///<summary> Initializes the chooseFromlist. /// </summary> public SAPbouiCOM.ChooseFromList initChooseFromListBussinesPartner(string pStrTipoDoc, SAPbouiCOM.ChooseFromList pObjCFLSocio) { string lStrType = string.Empty; if (pStrTipoDoc == "CFL_Venta") { lStrType = "C"; } if (pStrTipoDoc == "CFL_Compra") { lStrType = "S"; } try { SAPbouiCOM.Conditions lObjCons = null; SAPbouiCOM.Condition lObjCon = null; // Adding Conditions to CFLPO lObjCons = pObjCFLSocio.GetConditions(); bool lBolNewCond = true; foreach (SAPbouiCOM.Condition lObjCond in lObjCons) { if (lObjCond.Alias == "CardType") { lObjCond.CondVal = lStrType; lBolNewCond = false; break; } } if (lBolNewCond) { lObjCon = lObjCons.Add(); lObjCon.Alias = "CardType"; lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; lObjCon.CondVal = lStrType; } pObjCFLSocio.SetConditions(lObjCons); } catch (Exception ex) { UIApplication.ShowMessageBox(string.Format("InitChooseFromListException: {0}", ex.Message)); } return(pObjCFLSocio); }