public List <ContractsDTO> DataTableToDTO(SAPbouiCOM.DataTable pObjDataTable) { try { List <ContractsDTO> lLstContracts = new List <ContractsDTO>(); for (int i = 0; i < pObjDataTable.Rows.Count; i++) { ContractsDTO lObjContracts = new ContractsDTO(); lObjContracts.DocEntry = int.Parse(pObjDataTable.GetValue("DocECont", i).ToString()); lObjContracts.DocNum = int.Parse(pObjDataTable.GetValue("DocNCont", i).ToString()); lObjContracts.DocDate = DateTime.Parse(pObjDataTable.GetValue("DateCont", i).ToString()); lObjContracts.Type = int.Parse(pObjDataTable.GetValue("TypCCont", i).ToString()); lObjContracts.Status = pObjDataTable.GetValue("StsCCont", i).ToString(); lObjContracts.Import = double.Parse(pObjDataTable.GetValue("ImpCont", i).ToString()); lObjContracts.Code = pObjDataTable.GetValue("CodeTCont", i).ToString(); lObjContracts.CardName = pObjDataTable.GetValue("CardName", i).ToString(); lLstContracts.Add(lObjContracts); } return(lLstContracts); } catch (Exception lObjException) { LogService.WriteError(string.Format("[ContractsService - DataTableToDTO: {0}]", lObjException.Message)); throw lObjException; } }
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 SAPbouiCOM.DataTable GetBatchesByFilters(string pStrBuyer, string pStrSeller, string pStrSellerTaxCode, string pStrDate) { SAPbouiCOM.DataTable lDtbResult = new SAPbouiCOM.DataTable(); Recordset lObjRecordset = null; try { lObjRecordset = (Recordset)DIApplication.Company.GetBusinessObject(BoObjectTypes.BoRecordset); pStrDate = ValidStringDate(pStrDate); Dictionary <string, string> lLstStrParameters = new Dictionary <string, string>(); lLstStrParameters.Add("Buyer", pStrBuyer); lLstStrParameters.Add("Seller", pStrSeller); lLstStrParameters.Add("SellerTaxCode", pStrSellerTaxCode); lLstStrParameters.Add("Date", pStrDate); string lStrQuery = this.GetSQL("GetBatchesByFilters").Inject(lLstStrParameters); lObjRecordset.DoQuery(lStrQuery); lDtbResult = (SAPbouiCOM.DataTable)lObjRecordset.ToDataTable(); } catch (Exception lObjException) { throw new QueryException(lObjException.Message, lObjException); } finally { MemoryUtility.ReleaseComObject(lObjRecordset); } return(lDtbResult); }
public void GetItemReferences() { try { _oForm.Freeze(false); _cbARINV = _oForm.Items.Item("cbARINV").Specific as SAPbouiCOM.CheckBox; _cbARCN = _oForm.Items.Item("cbARCN").Specific as SAPbouiCOM.CheckBox; _cbAPINV = _oForm.Items.Item("cbAPINV").Specific as SAPbouiCOM.CheckBox; _cbAPCN = _oForm.Items.Item("cbAPCN").Specific as SAPbouiCOM.CheckBox; _txtDTFRM = _oForm.Items.Item("txtDTFRM").Specific as SAPbouiCOM.EditText; _txtDTTO = _oForm.Items.Item("txtDTTO").Specific as SAPbouiCOM.EditText; _btnView = _oForm.Items.Item("btnView").Specific as SAPbouiCOM.Button; _btnCP = _oForm.Items.Item("btnCP").Specific as SAPbouiCOM.Button; _txtPath = _oForm.Items.Item("txtPath").Specific as SAPbouiCOM.EditText; _btnExport = _oForm.Items.Item("btnExport").Specific as SAPbouiCOM.Button; _grid_Trans = _oForm.Items.Item("grid_Trans").Specific as SAPbouiCOM.Grid; _dt_grid_Trans = _oForm.DataSources.DataTables.Item("grid_Trans"); _btnView.PressedAfter += _btnView_PressedAfter; _btnExport.PressedAfter += _btnExport_PressedAfter; // Double click events _grid_Trans.DoubleClickAfter += _grid_Trans_DoubleClickAfter; _btnCP.PressedAfter += _btnCP_PressedAfter; } catch (Exception Ex) { eCommon.SBO_Application.MessageBox(Ex.Message); } }
private void Matrix0_ChooseFromListAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal) { SAPbouiCOM.ISBOChooseFromListEventArg chflarg = (SAPbouiCOM.ISBOChooseFromListEventArg)pVal; SAPbouiCOM.DataTable dt = chflarg.SelectedObjects; if (dt == null) { this.UIAPIRawForm.Freeze(false); return; } string ItemName = dt.GetValue("ItemName", 0).ToString(); string ItemCode = dt.GetValue("ItemCode", 0).ToString(); this.UIAPIRawForm.Items.Item("Item_23").Click(SAPbouiCOM.BoCellClickType.ct_Regular); Matrix0.Columns.Item("code").Editable = false; Matrix0.Columns.Item("title").Editable = false; (Matrix0.Columns.Item("code").Cells.Item(pVal.Row).Specific as SAPbouiCOM.EditText).Value = ItemCode; (Matrix0.Columns.Item("title").Cells.Item(pVal.Row).Specific as SAPbouiCOM.EditText).Value = ItemName; Matrix0.Columns.Item("code").Editable = true; Matrix0.Columns.Item("title").Editable = true; //Matrix0.AddRow(); (Matrix0.Columns.Item("insID").Cells.Item(pVal.Row + 1).Specific as SAPbouiCOM.EditText).Value = EditText7.Value; }
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(); } } }
public IList <InvoiceDTO> DataTableToInvoiceDTO(SAPbouiCOM.DataTable mDtClientInvoices) { IList <InvoiceDTO> lLstInvoiceDTO = new List <InvoiceDTO>(); for (int i = 0; i < mDtClientInvoices.Rows.Count; i++) { InvoiceDTO lObjInvoiceDTO = new InvoiceDTO(); lObjInvoiceDTO.DocNum = int.Parse(mDtClientInvoices.GetValue("C_DocNum", i).ToString()); lObjInvoiceDTO.DocDate = DateTime.Parse(mDtClientInvoices.GetValue("C_DocDate", i).ToString()); lObjInvoiceDTO.DocDueDate = DateTime.Parse(mDtClientInvoices.GetValue("C_DcDueDt", i).ToString()); lObjInvoiceDTO.DocCur = mDtClientInvoices.GetValue("C_DocCur", i).ToString(); lObjInvoiceDTO.OcrCode = mDtClientInvoices.GetValue("C_OcrCode", i).ToString(); lObjInvoiceDTO.DocTotal = double.Parse(mDtClientInvoices.GetValue("C_DocTotal", i).ToString()); lObjInvoiceDTO.DocRemaining = int.Parse(mDtClientInvoices.GetValue("C_DocRem", i).ToString()); lObjInvoiceDTO.SeriesName = mDtClientInvoices.GetValue("C_Series", i).ToString(); lObjInvoiceDTO.DocEntry = int.Parse(mDtClientInvoices.GetValue("C_DocEntry", i).ToString()); lObjInvoiceDTO.ObjType = mDtClientInvoices.GetValue("C_ObjType", i).ToString(); lLstInvoiceDTO.Add(lObjInvoiceDTO); //mDtClientInvoices.SetValue("C_DocDate", i, lObjinvoice.DocDate); //mDtClientInvoices.SetValue("C_DcDueDt", i, lObjinvoice.DocDueDate); //mDtClientInvoices.SetValue("C_DocCur", i, lObjinvoice.DocCur); //mDtClientInvoices.SetValue("C_OcrCode", i, lObjinvoice.OcrCode); //mDtClientInvoices.SetValue("C_DocTotal", i, lObjinvoice.DocTotal); //mDtClientInvoices.SetValue("C_DocRem", i, lObjinvoice.DocRemaining); //mDtClientInvoices.SetValue("C_Series", i, lObjinvoice.SeriesName); //// The following are not shown in the matrix, only internal //mDtClientInvoices.SetValue("C_DocEntry", i, lObjinvoice.DocEntry); //mDtClientInvoices.SetValue("C_ObjType", i, lObjinvoice.ObjType); } return(lLstInvoiceDTO); }
public SAPbouiCOM.DataTable GenerarEncabezado(SAPbouiCOM.DataTable DT_SQL, SAPbouiCOM.DataTable DT_HEAD) { try { string FechaPago = DT_SQL.GetValue(0, 0).ToString(); string CantidadPagos = DT_SQL.GetValue(0, 1).ToString(); string MontoPagos = DT_SQL.GetValue(0, 2).ToString();//.Replace(".",""); string[] SeparaTotal = MontoPagos.Split('.'); string MontoEntero = SeparaTotal[0]; string MontoDecimal = SeparaTotal.Count() == 1 ? "00" : MontoPagos.Split('.')[1]; string sql = @"EXEC [dbo].[Min_Bancos_Generar_Encabezado_Archivo_PagoTXT] @U_FechaPago = N'" + FechaPago + @"', @U_CantidadPago = N'" + CantidadPagos + @"', @U_MontoTotal = N'" + MontoEntero + MontoDecimal + "'"; DT_HEAD.ExecuteQuery(sql); //Hay que establecer la columana de tipo TEXT para que puedan agregarse posteriormente los rgistros de detalle string RC = DT_HEAD.GetValue(0, 0).ToString().Trim(); DT_HEAD.Clear(); DT_HEAD.Columns.Add("Info", SAPbouiCOM.BoFieldsType.ft_Text); DT_HEAD.Rows.Add(1); DT_HEAD.SetValue("Info", 0, RC); //DT_HEAD.SetValue("Info", 0, "RC00354803021120160000100000000016184000578509689910000968991000 [email protected]"); } catch (Exception) {} return(DT_HEAD); }
public static void IdentificarAccesoUsuario(SAPbouiCOM.DataTable oDataTable) { string Acceso = ""; if (!Conexion.oCompany.Connected) { Conexion.Conectar_Aplicacion(); } string sAliasUsuActual = Convert.ToString(Conexion.oCompany.UserName); string sBDComercial = "SBO_COMERCIAL"; //SAPbouiCOM.DataTable DT_SQL = new SAPbouiCOM.DataTable(); string sPSql = "SELECT * FROM [" + sBDComercial + "].dbo.[OUSR] where USER_Code ='" + sAliasUsuActual + "'"; try { oDataTable.ExecuteQuery(sPSql); Acceso = Convert.ToString(oDataTable.GetValue("U_Hab_Fec_Proy", 0)); Habilitado = Acceso == "Si" ? true : false; ConsultaUsuario = true; } catch { // item does not exist Habilitado = false; } }
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); } }
public static void Cargar_ComboBox(SAPbouiCOM.ComboBox oComboBox, SAPbouiCOM.DataTable oDataTable, string Query, int ValorValue, int ValorDescription, bool ValorVacio) { try { //oForm = Application.SBO_Application.Forms.Item(FormId) ; //oComboBox = (SAPbouiCOM.ComboBox) oForm.Items.Item(ComboID).Specific; //oDTTable = oForm.DataSources.DataTables.Item(DataTableID) ; oDataTable.ExecuteQuery(Query); if (ValorVacio) // Agrega primera linea de ComboBox Vacia { oComboBox.ValidValues.Add("", ""); } for (int i = 0; i <= oDataTable.Rows.Count - 1; i++) { oComboBox.ValidValues.Add(Convert.ToString(oDataTable.GetValue(ValorValue, i)), Convert.ToString(oDataTable.GetValue(ValorDescription, i))); } } catch (Exception) { throw; } }
public static void Unir_DataTables(SAPbouiCOM.DataTable DT1, SAPbouiCOM.DataTable DT2) { try { for (int iRow = 0; iRow <= DT2.Rows.Count - 1; iRow++) { DT1.Rows.Add(); int nRow = DT1.Rows.Count - 1; for (int iCol = 0; iCol <= DT2.Columns.Count - 1; iCol++) { try { DT1.SetValue(iCol, nRow, DT2.GetValue(iCol, iRow)); } catch (Exception) { } } } } catch (Exception) { } }
public static void FacturaProveedores_FormDataEvent(ref SAPbouiCOM.BusinessObjectInfo BOInfo, out bool BubbleEvent) { BubbleEvent = true; //Muestra en las Ordenes de Compra (Pedidos Compras) los saldos correspondientes a los pagos relacionados realizados. if ((BOInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD) && !(BOInfo.BeforeAction)) { try { //oForm = Application.SBO_Application.Forms.Item(BOInfo.FormUID); try { oDataTable = oForm.DataSources.DataTables.Item("DT_SQL"); } catch (Exception) { Program.AbiertoDesdeEnlace = true; } } catch { // Application.SBO_Application.MessageBox(ex.ToString(), 1, "Ok", "", ""); } } }
// query and populate matrix private void populateMatrix() { try { String strQuery = String.Format(TWM_KDS_AddOn.Src.Resource.Queries.TWM_GET_PO_MATRIX, _txtVendor.String, _txtDTFRM.Value, _txtDTTO.Value); _dt_VendorMatrix = _oForm.DataSources.DataTables.Item("dt_VendorfromOPOR"); _dt_VendorMatrix.ExecuteQuery(strQuery); if (_dt_VendorMatrix.Rows.Count > 0) { _mat_Vendor.Columns.Item("col_0").DataBind.Bind("dt_VendorfromOPOR", "Row"); _mat_Vendor.Columns.Item("colVCC").DataBind.Bind("dt_VendorfromOPOR", "CardCode"); _mat_Vendor.Columns.Item("colVCN").DataBind.Bind("dt_VendorfromOPOR", "CardName"); _mat_Vendor.Columns.Item("colCHK").DataBind.Bind("dt_VendorfromOPOR", "Check"); _mat_Vendor.Columns.Item("colSONO").DataBind.Bind("dt_VendorfromOPOR", "DocNum"); _mat_Vendor.Columns.Item("colPONO").DataBind.Bind("dt_VendorfromOPOR", "NumAtCard"); _mat_Vendor.Columns.Item("colDOCET").DataBind.Bind("dt_VendorfromOPOR", "DocEntry"); _mat_Vendor.LoadFromDataSource(); _mat_Vendor.AutoResizeColumns(); } } catch (Exception ex) { eCommon.SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error); } }
/// <summary> /// Create a new SAP Datatable and copy the contents from the table passed as parameter /// </summary> /// <param name="tempBatches">DataTable to copy from</param> /// <returns>Return a new SAP DataTable</returns> private System.Data.DataTable CopyBatchesDataTable(SAPbouiCOM.DataTable tempBatches) { System.Data.DataTable newDataTable = new System.Data.DataTable(); newDataTable.Columns.Add("ItemCode", typeof(string)); newDataTable.Columns.Add("DistNumber", typeof(string)); newDataTable.Columns.Add("Quantity", typeof(string)); newDataTable.Columns.Add("WhsCode", typeof(string)); newDataTable.Columns.Add("AvgPrice", typeof(double)); newDataTable.Columns.Add("Selected Qty", typeof(string)); for (int x = 0; x < tempBatches.Rows.Count; x++) { System.Data.DataRow dr = newDataTable.NewRow(); dr["ItemCode"] = tempBatches.GetValue("ItemCode", x); dr["DistNumber"] = tempBatches.GetValue("DistNumber", x); dr["Quantity"] = tempBatches.GetValue("Quantity", x); dr["WhsCode"] = tempBatches.GetValue("WhsCode", x); dr["AvgPrice"] = tempBatches.GetValue("AvgPrice", x); dr["Selected Qty"] = tempBatches.GetValue("Selected Qty", x);; newDataTable.Rows.Add(dr); } return(newDataTable); }
private void LoadMatrix(string lStrYear, string lStrPeriod, string lStrNo, string NameServer, string NameDB, string Login, string Password) { AccountsDAO lObjAccount = new AccountsDAO(); this.UIAPIRawForm.DataSources.DataTables.Item("DTMatrix") .ExecuteQuery(lObjAccount.GetAccts(lStrYear, lStrPeriod, lStrNo, NameServer, NameDB, Login, Password)); mObjMtx.Columns.Item("clICD").DataBind.Bind("DTMatrix", "ICDNOM"); mObjMtx.Columns.Item("cAIMPO").DataBind.Bind("DTMatrix", "AIMPO"); mObjMtx.Columns.Item("cNIVEL").DataBind.Bind("DTMatrix", "NIVEL"); mObjMtx.Columns.Item("cCUE").DataBind.Bind("DTMatrix", "CUE"); //mObjMtx.Columns.Item("cCUE").DataBind.Bind("DTMatrix", "ACONC"); //mObjMtx.Columns.Item("cCUE").DataBind.Bind("DTMatrix", "ATRAB"); mObjMtx.Columns.Item("cCC").DataBind.Bind("DTMatrix", "CC"); mObjMtx.Columns.Item("cPROY").DataBind.Bind("DTMatrix", "PROY"); mObjMtx.Columns.Item("cAcc1").DataBind.Bind("DTMatrix", "CUENTA1"); mObjMtx.Columns.Item("cNNOM").DataBind.Bind("DTMatrix", "NNOM"); mObjMtx.Columns.Item("cNRFC").DataBind.Bind("DTMatrix", "NRFC"); mObjDT = this.UIAPIRawForm.DataSources.DataTables.Item("DTMatrix"); mObjMtx.LoadFromDataSource(); mObjMtx.AutoResizeColumns(); CalculateTotal(); }
public List <HoursRecordsDTO> DataTableToDTO(SAPbouiCOM.DataTable pObjDataTable) { List <HoursRecordsDTO> lLstHoursRecords = new List <HoursRecordsDTO>(); for (int i = 0; i < pObjDataTable.Rows.Count; i++) { HoursRecordsDTO lObjHoursRecords = new HoursRecordsDTO(); lObjHoursRecords.Code = pObjDataTable.GetValue("CodeHrs", i).ToString(); lObjHoursRecords.IdRise = int.Parse(pObjDataTable.GetValue("IdRiHrs", i).ToString()); lObjHoursRecords.ContractEntry = int.Parse(pObjDataTable.GetValue("ContOVHrs", i).ToString()); lObjHoursRecords.ContractDocNum = int.Parse(pObjDataTable.GetValue("CDEOVHrs", i).ToString()); lObjHoursRecords.DateHour = DateTime.Parse(pObjDataTable.GetValue("DateHrs", i).ToString()); lObjHoursRecords.SupervisorId = int.Parse(pObjDataTable.GetValue("SupIdHrs", i).ToString()); lObjHoursRecords.Supervisor = pObjDataTable.GetValue("SupNmHrs", i).ToString(); lObjHoursRecords.OperatorId = int.Parse(pObjDataTable.GetValue("OpdIdHrs", i).ToString()); lObjHoursRecords.OperatorName = pObjDataTable.GetValue("OpdNmHrs", i).ToString(); lObjHoursRecords.PrcCode = pObjDataTable.GetValue("EqpHrs", i).ToString(); lObjHoursRecords.EcoNum = pObjDataTable.GetValue("NumEcnHrs", i).ToString(); lObjHoursRecords.HrFeet = double.Parse(pObjDataTable.GetValue("HrsFeetHr", i).ToString()); lObjHoursRecords.SectionId = int.Parse(pObjDataTable.GetValue("SctnIdHrs", i).ToString()); lObjHoursRecords.Section = pObjDataTable.GetValue("SctnNnHrs", i).ToString(); lObjHoursRecords.KmHt = double.Parse(pObjDataTable.GetValue("KmHcHrs", i).ToString()); lObjHoursRecords.Pending = double.Parse(pObjDataTable.GetValue("PendHrs", i).ToString()); lObjHoursRecords.Close = pObjDataTable.GetValue("CloseHrs", i).ToString(); lLstHoursRecords.Add(lObjHoursRecords); } return(lLstHoursRecords); }
private void HandleExportSOSelectAll(SAPbouiCOM.Form form, String MatxStr, SAPbouiCOM.DataTable oDataTable) { bool flgChange = false; try { if (form.Items.Item(MatxStr) == null) { return; } form.Items.Item(MatxStr).AffectsFormMode = false; SAPbouiCOM.Matrix OMatrix = (SAPbouiCOM.Matrix)form.Items.Item(MatxStr).Specific; int RowCount = oDataTable.Rows.Count; form.Freeze(true); if (RowCount > 0) { ShowMsgCustom("Selecting ...!"); for (int i = 0; i < oDataTable.Rows.Count; i++) { var chk = (SAPbouiCOM.CheckBox)OMatrix.Columns.Item("clSel").Cells.Item(i + 1).Specific; if (flStateExportSO) { if (chk.Checked) { } else { flgChange = true; OMatrix.Columns.Item("clSel").Cells.Item(i + 1).Click(SAPbouiCOM.BoCellClickType.ct_Regular); } } else { if (chk.Checked) { flgChange = true; OMatrix.Columns.Item("clSel").Cells.Item(i + 1).Click(SAPbouiCOM.BoCellClickType.ct_Regular); } else { } } } } form.Freeze(false); form.Update(); if (flgChange) { flStateExportSO = !flStateExportSO; // oMatrixBpExport.FlushToDataSource(); } } catch (Exception ex) { errorLog(ex.Message); } }
public static SAPbouiCOM.DataTable Listar(DateTime FecIni, DateTime FecFin, SAPbouiCOM.DataTable DT_Resultado) { DPagosTranferencia Obj = new DPagosTranferencia(); Obj.FechaIni = FecIni; Obj.FechaFin = FecFin; return(Obj.Listar(Obj, DT_Resultado)); }
private void InitiallizeForm() { isForLoading = true; oForm.Freeze(true); tab1 = (SAPbouiCOM.Folder)oForm.Items.Item("21").Specific; tab3 = (SAPbouiCOM.Folder)oForm.Items.Item("19").Specific; tab4 = (SAPbouiCOM.Folder)oForm.Items.Item("35").Specific; dtHead = oForm.DataSources.DataTables.Item("dtHead"); Animals = oForm.DataSources.DataTables.Item("Animals"); DTRpt = oForm.DataSources.DataTables.Item("DTRpt"); dtPro = oForm.DataSources.DataTables.Item("dtPro"); dtReqT = oForm.DataSources.DataTables.Item("dtReqT"); dtTypeS = oForm.DataSources.DataTables.Item("dtTypeS"); ocflCard = (SAPbouiCOM.ChooseFromList)oForm.ChooseFromLists.Item("cflCard"); cflcardcode(ocflCard, "cflCard"); mtAnimals = (SAPbouiCOM.Matrix)oForm.Items.Item("mtAnimals").Specific; mtReqT = (SAPbouiCOM.Matrix)oForm.Items.Item("mtReqT").Specific; mtRpt = (SAPbouiCOM.Matrix)oForm.Items.Item("mtRpt").Specific; mtProd = (SAPbouiCOM.Matrix)oForm.Items.Item("mtProd").Specific; mtTypePRO = (SAPbouiCOM.Matrix)oForm.Items.Item("mtTypePRO").Specific; cbAT = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbAT").Specific; cbAC = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbAC").Specific; txQtyT = (SAPbouiCOM.EditText)oForm.Items.Item("29").Specific; txSupplier = (SAPbouiCOM.EditText)oForm.Items.Item("47").Specific; chSO = (SAPbouiCOM.CheckBox)oForm.Items.Item("chSO").Specific; chPRO = (SAPbouiCOM.CheckBox)oForm.Items.Item("crRPRO").Specific; dtHead.Rows.Add(1); dtHead.SetValue("DocDate", 0, DateTime.Now); dtHead.SetValue("PoDate", 0, DateTime.Now); dtHead.SetValue("stDate", 0, DateTime.Now.AddDays(1)); dtHead.SetValue("eDate", 0, DateTime.Now.AddDays(4)); oForm.Freeze(false); fillCB(); txQtyT.Item.Enabled = false; oForm.PaneLevel = 4; tab4.Select(); isForLoading = false; fillPO(); mtProd.Item.Visible = false; fillAThash(); RefreshForm(); }
static void SBO_Application_FormDataEvent(ref SAPbouiCOM.BusinessObjectInfo BOInfo, out bool BubbleEvent) { BubbleEvent = true; SAPbouiCOM.Form oForm = Application.SBO_Application.Forms.Item(BOInfo.FormUID); try { if ((BOInfo.FormTypeEx == "142")) { OrdenCompra.OrdenCompra_FormDataEvent(ref BOInfo, out BubbleEvent); } if ((BOInfo.FormTypeEx == "141")) { FacturaProveedores.FacturaProveedores_FormDataEvent(ref BOInfo, out BubbleEvent); } int ObjN = Convert.ToInt32(BOInfo.Type); //Bloquear o Habilitar Campos de Fechas en la ventanas de UDF en los documentos de Marketing segun iFormularios if ((BOInfo.EventType == SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD) && BOInfo.BeforeAction && Array.Exists(iFormularios, element => element == ObjN)) { string[] U_Campos = { "U_MIN_FechaVenta", "U_MIN_FinMontaje", "U_MIN_FinDesarr", "U_MIN_FinProduccion", "U_MIN_IniDespacho", "U_MIN_IniMontaje", "U_MIN_FinMontaje", "U_MIN_FechaMulta" }; try { oForm = Application.SBO_Application.Forms.GetForm("-" + BOInfo.FormTypeEx, 1);// Item(BOInfo.FormUID); SAPbouiCOM.EditText oEdit; if (Funciones.ConsultaUsuario == false) { SAPbouiCOM.DataTable oDataTable = null; if (!Funciones.DataTableExists(oForm, "DT_SQL")) { oForm.DataSources.DataTables.Add("DT_SQL"); } oDataTable = oForm.DataSources.DataTables.Item("DT_SQL"); Funciones.IdentificarAccesoUsuario(oDataTable); } foreach (string element in U_Campos) { if (Funciones.ItemExists(oForm, element)) { oEdit = (SAPbouiCOM.EditText)oForm.Items.Item(element).Specific; if (oEdit.Item.Enabled == Funciones.Habilitado) // Verifica si ya estan condicionados los campos para no volver a ejecutar el proceso en la pantalla activa { break; } oEdit.Item.Enabled = Funciones.Habilitado; } } } catch (Exception) { } } } catch (Exception) { } }
/// <summary> /// Gets the value of datatable's cell, handing conversion. /// </summary> /// <typeparam name="T">The type of the stored value</typeparam> /// <param name="pDataTable">The datatable</param> /// <param name="pColumn">The column's id.</param> /// <param name="pRow">The row position.</param> /// <returns>The value in the cell</returns> public static T GetCellValue<T>(this SAPbouiCOM.DataTable pDataTable, string pColumn, int pRow) where T : IConvertible { object lObjValue = pDataTable.Columns.Item(pColumn).Cells.Item(pRow).Value; if (lObjValue == null) { return default(T); } return (T)Convert.ChangeType(lObjValue, typeof(T), CultureInfo.InvariantCulture); }
public static List <string> GetColumnValueAsList(this SAPbouiCOM.DataTable control, object column) { List <string> values = new List <string>(); for (int i = 0; i < control.Rows.Count; i++) { values.Add(control.GetValue(column, i).ToString()); } return(values); }
private void InitiallizeForm() { oForm.Freeze(true); initiallizing = true; dtRpt = oForm.DataSources.DataTables.Item("dtRpt"); dtHeads = oForm.DataSources.DataTables.Item("dtHeads"); dtHeads.Rows.Add(1); mtReport = (SAPbouiCOM.Matrix)oForm.Items.Item("mtReport").Specific; btAct = (SAPbouiCOM.ButtonCombo)oForm.Items.Item("btAct").Specific; btPL = (SAPbouiCOM.ButtonCombo)oForm.Items.Item("btPL").Specific; btAct.ValidValues.Add("01", "Released"); btAct.ValidValues.Add("02", "Canceled"); opALL = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opAO").Specific; opREL = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opREL").Specific; opPL = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opPL").Specific; opOd = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opOd").Specific; opDd = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opDd").Specific; opFirst = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opFirst").Specific; opLast = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opLast").Specific; opX = (SAPbouiCOM.OptionBtn)oForm.Items.Item("opX").Specific; opREL.GroupWith("opAO"); opPL.GroupWith("opAO"); opDd.GroupWith("opOd"); opLast.GroupWith("opFirst"); opX.GroupWith("opFirst"); // opLast.Selected = true; txProduct = (SAPbouiCOM.EditText)oForm.Items.Item("txProduct").Specific; txFrom = (SAPbouiCOM.EditText)oForm.Items.Item("txFrom").Specific; txTo = (SAPbouiCOM.EditText)oForm.Items.Item("txTo").Specific; cbFilter = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbFilter").Specific; cbPL = (SAPbouiCOM.ComboBox)oForm.Items.Item("cbPL").Specific; cbPL.ValidValues.Add("0", "All"); fillCbs(); // fillReport(); oForm.Freeze(false); opALL.Selected = true; opOd.Selected = true; opLast.Selected = true; initiallizing = false; }
private void populateRBillingMatrix(string orderBy = "", string where = "") { string sql = ""; try { if (oRBillingForm == null) { return; } SAPbouiCOM.Matrix oMatrix = (SAPbouiCOM.Matrix)oRBillingForm.Items.Item(matrixRBilling).Specific; oMatrix.Clear(); //oMatrix.AutoResizeColumns(); SAPbouiCOM.DataTable oDts = getRBillingMatrixDataTable(); sql = string.Format("select \"DocEntry\" as jobID, \r\n" + "(select \"DocEntry\" from ORDR where CAST(\"DocEntry\" AS VARCHAR) = \"U_OrderID\") as OrderID, \r\n" + "\"U_Description\", \r\n" + "\"U_Result\", \r\n" + "\"U_CustomerID\", \r\n" + "\"U_Frequency\", \r\n" + "\"U_StartDate\", \r\n" + "\"U_EndDate\", \r\n" + "\"U_NextRunDate\", \r\n" + "\"U_LastRunDate\", \r\n" + "\"U_CancelledDate\", \r\n" + "\"U_Amount\", \r\n" + "(select \"CardName\" from OCRD where \"CardCode\" = \"U_CustomerID\") as CustomerName, \r\n" + "(select \"DocEntry\" from OINV where \"CardCode\" = \"U_CustomerID\" and CAST(\"DocNum\" as VARCHAR) = \"U_InvoiceID\") as InvDocNum \r\n" + "from \"@CCJOB\" \r\n" + "where (\"U_Cancelled\"<>'Y' OR \"U_Cancelled\" is NULL) {0} order By {1} \"U_NextRunDate\" ", where, orderBy); //trace(sql); oDts.ExecuteQuery(sql); BindMatrix(oMatrix, "jobID", "jobID", dtRBilling); BindMatrix(oMatrix, "CustName", "CustomerName", dtRBilling); BindMatrix(oMatrix, "InvID", "InvDocNum", dtRBilling); BindMatrix(oMatrix, "CustomerID", "U_CustomerID", dtRBilling); BindMatrix(oMatrix, "Desc", "U_Description", dtRBilling); BindMatrix(oMatrix, "Frequency", "U_Frequency", dtRBilling); BindMatrix(oMatrix, "StartDate", "U_StartDate", dtRBilling); BindMatrix(oMatrix, "EndDate", "U_EndDate", dtRBilling); BindMatrix(oMatrix, "NextRun", "U_NextRunDate", dtRBilling); BindMatrix(oMatrix, "LastRun", "U_LastRunDate", dtRBilling); BindMatrix(oMatrix, "Result", "U_Result", dtRBilling); //BindMatrix(oMatrix, "CancelDate", "CancelledDate", dtRBilling); BindMatrix(oMatrix, "OrderID", "OrderID", dtRBilling); BindMatrix(oMatrix, "Amount", "U_Amount", dtRBilling); oMatrix.LoadFromDataSource(); } catch (Exception ex) { errorLog(ex); errorLog(sql); } }
private void Button0_PressedAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal) { //Cargar_Datos_Matrix(); oDTTable = oForm.DataSources.DataTables.Item("DT_SQL1"); string sql = "DELETE FROM [@ZDFER] WHERE U_Fecha is null"; oDTTable.ExecuteQuery(sql); Cargar_Datos_Matrix(); }
private void OnCustomInitialize() { LoadEvents(); mCmbMvType.Item.DisplayDesc = true; mCmbMvType.ExpandType = SAPbouiCOM.BoExpandType.et_DescriptionOnly; mDtChecks = this.UIAPIRawForm.DataSources.DataTables.Item("DT_Checks"); mDtChecks.BindToMatrix(mMtxChecks); mMtxChecks.AutoResizeColumns(); }
private void createGrid() { oDTGrid = this.oForm.DataSources.DataTables.Add("oDTSub"); oItem = oForm.Items.Add("subGrd", SAPbouiCOM.BoFormItemTypes.it_GRID); oItem.Height = 200; oItem.Width = this.oForm.Width - 30; oItem.Top = 5; oItem.Left = 5; oGrid = (SAPbouiCOM.Grid)oItem.Specific; oGrid.DataTable = oDTGrid; }
public SAPbouiCOM.DataTable BuscarDatosAutorizacion(SAPbouiCOM.DataTable DT_SQL, string ObjType, string sDocNum) { try { string sql = "SELECT * FROM [@ZAUTORI] WHERE U_ObjType = '" + ObjType + "' AND U_DocNum = ISNULL(" + sDocNum + ",0) ORDER BY DocEntry"; DT_SQL.ExecuteQuery(sql); } catch (Exception) {} return(DT_SQL); }
private void Matrix1_ChooseFromListAfter(object sboObject, SAPbouiCOM.SBOItemEventArg pVal) { if (pVal.ColUID == "code") { SAPbouiCOM.ISBOChooseFromListEventArg chflarg = (SAPbouiCOM.ISBOChooseFromListEventArg)pVal; SAPbouiCOM.DataTable dt = chflarg.SelectedObjects; if (dt == null) { this.UIAPIRawForm.Freeze(false); return; } string ItemName = dt.GetValue("ItemName", 0).ToString(); string ItemCode = dt.GetValue("ItemCode", 0).ToString(); this.UIAPIRawForm.Items.Item("Item_23").Click(SAPbouiCOM.BoCellClickType.ct_Regular); Matrix1.Columns.Item("code").Editable = false; Matrix1.Columns.Item("title").Editable = false; (Matrix1.Columns.Item("code").Cells.Item(pVal.Row).Specific as SAPbouiCOM.EditText).Value = ItemCode; (Matrix1.Columns.Item("title").Cells.Item(pVal.Row).Specific as SAPbouiCOM.EditText).Value = ItemName; Matrix1.Columns.Item("code").Editable = true; Matrix1.Columns.Item("title").Editable = true; Matrix1.Columns.Item("batch").Editable = true; Matrix1.Columns.Item("batch").ChooseFromListUID = "CFL_BatchNumber"; Matrix1.AddRow(); (Matrix1.Columns.Item("insID").Cells.Item(pVal.Row + 1).Specific as SAPbouiCOM.EditText).Value = EditText7.Value; } if (pVal.ColUID == "batch") { SAPbouiCOM.ISBOChooseFromListEventArg chflarg = (SAPbouiCOM.ISBOChooseFromListEventArg)pVal; SAPbouiCOM.DataTable dt = chflarg.SelectedObjects; if (dt == null) { this.UIAPIRawForm.Freeze(false); return; } try { var a = dt.GetValue("BatchNum", 0).ToString(); (Matrix1.Columns.Item("batch").Cells.Item(indexRow).Specific as SAPbouiCOM.EditText).Value = a; } catch { (Matrix1.Columns.Item("batch").Cells.Item(indexRow).Specific as SAPbouiCOM.EditText).Value = dt.GetValue("BatchNum", 0).ToString(); UIApp.Forms.ActiveForm.Close(); } indexRow = pVal.Row; } }
/// <summary> /// Initialize components. Called by framework after form created. /// </summary> public override void OnInitializeComponent() { this.dtBatches = this.UIAPIRawForm.DataSources.DataTables.Item("dtBatches"); this.dtSelected = this.UIAPIRawForm.DataSources.DataTables.Item("dtSelected"); this.dtDocuments = this.UIAPIRawForm.DataSources.DataTables.Item("dtDocumnts"); this.dtRecDocuments = this.UIAPIRawForm.DataSources.DataTables.Item("dtRecDocs"); this.dtRecBatches = this.UIAPIRawForm.DataSources.DataTables.Item("dtRBatches"); this.gvBatches = ((SAPbouiCOM.Grid)(this.GetItem("Batches").Specific)); this.btnRemove = ((SAPbouiCOM.Button)(this.GetItem("Remove").Specific)); this.btnSelect = ((SAPbouiCOM.Button)(this.GetItem("Select").Specific)); this.btnSave = ((SAPbouiCOM.Button)(this.GetItem("btnSave").Specific)); this.btnSave.PressedBefore += new SAPbouiCOM._IButtonEvents_PressedBeforeEventHandler(this.btnSave_PressedBefore); this.btnSave.ClickBefore += new SAPbouiCOM._IButtonEvents_ClickBeforeEventHandler(this.btnSave_ClickBefore); this.gvSelectedBatches = ((SAPbouiCOM.Grid)(this.GetItem("SlctdBtchs").Specific)); this.gvDocuments = ((SAPbouiCOM.Grid)(this.GetItem("Documents").Specific)); this.fldrIssueItems = ((SAPbouiCOM.Folder)(this.GetItem("IssBatches").Specific)); this.fldrRecItems = ((SAPbouiCOM.Folder)(this.GetItem("recBatches").Specific)); this.gvRecDocuments = ((SAPbouiCOM.Grid)(this.GetItem("RecDocs").Specific)); this.gvRecDocuments.ClickAfter += new SAPbouiCOM._IGridEvents_ClickAfterEventHandler(this.gvRecDocuments_ClickAfter); this.gvRecBatches = ((SAPbouiCOM.Grid)(this.GetItem("RecBatches").Specific)); this.gvRecBatches.ValidateAfter += new SAPbouiCOM._IGridEvents_ValidateAfterEventHandler(this.gvRecBatches_ValidateAfter); this.gvRecBatches.ValidateBefore += new SAPbouiCOM._IGridEvents_ValidateBeforeEventHandler(this.gvRecBatches_ValidateBefore); this.gvRecBatches.KeyDownAfter += new SAPbouiCOM._IGridEvents_KeyDownAfterEventHandler(this.gvRecBatches_KeyDownAfter); this.gvDocuments.ClickBefore += new SAPbouiCOM._IGridEvents_ClickBeforeEventHandler(this.gvDocuments_ClickBefore); this.gvDocuments.ValidateBefore += new SAPbouiCOM._IGridEvents_ValidateBeforeEventHandler(this.gvDocuments_ValidateBefore); this.gvDocuments.ClickAfter += new SAPbouiCOM._IGridEvents_ClickAfterEventHandler(this.gvDocuments_ClickAfter); this.btnSave.ClickAfter += new SAPbouiCOM._IButtonEvents_ClickAfterEventHandler(this.btnSave_ClickAfter); this.btnSelect.ClickAfter += new SAPbouiCOM._IButtonEvents_ClickAfterEventHandler(this.btnSelect_ClickAfter); this.btnSelect.ClickBefore += new SAPbouiCOM._IButtonEvents_ClickBeforeEventHandler(this.btnSelect_ClickBefore); this.gvBatches.ClickAfter += new SAPbouiCOM._IGridEvents_ClickAfterEventHandler(this.gvBatches_ClickAfter); this.btnRemove.ClickAfter += new SAPbouiCOM._IButtonEvents_ClickAfterEventHandler(this.btnRemove_ClickAfter); this.btnRemove.ClickBefore += new SAPbouiCOM._IButtonEvents_ClickBeforeEventHandler(this.btnRemove_ClickBefore); this.StaticText0 = ((SAPbouiCOM.StaticText)(this.GetItem("Item_8").Specific)); this.StaticText1 = ((SAPbouiCOM.StaticText)(this.GetItem("Item_9").Specific)); this.StaticText2 = ((SAPbouiCOM.StaticText)(this.GetItem("Item_10").Specific)); this.OnCustomInitialize(); }