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> 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); }
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); }
///<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 AddConditionChoseFromListEmployee(ChooseFromList pCFL, string pStrDept) { try { SAPbouiCOM.Condition lObjCon = null; SAPbouiCOM.Conditions lObjCons = new Conditions(); pCFL.SetConditions(lObjCons); //DimCode lObjCon = lObjCons.Add(); lObjCon.Alias = "dept"; lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; lObjCon.CondVal = pStrDept; pCFL.SetConditions(lObjCons); } catch (Exception ex) { LogService.WriteError("frmSearchRefunds (AddConditionChoseFromListEmployee) " + ex.Message); LogService.WriteError(ex); } }
///<summary> Loads matrix data from document. </summary> ///<remarks> Amartinez, 08/05/2017. </remarks> ///<param name="pstrAlias"> The pstr alias. </param> ///<param name="pstrCond"> The pstr condition. </param> public SAPbouiCOM.DBDataSource LoadMatrixConditions(string pstrAlias, string pstrCond, SAPbouiCOM.DBDataSource pDBDataSourceD) { SAPbouiCOM.Conditions lObjCons = null; SAPbouiCOM.Condition lObjCon = null; //PL001 1 lObjCons = new SAPbouiCOM.Conditions(); lObjCon = lObjCons.Add(); lObjCon.BracketOpenNum = 1; lObjCon.Alias = pstrAlias; lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; lObjCon.CondVal = pstrCond; lObjCon.BracketCloseNum = 1; ///Validacion para cargar solo las lineas abiertas lObjCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; lObjCon = lObjCons.Add(); lObjCon.BracketOpenNum = 1; lObjCon.Alias = "LineStatus"; lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; lObjCon.CondVal = "O"; lObjCon.BracketCloseNum = 1; pDBDataSourceD.Query(lObjCons); //Validacion para evitar lineas sin cantidades pendientes lObjCon.Relationship = SAPbouiCOM.BoConditionRelationship.cr_AND; lObjCon = lObjCons.Add(); lObjCon.BracketOpenNum = 1; lObjCon.Alias = "OpenQty"; lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_GRATER_THAN; lObjCon.CondVal = "0"; lObjCon.BracketCloseNum = 1; pDBDataSourceD.Query(lObjCons); return(pDBDataSourceD); }
private void AddConditionChoseFromListArea(ChooseFromList pCFL) { try { SAPbouiCOM.Condition lObjCon = null; SAPbouiCOM.Conditions lObjCons = null; lObjCons = pCFL.GetConditions(); //DimCode lObjCon = lObjCons.Add(); lObjCon.Alias = "DimCode"; lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; lObjCon.CondVal = "1"; lObjCon.Relationship = BoConditionRelationship.cr_AND; lObjCon = lObjCons.Add(); lObjCon.Alias = "Active"; lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; lObjCon.CondVal = "Y"; //lObjCon.Relationship = BoConditionRelationship.cr_AND; //lObjCon = lObjCons.Add(); //lObjCon.Alias = "GrpCode"; //lObjCon.Operation = SAPbouiCOM.BoConditionOperation.co_NOT_NULL; pCFL.SetConditions(lObjCons); } catch (Exception ex) { LogService.WriteError("frmSearchRefunds (AddConditionChoseFromListArea) " + ex.Message); LogService.WriteError(ex); } }
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; } } } }
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; }