}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); IvkFormInterface oFormB; String oUid; try { if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction)) { if (pVal.ItemUID == "btn1") { oFormB = (IvkFormInterface)(new TLibros()); TLibros.TipoLibro = "C"; oEditText = (EditText)(oForm.Items.Item("Desde").Specific); TLibros.Desde = oEditText.Value; oEditText = (EditText)(oForm.Items.Item("Hasta").Specific); TLibros.Hasta = oEditText.Value; oUid = FSBOf.generateFormId(FGlobalSettings.SBOSpaceName, FGlobalSettings); oFormB.InitForm(oUid, "forms\\", ref FSBOApp, ref FCmpny, ref FSBOf, ref FGlobalSettings); FoForms.Add(oFormB); } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); try { oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); //FSBOf.LoadForm(xmlPath, 'VID_Entrega.srf', Uid); oForm = FSBOApp.Forms.Item(uid); //Flag := false; /*if (GlobalSettings.RunningUnderSQLServer) * s = "select ISNULL(U_Localidad,'CL') Localidad from [@VID_FEPARAM] where Code = '1'"; * else * s = @"select IFNULL(""U_Localidad"",'CL') ""Localidad"" from ""@VID_FEPARAM"" where ""Code"" = '1' "; * * oRecordSet.DoQuery(s); * if (oRecordSet.RecordCount == 0) * throw new Exception("Debe parametrizar el Addon Factura Electronica"); * else*/ Localidad = "CL";// ((System.String)oRecordSet.Fields.Item("Localidad").Value).Trim(); oForm.Freeze(true); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } oForm.Freeze(false); return(Result); }//fin InitForm
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { Int32 CantRol; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Funciones.SBO_f = FSBOf; try { Lista = new List <string>(); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } finally { if (oForm != null) { oForm.Freeze(false); } } return(Result); }//fin InitForm
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { SAPbouiCOM.DataTable oDataTable; SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.ItemUID == "btnBuscar") && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction)) { if (Validar()) { CargarGrid(); } } if ((pVal.ItemUID == "btnExp") && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction)) { Exportar(); } } catch (Exception e) { if (FCmpny.InTransaction) { FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack); } FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin Initform public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; string sErr; //SAPbouiCOM.DataTable oDataTable; //Int32 iDif; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED) { if ((pVal.ItemUID == "btn1") && (!pVal.BeforeAction)) { BubbleEvent = false; ActualizarRegistrosWS(); } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin InitForm public void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction)) { if ((pVal.ItemUID == "1") && ((oForm.Mode == BoFormMode.fm_ADD_MODE) || (oForm.Mode == BoFormMode.fm_UPDATE_MODE))) { BubbleEvent = false; if (ValidarMatrix()) { GuardarRegistros(); } } } if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction)) { if (pVal.ItemUID == "btnProbar") { ProbarConexion(); } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { //SAPbouiCOM.ComboBox oCombo; SAPbouiCOM.Column oColumn; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); try { oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); //Lista := New list<string>; FSBOf.LoadForm(xmlPath, "VID_IndicadoresSII.srf", uid); //EnableCrystal := true; //oForm = FSBOApp.Forms.Item(uid); oForm = FSBOApp.Forms.ActiveForm; oForm.Freeze(true); oForm.AutoManaged = false; oForm.SupportedModes = -1; // afm_All VID_DelRow = true; VID_DelRowOK = true; oForm.DataBrowser.BrowseBy = "Code"; oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEDOCE"); oDBDSD = oForm.DataSources.DBDataSources.Item("@VID_FEDOCED"); // Ok Ad Fnd Vw Rq Sec //Lista.Add('DocNum , f, f, t, f, n, 1'); //Lista.Add('DocDate , f, t, f, f, r, 1'); //Lista.Add('CardCode , f, t, t, f, r, 1'); //FSBOf.SetAutoManaged(var oForm, Lista); //oCombo := ComboBox(oForm.Items.Item('TipDoc').Specific); //oCombo.ValidValues.Add('33', 'Factura'); //s := '1'; //oCombo.Select(s, BoSearchKey.psk_ByValue); AddChooseFromList(); oMtx = (Matrix)(oForm.Items.Item("mtx").Specific); oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("V_0")); oColumn.ChooseFromListUID = "CFL0"; oColumn.ChooseFromListAlias = "Code"; oMtx.AutoResizeColumns(); //EditText(oForm.Items.Item('CardCode').Specific).Active := True; //oForm.Mode := BoFormMode.fm_OK_MODE; } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } oForm.Freeze(false); return(Result); }//fin InitForm
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; SAPbouiCOM.ComboBox oComboBox; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction)) { if ((pVal.ItemUID == "1") && (oForm.Mode == BoFormMode.fm_ADD_MODE)) { BubbleEvent = false; GuardarRegistros(); } } if ((pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (!pVal.BeforeAction)) { if ((pVal.ItemUID == "TipoDoc") && (oForm.Mode == BoFormMode.fm_ADD_MODE)) { //carga Rango de Folios if (GlobalSettings.RunningUnderSQLServer) { s = @"select Code 'Code', CAST(U_Desde as varchar(20)) + '-' + CAST(U_Hasta as varchar(20)) 'Name' from [@VID_FECAF] where U_TipoDoc = '{0}'"; } else { s = @"select ""Code"" ""Code"", CAST(""U_Desde"" as varchar(20)) + '-' + CAST(""U_Hasta"" as varchar(20)) ""Name"" from ""@VID_FECAF"" where ""U_TipoDoc"" = '{0}' "; } oComboBox = (ComboBox)(oForm.Items.Item("TipoDoc").Specific); s = String.Format(s, (System.String)(oComboBox.Value).Trim()); oRecordSet.DoQuery(s); FSBOf.FillCombo((ComboBox)(oForm.Items.Item("RangoF").Specific), ref oRecordSet, true); } } if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction) && (pVal.ItemUID == "btnDist") && (oForm.Mode == BoFormMode.fm_ADD_MODE)) { if (Validar()) { Distribuir(); } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { SAPbouiCOM.DataTable oDataTable; SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.ItemUID == "87") && (pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (pVal.BeforeAction)) { oComboBox = (ComboBox)(oForm.Items.Item("87").Specific); SerieAnterior = (System.String)(oComboBox.Value); } if ((pVal.ItemUID == "87") && (pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (!pVal.BeforeAction)) { oComboBox = (ComboBox)(oForm.Items.Item("87").Specific); var sSeries = (System.String)(oComboBox.Value); if (GlobalSettings.RunningUnderSQLServer) { s = @"select LEFT(ISNULL(UPPER(BeginStr),''),1) 'Valor', DocSubType, SUBSTRING(ISNULL(UPPER(BeginStr),''),2,LEN(ISNULL(UPPER(BeginStr),''))) 'Doc', ObjectCode, SeriesName from NNM1 where Series = {0} --AND ObjectCode = '{1}' "; } else { s = @"select LEFT(IFNULL(UPPER(""BeginStr""),''),1) ""Valor"", ""DocSubType"", SUBSTRING(IFNULL(UPPER(""BeginStr""),''),2,LENGTH(IFNULL(UPPER(""BeginStr""),''))) ""Doc"", ""ObjectCode"", ""SeriesName"" from ""NNM1"" where ""Series"" = {0} --AND ""ObjectCode"" = '{1}' "; } s = String.Format(s, sSeries, oForm.BusinessObject.Type); oRecordSet.DoQuery(s); if (oRecordSet.RecordCount > 0) { if ((System.String)(oRecordSet.Fields.Item("Valor").Value) == "E") { oForm.Items.Item("VID_Estado").Visible = true; oForm.Items.Item("lblEstado").Visible = true; oForm.Items.Item("VID_FEDCTO").Visible = true; } else { oForm.Items.Item("VID_Estado").Visible = false; oForm.Items.Item("lblEstado").Visible = false; } } } } catch (Exception e) { if (FCmpny.InTransaction) { FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack); } FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; SAPbouiCOM.DataTable oDataTable; String sValue, sValue1; SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction)) { if ((pVal.ItemUID == "1") && (oForm.Mode == BoFormMode.fm_ADD_MODE)) { //BubbleEvent := ValidarDatosFE(); } } if ((pVal.EventType == BoEventTypes.et_CHOOSE_FROM_LIST) && (!pVal.BeforeAction)) { if (pVal.ColUID == "V_0") { oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)(pVal); oDataTable = oCFLEvento.SelectedObjects; if (oDataTable != null) { sValue = (System.String)(oDataTable.GetValue("Code", 0)); sValue1 = (System.String)(oDataTable.GetValue("Name", 0)); oMtx.FlushToDataSource(); oDBDSD.SetValue("U_Indicato", pVal.Row - 1, sValue); oDBDSD.SetValue("U_Descrip", pVal.Row - 1, sValue1); if (pVal.Row == oMtx.RowCount) { oDBDSD.InsertRecord(pVal.Row); } oMtx.LoadFromDataSource(); oMtx.AutoResizeColumns(); if (oForm.Mode == BoFormMode.fm_OK_MODE) { oForm.Mode = BoFormMode.fm_UPDATE_MODE; } } } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if (pVal.ItemUID == "3") { if ((pVal.ColUID == "Code") && (!pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_COMBO_SELECT)) { if (pVal.Row == oDataTable.Rows.Count - 1) { if ((System.String)(oDataTable.GetValue("Code", oDataTable.Rows.Count - 1)) != "") { oDataTable.Rows.Add(1); oDataTable.SetValue("Code", oDataTable.Rows.Count - 1, ""); oDataTable.SetValue("Name", oDataTable.Rows.Count - 1, ""); oDataTable.SetValue("U_TypeCode", oDataTable.Rows.Count - 1, ""); } } } } if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction)) { var paso = false; if ((pVal.ItemUID == "1") && ((oForm.Mode == BoFormMode.fm_ADD_MODE) || (oForm.Mode == BoFormMode.fm_UPDATE_MODE))) { BubbleEvent = false; if (LimpiarGrid()) { paso = CrearDatos(); } if ((paso) && (oForm.Mode != BoFormMode.fm_OK_MODE)) { oForm.Mode = BoFormMode.fm_OK_MODE; } } else if ((pVal.ItemUID == "1") && (oForm.Mode == BoFormMode.fm_OK_MODE)) { BubbleEvent = true; } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; SAPbouiCOM.EditText oEditText; SAPbouiCOM.ComboBox oComboBox; SAPbouiCOM.CommonSetting oSetting; Int32 i; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED) { if ((pVal.ItemUID == "1") && ((oForm.Mode == BoFormMode.fm_ADD_MODE) || (oForm.Mode == BoFormMode.fm_UPDATE_MODE)) && (pVal.BeforeAction)) { BubbleEvent = false; if (Limpiar()) { GuardarRegistros(); oMtx.FlushToDataSource(); i = oMtx.RowCount + 1; oMtx.AddRow(1, i); oEditText = (EditText)(oMtx.Columns.Item("Code").Cells.Item(i).Specific); oEditText.Value = ""; oEditText = (EditText)(oMtx.Columns.Item("Name").Cells.Item(i).Specific); oEditText.Value = ""; oComboBox = (ComboBox)(oMtx.Columns.Item("Habilitada").Cells.Item(i).Specific); oComboBox.Select("Y", BoSearchKey.psk_ByValue); oSetting = oMtx.CommonSetting; i = 1; while (i < oMtx.RowCount) { if ((System.String)(oDBDSH.GetValue("Code", i - 1)).Trim() != "") { oSetting.SetCellEditable(i, 1, false); } i++; } } } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin MenuEvent private void GuardarRegistros() { TFunctions Reg; Int32 i; Int32 DocEntryAsig; String User, Pass; try { if (ValidarMatrix()) { Reg = new TFunctions(); Reg.SBO_f = FSBOf; oMtx.FlushToDataSource(); FCmpny.StartTransaction(); i = 0; while (i < oMtx.RowCount) { User = (System.String)(oDBDSH.GetValue("U_Usuario", i)); Pass = (System.String)(oDBDSH.GetValue("U_Password", i)); //s = Reg.Encriptar(Pass); oDBDSH.SetValue("U_Password", i, Pass); if ((System.String)(oDBDSH.GetValue("DocEntry", i)) == "") { DocEntryAsig = Reg.FEMultiSocAdd((System.String)(oDBDSH.GetValue("U_Servidor", i)), (System.String)(oDBDSH.GetValue("U_RUT", i)), (System.String)(oDBDSH.GetValue("U_Base", i)), (System.String)(oDBDSH.GetValue("U_Usuario", i)), (System.String)(oDBDSH.GetValue("U_Password", i)), (System.String)(oDBDSH.GetValue("U_Sociedad", i)), (System.String)(oDBDSH.GetValue("U_Habilitada", i))); oDBDSH.SetValue("DocEntry", i, DocEntryAsig.ToString()); } else { Reg.FEMultiSocUpt((System.String)(oDBDSH.GetValue("DocEntry", i)), (System.String)(oDBDSH.GetValue("U_Servidor", i)), (System.String)(oDBDSH.GetValue("U_RUT", i)), (System.String)(oDBDSH.GetValue("U_Base", i)), (System.String)(oDBDSH.GetValue("U_Usuario", i)), (System.String)(oDBDSH.GetValue("U_Password", i)), (System.String)(oDBDSH.GetValue("U_Sociedad", i)), (System.String)(oDBDSH.GetValue("U_Habilitada", i))); } //oDBDSH.SetValue("U_Password", i, Pass); i++; } FCmpny.EndTransaction(BoWfTransOpt.wf_Commit); oDBDSH.InsertRecord(i); oMtx.LoadFromDataSource(); oMtx.AutoResizeColumns(); FSBOApp.StatusBar.SetText("Sociedades registradas satisfactoriamente", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } } catch (Exception e) { FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace); if (FCmpny.InTransaction) { FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack); } } }//fin GuardarRegistros
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { //SAPbouiCOM.DataTable oDataTable; //SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; Boolean bRes = false; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.ItemUID == "1") && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction)) { if (oForm.Mode == BoFormMode.fm_OK_MODE) { BubbleEvent = true; } else { BubbleEvent = false; if (oForm.Mode == BoFormMode.fm_ADD_MODE) { oDBDSHeader.SetValue("Code", 0, "1"); bRes = Funciones.AddDataSource1("VID_mSU", oDBDSHeader, "", null, "", null, "", null, "", null); } else if (oForm.Mode == BoFormMode.fm_UPDATE_MODE) { bRes = Funciones.UpdDataSource1("M", ((System.String)oDBDSHeader.GetValue("Code", 0)).Trim(), "VID_mSU", oDBDSHeader, "", null, "", null, "", null, "", null); } if (bRes) { oForm.Mode = BoFormMode.fm_OK_MODE; FSBOApp.StatusBar.SetText("Se registraron satisfactoriamente los datos", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } else { FSBOApp.StatusBar.SetText("No se ha registrado los datos", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } } } } catch (Exception e) { if (FCmpny.InTransaction) { FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack); } FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { Int32 CantRol; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Funciones.SBO_f = FSBOf; try { //Lista = new List<string>(); FSBOf.LoadForm(xmlPath, "VID_FECTASAP.srf", uid); oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = true; if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT COUNT(*) AS cant FROM [@VID_FEPLANCTA] WHERE DocEntry = {0}"; } else { s = @"SELECT COUNT(*) ""cant"" FROM ""@VID_FEPLANCTA"" WHERE ""DocEntry"" = {0} "; } s = String.Format(s, DocEntry); oRecordSet.DoQuery(s); oForm.SupportedModes = (((System.Int32)oRecordSet.Fields.Item("cant").Value) > 0 ? 1 : 3); oForm.Mode = (((System.Int32)oRecordSet.Fields.Item("cant").Value) > 0 ? BoFormMode.fm_OK_MODE : BoFormMode.fm_ADD_MODE); oDBDSDetalle = oForm.DataSources.DBDataSources.Add("@VID_FEPLANCTAD"); odt = oForm.DataSources.DataTables.Add("Cuentas"); oGrid = ((SAPbouiCOM.Grid)oForm.Items.Item("grid").Specific); oGrid.DataTable = odt; oGrid.SelectionMode = BoMatrixSelect.ms_Single; AddChooseFromList(); CargarGrilla(); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } finally { oForm.Freeze(false); } return(Result); }//fin InitForm
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); //IvkFormInterface oFormB; String oUid; String AbsDesde; String FDesde, FHasta; String TipoLibro; try { if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction)) { if (pVal.ItemUID == "btn1") { //enviar libro al portal oComboBox = ((ComboBox)oForm.Items.Item("Periodo").Specific); AbsDesde = oComboBox.Selected.Value; if (GlobalSettings.RunningUnderSQLServer) { s = @"select F_RefDate, T_RefDate,* from OFPR where AbsEntry = {0}"; } else { s = @"select ""F_RefDate"", ""T_RefDate"" from ""OFPR"" where ""AbsEntry"" = {0}"; } s = String.Format(s, AbsDesde); oRecordSet.DoQuery(s); FDesde = ((System.DateTime)oRecordSet.Fields.Item("F_RefDate").Value).ToString("yyyyMMdd"); FHasta = ((System.DateTime)oRecordSet.Fields.Item("T_RefDate").Value).ToString("yyyyMMdd"); oComboBox = ((ComboBox)oForm.Items.Item("TipoLibro").Specific); TipoLibro = oComboBox.Selected.Value; if (FSBOApp.MessageBox("¿ Desea enviar libro electronico al portal ?", 1, "Si", "No", "") == 1) { EnviarLibros(TipoLibro, FDesde, FHasta); } } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { SAPbouiCOM.ComboBox oComboBox; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); try { oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Lista = new List <string>(); FSBOf.LoadForm(xmlPath, "VID_FERESFOL.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = false; oForm.SupportedModes = -1; // afm_All oForm.EnableMenu("1281", false); //Buscar oForm.EnableMenu("1282", false); //Crear //VID_DelRow := true; //VID_DelRowOK := true; // oForm.DataBrowser.BrowseBy := "Code"; // oDBDSCAF := oForm.DataSources.DBDataSources.Add("@VID_FECAF"); // oDBDSDISTH := oForm.DataSources.DBDataSources.Add("@VID_FEDIST"); // oDBDSDISTD := oForm.DataSources.DBDataSources.Add("@VID_FEDISTD"); ogrid = (Grid)(oForm.Items.Item("grid").Specific); oDataTable = oForm.DataSources.DataTables.Add("dt"); ogrid.DataTable = oDataTable; FSBOApp.StatusBar.SetText("Actualizando estado de folios asignados", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning); ActualizarRegistros(); // Ok Ad Fnd Vw Rq Sec // Lista.Add('TipoDoc , f, t, t, f, r, 1'); // FSBOf.SetAutoManaged(var oForm, Lista); oForm.Mode = BoFormMode.fm_OK_MODE; } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } oForm.Freeze(false); return(Result); }//fin InitForm
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { Int32 CantRol; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Funciones.SBO_f = FSBOf; try { //Lista = new List<string>(); FSBOf.LoadForm(xmlPath, "VID_FEListaNegra.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = false; oForm.SupportedModes = -1; // afm_All oForm.EnableMenu("1282", false); //Crear oForm.EnableMenu("1281", false); //Actualizar ogrid = ((Grid)oForm.Items.Item("ogrid").Specific); oDBDSHeader = ((DBDataSource)oForm.DataSources.DBDataSources.Item("@VID_FELISTANE")); ogrid.DataTable = oForm.DataSources.DataTables.Add("dt"); AddChooseFromList(); CargarGrid(); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } finally { if (oForm != null) { oForm.Freeze(false); } } return(Result); }//fin InitForm
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { SAPbouiCOM.DataTable oDataTable; SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { } catch (Exception e) { if (FCmpny.InTransaction) { FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack); } FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { SAPbouiCOM.DataTable oDataTable; SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.ItemUID == "Buscar") && (!pVal.BeforeAction)) { var DateD = DateTime.ParseExact(((EditText)oForm.Items.Item("FechaD").Specific).Value, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); var DateH = DateTime.ParseExact(((EditText)oForm.Items.Item("FechaH").Specific).Value, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture); TimeSpan ts = DateH - DateD; var differenceInDays = ts.Days + 1; if (differenceInDays > 31) { FSBOApp.StatusBar.SetText("El intervalo de fechas no puede ser superior a 30 dias", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning); } else { BuscarDatos(); } } if ((pVal.EventType == BoEventTypes.et_DOUBLE_CLICK) && (!pVal.BeforeAction) && (pVal.ColUID == "Folio")) { var TipoDTE = ((System.String)((ComboBox)oForm.Items.Item("TipoDTE").Specific).Selected.Value).Trim(); if (TipoDTE == "C") { MostrarPDF(pVal.Row); } } } catch (Exception e) { if (FCmpny.InTransaction) { FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack); } FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.EventType == BoEventTypes.et_FORM_ACTIVATE) && (!pVal.BeforeAction)) { GlobalSettings.PrevFormUID = oForm.UniqueID; } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { SAPbouiCOM.DataTable oDataTable; SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if (pVal.EventType == BoEventTypes.et_ITEM_PRESSED && pVal.BeforeAction) { if (pVal.ItemUID == "1" && oForm.Mode == BoFormMode.fm_ADD_MODE) { BubbleEvent = false; if (Validar(true)) { GuardarRegistros(); } } } if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction)) { if (pVal.ItemUID == "btnBuscar" && oForm.Mode == BoFormMode.fm_ADD_MODE) { if (Validar(false)) { BuscarRegistros(); } } } } catch (Exception e) { if (FCmpny.InTransaction) { FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack); } FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { //SAPbouiCOM.ComboBox oComboBox; SAPbouiCOM.Column oColumn; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); try { oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); //Lista := New list<string>; FSBOf.LoadForm(xmlPath, "VID_LibroCompra.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = false; oForm.SupportedModes = -1; // afm_All oForm.EnableMenu("1281", false); //Actualizar oForm.EnableMenu("1282", false); //Crear oForm.DataSources.UserDataSources.Add("Desde", BoDataType.dt_DATE, 10); oEditText = (EditText)(oForm.Items.Item("Desde").Specific); oEditText.DataBind.SetBound(true, "", "Desde"); oEditText.Value = DateTime.Now.ToString("yyyyMM") + "01"; oForm.DataSources.UserDataSources.Add("Hasta", BoDataType.dt_DATE, 10); oEditText = (EditText)(oForm.Items.Item("Hasta").Specific); oEditText.DataBind.SetBound(true, "", "Hasta"); oEditText.Value = DateTime.Now.ToString("yyyyMMdd"); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } oForm.Freeze(false); return(Result); }//fin InitForm
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); try { oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); //FSBOf.LoadForm(xmlPath, 'VID_Entrega.srf', Uid); oForm = FSBOApp.Forms.Item(uid); //Flag := false; oForm.Freeze(true); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } oForm.Visible = true; oForm.Freeze(false); return(Result); }//fin InitForm
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { Int32 CantRol; SAPbouiCOM.Folder oFolder; SAPbouiCOM.Item oItem; SAPbouiCOM.Item oItemB; Boolean Flag; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Funciones.SBO_f = FSBOf; try { Lista = new List <string>(); oForm = FSBOApp.Forms.Item(uid); Flag = false; oForm.Freeze(true); if (GlobalSettings.RunningUnderSQLServer) { s = "select ISNULL(TaxIdNum,'') TaxIdNum from OADM "; } else { s = @"select IFNULL(""TaxIdNum"",'') ""TaxIdNum"" from ""OADM"" "; } oRecordSet.DoQuery(s); if (oRecordSet.RecordCount == 0) { throw new Exception("Debe ingresar RUC de Emisor, Gestión -> Inicialización Sistema -> Detalle Sociedad -> Datos de Contabilidad -> ID fiscal general 1"); } else { RUC = ((System.String)oRecordSet.Fields.Item("TaxIdNum").Value).Trim(); } //Campo con el estado de DTE oItemB = oForm.Items.Item("53"); oItem = oForm.Items.Add("lblEstado", SAPbouiCOM.BoFormItemTypes.it_STATIC); oItem.Left = oItemB.Left; oItem.Width = oItemB.Width; oItem.Top = oItemB.Top + oItemB.Height + 5; oItem.Height = oItem.Height; oItem.LinkTo = "VID_FEEstado"; oStatic = (StaticText)(oForm.Items.Item("lblEstado").Specific); oStatic.Caption = "Estado Doc. Electronico"; oItemB = oForm.Items.Item("52"); oItem = oForm.Items.Add("VID_Estado", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX); oItem.Left = oItemB.Left; oItem.Width = oItemB.Width; oItem.Top = oItemB.Top + oItemB.Height + 5; oItem.Height = oItem.Height; oItem.DisplayDesc = true; oItem.Enabled = false; oComboBox = (ComboBox)(oForm.Items.Item("VID_Estado").Specific); //colocar folder con los campos necesarios en FE PERU //oForm.DataSources.UserDataSources.Add("VID_FEDCTO", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1); //oItem = oForm.Items.Add("VID_FEDCTO", SAPbouiCOM.BoFormItemTypes.it_FOLDER); //oItemB = oForm.Items.Item("1320002137"); //oItem.Left = oItemB.Left + 30; //oItem.Width = oItemB.Width; //oItem.Top = oItemB.Top; //oItem.Height = oItem.Height; //oFolder = (Folder)((oItem.Specific)); //oFolder.Caption = "Factura Electrónica"; //oFolder.Pane = 333; //oFolder.DataBind.SetBound(true, "", "VID_FEDCTO"); //para SAP 882 en adelante //oFolder.GroupWith("1320002137"); //cargar campos de usuarios oItemB = oForm.Items.Item("lblEstado"); oItem = oForm.Items.Add("lblPTSC", SAPbouiCOM.BoFormItemTypes.it_STATIC); oItem.Left = oItemB.Left; oItem.Width = oItemB.Width; oItem.Top = oItemB.Top + oItemB.Height + 5; oItem.Height = oItemB.Height; //oItem.FromPane = 333; //oItem.ToPane = 333; oItem.LinkTo = "VID_FEPTSC"; oStatic = (StaticText)(oForm.Items.Item("lblPTSC").Specific); oStatic.Caption = "Serie del documento"; oItemB = oForm.Items.Item("VID_Estado"); oItem = oForm.Items.Add("VID_FEPTSC", SAPbouiCOM.BoFormItemTypes.it_EDIT); oItem.Left = oItemB.Left; oItem.Width = 90; // oItemB.Width; oItem.Top = oItemB.Top + oItemB.Height + 5; oItem.Height = oItemB.Height; //oItem.FromPane = 333; //oItem.ToPane = 333; oItem.RightJustified = true; oEditText = (EditText)(oForm.Items.Item("VID_FEPTSC").Specific); oEditText.DataBind.SetBound(true, "OVPM", "U_BPP_PTSC"); //-- oItemB = oForm.Items.Item("lblPTSC"); oItem = oForm.Items.Add("lblPTCC", SAPbouiCOM.BoFormItemTypes.it_STATIC); oItem.Left = oItemB.Left; oItem.Width = oItemB.Width; oItem.Top = oItemB.Top + oItemB.Height + 5; oItem.Height = oItemB.Height; //oItem.FromPane = 333; //oItem.ToPane = 333; oItem.LinkTo = "VID_FEPTCC"; oStatic = (StaticText)(oForm.Items.Item("lblPTCC").Specific); oStatic.Caption = "Correlativo del documento"; oItemB = oForm.Items.Item("VID_FEPTSC"); oItem = oForm.Items.Add("VID_FEPTCC", SAPbouiCOM.BoFormItemTypes.it_EDIT); oItem.Left = oItemB.Left; oItem.Width = 90; // oItemB.Width; oItem.Top = oItemB.Top + oItemB.Height + 5; oItem.Height = oItemB.Height; //oItem.FromPane = 333; //oItem.ToPane = 333; oItem.RightJustified = true; oEditText = (EditText)(oForm.Items.Item("VID_FEPTCC").Specific); oEditText.DataBind.SetBound(true, "OVPM", "U_BPP_PTCC"); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } finally { if (oForm != null) { oForm.Visible = true; oForm.Freeze(false); } } return(Result); }//fin InitForm
}//fin FormDataEvent public new void MenuEvent(ref MenuEvent pVal, ref Boolean BubbleEvent) { //Int32 Entry; base.MenuEvent(ref pVal, ref BubbleEvent); SAPbobsCOM.Recordset orsx = ((SAPbobsCOM.Recordset)FCmpny.GetBusinessObject(BoObjectTypes.BoRecordset)); try { //1281 Buscar; //1282 Crear //1284 cancelar; //1285 Restablecer; //1286 Cerrar; //1288 Registro siguiente; //1289 Registro anterior; //1290 Primer Registro; //1291 Ultimo Registro; if ((pVal.MenuUID != "") && (pVal.BeforeAction == false)) { //if (ObjType == "203") // DocSubType = ((System.String)oForm.DataSources.DBDataSources.Item("ODPI").GetValue("DocSubType", 0)).Trim(); //else // DocSubType = ((System.String)oForm.DataSources.DBDataSources.Item("OINV").GetValue("DocSubType", 0)).Trim(); if ((pVal.MenuUID == "1288") || (pVal.MenuUID == "1289") || (pVal.MenuUID == "1290") || (pVal.MenuUID == "1291") || (pVal.MenuUID == "1304")) { oForm.Freeze(true); //oForm.Items.Item("VID_Estado").Enabled = false; oComboBox = (ComboBox)(oForm.Items.Item("87").Specific); var sSeries = (System.String)(oComboBox.Value); if (GlobalSettings.RunningUnderSQLServer) { s = @"select LEFT(ISNULL(UPPER(BeginStr),''),1) 'Valor', DocSubType, SUBSTRING(ISNULL(UPPER(BeginStr),''),2,LEN(ISNULL(UPPER(BeginStr),''))) 'Doc', ObjectCode from NNM1 where Series = {0} --AND ObjectCode = '{1}' "; } else { s = @"select LEFT(IFNULL(UPPER(""BeginStr""),''),1) ""Valor"", ""DocSubType"", SUBSTRING(IFNULL(UPPER(""BeginStr""),''),2,LENGTH(IFNULL(UPPER(""BeginStr""),''))) ""Doc"", ""ObjectCode"" from ""NNM1"" where ""Series"" = {0} --AND ""ObjectCode"" = '{1}' "; } s = String.Format(s, sSeries, oForm.BusinessObject.Type); orsx.DoQuery(s); if (orsx.RecordCount > 0) { if (((System.String)orsx.Fields.Item("Valor").Value).Trim() == "E") { oForm.Items.Item("VID_Estado").Visible = true; oForm.Items.Item("VID_Estado").Enabled = false; oForm.Items.Item("lblEstado").Visible = true; } else { oForm.Items.Item("VID_Estado").Visible = false; oForm.Items.Item("lblEstado").Visible = false; } } oForm.Freeze(false); } if ((pVal.MenuUID == "1282") || (pVal.MenuUID == "1281") || (pVal.MenuUID == "1287")) { oForm.Freeze(true); //oForm.Items.Item("VID_Estado").Enabled = false; oComboBox = (ComboBox)(oForm.Items.Item("87").Specific); var sSeries = (System.String)(oComboBox.Value); if (GlobalSettings.RunningUnderSQLServer) { s = @"select LEFT(ISNULL(UPPER(BeginStr),''),1) 'Valor', DocSubType, SUBSTRING(ISNULL(UPPER(BeginStr),''),2,LEN(ISNULL(UPPER(BeginStr),''))) 'Doc', ObjectCode from NNM1 where Series = {0} --AND ObjectCode = '{1}' "; } else { s = @"select LEFT(IFNULL(UPPER(""BeginStr""),''),1) ""Valor"", ""DocSubType"", SUBSTRING(IFNULL(UPPER(""BeginStr""),''),2,LENGTH(IFNULL(UPPER(""BeginStr""),''))) ""Doc"", ""ObjectCode"" from ""NNM1"" where ""Series"" = {0} --AND ""ObjectCode"" = '{1}' "; } s = String.Format(s, sSeries, oForm.BusinessObject.Type); orsx.DoQuery(s); if (orsx.RecordCount > 0) { if ((System.String)(orsx.Fields.Item("Valor").Value) == "E") { oForm.Items.Item("VID_Estado").Visible = true; oForm.Items.Item("VID_Estado").Enabled = false; oForm.Items.Item("lblEstado").Visible = true; } else { oForm.Items.Item("VID_Estado").Visible = false; oForm.Items.Item("lblEstado").Visible = false; } } oForm.Freeze(false); } } } catch (Exception e) { FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); OutLog("MenuEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin MenuEvent
public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { //SAPbouiCOM.ComboBox oCombo; SAPbouiCOM.GridColumn oColumn; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); try { oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Funciones.SBO_f = FSBOf; Lista = new List <string>(); FSBOf.LoadForm(xmlPath, "VID_FECAF.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = false; oForm.SupportedModes = -1; // afm_All oForm.EnableMenu("1281", false); //Buscar oForm.EnableMenu("1282", false); //Crear // VID_DelRow := true; // VID_DelRowOK := true; // oForm.DataBrowser.BrowseBy := "Code"; oDBDSH = oForm.DataSources.DBDataSources.Add("@VID_FECAF"); ogrid = (Grid)(oForm.Items.Item("grid").Specific); oDataTable = oForm.DataSources.DataTables.Add("dt"); ogrid.DataTable = oDataTable; if (GlobalSettings.RunningUnderSQLServer) { s = @"select ISNULL(U_MultiSoc,'N') MultiSoc from [@VID_FEPARAM]"; } else { s = @"select IFNULL(""U_MultiSoc"",'N') ""MultiSoc"" from ""@VID_FEPARAM"" "; } oRecordSet.DoQuery(s); if (oRecordSet.RecordCount > 0) { if (((System.String)oRecordSet.Fields.Item("MultiSoc").Value).Trim() == "Y") { bMultiSoc = true; } else { bMultiSoc = false; } } else { bMultiSoc = false; } ActualizarGrilla(); // Ok Ad Fnd Vw Rq Sec // Lista.Add('TipoDoc , f, t, t, f, r, 1'); // FSBOf.SetAutoManaged(var oForm, Lista); oForm.Mode = BoFormMode.fm_OK_MODE; } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } oForm.Freeze(false); return(Result); }//fin Initform
}//fin InitForm public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent) { Int32 nErr; String sErr; SAPbouiCOM.Form oFormAux; String DocEntry; String Tabla; XmlDocument _xmlDocument; XmlNode N; Boolean FolioUnico; SAPbouiCOM.EditText oEditText; String[] FE52 = { "15", "67", "21" }; base.FormEvent(FormUID, ref pVal, ref BubbleEvent); try { if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction)) { if (Localidad == "CL") { if (pVal.ItemUID == "4") { s = GlobalSettings.PrevFormUID; oFormAux = FSBOApp.Forms.Item(s); //if (oFormAux.BusinessObject.Type in ['15','67']) if (FE52.Contains(oFormAux.BusinessObject.Type)) { if (GlobalSettings.RunningUnderSQLServer) { s = @"select isnull(U_FolioGuia,'N') FolioUnico from [@VID_FEPARAM] where code = '1'"; } else { s = @"select IFNULL(""U_FolioGuia"",'N') ""FolioUnico"" from ""@VID_FEPARAM"" where ""Code"" = '1' "; } oRecordSet.DoQuery(s); if ((System.String)(oRecordSet.Fields.Item("FolioUnico").Value) == "Y") { FolioUnico = true; } else { FolioUnico = false; } if (FolioUnico) { if (oFormAux.BusinessObject.Type == "15") { Tabla = "ODLN"; } else if (oFormAux.BusinessObject.Type == "21") { Tabla = "ORPD"; } else { Tabla = "OWTR"; } _xmlDocument = new XmlDocument(); _xmlDocument.LoadXml(oFormAux.BusinessObject.Key); N = _xmlDocument.SelectSingleNode("DocumentParams"); DocEntry = N.InnerText; if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT Count(*) Cont FROM NNM1 T0 JOIN {0} T1 ON T1.Series = T0.Series WHERE (SUBSTRING(UPPER(T0.BeginStr), 1, 1) = 'E') AND T1.DocEntry = {1} --AND T0.ObjectCode = '{2}'"; } else { s = @"SELECT Count(*) ""Cont"" FROM ""NNM1"" T0 JOIN ""{0}"" T1 ON T1.""Series"" = T0.""Series"" WHERE (SUBSTRING(UPPER(T0.""BeginStr""), 1, 1) = 'E') AND T1.""DocEntry"" = {1} --AND T0.""ObjectCode"" = '{2}'"; } s = String.Format(s, Tabla, DocEntry, oFormAux.BusinessObject.Type); oRecordSet.DoQuery(s); if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0) { BubbleEvent = false; oForm.Close(); } } } } } } if ((pVal.EventType == BoEventTypes.et_FORM_LOAD) && (!pVal.BeforeAction)) { s = GlobalSettings.PrevFormUID; oFormAux = FSBOApp.Forms.Item(s); //if (oFormAux.BusinessObject.Type in ['15','67']) if (Localidad == "CL") { if (FE52.Contains(oFormAux.BusinessObject.Type)) { if (GlobalSettings.RunningUnderSQLServer) { s = @"select isnull(U_FolioGuia,'N') FolioUnico from [@VID_FEPARAM] where code = '1'"; } else { s = @"select IFNULL(""U_FolioGuia"",'N') ""FolioUnico"" from ""@VID_FEPARAM"" where ""Code"" = '1'"; } oRecordSet.DoQuery(s); if ((System.String)(oRecordSet.Fields.Item("FolioUnico").Value) == "Y") { FolioUnico = true; } else { FolioUnico = false; } if (FolioUnico) { if (oFormAux.BusinessObject.Type == "15") { Tabla = "ODLN"; } else if (oFormAux.BusinessObject.Type == "21") { Tabla = "ORPD"; } else { Tabla = "OWTR"; } _xmlDocument = new XmlDocument(); _xmlDocument.LoadXml(oFormAux.BusinessObject.Key); N = _xmlDocument.SelectSingleNode("DocumentParams"); DocEntry = N.InnerText; if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT Count(*) Cont FROM NNM1 T0 JOIN {0} T1 ON T1.Series = T0.Series WHERE (SUBSTRING(UPPER(T0.BeginStr), 1, 1) = 'E') AND T1.DocEntry = {1} --AND T0.ObjectCode = '{2}'"; } else { s = @"SELECT Count(*) ""Cont"" FROM ""NNM1"" T0 JOIN ""{0}"" T1 ON T1.""Series"" = T0.""Series"" WHERE (SUBSTRING(UPPER(T0.""BeginStr""), 1, 1) = 'E') AND T1.""DocEntry"" = {1} --AND T0.""ObjectCode"" = '{2}'"; } s = String.Format(s, Tabla, DocEntry, oFormAux.BusinessObject.Type); oRecordSet.DoQuery(s); if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0) { if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT 'GE' BeginStr, NextNumber FROM NNM1 WHERE (ObjectCode = 'VD_FEEntreg')"; } else { s = @"SELECT 'GE' ""BeginStr"", ""NextNumber"" FROM ""NNM1"" WHERE (""ObjectCode"" = 'VD_FEEntreg')"; } oRecordSet.DoQuery(s); s = Convert.ToString((System.Int32)(oRecordSet.Fields.Item("NextNumber").Value)); oEditText = (EditText)(oForm.Items.Item("7").Specific); oEditText.Value = s; } } } } } } catch (Exception e) { FCmpny.GetLastError(out nErr, out sErr); FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin FormEvent
}//fin ActualizarRegistros private void ActualizarRegistros() { TFunctions Reg; String sCode = ""; SqlDataAdapter cmd; //SqlDataAdapter cmd2; SqlConnection ConexionADO; System.Data.DataTable resultDataTable; //System.Data.DataTable resultDataTable1; Int32 i; Boolean _return; String sCnn; SAPbouiCOM.GridColumn oColumn; Boolean bExiste; SqlCommand cmd1; Int32 iDif; String User, Pass, sDocEntry; SAPbobsCOM.Recordset orsAux; try { ActualizarGrilla(); orsAux = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); if (bMultiSoc) { if (GlobalSettings.RunningUnderSQLServer) { s = @"select DocEntry, U_Servidor, U_Base, U_Usuario, U_Password from [@VID_FEMULTISOC] where U_Habilitada = 'Y'"; } else { s = @"select TO_VARCHAR(""DocEntry"") ""DocEntry"", ""U_Servidor"", ""U_Base"", ""U_Usuario"", ""U_Password"" from ""@VID_FEMULTISOC"" where ""U_Habilitada"" = 'Y' "; } } else { if (GlobalSettings.RunningUnderSQLServer) { s = @"select TOP 1 * from [@VID_FEPARAM]"; } else { s = @"select TOP 1 * from ""@VID_FEPARAM"" "; } } oRecordSet.DoQuery(s); if (oRecordSet.RecordCount > 0) { Reg = new TFunctions(); Reg.SBO_f = FSBOf; while (!oRecordSet.EoF) { if (bMultiSoc) { User = (System.String)(oRecordSet.Fields.Item("U_Usuario").Value); Pass = (System.String)(oRecordSet.Fields.Item("U_Password").Value); } else { User = Reg.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Usuario").Value)); Pass = Reg.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Password").Value)); } sCnn = Reg.sConexion((System.String)(oRecordSet.Fields.Item("U_Servidor").Value), (System.String)(oRecordSet.Fields.Item("U_Base").Value), User, Pass); sDocEntry = Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value)); if (sCnn.Substring(0, 1) != "E") { ConexionADO = new SqlConnection(sCnn); if (ConexionADO.State == ConnectionState.Closed) { ConexionADO.Open(); } s = @"SELECT CAST(TPDOCUMENTO AS VARCHAR(20)) 'TipoDoc' ,CAST(RANGODESDE AS VARCHAR(20)) 'Desde' ,CAST(RANGOHASTA AS VARCHAR(20)) 'Hasta' ,CONVERT(Char(8),FECHA,112) 'Fecha' ,CAST((RANGOHASTA - (RANGODESDE + UTILIZADOS)) + 1 AS VARCHAR(20)) 'Asig' ,CAST(ID as varchar(20)) 'ID' ,CAST((RANGODESDE + UTILIZADOS) AS VARCHAR(20)) 'FolioDesde' ,CAST(UTILIZADOS AS VARCHAR(20)) 'Utilizados' ,ISNULL(XML_CAF,'') 'XML_CAF' FROM folios WITH(nolock)"; cmd = new SqlDataAdapter(s, ConexionADO); resultDataTable = new System.Data.DataTable(); cmd.Fill(resultDataTable); foreach (System.Data.DataRow oRow in resultDataTable.Rows) { bExiste = false; i = 0; if (!oDataTable.IsEmpty) { while (i < oDataTable.Rows.Count) { s = oDataTable.Rows.Count.ToString(); var dFecha = (System.DateTime)(oDataTable.GetValue("U_Fecha", i)); if (((System.String)(oDataTable.GetValue("U_TipoDoc", i)) == oRow.Field <String>("TipoDoc").ToString()) && (Convert.ToString((System.Int32)(oDataTable.GetValue("U_Desde", i))) == oRow.Field <String>("Desde")) && (Convert.ToString((System.Int32)(oDataTable.GetValue("U_Hasta", i))) == oRow.Field <String>("Hasta")) && (dFecha.ToString("yyyyMMdd") == oRow.Field <String>("Fecha"))) { bExiste = true; i = oDataTable.Rows.Count; } i++; } } if (!bExiste) { sCode = Reg.sNuevoDocEntryLargo("@VID_FECAF", GlobalSettings.RunningUnderSQLServer); oDBDSH.Clear(); oDBDSH.InsertRecord(0); oDBDSH.SetValue("Code", 0, sCode); //OutLog("Code -> " + oDBDSH.GetValue("Code",0)); oDBDSH.SetValue("U_TipoDoc", 0, oRow.Field <String>("TipoDoc")); //OutLog("TipoDoc -> " + oDBDSH.GetValue("U_TipoDoc", 0)); oDBDSH.SetValue("U_Desde", 0, oRow.Field <String>("Desde")); //OutLog("Desde -> " + oDBDSH.GetValue("U_Desde", 0)); oDBDSH.SetValue("U_Hasta", 0, oRow.Field <String>("Hasta")); //OutLog("Hasta -> " + oDBDSH.GetValue("U_Hasta", 0)); oDBDSH.SetValue("U_Fecha", 0, oRow.Field <String>("Fecha")); //OutLog("Fecha -> " + oDBDSH.GetValue("U_Fecha", 0)); oDBDSH.SetValue("U_BaseMul", 0, sDocEntry); //OutLog("BaseMul -> " + oDBDSH.GetValue("U_BaseMul", 0)); s = oRow.Field <String>("XML_CAF"); oDBDSH.SetValue("U_CAF", 0, s); //OutLog("CAF -> " + oDBDSH.GetValue("U_CAF", 0)); iDif = (Int32.Parse(oRow.Field <String>("Hasta")) - Int32.Parse(oRow.Field <String>("Desde"))) + 1; cmd1 = new SqlCommand(); cmd1.CommandTimeout = 0; cmd1.CommandType = CommandType.Text; cmd1.Connection = ConexionADO; s = @"WITH n(n) AS ( SELECT 1 UNION ALL SELECT n + 1 FROM n WHERE n < {0} ) SELECT COUNT(*) --n + {1} , T0.CAB_FOL_DOCTO_INT FROM n left outer join Faet_Erp_Encabezado_Doc T0 on n.n + {1} = T0.CAB_FOL_DOCTO_INT and T0.CAB_COD_TP_FACTURA = '{2}' and T0.CAB_FOL_DOCTO_INT between {3} and {4} where t0.CAB_FOL_DOCTO_INT is not null --ORDER BY n OPTION (MAXRECURSION 0)"; // antes OPTION (MAXRECURSION {0})"; s = String.Format(s, iDif.ToString(), Int32.Parse(oRow.Field <String>("Desde")) - 1, oRow.Field <String>("TipoDoc"), oRow.Field <String>("Desde"), oRow.Field <String>("Hasta")); cmd1.CommandText = s; s = cmd1.ExecuteScalar().ToString(); oDBDSH.SetValue("U_Utilizados", 0, s); //OutLog("Utilizados -> " + oDBDSH.GetValue("U_Utilizados", 0)); iDif = iDif - Int32.Parse(s); oDBDSH.SetValue("U_Asignables", 0, iDif.ToString()); //OutLog("Asignables -> " + oDBDSH.GetValue("U_Asignables", 0)); s = @"WITH n(n) AS ( SELECT 1 UNION ALL SELECT n + 1 FROM n WHERE n < {0} ) SELECT TOP 1 n + {1} --, T0.CAB_FOL_DOCTO_INT FROM n left outer join Faet_Erp_Encabezado_Doc T0 on n.n + {1} = T0.CAB_FOL_DOCTO_INT and T0.CAB_COD_TP_FACTURA = '{2}' and T0.CAB_FOL_DOCTO_INT between {3} and {4} where t0.CAB_FOL_DOCTO_INT is null ORDER BY n OPTION (MAXRECURSION 0)"; // antes OPTION (MAXRECURSION {0})"; s = String.Format(s, iDif.ToString(), Int32.Parse(oRow.Field <String>("Desde")) - 1, oRow.Field <String>("TipoDoc"), oRow.Field <String>("Desde"), oRow.Field <String>("Hasta")); cmd1.CommandText = s; if (cmd1.ExecuteScalar() == null) { s = oRow.Field <String>("Desde"); } else { s = cmd1.ExecuteScalar().ToString(); } oDBDSH.SetValue("U_FolioDesde", 0, s); //OutLog("FolioDesde -> " + oDBDSH.GetValue("U_FolioDesde", 0)); _return = Reg.CAFAdd(oDBDSH); if (_return) { FSBOApp.StatusBar.SetText("CAF Registrado, ID " + oRow.Field <String>("ID"), BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } else { FSBOApp.StatusBar.SetText("CAF no se ha registrado, ID " + oRow.Field <String>("ID"), BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } } } if (ConexionADO.State == ConnectionState.Open) { ConexionADO.Close(); } FSBOApp.StatusBar.SetText("CAF actualizados", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success); } else { FSBOApp.StatusBar.SetText("Faltan datos Conexion. " + sCnn.Substring(1, sCnn.Length - 1), BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } oRecordSet.MoveNext(); } ActualizarGrilla(); } else { FSBOApp.StatusBar.SetText("Debe ingresar datos de conexion", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error); } } catch (Exception e) { FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); OutLog("ActualizarRegistros: " + e.Message + " ** Trace: " + e.StackTrace); } }//fin ActualizarRegistros
public new bool InitForm(string uid, string xmlPath, ref SAPbouiCOM.Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings) { Int32 CantRol; bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings); oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)); Funciones.SBO_f = FSBOf; try { Lista = new List <string>(); FSBOf.LoadForm(xmlPath, "VID_FEMonDTE.srf", uid); //EnableCrystal := true; oForm = FSBOApp.Forms.Item(uid); oForm.Freeze(true); oForm.AutoManaged = false; oForm.SupportedModes = -1; // afm_All oForm.EnableMenu("1282", false); //Crear oForm.EnableMenu("1281", false); //Actualizar // Ok Ad Fnd Vw Rq Sec //Lista.Add('DocNum , f, f, t, f, n, 1'); //Lista.Add('DocDate , f, t, f, f, r, 1'); //Lista.Add('CardCode , f, t, t, f, r, 1'); //FSBOf.SetAutoManaged(var oForm, Lista); oDBDSHC = oForm.DataSources.DBDataSources.Add("@VID_FEDTECPRA"); oDBDSHV = oForm.DataSources.DBDataSources.Add("@VID_FEDTEVTA"); oForm.DataSources.UserDataSources.Add("FechaD", BoDataType.dt_DATE, 10); oEditText = (EditText)(oForm.Items.Item("FechaD").Specific); oEditText.DataBind.SetBound(true, "", "FechaD"); oEditText.Value = DateTime.Now.ToString("yyyyMMdd"); oForm.DataSources.UserDataSources.Add("FechaH", BoDataType.dt_DATE, 10); oEditText = (EditText)(oForm.Items.Item("FechaH").Specific); oEditText.DataBind.SetBound(true, "", "FechaH"); oEditText.Value = DateTime.Now.ToString("yyyyMMdd"); oComboBox = (ComboBox)(oForm.Items.Item("TipoDTE").Specific); oForm.DataSources.UserDataSources.Add("TipoDTE", BoDataType.dt_SHORT_TEXT, 10); oComboBox.DataBind.SetBound(true, "", "TipoDTE"); oComboBox.ValidValues.Add("V", "Venta"); oComboBox.ValidValues.Add("C", "Compra"); oComboBox.Select("V", BoSearchKey.psk_ByValue); oForm.Items.Item("TipoDTE").DisplayDesc = true; oDataTable = oForm.DataSources.DataTables.Add("dt"); oGrid = (Grid)(oForm.Items.Item("grid").Specific); oGrid.DataTable = oDataTable; DSOpFec = oForm.DataSources.UserDataSources.Add("FechaEmi", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1); ((OptionBtn)oForm.Items.Item("FechaEmi").Specific).DataBind.SetBound(true, "", "FechaEmi"); ((OptionBtn)oForm.Items.Item("FechaRecep").Specific).DataBind.SetBound(true, "", "FechaEmi"); ((OptionBtn)oForm.Items.Item("FechaRecep").Specific).GroupWith("FechaEmi"); ((OptionBtn)oForm.Items.Item("FechaEmi").Specific).Selected = true; oComboBox = (ComboBox)(oForm.Items.Item("Cliente").Specific); oForm.DataSources.UserDataSources.Add("Cliente", BoDataType.dt_SHORT_TEXT, 10); oComboBox.DataBind.SetBound(true, "", "Cliente"); if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT 'Todos' Code, 'Todos' Name UNION ALL SELECT T1.FldValue Code, T1.Descr Name FROM CUFD T0 JOIN UFD1 T1 ON T1.TableID = T0.TableID AND T1.FieldID = T0.FieldID WHERE T0.TableID = '{0}' AND T0.AliasID = 'EstadoC'"; } else { s = @"SELECT 'Todos' ""Code"", 'Todos' ""Name"" FROM DUMMY UNION ALL SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name"" FROM ""CUFD"" T0 JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID"" AND T1.""FieldID"" = T0.""FieldID"" WHERE T0.""TableID"" = '{0}' AND T0.""AliasID"" = 'EstadoC'"; } s = String.Format(s, "@VID_FEDTEVTA"); oRecordSet.DoQuery(s); FSBOf.FillCombo(oComboBox, ref oRecordSet, false); oComboBox.Select("Todos", BoSearchKey.psk_ByValue); oComboBox = (ComboBox)(oForm.Items.Item("SII").Specific); oForm.DataSources.UserDataSources.Add("SII", BoDataType.dt_SHORT_TEXT, 10); oComboBox.DataBind.SetBound(true, "", "SII"); if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT 'Todos' Code, 'Todos' Name UNION ALL SELECT T1.FldValue Code, T1.Descr Name FROM CUFD T0 JOIN UFD1 T1 ON T1.TableID = T0.TableID AND T1.FieldID = T0.FieldID WHERE T0.TableID = '{0}' AND T0.AliasID = 'EstadoSII'"; } else { s = @"SELECT 'Todos' ""Code"", 'Todos' ""Name"" FROM DUMMY UNION ALL SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name"" FROM ""CUFD"" T0 JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID"" AND T1.""FieldID"" = T0.""FieldID"" WHERE T0.""TableID"" = '{0}' AND T0.""AliasID"" = 'EstadoSII'"; } s = String.Format(s, "@VID_FEDTEVTA"); oRecordSet.DoQuery(s); FSBOf.FillCombo(oComboBox, ref oRecordSet, false); oComboBox.Select("Todos", BoSearchKey.psk_ByValue); oComboBox = (ComboBox)(oForm.Items.Item("Ley").Specific); oForm.DataSources.UserDataSources.Add("Ley", BoDataType.dt_SHORT_TEXT, 10); oComboBox.DataBind.SetBound(true, "", "Ley"); if (GlobalSettings.RunningUnderSQLServer) { s = @"SELECT 'Todos' Code, 'Todos' Name UNION ALL SELECT T1.FldValue Code, T1.Descr Name FROM CUFD T0 JOIN UFD1 T1 ON T1.TableID = T0.TableID AND T1.FieldID = T0.FieldID WHERE T0.TableID = '{0}' AND T0.AliasID = 'EstadoLey'"; } else { s = @"SELECT 'Todos' ""Code"", 'Todos' ""Name"" FROM DUMMY UNION ALL SELECT T1.""FldValue"" ""Code"", T1.""Descr"" ""Name"" FROM ""CUFD"" T0 JOIN ""UFD1"" T1 ON T1.""TableID"" = T0.""TableID"" AND T1.""FieldID"" = T0.""FieldID"" WHERE T0.""TableID"" = '{0}' AND T0.""AliasID"" = 'EstadoLey'"; } s = String.Format(s, "@VID_FEDTEVTA"); oRecordSet.DoQuery(s); FSBOf.FillCombo(oComboBox, ref oRecordSet, false); oComboBox.Select("Todos", BoSearchKey.psk_ByValue); BuscarDatos(); } catch (Exception e) { OutLog("InitForm: " + e.Message + " ** Trace: " + e.StackTrace); FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", ""); } finally { if (oForm != null) { oForm.Freeze(false); } } return(Result); }//fin InitForm