public override void etAfterCfl(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent) { base.etAfterCfl(ref pVal, ref BubbleEvent); if (pVal.ItemUID == "txAcct") { int rowind = pVal.Row; SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal; SAPbouiCOM.DataTable dtSel = oCFLEvento.SelectedObjects; if (dtSel == null) { return; } if (dtSel.Rows.Count > 0) { for (int k = 0; k < dtSel.Rows.Count; k++) { string strCode = dtSel.GetValue("AcctCode", k).ToString(); string strName = dtSel.GetValue("FormatCode", k).ToString(); dtHead.SetValue("AcctCode", 0, strName); addGLRecord("GL"); ini_controls(); fillDetail(); } //bt.Item.Click(); } } }
private static void GestionarSeleccionCFL(SAPbouiCOM.Form oForm, SAPbouiCOM.ItemEvent pVal) { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; String CflID = string.Empty; SAPbouiCOM.ChooseFromList oCFL = null; SAPbouiCOM.DataTable oDataTable = null; try { oCFLEvento = ((SAPbouiCOM.IChooseFromListEvent)(pVal)); CflID = oCFLEvento.ChooseFromListUID; oCFL = oForm.ChooseFromLists.Item(CflID); oDataTable = oCFLEvento.SelectedObjects; if (oDataTable != null) { switch (CflID) { case "CflCC": oForm.DataSources.UserDataSources.Item("ds_Acc").Value = oDataTable.GetValue("AcctCode", 0).ToString(); break; case "CflDim1": oForm.DataSources.UserDataSources.Item("ds_Dim1").Value = oDataTable.GetValue("OcrCode", 0).ToString(); break; case "CflDim2": oForm.DataSources.UserDataSources.Item("ds_Dim2").Value = oDataTable.GetValue("OcrCode", 0).ToString(); break; case "CflDim3": oForm.DataSources.UserDataSources.Item("ds_Dim3").Value = oDataTable.GetValue("OcrCode", 0).ToString(); break; case "CflDim4": oForm.DataSources.UserDataSources.Item("ds_Dim4").Value = oDataTable.GetValue("OcrCode", 0).ToString(); break; case "CflDim5": oForm.DataSources.UserDataSources.Item("ds_Dim5").Value = oDataTable.GetValue("OcrCode", 0).ToString(); break; default: break; } } } catch (Exception ex) { Conexion_SBO.m_SBO_Appl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); } finally { FuncionesComunes.LiberarObjetoGenerico(oCFLEvento); FuncionesComunes.LiberarObjetoGenerico(oCFL); FuncionesComunes.LiberarObjetoGenerico(oDataTable); } }
/// <summary> /// Converte um objeto SAPBouiCOM.ItemEvent em Desktop /// </summary> /// <param name="pCompany">Um objeto SAPBouiCOM.ItemEvent</param> /// <returns>um objeto ItemEvent</returns> public static ItemEvent ToItemEvent(this SAPbouiCOM.ItemEvent pItemEvent) { ItemEvent myEvent = new ItemEvent(); myEvent.ActionSuccess = pItemEvent.ActionSuccess; myEvent.BeforeAction = pItemEvent.BeforeAction; myEvent.CharPressed = pItemEvent.CharPressed; myEvent.ColUID = pItemEvent.ColUID; myEvent.EventType = pItemEvent.EventType.ToEventType(); myEvent.FormMode = pItemEvent.FormMode; myEvent.FormType = pItemEvent.FormType; myEvent.FormTypeCount = pItemEvent.FormTypeCount; myEvent.FormTypeEx = pItemEvent.FormTypeEx; myEvent.FormUID = pItemEvent.FormUID; myEvent.InnerEvent = pItemEvent.InnerEvent; myEvent.ItemChanged = pItemEvent.ItemChanged; myEvent.ItemUID = pItemEvent.ItemUID; myEvent.Modifiers = pItemEvent.Modifiers.ToModifiersEnum(); myEvent.PopUpIndicator = pItemEvent.PopUpIndicator; myEvent.row = pItemEvent.Row; if (pItemEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { SAPbouiCOM.IChooseFromListEvent chooseFromListEvent = (SAPbouiCOM.IChooseFromListEvent)pItemEvent; myEvent.SelectedObjects = chooseFromListEvent.SelectedObjects; } return(myEvent); }
private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; oCFLEvento = ((SAPbouiCOM.IChooseFromListEvent)(pVal)); string sCFL_ID = null; sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.Form oForm = null; oForm = SBO_Application.Forms.Item(FormUID); SAPbouiCOM.ChooseFromList oCFL = null; oCFL = oForm.ChooseFromLists.Item(sCFL_ID); if (oCFLEvento.BeforeAction == false) { SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCFLEvento.SelectedObjects; string val = null; try { val = System.Convert.ToString(oDataTable.GetValue(0, 0)); } catch (Exception ex) { } if ((pVal.ItemUID == "EditTxt") | (pVal.ItemUID == "Button")) { oForm.DataSources.UserDataSources.Item("EditDS").ValueEx = val; } } } if ((FormUID == "CFL1") & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD)) { System.Windows.Forms.Application.Exit(); } }
public override void etAfterCfl(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent) { base.etAfterCfl(ref pVal, ref BubbleEvent); SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal; SAPbouiCOM.DataTable dtSel = oCFLEvento.SelectedObjects; if (pVal.ItemUID == txCode.Item.UniqueID) { if (dtSel != null && dtSel.Rows.Count > 0) { string strCode = dtSel.GetValue("ItemCode", 0).ToString(); string strName = dtSel.GetValue("ItemName", 0).ToString(); string Remarks = dtSel.GetValue("U_B1_BOQREM", 0).ToString(); string Qty = dtSel.GetValue("U_B1_BOQQty", 0).ToString(); double APC = getAPCCost(strCode); BOQH.SetValue("ItemCode", 0, strCode); BOQH.SetValue("ItemName", 0, strName); BOQH.SetValue("Remarks", 0, Remarks); BOQH.SetValue("Qty", 0, Qty); BOQH.SetValue("APC", 0, APC); fillDetails(strCode); getIndirectCost(strCode); addEmptyRow(mtDC, BOQD, "CostCode"); } } if (pVal.ItemUID == mtDC.Item.UniqueID && pVal.ColUID == "cCode") { if (dtSel != null && dtSel.Rows.Count > 0) { SAPbouiCOM.ComboBox cbColType = (SAPbouiCOM.ComboBox)mtDC.Columns.Item("cType").Cells.Item(pVal.Row).Specific; if (cbColType.Selected.Value == "I") { string strCode = dtSel.GetValue("ItemCode", 0).ToString(); string strName = dtSel.GetValue("ItemName", 0).ToString(); BOQD.SetValue("Code", pVal.Row - 1, strCode); BOQD.SetValue("Name", pVal.Row - 1, strName); } if (cbColType.Selected.Value == "S") { string strCode = dtSel.GetValue("AcctCode", 0).ToString(); string strName = dtSel.GetValue("AcctName", 0).ToString(); BOQD.SetValue("Code", pVal.Row - 1, strCode); BOQD.SetValue("Name", pVal.Row - 1, strName); } mtDC.LoadFromDataSource(); } } }
public override void etAfterCfl(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent) { base.etAfterCfl(ref pVal, ref BubbleEvent); SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal; SAPbouiCOM.DataTable dtSel = oCFLEvento.SelectedObjects; if (pVal.ItemUID == txSupplier.Item.UniqueID) { if (dtSel != null && dtSel.Rows.Count > 0) { string strCode = dtSel.GetValue("CardCode", 0).ToString(); string strName = dtSel.GetValue("CardName", 0).ToString(); dtHead.SetValue("CardCode", 0, strCode); dtHead.SetValue("CardName", 0, strName); } } }
public static string GetCFL_value(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent, string ItemUID, string CFLID) { string ret = ""; BubbleEvent = true; if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; oCFLEvento = ((SAPbouiCOM.IChooseFromListEvent)(pVal)); string sCFL_ID = null; sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.Form oForm = null; oForm = SBO_Application.Forms.Item(FormUID); SAPbouiCOM.ChooseFromList oCFL = null; oCFL = oForm.ChooseFromLists.Item(sCFL_ID); if (oCFLEvento.BeforeAction == false) { SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCFLEvento.SelectedObjects; string val = null; try { val = System.Convert.ToString(oDataTable.GetValue(0, 0)); } catch (Exception ex) { } try { if (pVal.ItemUID == ItemUID) { ret = val; } } catch (Exception ex) { SubMain.MessageBox(ex.Message); } } } if ((FormUID == CFLID) & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD)) { System.Windows.Forms.Application.Exit(); } return(ret); }
private void AfterCFL(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; __Form = __app.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount); try { if (pVal.ItemUID == "Item_0") { SAPbouiCOM.EditText BPCode = (SAPbouiCOM.EditText)__Form.Items.Item("Item_0").Specific; SAPbouiCOM.IChooseFromListEvent chl = (SAPbouiCOM.IChooseFromListEvent)pVal; SAPbouiCOM.ChooseFromList oCFL = null; string cflID = chl.ChooseFromListUID; oCFL = __Form.ChooseFromLists.Item(cflID); SAPbouiCOM.DataTable dTable = chl.SelectedObjects; if (dTable != null) { try { BPCode.String = dTable.GetValue("CardCode", 0); __Form.Items.Item("Item_1").Click(SAPbouiCOM.BoCellClickType.ct_Regular); } catch (Exception ex) { __Form.Items.Item("Item_1").Click(SAPbouiCOM.BoCellClickType.ct_Regular); } } } } catch (SqlException e) { __app.MessageBox(e.Message, 1, "Ok", "", ""); BubbleEvent = false; } catch (COMException e) { __app.MessageBox(e.Message, 1, "Ok", "", ""); BubbleEvent = false; } catch (Exception e) { __app.MessageBox(e.Message, 1, "Ok", "", ""); BubbleEvent = false; } }
public void GetCFL_M1_EDIT(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent, string UDSID, string CFLID) { BubbleEvent = true; if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; oCFLEvento = ((SAPbouiCOM.IChooseFromListEvent)(pVal)); string sCFL_ID = null; sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.Form oForm = null; oForm = SubMain.SBO_Application.Forms.Item(FormUID); SAPbouiCOM.ChooseFromList oCFL = null; oCFL = oForm.ChooseFromLists.Item(sCFL_ID); if (oCFLEvento.BeforeAction == false) { SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCFLEvento.SelectedObjects; string val = null; try { val = System.Convert.ToString(oDataTable.GetValue(0, 0)); } catch (Exception ex) { } try { if (pVal.ItemUID == UDSID) { if (CFLID == "4") { ((SAPbouiCOM.EditText)m1.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific).String = val; } } } catch (Exception ex) { //SubMain.MessageBox(ex.Message); } } } if ((FormUID == CFLID) & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD)) { System.Windows.Forms.Application.Exit(); } }
public override void etAfterCfl(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent) { base.etAfterCfl(ref pVal, ref BubbleEvent); if (pVal.ItemUID == txActCod.Item.UniqueID) { int rowind = pVal.Row; SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal; SAPbouiCOM.DataTable dtSel = oCFLEvento.SelectedObjects; if (dtSel == null) { return; } if (dtSel.Rows.Count > 0) { string strCode = dtSel.GetValue("AcctCode", 0).ToString(); string strName = dtSel.GetValue("AcctName", 0).ToString(); string strFC = dtSel.GetValue("FormatCode", 0).ToString(); dtHeads.SetValue("AccCode", 0, strCode); dtHeads.SetValue("AccFC", 0, strFC); dtHeads.SetValue("AcctName", 0, strName); //bt.Item.Click(); } } if (pVal.ItemUID == "txFAC") { int rowind = pVal.Row; SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal; SAPbouiCOM.DataTable dtSel = oCFLEvento.SelectedObjects; if (dtSel == null) { return; } if (dtSel.Rows.Count > 0) { string strCode = dtSel.GetValue("ItemCode", 0).ToString(); string strName = dtSel.GetValue("ItemName", 0).ToString(); dtHeads.SetValue("FAC", 0, strCode); dtHeads.SetValue("FAN", 0, strName); //bt.Item.Click(); } } }
public override void etAfterCfl(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent) { base.etAfterCfl(ref pVal, ref BubbleEvent); SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal; SAPbouiCOM.DataTable dtSel = oCFLEvento.SelectedObjects; if (pVal.ItemUID == txDfltExp.Item.UniqueID) { if (dtSel != null && dtSel.Rows.Count > 0) { string strCode = dtSel.GetValue("AcctCode", 0).ToString(); string strName = dtSel.GetValue("AcctName", 0).ToString(); dtSetting.SetValue("dfltExp", 0, strCode); oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; } } }
private void ChooseFromListAfterEvent(SAPbouiCOM.ItemEvent pObjValEvent) { if (pObjValEvent.Action_Success) { SAPbouiCOM.IChooseFromListEvent lObjCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pObjValEvent; if (lObjCFLEvento.SelectedObjects == null) { return; } SAPbouiCOM.DataTable lObjDataTable = lObjCFLEvento.SelectedObjects; if (lObjDataTable.UniqueID == "CFLSup") { mStrClientCode = Convert.ToString(lObjDataTable.GetValue(0, 0)); this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = lObjDataTable.GetValue(1, 0).ToString(); } } }
private void ChooseFromListAfterEvent(SAPbouiCOM.ItemEvent pObjValEvent) { if (pObjValEvent.Action_Success) { SAPbouiCOM.IChooseFromListEvent lObjCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pObjValEvent; SAPbouiCOM.DataTable lObjDataTable = lObjCFLEvento.SelectedObjects; if (lObjCFLEvento.SelectedObjects == null) { return; } //this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = Convert.ToString(lObjDataTable.GetValue(0, 0)); if (lObjDataTable.UniqueID == "CFL_Acct") { string lStrAccount = Convert.ToString(lObjDataTable.GetValue(0, 0)); //this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = Convert.ToString(lObjDataTable.GetValue(0, 0)); } } }
private void ChosFrmList_Before(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; __Form = __app.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount); try { if (pVal.ItemUID == "Item_0") { SAPbouiCOM.IChooseFromListEvent chl = (SAPbouiCOM.IChooseFromListEvent)pVal; SAPbouiCOM.ChooseFromList oCFL = null; string cflID = chl.ChooseFromListUID; oCFL = __Form.ChooseFromLists.Item(cflID); oCFL.SetConditions(null); SAPbouiCOM.Conditions oCons = oCFL.GetConditions(); SAPbouiCOM.Condition c = null; c = oCons.Add(); c.BracketOpenNum = 1; c.Alias = "CardType"; c.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL; c.CondVal = "C"; c.BracketCloseNum = 1; oCFL.SetConditions(oCons); } } catch (SqlException e) { __app.SetStatusBarMessage(e + "...", SAPbouiCOM.BoMessageTime.bmt_Medium, true); BubbleEvent = false; } catch (COMException e) { __app.SetStatusBarMessage(e + "...", SAPbouiCOM.BoMessageTime.bmt_Medium, true); BubbleEvent = false; } catch (Exception e) { __app.SetStatusBarMessage(e + "...", SAPbouiCOM.BoMessageTime.bmt_Medium, true); BubbleEvent = false; } }
public override void etBeforeCfl(ref SAPbouiCOM.ItemEvent pVal, ref bool BubbleEvent) { base.etBeforeCfl(ref pVal, ref BubbleEvent); SAPbouiCOM.IChooseFromListEvent oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal; mtDC.FlushToDataSource(); if (pVal.ItemUID == mtDC.Item.UniqueID && pVal.ColUID == "cCode") { SAPbouiCOM.ComboBox cbColType = (SAPbouiCOM.ComboBox)mtDC.Columns.Item("cType").Cells.Item(pVal.Row).Specific; SAPbouiCOM.Column CodCol = mtDC.Columns.Item("cCode"); if (cbColType.Selected.Value == "I") { CodCol.ChooseFromListUID = "cflrOITM"; CodCol.ChooseFromListAlias = "ItemCode"; } if (cbColType.Selected.Value == "S") { CodCol.ChooseFromListUID = "cflrGL"; CodCol.ChooseFromListAlias = "AcctCode"; } } }
private void OApplication_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST /*& pVal.FormType.Equals("CFL1")*/) { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; oCFLEvento = ((SAPbouiCOM.IChooseFromListEvent)(pVal)); string sCFL_ID = null; sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.ChooseFromList oCFl = null; oCFl = oForm.ChooseFromLists.Item(sCFL_ID); if (oCFLEvento.BeforeAction == false) { SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCFLEvento.SelectedObjects; string val = null; string valN = null; try { val = System.Convert.ToString(oDataTable.GetValue(0, 0)); valN = System.Convert.ToString(oDataTable.GetValue(1, 0)); } catch { } if (pVal.ItemUID.Equals("EditCLF")) { oForm.DataSources.UserDataSources.Item("CLFDS").ValueEx = val; } } } if ((FormUID == "PickerForm") & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD)) { System.Windows.Forms.Application.Exit(); } }
private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST && pVal.FormTypeEx == "U_ApproveJV.BILL_VP") { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; oCFLEvento = ((SAPbouiCOM.IChooseFromListEvent)(pVal)); string sCFL_ID = null; sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.Form oForm = null; oForm = Application.SBO_Application.Forms.Item(FormUID); SAPbouiCOM.ChooseFromList oCFL = null; oCFL = oForm.ChooseFromLists.Item(sCFL_ID); if (oCFLEvento.BeforeAction == false) { SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCFLEvento.SelectedObjects; BpCode = ""; try { BpCode = System.Convert.ToString(oDataTable.GetValue("CardCode", 0)); } catch (Exception ex) { } if (pVal.ItemUID == "txt_bpcode") { oForm.DataSources.UserDataSources.Item("UD_0").ValueEx = BpCode; } } } if ((FormUID == "CFL1") & (pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD)) { System.Windows.Forms.Application.Exit(); } }
private void chooseFromListAfterEvent(string FormUID, ref SAPbouiCOM.ItemEvent pValEvent, out bool BubbleEvent) { BubbleEvent = true; if (pValEvent.FormType == 0 && pValEvent.Action_Success == true && pValEvent.Before_Action == false && pValEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pValEvent; string sCFL_ID = null; sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.ChooseFromList oCFL = null; oCFL = this.UIAPIRawForm.ChooseFromLists.Item(sCFL_ID); SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCFLEvento.SelectedObjects; string val = null; try { val = System.Convert.ToString(oDataTable.GetValue(0, 0)); lObjTxtClient.Value = val; } catch (Exception ex) { if (!ex.Message.Contains("Form - Bad Value") && !ex.Message.Contains("Can't set value on item because the item can't get focus.")) { Application.SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } finally { } } }
private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; /*try * {*/ if (!FormUID.Equals(this.UIAPIRawForm.UniqueID)) { return; } if (!pVal.BeforeAction) { switch (pVal.EventType) { case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST: if (pVal.Action_Success) { SAPbouiCOM.IChooseFromListEvent lObjCFLEvent = (SAPbouiCOM.IChooseFromListEvent)pVal; if (lObjCFLEvent.SelectedObjects != null) { SAPbouiCOM.DataTable lObjDataTable = lObjCFLEvent.SelectedObjects; // Client Selector if (lObjDataTable.UniqueID == mEdtCardCode.ChooseFromListUID) { this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = System.Convert.ToString(lObjDataTable.GetValue(0, 0)); } // Payment Method if (lObjDataTable.UniqueID == mEdtPaymentMethod.ChooseFromListUID) { this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = System.Convert.ToString(lObjDataTable.GetValue(0, 0)); } // Payment Group if (lObjDataTable.UniqueID == mEdtPaymentGroup.ChooseFromListUID) { this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = System.Convert.ToString(lObjDataTable.GetValue(0, 0)); } // Item Code if (lObjDataTable.UniqueID == mEdtItemCode.ChooseFromListUID) { this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = System.Convert.ToString(lObjDataTable.GetValue(0, 0)); } // Item Tax if (lObjDataTable.UniqueID == mEdtItemTax.ChooseFromListUID) { this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = System.Convert.ToString(lObjDataTable.GetValue(0, 0)); } // Item Warehouse if (lObjDataTable.UniqueID == mEdtItemWarehouse.ChooseFromListUID) { this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = System.Convert.ToString(lObjDataTable.GetValue(0, 0)); } // Item Costing Code if (lObjDataTable.UniqueID == mEdtItemCosting.ChooseFromListUID) { this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = System.Convert.ToString(lObjDataTable.GetValue(0, 0)); } // EDocFormat if (lObjDataTable.UniqueID == mEdtEdocFormat.ChooseFromListUID) { this.UIAPIRawForm.DataSources.UserDataSources.Item(lObjDataTable.UniqueID).ValueEx = System.Convert.ToString(lObjDataTable.GetValue(0, 0)); } } } break; case SAPbouiCOM.BoEventTypes.et_FORM_CLOSE: UnloadEvents(); break; } } else { switch (pVal.EventType) { } } }
private void chooseFromListAfterEvent(string FormUID, ref SAPbouiCOM.ItemEvent pValEvent, out bool BubbleEvent) { BubbleEvent = true; if (pValEvent.EventType != SAPbouiCOM.BoEventTypes.et_FORM_CLOSE) { if (pValEvent.ItemUID == "Item_90" && pValEvent.FormType == 0 && pValEvent.Action_Success == true && pValEvent.Before_Action == false && pValEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { try { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pValEvent; string sCFL_ID = null; sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.ChooseFromList oCFL = null; oCFL = oForm.ChooseFromLists.Item(sCFL_ID); SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCFLEvento.SelectedObjects; string lStrVal = null; lStrVal = Convert.ToString(oDataTable.GetValue(0, 0)); txtCuentaCNom.Value = lStrVal; } catch (Exception ex) { if (!ex.Message.Contains("Form - Bad Value") && !ex.Message.Contains("Can't set value on item because the item can't get focus.")) { Application.SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } if (ex.Message.Contains("Can't set value on item because the item can't get focus.")) { //LoadMatrixPeticiones(val); } } } if (pValEvent.ItemUID == "Item_94" && pValEvent.FormType == 0 && pValEvent.Action_Success == true && pValEvent.Before_Action == false && pValEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { try { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pValEvent; string sCFL_ID = null; sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.ChooseFromList oCFL = null; oCFL = oForm.ChooseFromLists.Item(sCFL_ID); SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCFLEvento.SelectedObjects; string lStrVal = null; lStrVal = System.Convert.ToString(oDataTable.GetValue(0, 0)); txtCuentaCAsal.Value = lStrVal; } catch (Exception ex) { if (!ex.Message.Contains("Form - Bad Value") && !ex.Message.Contains("Can't set value on item because the item can't get focus.")) { Application.SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } if (ex.Message.Contains("Can't set value on item because the item can't get focus.")) { //LoadMatrixPeticiones(); } } } } }
/// <summary> /// /// </summary> /// <param name="FormUID"></param> /// <param name="pVal"></param> /// <param name="BubbleEvent"></param> /// public void app_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) { BubbleEvent = true; // se evalua que el boton presionado es el correspondiente al copy to // y se se asignan los valores a la clase copiadora la cual se encarga del transporte los itenes if (pVal.FormUID == "FSDC" && pVal.FormMode == 1 && pVal.BeforeAction == true && pVal.ItemUID == "btnCpTo" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) { try { if (!copyTo) { docNum = forma.DataSources.DBDataSources.Item("@ZTV").GetValue("DocNum", 0); copiar = true; copyTo = true; app.ActivateMenuItem("2305"); } } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_copiar a -> " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // se captura el evento que se produce al clickear o presionar el campo // descuento del documento if ((pVal.FormUID == "FSDC" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_KEY_DOWN && pVal.BeforeAction == false && (pVal.ItemUID == "txtDscPrc" || pVal.ItemUID == "txtDsc")) || (pVal.FormUID == "FSDC" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_CLICK && pVal.BeforeAction == false && (pVal.ItemUID == "txtDscPrc" || pVal.ItemUID == "txtDsc"))) { double discPcnt, discDoc, total; SAPbouiCOM.EditText oEdit; try { switch (pVal.ItemUID) { case "txtDscPrc": oEdit = (SAPbouiCOM.EditText)forma.Items.Item(pVal.ItemUID).Specific; discDoc = Convert.ToDouble(forma.DataSources.DBDataSources.Item("@ZTV").GetValue("U_TlBfDsc", 0)) * (Convert.ToDouble(oEdit.Value) / 100); forma.DataSources.DBDataSources.Item("@ZTV").SetValue("U_DiscPrc", 0, oEdit.Value); forma.DataSources.DBDataSources.Item("@ZTV").SetValue("U_Disc", 0, discDoc.ToString()); break; case "txtDsc": oEdit = (SAPbouiCOM.EditText)forma.Items.Item(pVal.ItemUID).Specific; total = Convert.ToDouble(forma.DataSources.DBDataSources.Item("@ZTV").GetValue("U_TlBfDsc", 0).ToString()); discPcnt = ((Convert.ToDouble(oEdit.Value) / total) * 100); forma.DataSources.DBDataSources.Item("@ZTV").SetValue("U_Disc", 0, oEdit.Value); forma.DataSources.DBDataSources.Item("@ZTV").SetValue("U_DiscPrc", 0, discPcnt.ToString()); break; default: break; } calcTaxDoc(); } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_descuento -> " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // se utiliza esta comprobacion para activar un elemento de la // matrix despues de utilizar el metodo loadfromdatasource() if (smf && pVal.FormUID == "FSDC") { SAPbouiCOM.EditText oEdit; SAPbouiCOM.Matrix oMatrix; try { smf = false; oMatrix = (SAPbouiCOM.Matrix)forma.Items.Item("matrix1").Specific; oEdit = (SAPbouiCOM.EditText)oMatrix.Columns.Item(colUID).Cells.Item(rowNum).Specific; oEdit.Active = true; calcTotalBfDsc(); calcTaxDoc(); } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_semaforo -> " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // se registraran los cambios en los campo de calculo como la cantidad y el descuento entre otros if (((pVal.FormUID == "FSDC" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_KEY_DOWN && pVal.BeforeAction == false && pVal.ItemUID == "matrix1") || (pVal.FormUID == "FSDC" && pVal.EventType == SAPbouiCOM.BoEventTypes.et_CLICK && pVal.BeforeAction == false && pVal.ItemUID == "matrix1"))) { SAPbouiCOM.Matrix oMatrix; SAPbouiCOM.EditText oEdit; double qnty; double price; try { oMatrix = (SAPbouiCOM.Matrix)forma.Items.Item("matrix1").Specific; oEdit = (SAPbouiCOM.EditText)oMatrix.Columns.Item("colItemCod").Cells.Item(pVal.Row).Specific; // se verifica que el campo codigo cliente no este vacio para proceder a // realizar los calculos if (oEdit.Value.Trim() != "") { switch (pVal.ColUID) { case "colItemCod": if (pVal.CharPressed == 9) { colUID = "colDscrip"; smf = true; } break; case "colCant": oMatrix.FlushToDataSource(); oEdit = (SAPbouiCOM.EditText)oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific; forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_Quantity", pVal.Row - 1, oEdit.Value); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_OpenQty", pVal.Row - 1, oEdit.Value); qnty = Convert.ToDouble(forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_Quantity", pVal.Row - 1)); price = Convert.ToDouble(forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_PrcBfDi", pVal.Row - 1)); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_Total", pVal.Row - 1, (qnty * price).ToString()); if ("0.0" != forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_DiscItem", pVal.Row - 1)) { goto Descuento; } if (pVal.CharPressed == 9) { colUID = "colPrecioU"; smf = true; oMatrix.LoadFromDataSource(); } break; case "colPrecioU": oMatrix.FlushToDataSource(); oEdit = (SAPbouiCOM.EditText)oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific; forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_PrcBfDi", pVal.Row - 1, oEdit.Value); price = Convert.ToDouble(forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_PrcBfDi", pVal.Row - 1)); qnty = Convert.ToDouble(forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_Quantity", pVal.Row - 1)); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_Total", pVal.Row - 1, (qnty * price).ToString()); if ("0.0" != forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_DiscItem", pVal.Row - 1)) { goto Descuento; } if (pVal.CharPressed == 9) { colUID = "colDiscPrc"; smf = true; oMatrix.LoadFromDataSource(); } break; case "colDiscPrc": double temp; double discLine; oMatrix.FlushToDataSource(); Descuento: oEdit = (SAPbouiCOM.EditText)oMatrix.Columns.Item("colDiscPrc").Cells.Item(pVal.Row).Specific; discLine = Convert.ToDouble(oEdit.Value); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_DiscItem", pVal.Row - 1, oEdit.Value); price = Convert.ToDouble(forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_PrcBfDi", pVal.Row - 1)); qnty = Convert.ToDouble(forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_Quantity", pVal.Row - 1)); temp = (price * qnty); discLine = temp * (discLine / 100); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_Total", pVal.Row - 1, (temp - discLine).ToString()); if (pVal.CharPressed == 9) { if (colUID == "colCant") { colUID = "colPrecioU"; } else { colUID = "colTaxCod"; } smf = true; oMatrix.LoadFromDataSource(); } break; default: break; } } } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_calc_prc_qnt_dsc " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // se utiliza para manejar todos los eventos que procuren actualizar la forma if (pVal.FormUID == "FSDC" && pVal.FormMode == 1 && pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) { try { if ((pVal.ItemUID == "txtCodProv" || pVal.ItemUID == "matrix1" || pVal.ItemUID == "txtNmbProv" || pVal.ItemUID == "btnCntPr")) { forma.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE; } } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_mode_edit " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // se utiliza esta comprobacion por si dos o mas personas estan utilizando el modulo y deciden procesar una // solicitud con el mismo numero de documento if (pVal.FormUID == "FSDC" && pVal.FormMode == 3 && pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED && pVal.ItemUID == "1" && pVal.BeforeAction == true) { SAPbouiCOM.ComboBox oCombo; SAPbouiCOM.Matrix oMatrix; try { oMatrix = (SAPbouiCOM.Matrix)forma.Items.Item("matrix1").Specific; if (oMatrix.RowCount <= 1 && (forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_ItemCode", oMatrix.RowCount).ToString().Trim()) == "") { app.StatusBar.SetText("No se puede procesar la orden - Debe tener al menos un articulo", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); BubbleEvent = false; } else { if ("" == forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_ItemCode", oMatrix.RowCount - 1).ToString().Trim()) { oMatrix.FlushToDataSource(); forma.DataSources.DBDataSources.Item("@ZTV_LINES").RemoveRecord(forma.DataSources.DBDataSources.Item("@ZTV_LINES").Size - 1); oMatrix.LoadFromDataSource(); } } oCombo = ((SAPbouiCOM.ComboBox)forma.Items.Item("cmbSeries").Specific); oMatrix.FlushToDataSource(); forma.DataSources.DBDataSources.Item("@ZTV").SetValue("DocNum", 0, forma.BusinessObject.GetNextSerialNumber(oCombo.Selected.Value, "OZTV").ToString()); oMatrix.LoadFromDataSource(); } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_mode_add " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // luego de que se procesa una orden se agrega una linea nueva en la matrix para se puedan seguir aniadiendo registros if (pVal.FormUID == "FSDC" && pVal.FormMode == 3 && pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED && pVal.ItemUID == "1" && pVal.BeforeAction == false) { SAPbouiCOM.Matrix oMatrix; SAPbouiCOM.Item oButton; try { oMatrix = (SAPbouiCOM.Matrix)forma.Items.Item("matrix1").Specific; if (oMatrix.RowCount < 1) { oMatrix.AddRow(1, 0); } oButton = forma.Items.Item("btnCpTo"); llenarComboBox(); setFecha(); setColCount(); forma.ActiveItem = "txtCodProv"; oButton.Enabled = false; } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_post_add " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // si la solicitud esta en modo busqueda entonces se habilita el campo que contiene el DocNum // y el campo series if (pVal.FormUID == "FSDC" && pVal.FormMode == 0) { SAPbouiCOM.Item oButton; try { oButton = forma.Items.Item("btnCpTo"); oButton.Enabled = false; if (!forma.Items.Item("txtSeries").Enabled&& !forma.Items.Item("txtStatus").Enabled) { forma.Items.Item("txtSeries").Enabled = true; forma.Items.Item("txtStatus").Enabled = true; } } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_mode_find " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // si la solicitud esta en modo de ok que no puedan alterar el tipo de serie con el // cual se proceso el documento ni tampoco su numeracion if ((pVal.FormUID == "FSDC" && pVal.FormMode == 1) && pVal.BeforeAction == false && pVal.ActionSuccess == true) { SAPbouiCOM.Item oButton; SAPbouiCOM.Matrix oMatrix; try { oButton = forma.Items.Item("btnCpTo"); oMatrix = (SAPbouiCOM.Matrix)forma.Items.Item("matrix1").Specific; if (forma.Items.Item("cmbSeries").Enabled || forma.Items.Item("cmbDcType").Enabled) { forma.Items.Item("cmbSeries").Enabled = false; forma.Items.Item("cmbDcType").Enabled = false; } if (pVal.FormMode == 1) { if ("O" == forma.DataSources.DBDataSources.Item("@ZTV").GetValue("Status", 0).ToString()) { oButton.Enabled = true; } else { oButton.Enabled = false; } if ("" != forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_ItemCode", oMatrix.RowCount - 1).ToString().Trim()) { oMatrix.FlushToDataSource(); forma.DataSources.DBDataSources.Item("@ZTV_LINES").InsertRecord(forma.DataSources.DBDataSources.Item("@ZTV_LINES").Size); oMatrix.LoadFromDataSource(); } } } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_mode_ok " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // si la solicitud esta en modo de UPDATE que no puedan alterar el tipo de serie con el // cual se proceso el documento ni tampoco su numeracion if ((pVal.FormUID == "FSDC" && pVal.FormMode == 2) && pVal.BeforeAction == true) { SAPbouiCOM.Item oButton; SAPbouiCOM.Matrix oMatrix; try { oMatrix = (SAPbouiCOM.Matrix)forma.Items.Item("matrix1").Specific; oButton = forma.Items.Item("btnCpTo"); oButton.Enabled = false; if (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED && pVal.ItemUID == "1") { if ("" == forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_ItemCode", oMatrix.RowCount - 1).ToString().Trim()) { oMatrix.FlushToDataSource(); forma.DataSources.DBDataSources.Item("@ZTV_LINES").RemoveRecord(forma.DataSources.DBDataSources.Item("@ZTV_LINES").Size - 1); oMatrix.LoadFromDataSource(); } } } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_mode_update " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // se utiliza para ajustar el rectangulo cuando la forma cambie de tamanio if (pVal.FormUID == "FSDC" && pVal.BeforeAction == false && pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_RESIZE && pVal.ActionSuccess == true) { SAPbouiCOM.Item oItem; SAPbouiCOM.Item rectangle; SAPbouiCOM.Matrix oMatrix; try { oItem = forma.Items.Item("matrix1"); oMatrix = (SAPbouiCOM.Matrix)oItem.Specific; rectangle = forma.Items.Item("rtgl"); rectangle.Width = (oItem.Width + 19); rectangle.Height = (oItem.Height + 52); oMatrix.AutoResizeColumns(); } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_resize " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } // se utiliza para capturar dos tipos de eventos: // el choose from list y el combo select switch (pVal.EventType) { case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST: SAPbouiCOM.IChooseFromListEvent oCflEvento = null; oCflEvento = ((SAPbouiCOM.IChooseFromListEvent)(pVal)); string sCflId = null; sCflId = oCflEvento.ChooseFromListUID; if (oCflEvento.Before_Action == false) { SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCflEvento.SelectedObjects; if (pVal.ItemUID == "txtCodProv" || pVal.ItemUID == "txtNmbProv" && pVal.BeforeAction == false) { try { forma.DataSources.DBDataSources.Item("@ZTV").SetValue("U_CardCode", 0, System.Convert.ToString(oDataTable.GetValue("CardCode", 0))); forma.DataSources.DBDataSources.Item("@ZTV").SetValue("U_CardName", 0, System.Convert.ToString(oDataTable.GetValue("CardName", 0))); forma.DataSources.DBDataSources.Item("@ZTV").SetValue("U_CntCod", 0, System.Convert.ToString(oDataTable.GetValue("CntctPrsn", 0))); } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_cfl_BPCode " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } if (pVal.ItemUID == "btnCntPr" && pVal.Action_Success) { try { forma.DataSources.DBDataSources.Item("@ZTV").SetValue("U_CntCod", 0, Convert.ToString(oDataTable.GetValue(2, 0))); } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_BPCntName " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } if (sCflId == "CFL_7" || sCflId.ToString() == "CFL_5") { SAPbouiCOM.Matrix oMatrix; try { int i = pVal.Row; oMatrix = (SAPbouiCOM.Matrix)forma.Items.Item("matrix1").Specific; // la manera en como se agregara los itenes a la matrix siempre sera // en modo edicion de un registro ya que se clickea una columna existente // en este caso una columna sin ningun valor forma.DataSources.DBDataSources.Item("@ZTV_LINES").Clear(); oMatrix.FlushToDataSource(); if (sCflId == "CFL_5") { forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_ItemCode", (i - 1), oDataTable.GetValue("ItemCode", 0).ToString()); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_Dscript", (i - 1), oDataTable.GetValue("ItemName", 0).ToString()); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_Quantity", (i - 1), "1"); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_OpenQty", (i - 1), forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_Quantity", (i - 1)).ToString()); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_PrcBfDi", (i - 1), oDataTable.GetValue("LastPurPrc", 0).ToString()); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_UnitMsr", (i - 1), oDataTable.GetValue("BuyUnitMsr", 0).ToString()); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_Total", (i - 1), oDataTable.GetValue("LastPurPrc", 0).ToString()); if (oDataTable.GetValue("VATLiable", 0).ToString() == "N") { forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_TaxCode", (i - 1), "EX"); } else { forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_TaxCode", (i - 1), "IT"); } } if (sCflId == "CFL_7") { if ((oDataTable.GetValue("Code", 0).ToString() == "IT") || (oDataTable.GetValue("Code", 0).ToString() == "EX")) { forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_TaxCode", (i - 1), oDataTable.GetValue("Code", 0).ToString()); } else { app.StatusBar.SetText("No se puede utilizar este tipo de impuesto.", SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); } } if ((i == oMatrix.RowCount) && (sCflId == "CFL_5")) { forma.DataSources.DBDataSources.Item("@ZTV_LINES").InsertRecord(i); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_ItemCode", i, ""); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_Dscript", i, ""); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_Quantity", i, "1"); forma.DataSources.DBDataSources.Item("@ZTV_LINES").SetValue("U_OpenQty", i, forma.DataSources.DBDataSources.Item("@ZTV_LINES").GetValue("U_Quantity", i).ToString()); } oMatrix.LoadFromDataSource(); smf = true; rowNum = pVal.Row; colUID = pVal.ColUID; calcTotalBfDsc(); calcTaxDoc(); } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_matrix1 " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } } break; case SAPbouiCOM.BoEventTypes.et_COMBO_SELECT: SAPbouiCOM.ComboBox oCombo; int lNum = 0; // con este procedimiento se llena el combo de la series if (pVal.ItemUID == "cmbSeries" && pVal.Before_Action == false && pVal.ItemChanged == true) { oCombo = ((SAPbouiCOM.ComboBox)forma.Items.Item("cmbSeries").Specific); try { SAPbouiCOM.EditText oEdit; lNum = forma.BusinessObject.GetNextSerialNumber(oCombo.Selected.Value, "OZTV"); oEdit = (SAPbouiCOM.EditText)forma.Items.Item("txtSeries").Specific; oEdit.String = lNum.ToString(); } catch (Exception e) { app.StatusBar.SetText("solicitud_app_event_comboSeries " + e.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Warning); } } break; } }
/// <summary> /// funcion gentiion el uso del ChooseFromList /// </summary> /// <param name="oForm">objeto del formulario</param> /// <param name="pVal">Item Even</param> private static void GestionarSeleccionCFL(SAPbouiCOM.Form oForm, SAPbouiCOM.ItemEvent pVal) { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; String CflID = string.Empty; SAPbouiCOM.ChooseFromList oCFL = null; SAPbouiCOM.DataTable oDataTable = null; try { oCFLEvento = ((SAPbouiCOM.IChooseFromListEvent)(pVal)); CflID = oCFLEvento.ChooseFromListUID; oCFL = oForm.ChooseFromLists.Item(CflID); oDataTable = oCFLEvento.SelectedObjects; if (oDataTable != null) { SAPbouiCOM.Matrix oMatrix = oForm.Items.Item("MatrixIM").Specific; try { switch (CflID) { case "CFL_ACT": oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific.String = oDataTable.GetValue("AcctCode", 0).ToString(); break; case "CFL_dim1": oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific.String = oDataTable.GetValue("OcrCode", 0).ToString(); break; case "CFL_dim2": oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific.String = oDataTable.GetValue("OcrCode", 0).ToString(); break; case "CFL_dim3": oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific.String = oDataTable.GetValue("OcrCode", 0).ToString(); break; case "CFL_dim4": oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific.String = oDataTable.GetValue("OcrCode", 0).ToString(); break; case "CFL_dim5": oMatrix.Columns.Item(pVal.ColUID).Cells.Item(pVal.Row).Specific.String = oDataTable.GetValue("OcrCode", 0).ToString(); break; default: break; } } catch (Exception ex) { } } } catch (Exception ex) { Conexion_SBO.m_SBO_Appl.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); } finally { FuncionesComunes.LiberarObjetoGenerico(oCFLEvento); FuncionesComunes.LiberarObjetoGenerico(oCFL); FuncionesComunes.LiberarObjetoGenerico(oDataTable); } }
//Events private void chooseFromListAfterEvent(string FormUID, ref SAPbouiCOM.ItemEvent pValEvent, out bool BubbleEvent) { BubbleEvent = true; if (pValEvent.EventType != SAPbouiCOM.BoEventTypes.et_FORM_CLOSE || pValEvent.EventType != SAPbouiCOM.BoEventTypes.et_FORM_DATA_DELETE) { if (pValEvent.ColUID == "Col_0" && pValEvent.FormType == 0 && pValEvent.Action_Success == true && pValEvent.Before_Action == false && pValEvent.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST) { SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pValEvent; string sCFL_ID = null; sCFL_ID = oCFLEvento.ChooseFromListUID; SAPbouiCOM.ChooseFromList oCFL = null; if (oCFLEvento.SelectedObjects == null) { return; } try { oCFL = lObjFormXml.ChooseFromLists.Item(sCFL_ID); } catch (Exception) { return; } SAPbouiCOM.DataTable oDataTable = null; oDataTable = oCFLEvento.SelectedObjects; var Descrpition = ""; var Num = ""; try { string val = null; val = System.Convert.ToString(oDataTable.GetValue(0, 0)); if (val != null) { if (pValEvent.ItemUID == "Item_6") { if (((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_0").Cells.Item(pValEvent.Row).Specific).Value == "") { oMatrix.Columns.Item("Col_0").Cells.Item(pValEvent.Row).Click(); oMatrix.Item.Click(); } if (pListxmlConceptLines2.Count == 0) { Concepts lObjConcepto = lObjPurchaseInvoice.ConceptLines[pValEvent.Row - 1]; if (lStrDocType.Equals("Servicios")) { lObjConcepto.NumeroCuenta = val; } else { lObjConcepto.Articulo = val; } pListxmlConceptLines2.Add(lObjConcepto); } else { ///Validate the account change if (lStrDocType.Equals("Servicios")) { Descrpition = lObjPurchaseInvoice.ConceptLines[pValEvent.Row - 1].Descripcion; Num = lObjPurchaseInvoice.ConceptLines[pValEvent.Row - 1].NumeroCuenta; if (pListxmlConceptLines2.Find(x => x.NumeroCuenta == Num && x.Descripcion == Descrpition) != null) { pListxmlConceptLines2.Where(x => x.NumeroCuenta == Num && x.Descripcion == Descrpition).Select(x => x.NumeroCuenta = val).ToList(); } else { Concepts lObjConcepto = lObjPurchaseInvoice.ConceptLines[pValEvent.Row - 1]; lObjConcepto.NumeroCuenta = val; pListxmlConceptLines2.Add(lObjConcepto); } } else { Descrpition = lObjPurchaseInvoice.ConceptLines[pValEvent.Row - 1].Descripcion; Num = lObjPurchaseInvoice.ConceptLines[pValEvent.Row - 1].Articulo; if (pListxmlConceptLines2.Find(x => x.Articulo == Num && x.Descripcion == Descrpition) != null) { pListxmlConceptLines2.Where(x => x.Articulo == Num && x.Descripcion == Descrpition).Select(x => x.Articulo = val).ToList(); } else { Concepts lObjConcepto = lObjPurchaseInvoice.ConceptLines[pValEvent.Row - 1]; lObjConcepto.Articulo = val; pListxmlConceptLines2.Add(lObjConcepto); } } } if (lObjPurchaseInvoice.Version == "3.3") { if ((lObjPurchaseInvoice.ConceptLines[pValEvent.Row - 1].ClaveItmProd != "" && lObjPurchaseInvoice.ConceptLines[pValEvent.Row - 1].ClaveItmProd != null) && !lStrDocType.Equals("Servicios")) { SAPbobsCOM.Recordset lObjRecordSet = (SAPbobsCOM.Recordset)DIApplication.Company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset); lObjRecordSet.DoQuery("select ItemSAT.NcmCode as Code from OITM Items inner join ONCM ItemSAT on Items.NCMCode = ItemSAT.AbsEntry where Items.ItemCode = '" + val + "'"); if (lObjRecordSet.RecordCount == 1) { string lStrCode = lObjRecordSet.Fields.Item(0).Value.ToString(); if (!(lStrCode == lObjPurchaseInvoice.ConceptLines[pValEvent.Row - 1].ClaveItmProd)) { throw new Exception("Los codigos de articulos con coinciden."); } } else { throw new Exception("El artitulo no se encuentra mapeado."); } } ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_0").Cells.Item(pValEvent.Row).Specific).Value = val; } else { ((SAPbouiCOM.EditText)oMatrix.Columns.Item("Col_0").Cells.Item(pValEvent.Row).Specific).Value = val; } } } } catch (Exception ex) { if (!ex.Message.Contains("Form - Bad Value") && !ex.Message.Contains("Can't set value on item because the item can't get focus.")) { Application.SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Medium, SAPbouiCOM.BoStatusBarMessageType.smt_Error); } } } } }