private void filtertocfl() { SAPbouiCOM.Conditions oCons; SAPbouiCOM.Condition oCon; oCons = cflDE.GetConditions(); oCon = oCons.Add(); oCon.Alias = "Postable"; oCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; oCon.CondVal = "Y"; cflDE.SetConditions(oCons); }
///<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); }
///<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); }
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) } }
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); } } }
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; }