Ejemplo n.º 1
0
        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
        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)
        {
            //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
Ejemplo n.º 4
0
        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
        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
        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
Ejemplo n.º 8
0
        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
        }//fin MenuEvent

        private void ActualizarRegistrosWS()
        {
            String sCode = "";

            //SqlDataAdapter cmd2;
            System.Data.DataTable resultDataTable;
            //System.Data.DataTable resultDataTable1;
            Int32   i;
            Boolean _return;

            SAPbouiCOM.GridColumn oColumn;
            String sDocEntry = "";

            SAPbobsCOM.Recordset orsAux;
            String RUTEmpresa = "";
            String URL        = "";
            String URLFinal;

            String[]    TipoDocs = { "33", "34", "39", "41", "43", "46", "52", "56", "61", "110", "111", "112" };
            String      UserWS   = "";
            String      PassWS   = "";
            String      sMessage;
            String      xmlCAF = "";
            XmlDocument oXml;
            String      Desde = "";
            String      Hasta = "";
            String      Fecha = "";

            try
            {
                ActualizarGrilla();

                orsAux = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT U_BuscarCAF, ISNULL(U_UserWSCL,'') 'UserWS', ISNULL(U_PassWSCL,'') 'PassWS' FROM [@VID_FEPARAM] WHERE Code = '1'";
                }
                else
                {
                    s = @"SELECT ""U_BuscarCAF"", IFNULL(""U_UserWSCL"",'') ""UserWS"", IFNULL(""U_PassWSCL"",'') ""PassWS"" FROM ""@VID_FEPARAM"" WHERE ""Code"" = '1'";
                }
                orsAux.DoQuery(s);

                if (orsAux.RecordCount == 0)
                {
                    throw new Exception("Debe parametrizar el addon");
                }
                else if (((System.String)orsAux.Fields.Item("U_BuscarCAF").Value).Trim() == "")
                {
                    throw new Exception("Debe ingresar http para buscar CAF en paramatros del addon");
                }
                else
                {
                    URL = ((System.String)orsAux.Fields.Item("U_BuscarCAF").Value).Trim();
                    if (((System.String)orsAux.Fields.Item("UserWS").Value).Trim() != "")
                    {
                        UserWS = Funciones.DesEncriptar(((System.String)orsAux.Fields.Item("UserWS").Value).Trim());
                    }
                    if (((System.String)orsAux.Fields.Item("PassWS").Value).Trim() != "")
                    {
                        PassWS = Funciones.DesEncriptar(((System.String)orsAux.Fields.Item("PassWS").Value).Trim());
                    }
                }

                if (bMultiSoc)
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"SELECT DocEntry, REPLACE(REPLACE(ISNULL(U_RUT,''),'.',''),'-','') TaxIdNum FROM [@VID_FEMULTISOC] WHERE U_Habilitada = 'Y'";
                    }
                    else
                    {
                        s = @"SELECT TO_VARCHAR(""DocEntry"") ""DocEntry"", REPLACE(REPLACE(IFNULL(""U_RUT"",''),'.',''),'-','') ""TaxIdNum"" FROM ""@VID_FEMULTISOC"" WHERE ""U_Habilitada"" = 'Y' ";
                    }
                }
                else
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"SELECT REPLACE(REPLACE(ISNULL(TaxIdNum,''),'-',''),'.','') TaxIdNum FROM OADM";
                    }
                    else
                    {
                        s = @"SELECT REPLACE(REPLACE(IFNULL(""TaxIdNum"",''),'-',''),'.','') ""TaxIdNum"" FROM ""OADM"" ";
                    }
                }
                oRecordSet.DoQuery(s);

                if (oRecordSet.RecordCount > 0)
                {
                    while (!oRecordSet.EoF)
                    {
                        try
                        {
                            RUTEmpresa = ((System.String)oRecordSet.Fields.Item("TaxIdNum").Value).Trim();
                            if (bMultiSoc)
                            {
                                sDocEntry = Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value));
                            }
                            else
                            {
                                sDocEntry = "0";
                            }

                            foreach (String xTipo in TipoDocs)
                            {
                                try
                                {
                                    //http://portal1.easydoc.cl/consulta/generaciondte.aspx?RUT={0}&TIPODTE={1}&OP=22
                                    URLFinal = URL;
                                    URLFinal = String.Format(URLFinal, RUTEmpresa, xTipo);


                                    WebRequest request = WebRequest.Create(URLFinal);
                                    if ((UserWS != "") && (PassWS != ""))
                                    {
                                        request.Credentials = new NetworkCredential(UserWS, PassWS);
                                    }
                                    request.Method = "POST";
                                    string postData  = "";//** xmlDOC.InnerXml;
                                    byte[] byteArray = Encoding.UTF8.GetBytes(postData);
                                    request.ContentType   = "text/xml";
                                    request.ContentLength = byteArray.Length;
                                    Stream dataStream = request.GetRequestStream();
                                    dataStream.Write(byteArray, 0, byteArray.Length);
                                    dataStream.Close();
                                    WebResponse response = request.GetResponse();
                                    Console.WriteLine(((HttpWebResponse)(response)).StatusDescription);
                                    dataStream = response.GetResponseStream();
                                    StreamReader reader             = new StreamReader(dataStream);
                                    string       responseFromServer = reader.ReadToEnd();
                                    reader.Close();
                                    dataStream.Close();
                                    response.Close();
                                    sMessage = responseFromServer;
                                    request  = null;
                                    response = null;
                                    GC.Collect();
                                    GC.WaitForPendingFinalizers();

                                    if (sMessage != "")
                                    {
                                        xmlCAF = sMessage;
                                        xmlCAF = xmlCAF.Replace(@"<?xml version=""1.0""?>", "");
                                        //xmlCAF = xmlCAF.Replace("\n", "");
                                        //xmlCAF = xmlCAF.Replace(@"\", "");
                                        //xmlCAF = xmlCAF.Replace(Environment.NewLine, "");
                                        oXml = new XmlDocument();
                                        oXml.LoadXml(xmlCAF);

                                        var DA  = oXml.GetElementsByTagName("DA");
                                        var RNG = ((XmlElement)DA[0]).GetElementsByTagName("RNG");
                                        foreach (XmlElement nodo in RNG)
                                        {
                                            var nDesde = nodo.GetElementsByTagName("D");
                                            var nHasta = nodo.GetElementsByTagName("H");
                                            Desde = (System.String)(nDesde[0].InnerText);
                                            Hasta = (System.String)(nHasta[0].InnerText);
                                        }

                                        var CAF = oXml.GetElementsByTagName("CAF");
                                        var DA2 = ((XmlElement)CAF[0]).GetElementsByTagName("DA");
                                        foreach (XmlElement nodo in CAF)
                                        {
                                            var nFecha = nodo.GetElementsByTagName("FA");
                                            Fecha = (System.String)(nFecha[0].InnerText);
                                        }

                                        if (GlobalSettings.RunningUnderSQLServer)
                                        {
                                            s = @"SELECT Code
                                          FROM [@VID_FECAF]
                                         WHERE U_TipoDoc = '{0}'
                                           AND U_Desde = {1}
                                           AND U_Hasta = {2}
                                           {3}";
                                        }
                                        else
                                        {
                                            s = @"SELECT ""Code""
                                          FROM ""@VID_FECAF""
                                         WHERE ""U_TipoDoc"" = '{0}'
                                           AND ""U_Desde"" = {1}
                                           AND ""U_Hasta"" = {2}
                                            {3}";
                                        }
                                        s = String.Format(s, xTipo, Desde, Hasta, (bMultiSoc ? " AND U_BaseMul = " + sDocEntry : ""));
                                        orsAux.DoQuery(s);
                                        if (orsAux.RecordCount == 0) //no existe en la base de datos
                                        {
                                            sCode = Funciones.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, xTipo);
                                            //OutLog("TipoDoc -> " + oDBDSH.GetValue("U_TipoDoc", 0));
                                            oDBDSH.SetValue("U_Desde", 0, Desde);
                                            //OutLog("Desde -> " + oDBDSH.GetValue("U_Desde", 0));
                                            oDBDSH.SetValue("U_Hasta", 0, Hasta);
                                            //OutLog("Hasta -> " + oDBDSH.GetValue("U_Hasta", 0));
                                            DateTime oFecha;
                                            DateTime.TryParse(Fecha, out oFecha);
                                            oDBDSH.SetValue("U_Fecha", 0, oFecha.ToString("yyyyMMdd"));
                                            //OutLog("Fecha -> " + oDBDSH.GetValue("U_Fecha", 0));
                                            oDBDSH.SetValue("U_BaseMul", 0, sDocEntry);
                                            //OutLog("BaseMul -> " + oDBDSH.GetValue("U_BaseMul", 0));
                                            oDBDSH.SetValue("U_CAF", 0, xmlCAF);
                                            //OutLog("CAF -> " + oDBDSH.GetValue("U_CAF", 0));
                                            oDBDSH.SetValue("U_Utilizados", 0, "0");
                                            //OutLog("Utilizados -> " + oDBDSH.GetValue("U_Utilizados", 0));
                                            var iDif = (Convert.ToInt32(Hasta) - Convert.ToInt32(Desde)) + 1;
                                            oDBDSH.SetValue("U_Asignables", 0, iDif.ToString());
                                            //OutLog("Asignables -> " + oDBDSH.GetValue("U_Asignables", 0));
                                            oDBDSH.SetValue("U_FolioDesde", 0, Desde);
                                            //OutLog("FolioDesde -> " + oDBDSH.GetValue("U_FolioDesde", 0));
                                            _return = Funciones.CAFAdd(oDBDSH);
                                            if (_return)
                                            {
                                                FSBOApp.StatusBar.SetText("CAF Registrado, TipoDoc " + xTipo, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                                            }
                                            else
                                            {
                                                FSBOApp.StatusBar.SetText("CAF no se ha registrado, TipoDoc " + xTipo, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                            }
                                        }
                                    }
                                    else
                                    {
                                        FSBOApp.StatusBar.SetText("No se ha encontrado CAF para documento " + xTipo, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                    }
                                }
                                catch (Exception v)
                                {
                                    OutLog("Error actualizar CAF Tipo " + xTipo + " RUT Empresa " + RUTEmpresa + ", " + v.Message + ", TRACE " + v.StackTrace);
                                    FSBOApp.StatusBar.SetText("Error actualizar CAF Tipo " + xTipo + " RUT Empresa " + RUTEmpresa + ", " + v.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                                }
                            }//Fin Foreach
                            FSBOApp.StatusBar.SetText("CAF actualizados", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                        }
                        catch (Exception v)
                        {
                            OutLog("Error actualizar empresa RUT " + RUTEmpresa + ", " + v.Message + ", TRACE " + v.StackTrace);
                            FSBOApp.StatusBar.SetText("Error actualizar empresa RUT " + RUTEmpresa + ", " + v.Message, 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 Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            //SAPbouiCOM.ComboBox oCombo;
            TFunctions Param;

            SAPbouiCOM.CheckBox oCheckBox;
            SAPbouiCOM.EditText oEditText;

            //
            //  obetener recurso
            //  try
            //  .....
            //  finally
            //  liberar recurso
            //  end

            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
            try
            {
                //Lista    := New list<string>;

                FSBOf.LoadForm(xmlPath, "strCnn.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;             // afm_All

                //oForm.DataBrowser.BrowseBy := "DocNum";

                // 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);

                oDBDSHeader = (DBDataSource)(oForm.DataSources.DBDataSources.Item("@VID_FEPARAM"));

                if (!GlobalSettings.RunningUnderSQLServer)
                {
                    oForm.Items.Item("btnProcFE").Visible = false;
                }
                else
                {
                    oForm.Items.Item("btnProcFE").Visible = true;
                }

                //s := 'Select count(*) cant from [@VID_FEPARAM]';
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"Select count(*) CANT
                                ,U_UserED
                                ,U_PwdED
                                ,U_UserWS
                                ,U_PassWS
                            from [@VID_FEPARAM] 
                            group by U_UserED
                                ,U_PwdED
                                ,U_UserWS
                                ,U_PassWS";
                }
                else
                {
                    s = @"Select count(*) ""CANT"" 
                           ,""U_UserED""
                           ,""U_PwdED""
                           ,""U_UserWS""
                           ,""U_PassWS""
                      from ""@VID_FEPARAM"" 
                     group by ""U_UserED""
                             ,""U_PwdED""
                             ,""U_UserWS""
                             ,""U_PassWS""";
                }
                oRecordSet.DoQuery(s);
                if ((System.Int32)(oRecordSet.Fields.Item("CANT").Value) > 0)
                {
                    Param       = new TFunctions();
                    Param.SBO_f = FSBOf;

                    oForm.SupportedModes = 1;
                    oForm.Mode           = BoFormMode.fm_UPDATE_MODE;
                    oDBDSHeader.Query(null);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_UserED").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_UserED", 0, s);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_PwdED").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_PwdED", 0, s);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_UserWS").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_UserWS", 0, s);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_PassWS").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_PassWS", 0, s);
                }
                else
                {
                    oForm.SupportedModes = 3;
                    oForm.Mode           = BoFormMode.fm_ADD_MODE;
                    oForm.PaneLevel      = 106;
                }
            }
            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
Ejemplo n.º 11
0
        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_FEIMPADIC.srf", uid);
                oForm                = FSBOApp.Forms.Item(uid);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;             // afm_All
                Flag = false;
                oForm.Freeze(true);

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select count(*) Cont from [@VID_FEIMPADIC]";
                }
                else
                {
                    s = @"select count(*) ""Cont"" from ""@VID_FEIMPADIC"" ";
                }
                oRecordSet.DoQuery(s);
                if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0)
                {
                    oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                }
                else
                {
                    oForm.Mode = BoFormMode.fm_ADD_MODE;
                }


                oGrid       = (Grid)(oForm.Items.Item("3").Specific);
                oDBDSHeader = oForm.DataSources.DBDataSources.Add("@VID_FEIMPADIC");

                oDataTable = oForm.DataSources.DataTables.Add("Tax");
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select Code, U_CodImpto, U_Desc, U_Porc from [@VID_FEIMPADIC]
                          UNION ALL 
                          select CAST('' as varchar(20)), CAST('' as varchar(20)), CAST('' as varchar(50)), 0";
                }
                else
                {
                    s = @"select ""Code"", ""U_CodImpto"", ""U_Desc"", ""U_Porc"" from ""@VID_FEIMPADIC""
                          UNION ALL
                          select CAST('' as varchar(20)), CAST('' as varchar(20)), CAST('' as varchar(50)), 0 FROM DUMMY ";
                }

                oDataTable.ExecuteQuery(s);
                oGrid.DataTable = oDataTable;

                oGrid.Columns.Item("Code").Type = BoGridColumnType.gct_ComboBox;
                oColumn = (GridColumn)(oGrid.Columns.Item("Code"));
                var oComboCol = (ComboBoxColumn)(oColumn);
                oComboCol.Editable            = true;
                oComboCol.TitleObject.Caption = "Impuesto SAP";

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select Code, Name from OSTA
                          UNION ALL
                          select WTCode 'Code', WTName 'Name' from OWHT where Inactive = 'N'";
                }
                else
                {
                    s = @"select ""Code"", ""Name"" from ""OSTA""
                          UNION ALL
                          select ""WTCode"" ""Code"", ""WTName"" ""Name"" from ""OWHT"" where ""Inactive"" = 'N' ";
                }

                oRecordSet.DoQuery(s);
                FSBOf.FillComboGrid((GridColumn)(oGrid.Columns.Item("Code")), ref oRecordSet, true);

                oGrid.Columns.Item("U_CodImpto").Type = BoGridColumnType.gct_EditText;
                oColumn = (GridColumn)(oGrid.Columns.Item("U_CodImpto"));
                var oEditCol = (EditTextColumn)(oColumn);
                oEditCol.Editable            = true;
                oEditCol.TitleObject.Caption = "Código Impto. SII";


                oGrid.Columns.Item("U_Desc").Type = BoGridColumnType.gct_EditText;
                oColumn                      = (GridColumn)(oGrid.Columns.Item("U_Desc"));
                oEditCol                     = (EditTextColumn)(oColumn);
                oEditCol.Editable            = true;
                oEditCol.TitleObject.Caption = "Descripción Impuesto";

                oGrid.Columns.Item("U_Porc").Type = BoGridColumnType.gct_EditText;
                oColumn                      = (GridColumn)(oGrid.Columns.Item("U_Porc"));
                oEditCol                     = (EditTextColumn)(oColumn);
                oEditCol.Editable            = true;
                oEditCol.TitleObject.Caption = "Porcentaje Retencion";
                oEditCol.RightJustified      = true;

                oGrid.AutoResizeColumns();
            }
            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 i;
            //TFunctions Reg;
            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_FEPROCED.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                //        VID_DelRow := true;
                //        VID_DelRowOK := true;

                //oForm.DataBrowser.BrowseBy := "Code";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEPROCED");

                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("mtx      , f,  t,  f,  f, r, 1");
                //Lista.Add('Name      , f,  t,  t,  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();


                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select DocEntry, ISNULL(U_TipoDoc,'') TipoDoc, ISNULL(U_ProcNomE,'') ProcNomE, ISNULL(U_ProcNomD,'') ProcNomD, ISNULL(U_ProcNomR,'') ProcNomR, ISNULL(U_ProcNomC,'') ProcNomC, ISNULL(U_ProcNomDe,'') ProcNomDe, ISNULL(U_ProcNomL,'') ProcNomL, ISNULL(U_ProcNomS,'') ProcNomS, ISNULL(U_Habili,'Y') 'Habilitada', ISNULL(U_CantLineas,0) 'CantLineas' from [@VID_FEPROCED]";
                }
                else
                {
                    s = @"select ""DocEntry"", IFNULL(""U_TipoDoc"",'') ""TipoDoc"", IFNULL(""U_ProcNomE"",'') ""ProcNomE"", IFNULL(""U_ProcNomD"",'') ""ProcNomD"", IFNULL(""U_ProcNomR"",'') ""ProcNomR"", IFNULL(""U_ProcNomC"",'') ""ProcNomC"", IFNULL(""U_ProcNomDe"",'') ""ProcNomDe"", IFNULL(""U_ProcNomL"",'') ""ProcNomL"", IFNULL(""U_ProcNomS"",'') ""ProcNomS"", IFNULL(""U_Habili"",'Y') ""Habilitada"", IFNULL(""U_CantLineas"",0) ""CantLineas"" from ""@VID_FEPROCED"" ";
                }
                oRecordSet.DoQuery(s);

                i = 0;
                oDBDSH.Clear();
                while (!oRecordSet.EoF)
                {
                    oDBDSH.InsertRecord(i);
                    oDBDSH.SetValue("DocEntry", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value)));
                    oDBDSH.SetValue("U_TipoDoc", i, (System.String)(oRecordSet.Fields.Item("TipoDoc").Value));
                    //oDBDSH.SetValue("U_TipoDocPE", i, (System.String)(oRecordSet.Fields.Item("TipoDocPE").Value));
                    oDBDSH.SetValue("U_ProcNomE", i, (System.String)(oRecordSet.Fields.Item("ProcNomE").Value));
                    oDBDSH.SetValue("U_ProcNomD", i, (System.String)(oRecordSet.Fields.Item("ProcNomD").Value));
                    oDBDSH.SetValue("U_ProcNomR", i, (System.String)(oRecordSet.Fields.Item("ProcNomR").Value));
                    oDBDSH.SetValue("U_ProcNomC", i, (System.String)(oRecordSet.Fields.Item("ProcNomC").Value));
                    //oDBDSH.SetValue("U_ProcNomDe", i, (System.String)(oRecordSet.Fields.Item("ProcNomDe").Value));
                    //oDBDSH.SetValue("U_ProcNomL", i, (System.String)(oRecordSet.Fields.Item("ProcNomL").Value));
                    //oDBDSH.SetValue("U_ProcNomS", i, (System.String)(oRecordSet.Fields.Item("ProcNomS").Value));
                    oDBDSH.SetValue("U_Habili", i, (System.String)(oRecordSet.Fields.Item("Habilitada").Value));
                    oDBDSH.SetValue("U_CantLineas", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("CantLineas").Value)));
                    oRecordSet.MoveNext();
                    i++;
                }

                oDBDSH.InsertRecord(i);
                oDBDSH.SetValue("DocEntry", i, "");
                oDBDSH.SetValue("U_TipoDoc", i, "");
                //oDBDSH.SetValue("U_TipoDocPE", i, "");
                oDBDSH.SetValue("U_ProcNomE", i, "");
                oDBDSH.SetValue("U_ProcNomD", i, "");
                oDBDSH.SetValue("U_ProcNomR", i, "");
                oDBDSH.SetValue("U_ProcNomC", i, "");
                //oDBDSH.SetValue("U_ProcNomDe", i, "");
                //oDBDSH.SetValue("U_ProcNomL", i, "");
                //oDBDSH.SetValue("U_ProcNomS", i, "");
                oDBDSH.SetValue("U_Habili", i, "Y");
                oDBDSH.SetValue("U_CantLineas", i, "60");

                if (GlobalSettings.RunningUnderSQLServer) //TipoDoc
                {
                    s = @"select U1.FldValue 'Code', U1.Descr 'Name' from UFD1 U1 join CUFD U0 on U0.TableID = U1.TableID and U0.FieldID = U1.FieldID where U1.TableID = '@VID_FEPROCED' and U0.AliasID = '{0}'";
                }
                else
                {
                    s = @"select U1.""FldValue"" ""Code"", U1.""Descr"" ""Name"" from ""UFD1"" U1 join ""CUFD"" U0 on U0.""TableID"" = U1.""TableID"" and U0.""FieldID"" = U1.""FieldID"" where U1.""TableID"" = '@VID_FEPROCED' and U0.""AliasID"" = '{0}' ";
                }

                s = String.Format(s, "TipoDoc");
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("TipoDoc"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);
                //((SAPbouiCOM.Column)oMtx.Columns.Item("TipoDocPE")).Visible = false;

                if (GlobalSettings.RunningUnderSQLServer) //Habilitado
                {
                    s = @"select FldValue 'Code', Descr 'Name' from UFD1 where TableID = '@VID_FEPROCED' and FieldID = 2";
                }
                else
                {
                    s = @"select ""FldValue"" ""Code"", ""Descr"" ""Name"" from ""UFD1"" where ""TableID"" = '@VID_FEPROCED' and ""FieldID"" = 2";
                }
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Habili"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);


                //EditText(oForm.Items.Item('CardCode').Specific).Active := True;
                oMtx.LoadFromDataSource();


                oForm.Mode = BoFormMode.fm_OK_MODE;
                oMtx.AutoResizeColumns();
            }
            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_MenuConf.srf", uid);

                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.Visible        = true;
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;

                ((StaticText)oForm.Items.Item("18").Specific).Caption = "Conexión a HANA";
                oForm.Mode = BoFormMode.fm_ADD_MODE;

                oDBDSHeader = oForm.DataSources.DBDataSources.Item("@VID_MENUSU");

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT Code FROM [@VID_MENUSU]";
                }
                else
                {
                    s = @"SELECT ""Code"" FROM ""@VID_MENUSU"" ";
                }
                oRecordSet.DoQuery(s);

                if (oRecordSet.RecordCount == 0)
                {
                    if (((System.String)oRecordSet.Fields.Item("Code").Value) == "1")
                    {
                        oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                    }
                    else
                    {
                        oForm.Mode = SAPbouiCOM.BoFormMode.fm_ADD_MODE;
                    }
                }
                else
                {
                    oDBDSHeader.Query(null);
                    oForm.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE;
                }
            }
            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
Ejemplo n.º 14
0
        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
Ejemplo n.º 15
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32 i;

            //SAPbouiCOM.EditTextColumn oEditText;
            SAPbouiCOM.CommonSetting oSetting;
            TFunctions Reg;
            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_Sucursal.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                //        VID_DelRow := true;
                //        VID_DelRowOK := true;

                //oForm.DataBrowser.BrowseBy := "Code";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FESUC");

                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("mtx      , f,  t,  f,  f, r, 1");
                //Lista.Add('Name      , f,  t,  t,  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();

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select Code, Name, ISNULL(U_Habilitada,'Y') 'Habilitada' from [@VID_FESUC]";
                }
                else
                {
                    s = @"select ""Code"", ""Name"", IFNULL(""U_Habilitada"",'Y') ""Habilitada"" from ""@VID_FESUC"" ";
                }
                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount == 0)
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select Code from [@VID_FESUC] where Code = 'Principal'";
                    }
                    else
                    {
                        s = @"select ""Code"" from ""@VID_FESUC"" where ""Code"" = 'Principal' ";
                    }
                    oRecordSet.DoQuery(s);
                    if (oRecordSet.RecordCount == 0)
                    {
                        Reg       = new TFunctions();
                        Reg.SBO_f = FSBOf;
                        oDBDSH.Clear();
                        oDBDSH.InsertRecord(0);
                        oDBDSH.SetValue("Code", 0, "Principal");
                        oDBDSH.SetValue("Name", 0, "SAP BO");
                        oDBDSH.SetValue("U_Habilitada", 0, "Y");
                        if (Reg.FESUCAdd(oDBDSH) == true)
                        {
                            FSBOApp.StatusBar.SetText("Sucursal Principal creada correctamente", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                        }
                        else
                        {
                            FSBOApp.StatusBar.SetText("Sucursal Principal no ha sido creada", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                    }
                }

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select Code, Name, ISNULL(U_Habilitada,'Y') 'Habilitada' from [@VID_FESUC]";
                }
                else
                {
                    s = @"select ""Code"", ""Name"", IFNULL(""U_Habilitada"",'Y') ""Habilitada"" from ""@VID_FESUC"" ";
                }
                oRecordSet.DoQuery(s);
                i = 0;
                oDBDSH.Clear();
                while (!oRecordSet.EoF)
                {
                    oDBDSH.InsertRecord(i);
                    oDBDSH.SetValue("Code", i, (System.String)(oRecordSet.Fields.Item("Code").Value));
                    oDBDSH.SetValue("Name", i, (System.String)(oRecordSet.Fields.Item("Name").Value));
                    oDBDSH.SetValue("U_Habilitada", i, (System.String)(oRecordSet.Fields.Item("Habilitada").Value));
                    oRecordSet.MoveNext();
                    i++;
                }

                oDBDSH.InsertRecord(i);
                oDBDSH.SetValue("Code", i, "");
                oDBDSH.SetValue("Name", i, "");
                oDBDSH.SetValue("U_Habilitada", i, "Y");

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select FldValue 'Code', Descr 'Name' from UFD1 where TableID = '@VID_FESUC' and FieldID = 0";
                }
                else
                {
                    s = @"select ""FldValue"" ""Code"", ""Descr"" ""Name"" from ""UFD1"" where ""TableID"" = '@VID_FESUC' and ""FieldID"" = 0";
                }
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Habilitada"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);

                //EditText(oForm.Items.Item('CardCode').Specific).Active := True;
                oMtx.LoadFromDataSource();

                oSetting = oMtx.CommonSetting;
                i        = 1;
                while (i <= oMtx.RowCount)
                {
                    if ((System.String)(oDBDSH.GetValue("Code", i - 1)).Trim() != "")
                    {
                        oSetting.SetCellEditable(i, 1, false);
                    }
                    i++;
                }

                oForm.Mode = BoFormMode.fm_OK_MODE;
                oMtx.AutoResizeColumns();
            }
            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
Ejemplo n.º 16
0
        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_GLibro.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("TipoLibro", BoDataType.dt_SHORT_TEXT);
                oComboBox = (ComboBox)(oForm.Items.Item("TipoLibro").Specific);
                oComboBox.DataBind.SetBound(true, "", "TipoLibro");
                oComboBox.ValidValues.Add("V", "Venta");
                oComboBox.ValidValues.Add("C", "Compra");
                oComboBox.ValidValues.Add("B", "Boletas");
                oComboBox.ValidValues.Add("G", "Guias");
                oComboBox.Select("V", BoSearchKey.psk_ByValue);

                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");

                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) == "Y")
                    {
                        bMultiSoc = true;
                    }
                }

                if (bMultiSoc)
                {
                    oForm.Items.Item("LInstituto").Visible = true;
                    oForm.Items.Item("Instituto").Visible  = true;
                    oComboBox = (ComboBox)(oForm.Items.Item("Instituto").Specific);
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"select DocEntry, U_Sociedad 'Sociedad' from [@VID_FEMULTISOC] where isnull(U_Habilitada,'N') = 'Y'";
                    }
                    else
                    {
                        s = @"select ""DocEntry"", ""U_Sociedad"" ""Sociedad"" from ""@VID_FEMULTISOC"" where IFNULL(""U_Habilitada"",'N') = 'Y' ";
                    }
                    oRecordSet.DoQuery(s);
                    while (!oRecordSet.EoF)
                    {
                        oComboBox.ValidValues.Add(((System.Int32)oRecordSet.Fields.Item("DocEntry").Value).ToString(), ((System.String)oRecordSet.Fields.Item("Sociedad").Value).Trim());
                        oRecordSet.MoveNext();
                    }
                }
                else
                {
                    oForm.Items.Item("LInstituto").Visible = false;
                    oForm.Items.Item("Instituto").Visible  = false;
                }
            }
            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
Ejemplo n.º 17
0
        private void GuardarRegistros()
        {
            SAPbouiCOM.Grid oGrid;
            Boolean         Paso = false;
            String          ObjType;
            Int32           DocEntry;
            String          Tipo;
            String          Serie;
            String          Folio;
            Int32           lRetCode;
            String          errMsg;
            Int32           errCode;
            XDocument       miXMLDoc;
            XmlDocument     oXml;
            String          UserWS        = "";
            String          PassWS        = "";
            String          TaxIdNum      = "";
            String          URL           = "";
            String          ExternalFolio = "";
            XmlNode         oNode;

            SAPbobsCOM.Documents     oDocs;
            SAPbobsCOM.StockTransfer oStock;
            SAPbobsCOM.Payments      oPay;
            try
            {
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT T0.U_URLDarBaja 'URL', ISNULL(T0.U_UserWS,'') 'UserWS', ISNULL(T0.U_PassWS,'') 'PassWS', ISNULL(T0.U_MostrarXML,'N') 'MostrarXML', ISNULL(A0.TaxIdNum,'') 'TaxIdNum' 
                           FROM [@VID_FEPARAM] T0 , OADM A0";
                }
                else
                {
                    s = @"SELECT T0.""U_URLDarBaja"" ""URL"", IFNULL(T0.""U_UserWS"",'') ""UserWS"", IFNULL(T0.""U_PassWS"",'') ""PassWS"", IFNULL(T0.""U_MostrarXML"",'N') ""MostrarXML"", IFNULL(A0.""TaxIdNum"",'') ""TaxIdNum"" 
                           FROM ""@VID_FEPARAM"" T0, ""OADM"" A0";
                }

                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount == 0)
                {
                    FSBOApp.StatusBar.SetText("No se ha ingresado URL", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                }
                else if (((System.String)oRecordSet.Fields.Item("URL").Value).Trim() == "")
                {
                    FSBOApp.StatusBar.SetText("No se ha ingresado URL", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                }
                //else if (((System.String)oRecordSet.Fields.Item("UserWS").Value).Trim() == "")
                //    throw new Exception("No se encuentra usuario en Parametros");
                //else if (((System.String)oRecordSet.Fields.Item("PassWS").Value).Trim() == "")
                //    throw new Exception("No se encuentra password en Parametros");
                else if (((System.String)oRecordSet.Fields.Item("TaxIdNum").Value).Trim() == "")
                {
                    throw new Exception("No se encuentra RUC de Emisor, Gestión -> Inicialización Sistema -> Detalle Sociedad -> Datos de Contabilidad -> ID fiscal general 1");
                }
                else
                {
                    UserWS   = Funciones.DesEncriptar((System.String)(oRecordSet.Fields.Item("UserWS").Value).ToString().Trim());
                    PassWS   = Funciones.DesEncriptar((System.String)(oRecordSet.Fields.Item("PassWS").Value).ToString().Trim());
                    TaxIdNum = ((System.String)oRecordSet.Fields.Item("TaxIdNum").Value).Trim();
                    URL      = ((System.String)oRecordSet.Fields.Item("URL").Value).Trim();
                }

                oGrid = ((SAPbouiCOM.Grid)oForm.Items.Item("grid").Specific);
                FCmpny.StartTransaction();
                for (Int32 iLinea = 0; iLinea <= oGrid.DataTable.Rows.Count - 1; iLinea++)
                {
                    if (((System.String)oGrid.DataTable.GetValue("Sel", iLinea)).Trim() == "Y")
                    {
                        try
                        {
                            Paso          = true;
                            ObjType       = ((System.String)oGrid.DataTable.GetValue("ObjType", iLinea));
                            DocEntry      = ((System.Int32)oGrid.DataTable.GetValue("DocEntry", iLinea));
                            Tipo          = ((System.String)oGrid.DataTable.GetValue("TipoDoc", iLinea));
                            Serie         = ((System.String)oGrid.DataTable.GetValue("Serie", iLinea));
                            Folio         = ((System.String)oGrid.DataTable.GetValue("Folio", iLinea));
                            ExternalFolio = ((System.String)oGrid.DataTable.GetValue("ExtFolio", iLinea));

                            if (ObjType == "67")
                            {
                                oStock = ((SAPbobsCOM.StockTransfer)FCmpny.GetBusinessObject(BoObjectTypes.oStockTransfer));
                                if (oStock.GetByKey(DocEntry))
                                {
                                    lRetCode = oStock.Cancel();
                                }
                            }
                            else if (ObjType == "46")
                            {
                                oPay = ((SAPbobsCOM.Payments)FCmpny.GetBusinessObject(BoObjectTypes.oVendorPayments));
                                if (oPay.GetByKey(DocEntry))
                                {
                                    lRetCode = oPay.Cancel();
                                }
                            }
                            else
                            {
                                if (ObjType == "21")
                                {
                                    oDocs = ((SAPbobsCOM.Documents)FCmpny.GetBusinessObject(BoObjectTypes.oPurchaseReturns));
                                }
                                else if (ObjType == "15")
                                {
                                    oDocs = ((SAPbobsCOM.Documents)FCmpny.GetBusinessObject(BoObjectTypes.oDeliveryNotes));
                                }
                                else if (ObjType == "14")
                                {
                                    oDocs = ((SAPbobsCOM.Documents)FCmpny.GetBusinessObject(BoObjectTypes.oCreditNotes));
                                }
                                else if (ObjType == "203")
                                {
                                    oDocs = ((SAPbobsCOM.Documents)FCmpny.GetBusinessObject(BoObjectTypes.oDownPayments));
                                }
                                else
                                {
                                    oDocs = ((SAPbobsCOM.Documents)FCmpny.GetBusinessObject(BoObjectTypes.oInvoices));
                                }
                                if (oDocs.GetByKey(DocEntry))
                                {
                                    var oDocCancel = oDocs.CreateCancellationDocument();
                                    lRetCode = oDocCancel.Add();// Cancel();
                                    if (lRetCode != 0)
                                    {
                                        FCmpny.GetLastError(out errCode, out errMsg);
                                        throw new Exception("No se ha encontrado Documento " + Tipo + " " + Serie + "-" + Folio + ": " + errMsg);
                                    }
                                    else
                                    {
                                        //enviar baja al portal
                                        miXMLDoc = new XDocument(
                                            new XDeclaration("1.0", "utf-8", "yes")
                                            , new XElement("documentoelectronico",
                                                           new XElement("DocNum", TaxIdNum),
                                                           new XElement("DocType", Tipo),
                                                           new XElement("IdDocumento", ExternalFolio.Trim()
                                                                        ))
                                            );
                                        oXml = new XmlDocument();
                                        using (var xmlReader = miXMLDoc.CreateReader())
                                        {
                                            oXml.Load(xmlReader);
                                        }

                                        s = Funciones.UpLoadDocumentByUrl(oXml, null, GlobalSettings.RunningUnderSQLServer, URL, UserWS, PassWS, "D-" + ExternalFolio);

                                        oXml.LoadXml(s);

                                        oNode = oXml.DocumentElement.SelectSingleNode("/Error/ErrorCode");

                                        string ticket = oNode.InnerText;

                                        oNode = oXml.DocumentElement.SelectSingleNode("/Error/ErrorText");

                                        string errorText = oNode.InnerText;

                                        oNode = oXml.DocumentElement.SelectSingleNode("/Error/IdDocument");

                                        string idDocument = oNode.InnerText;

                                        if (errorText != "OK")
                                        {
                                            FSBOApp.StatusBar.SetText("Mensaje: " + errorText + " " + Tipo + " " + Serie + "-" + Folio, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                        }
                                        else
                                        {
                                            FSBOApp.StatusBar.SetText("Se ha creado cancelacion del documento " + Tipo + " " + Serie + "-" + Folio, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);

                                            //insertar en la tabla  y consultar por el estado mismo codigo que insert de factura
                                        }
                                    }
                                }
                                else
                                {
                                    FSBOApp.StatusBar.SetText("No se ha encontrado Documento " + Tipo + " " + Serie + "-" + Folio, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                }
                            }

                            oDocs  = null;
                            oPay   = null;
                            oStock = null;
                        }
                        catch (Exception ss)
                        {
                            FSBOApp.StatusBar.SetText("Dar de Baja: " + ss.Message + " ** Trace: " + ss.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                            OutLog("Dar de Baja: " + ss.Message + " ** Trace: " + ss.StackTrace);
                            if (FCmpny.InTransaction)
                            {
                                FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                            }
                        }
                    }
                }

                if (!Paso)
                {
                    FSBOApp.StatusBar.SetText("Debe seleccionar un documento minimo", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                }
                else
                {
                    if (FCmpny.InTransaction)
                    {
                        FCmpny.EndTransaction(BoWfTransOpt.wf_Commit);
                    }
                }
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace);
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
            }
        }
        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_FEDIST.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                VID_DelRow   = false;
                VID_DelRowOK = false;

                oForm.DataBrowser.BrowseBy = "DocEntry";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEDIST");
                oDBDSD = oForm.DataSources.DBDataSources.Item("@VID_FEDISTD");

                oForm.EnableMenu("1282", false); // boton Crear

                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("DocEntry  , f,  f,  f,  f, r, 1");
                Lista.Add("Desde     , f,  t,  f,  f, r, 1");
                Lista.Add("Hasta     , f,  t,  f,  f, r, 1");
                Lista.Add("Hasta     , f,  t,  f,  f, r, 1");
                Lista.Add("Sucursal  , f,  t,  f,  f, r, 1");
                Lista.Add("RangoF    , f,  t,  t,  f, r, 1");
                Lista.Add("TipoDoc   , f,  t,  t,  f, r, 1");
                Lista.Add("btnDist   , f,  t,  f,  f, n, 1");
                FSBOf.SetAutoManaged(oForm, Lista);

                //carga tipo documentos
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select distinct U_TipoDoc 'Code', U_TipoDoc 'Name' from [@VID_FECAF]";
                }
                else
                {
                    s = @"select distinct ""U_TipoDoc"" ""Code"", ""U_TipoDoc"" ""Name"" from ""@VID_FECAF"" ";
                }
                oRecordSet.DoQuery(s);
                FSBOf.FillCombo((ComboBox)(oForm.Items.Item("TipoDoc").Specific), ref oRecordSet, true);

                //carga sucursales
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = "select Code, Name from [@VID_FESUC]";
                }
                else
                {
                    s = @"select ""Code"", ""Name"" from ""@VID_FESUC"" ";
                }
                oRecordSet.DoQuery(s);
                FSBOf.FillCombo((ComboBox)(oForm.Items.Item("Sucursal").Specific), ref oRecordSet, true);

                //        AddChooseFromList();
                oMtx = (Matrix)(oForm.Items.Item("mtx").Specific);
                //        oColumn                    := SAPbouiCOM.Column(oMtx.Columns.Item('V_0'));
                //        oColumn.ChooseFromListUID  := 'CFL0';
                //        oColumn.ChooseFromListAlias:= 'Code';

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select C1.FldValue 'Code', C1.Descr 'Name'
                           from CUFD C0
                           join UFD1 C1 on C1.TableID = C0.TableID
                                       and C1.FieldID = C0.FieldID
                          where C0.TableID = '@VID_FEDISTD'
                            and C0.AliasID = 'Estado'";
                }
                else
                {
                    s = @"select C1.""FldValue"" ""Code"", C1.""Descr"" ""Name""
                           from ""CUFD"" C0
                           join ""UFD1"" C1 on C1.""TableID"" = C0.""TableID""
                                       and C1.""FieldID"" = C0.""FieldID""
                          where C0.""TableID"" = '@VID_FEDISTD'
                            and C0.""AliasID"" = 'Estado' ";
                }
                oRecordSet.DoQuery(s);
                oColumn = (SAPbouiCOM.Column)(oMtx.Columns.Item("Estado"));
                FSBOf.FillComboMtx(oColumn, ref oRecordSet, false);

                oDBDSD.InsertRecord(0);
                oMtx.LoadFromDataSource();
                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
Ejemplo n.º 19
0
        }//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)
        {
            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_Monitor.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);

                oDBDSHeader = oForm.DataSources.DBDataSources.Add("@VID_FELOG");
                oDBDSD      = oForm.DataSources.DBDataSources.Add("@VID_FELOGD");

                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");

                oForm.DataSources.UserDataSources.Add("chk_Todo", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("chk_Todo").Specific);
                oCheckBox.DataBind.SetBound(true, "", "chk_Todo");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = false;

                oForm.DataSources.UserDataSources.Add("Rechazados", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("Rechazados").Specific);
                oCheckBox.DataBind.SetBound(true, "", "Rechazados");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = true;

                oForm.DataSources.UserDataSources.Add("Pendientes", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("Pendientes").Specific);
                oCheckBox.DataBind.SetBound(true, "", "Pendientes");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = true;

                oForm.DataSources.UserDataSources.Add("Aceptados", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("Aceptados").Specific);
                oCheckBox.DataBind.SetBound(true, "", "Aceptados");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = false;

                oForm.DataSources.UserDataSources.Add("DadoBaja", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("DadoBaja").Specific);
                oCheckBox.DataBind.SetBound(true, "", "DadoBaja");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = false;

                oForm.DataSources.UserDataSources.Add("Errores", BoDataType.dt_SHORT_TEXT, 1);
                oCheckBox = (CheckBox)(oForm.Items.Item("Errores").Specific);
                oCheckBox.DataBind.SetBound(true, "", "Errores");
                oCheckBox.ValOn   = "Y";
                oCheckBox.ValOff  = "N";
                oCheckBox.Checked = true;

                oDataTable      = oForm.DataSources.DataTables.Add("dt");
                oGrid           = (Grid)(oForm.Items.Item("grid").Specific);
                oGrid.DataTable = oDataTable;

                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();
                }

                CargarDatosPE();
            }
            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
Ejemplo n.º 21
0
        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_FELibros.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

                oDataTable      = oForm.DataSources.DataTables.Add("dt");
                ogrid           = (SAPbouiCOM.Grid)(oForm.Items.Item("grid").Specific);
                ogrid.DataTable = oDataTable;
                if (TipoLibro == "V")
                {
                    oForm.Title = "Libro de Ventas";
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select isnull(U_ProcVenta,'') Libro from [@VID_FEPARAM]";
                    }
                    else
                    {
                        s = @"select IFNULL(""U_ProcVenta"",'') ""Libro"" from ""@VID_FEPARAM"" ";
                    }
                }
                else if (TipoLibro == "C")
                {
                    oForm.Title = "Libro de Compras";
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select isnull(U_ProcCompra,'') Libro from [@VID_FEPARAM]";
                    }
                    else
                    {
                        s = @"select IFNULL(""U_ProcCompra"",'') ""Libro"" from ""@VID_FEPARAM"" ";
                    }
                }
                else if (TipoLibro == "G")
                {
                    oForm.Title = "Libro de Guias";
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select isnull(U_ProcGuia,'') Libro from [@VID_FEPARAM]";
                    }
                    else
                    {
                        s = @"select IFNULL(""U_ProcGuia"",'') ""Libro"" from ""@VID_FEPARAM"" ";
                    }
                }
                else if (TipoLibro == "B")
                {
                    oForm.Title = "Libro de Boletas";
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = "select isnull(U_ProcBol,'') Libro from [@VID_FEPARAM]";
                    }
                    else
                    {
                        s = @"select IFNULL(""U_ProcBol"",'') ""Libro"" from ""@VID_FEPARAM"" ";
                    }
                }

                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount > 0)
                {
                    if ((System.String)(oRecordSet.Fields.Item("Libro").Value) != "")
                    {
                        Query((System.String)(oRecordSet.Fields.Item("Libro").Value));
                    }
                }
            }
            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      i;
            TFunctions Param;

            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_FEMULTISOC.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                VID_DelRow   = false;
                VID_DelRowOK = false;

                Param       = new TFunctions();
                Param.SBO_f = FSBOf;

                //oForm.DataBrowser.BrowseBy := "DocEntry";
                oDBDSH = oForm.DataSources.DBDataSources.Item("@VID_FEMULTISOC");
                //oDBDSBases := oForm.DataSources.DBDataSources.Item("@VID_FEMULTISOC");

                // Ok Ad  Fnd Vw Rq Sec
                //        Lista.Add('DocEntry  , f,  f,  t,  f, r, 1');
                //        Lista.Add('Desde     , f,  f,  f,  f, r, 1');
                //        Lista.Add('mtx       , f,  t,  f,  f, n, 1');
                //        FSBOf.SetAutoManaged(var oForm, Lista);

                oMtx = (Matrix)(oForm.Items.Item("mtx").Specific);

                oMtx.AutoResizeColumns();
                //EditText(oForm.Items.Item('CardCode').Specific).Active := True;

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select U_Sociedad
                              ,U_RUT 
                              ,U_Servidor
                              ,U_Base
	                          ,U_Usuario
	                          ,U_Password
	                          ,DocEntry
	                          ,U_Habilitada
                          from [@VID_FEMULTISOC]";
                }
                else
                {
                    s = @"select ""U_Sociedad""
                              ,""U_RUT""
                              ,""U_Servidor""
                              ,""U_Base""
	                          ,""U_Usuario""
	                          ,""U_Password""
	                          ,""DocEntry""
	                          ,""U_Habilitada""
                          from ""@VID_FEMULTISOC"" ";
                }
                oRecordSet.DoQuery(s);

                if (oRecordSet.RecordCount == 0)
                {
                    oMtx.AddRow(1, 1);
                    oMtx.FlushToDataSource();
                    oMtx.AutoResizeColumns();
                }
                else
                {
                    i = 0;
                    oDBDSH.Clear();
                    while (!oRecordSet.EoF)
                    {
                        oDBDSH.InsertRecord(i);
                        oDBDSH.SetValue("U_Sociedad", i, (System.String)(oRecordSet.Fields.Item("U_Sociedad").Value));
                        oDBDSH.SetValue("U_RUT", i, (System.String)(oRecordSet.Fields.Item("U_RUT").Value));
                        oDBDSH.SetValue("U_Servidor", i, (System.String)(oRecordSet.Fields.Item("U_Servidor").Value));
                        oDBDSH.SetValue("U_Base", i, (System.String)(oRecordSet.Fields.Item("U_Base").Value));

                        oDBDSH.SetValue("U_Usuario", i, (System.String)(oRecordSet.Fields.Item("U_Usuario").Value));
                        //s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Password").Value).ToString().Trim());
                        oDBDSH.SetValue("U_Password", i, (System.String)(oRecordSet.Fields.Item("U_Password").Value));

                        oDBDSH.SetValue("DocEntry", i, Convert.ToString((System.Int32)(oRecordSet.Fields.Item("DocEntry").Value)));
                        oDBDSH.SetValue("U_Habilitada", i, (System.String)(oRecordSet.Fields.Item("U_Habilitada").Value));
                        i++;
                        oRecordSet.MoveNext();
                    }
                    oDBDSH.InsertRecord(i);
                    oMtx.LoadFromDataSource();
                    oMtx.AutoResizeColumns();
                }



                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)
        {
            //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
        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_FEPLANCTA.srf", uid);
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged = true;

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT COUNT(*) AS cant FROM [@VID_FEPLANCTA]";
                }
                else
                {
                    s = @"SELECT COUNT(*) ""cant"" FROM ""@VID_FEPLANCTA""";
                }
                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);

                oDBDSHeader = oForm.DataSources.DBDataSources.Add("@VID_FEPLANCTA");

                if (((System.Int32)oRecordSet.Fields.Item("cant").Value) == 0)
                {
                    FSBOApp.StatusBar.SetText("Iniciando carga de cuentas SII", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                    CargarCtaSII();
                }

                // Ok  Ad  Fnd Vw Rq Sec
                Lista.Add("grid       , t,  t,  f,  t, n, 1 ");
                FSBOf.SetAutoManaged(oForm, Lista);

                oForm.DataSources.UserDataSources.Add("Cuenta", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 30);
                oEditText = ((EditText)oForm.Items.Item("Cuenta").Specific);
                oEditText.DataBind.SetBound(true, "", "Cuenta");

                oForm.DataSources.UserDataSources.Add("Descr", SAPbouiCOM.BoDataType.dt_LONG_TEXT, 60);
                oEditText = ((EditText)oForm.Items.Item("Descr").Specific);
                oEditText.DataBind.SetBound(true, "", "Descr");

                oDataTable          = oForm.DataSources.DataTables.Add("VID_FEPLANCTA");
                oGrid               = ((SAPbouiCOM.Grid)oForm.Items.Item("grid").Specific);
                oGrid.DataTable     = oDataTable;
                oGrid.SelectionMode = BoMatrixSelect.ms_Single;

                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 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
Ejemplo n.º 26
0
        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;

            Param       = new TFunctions();
            Param.SBO_f = FSBOf;

            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_GELibro.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("TipoLibro", BoDataType.dt_SHORT_TEXT);
                oComboBox = (ComboBox)(oForm.Items.Item("TipoLibro").Specific);
                oComboBox.DataBind.SetBound(true, "", "TipoLibro");
                oComboBox.ValidValues.Add("V", "Venta");
                oComboBox.ValidValues.Add("C", "Compra");
                oComboBox.Select("V", BoSearchKey.psk_ByValue);

                oForm.DataSources.UserDataSources.Add("Periodo", BoDataType.dt_SHORT_TEXT);
                oComboBox = (ComboBox)(oForm.Items.Item("Periodo").Specific);
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    oRecordSet.DoQuery("select CAST(AbsEntry AS VARCHAR(20)) Code, Code 'Name'  from OFPR where YEAR(F_RefDate) >= YEAR(GETDATE())-1  AND YEAR(T_RefDate) <= YEAR(GETDATE())");
                }
                else
                {
                    oRecordSet.DoQuery(@"select TO_VARCHAR(""AbsEntry"") ""Code"", ""Code"" ""Name""  from ""OFPR"" where YEAR(""F_RefDate"") >= YEAR(NOW())-1  AND YEAR(""T_RefDate"") <= YEAR(NOW()) ");
                }
                FSBOf.FillCombo((ComboBox)(oForm.Items.Item("Periodo").Specific), ref oRecordSet, false);
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select AbsEntry from OFPR where GETDATE() BETWEEN F_RefDate AND T_RefDate";
                }
                else
                {
                    s = @"select ""AbsEntry"" from ""OFPR"" where NOW() BETWEEN ""F_RefDate"" AND ""T_RefDate"" ";
                }
                oRecordSet.DoQuery(s);
                oComboBox.Select(((System.Int32)oRecordSet.Fields.Item("AbsEntry").Value).ToString(), BoSearchKey.psk_ByValue);


                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) == "Y")
                    {
                        bMultiSoc = true;
                    }
                }

                if (bMultiSoc)
                {
                    oForm.Items.Item("LInstituto").Visible = true;
                    oForm.Items.Item("Instituto").Visible  = true;
                    oComboBox = (ComboBox)(oForm.Items.Item("Instituto").Specific);
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"select DocEntry, U_Sociedad 'Sociedad' from [@VID_FEMULTISOC] where isnull(U_Habilitada,'N') = 'Y'";
                    }
                    else
                    {
                        s = @"select ""DocEntry"", ""U_Sociedad"" ""Sociedad"" from ""@VID_FEMULTISOC"" where IFNULL(""U_Habilitada"",'N') = 'Y' ";
                    }
                    oRecordSet.DoQuery(s);
                    while (!oRecordSet.EoF)
                    {
                        oComboBox.ValidValues.Add(((System.Int32)oRecordSet.Fields.Item("DocEntry").Value).ToString(), ((System.String)oRecordSet.Fields.Item("Sociedad").Value).Trim());
                        oRecordSet.MoveNext();
                    }
                }
                else
                {
                    oForm.Items.Item("LInstituto").Visible = false;
                    oForm.Items.Item("Instituto").Visible  = false;
                }
            }
            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
Ejemplo n.º 27
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            //SAPbouiCOM.ComboBox oCombo;
            TFunctions Param;

            SAPbouiCOM.CheckBox oCheckBox;
            SAPbouiCOM.EditText oEditText;

            //
            //  obetener recurso
            //  try
            //  .....
            //  finally
            //  liberar recurso
            //  end

            bool Result = base.InitForm(uid, xmlPath, ref application, ref company, ref SBOFunctions, ref _GlobalSettings);

            oRecordSet = (SAPbobsCOM.Recordset)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset));
            try
            {
                //Lista    := New list<string>;

                FSBOf.LoadForm(xmlPath, "strCnn.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = false;
                oForm.SupportedModes = -1;             // afm_All

                //oForm.DataBrowser.BrowseBy := "DocNum";

                // 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);

                oDBDSHeader = (DBDataSource)(oForm.DataSources.DBDataSources.Item("@VID_FEPARAM"));

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkMon").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkDteTra").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                //oCheckBox = (CheckBox)(oForm.Items.Item("chkCrearD").Specific);
                //oCheckBox.ValOn = "Y";
                //oCheckBox.ValOff = "N";

                //oCheckBox = (CheckBox)(oForm.Items.Item("chkCrearDS").Specific);
                //oCheckBox.ValOn = "Y";
                //oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkPrint").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkDistrib").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkVal90").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("MultiSoc").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("ValDescL").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("GeneraT").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("SubirSuc").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("AbrirDoc").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oCheckBox        = (CheckBox)(oForm.Items.Item("chkFProv").Specific);
                oCheckBox.ValOn  = "Y";
                oCheckBox.ValOff = "N";

                oEditText            = (EditText)(oForm.Items.Item("Pasword").Specific);
                oEditText.IsPassword = true;


                //Configuración RadioButtons
                DSOpDif = oForm.DataSources.UserDataSources.Add("rbOpDif", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 1);
                ((OptionBtn)oForm.Items.Item("opDifPor").Specific).DataBind.SetBound(true, "", "rbOpDif"); //1

                ((OptionBtn)oForm.Items.Item("opDifMon").Specific).DataBind.SetBound(true, "", "rbOpDif"); //2
                ((OptionBtn)oForm.Items.Item("opDifMon").Specific).GroupWith("opDifPor");


                if (!GlobalSettings.RunningUnderSQLServer)
                {
                    oForm.Items.Item("btnProcFE").Visible = false;
                }
                else
                {
                    oForm.Items.Item("btnProcFE").Visible = true;
                }

                //s := 'Select count(*) cant from [@VID_FEPARAM]';
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"Select count(*) CANT
                                ,U_Usuario
                                ,U_Password
                                ,U_UserWSCL
                                ,U_PassWSCL
                                ,ISNULL(U_TipoDif,'M') 'U_TipoDif'
                            from [@VID_FEPARAM] 
                            group by U_Usuario
                                ,U_Password
                                ,U_UserWSCL
                                ,U_PassWSCL
                                ,ISNULL(U_TipoDif,'M')";
                }
                else
                {
                    s = @"Select count(*) ""CANT"" 
                           ,""U_Usuario"" 
                           ,""U_Password""
                           ,""U_UserWSCL""
                           ,""U_PassWSCL""
                           ,IFNULL(""U_TipoDif"",'M') ""U_TipoDif""
                      from ""@VID_FEPARAM"" 
                     group by ""U_Usuario"" 
                             ,""U_Password""
                             ,""U_UserWSCL""
                             ,""U_PassWSCL""
                             ,IFNULL(""U_TipoDif"",'M') ";
                }
                oRecordSet.DoQuery(s);
                if ((System.Int32)(oRecordSet.Fields.Item("CANT").Value) > 0)
                {
                    Param       = new TFunctions();
                    Param.SBO_f = FSBOf;

                    oForm.SupportedModes = 1;
                    oForm.Mode           = BoFormMode.fm_UPDATE_MODE;
                    oDBDSHeader.Query(null);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Usuario").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_Usuario", 0, s);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_Password").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_Password", 0, s);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_UserWSCL").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_UserWSCL", 0, s);

                    s = Param.DesEncriptar((System.String)(oRecordSet.Fields.Item("U_PassWSCL").Value).ToString().Trim());
                    oDBDSHeader.SetValue("U_PassWSCL", 0, s);

                    oForm.PaneLevel = 101;

                    if (((System.String)oDBDSHeader.GetValue("U_MultiSoc", 0)).Trim() == "Y")
                    {
                        oForm.Items.Item("chkDistrib").Visible = false;
                        oForm.Items.Item("AbrirDoc").Visible   = true;
                    }
                    else if (((System.String)oDBDSHeader.GetValue("U_MultiSoc", 0)).Trim() == "N")
                    {
                        oForm.Items.Item("chkDistrib").Visible = true;
                        oForm.Items.Item("AbrirDoc").Visible   = false;
                    }

                    oForm.Freeze(false);
                    if (((System.String)oRecordSet.Fields.Item("U_TipoDif").Value).Trim() == "M")
                    {
                        DSOpDif.Value = "2";
                    }
                    //((OptionBtn)oForm.Items.Item("opDifMon").Specific).Selected = true;
                    else
                    {
                        DSOpDif.Value = "1";
                    }
                    //((OptionBtn)oForm.Items.Item("opDifPor").Specific).Selected = true;
                }
                else
                {
                    oForm.SupportedModes = 3;
                    oForm.Mode           = BoFormMode.fm_ADD_MODE;
                    oForm.PaneLevel      = 101;
                    ((OptionBtn)oForm.Items.Item("opDifMon").Specific).Selected = true;
                }
            }
            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
Ejemplo n.º 28
0
        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));

                //Lista    := New list<string>;

                FSBOf.LoadForm(xmlPath, "VID_FEDetalleLog.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

                //oForm.DataBrowser.BrowseBy := "DocNum";

                // 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);

                //s := '1';
                //oCombo.Select(s, BoSearchKey.psk_ByValue);

                oForm.Items.Item("grid").Enabled = false;
                ogrid           = (Grid)(oForm.Items.Item("grid").Specific);
                dt              = oForm.DataSources.DataTables.Add("dt");
                ogrid.DataTable = dt;

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select U_TipoDoc
                              ,LTRIM(STR(U_FolioNum,18,0)) 'U_FolioNum'
                              ,U_ID_Log
                              ,U_Glosa
                              ,U_FechaIn
                          from [@VID_FELOG] T0
                          join [@VID_FELOGD] T1 ON T1.DocEntry = T0.DocEntry
                         where T0.DocEntry = {0}
                         order by T1.LineId DESC";
                }
                else
                {
                    s = @"select ""U_TipoDoc""
                              ,LTRIM(ROUND(""U_FolioNum"",0)) ""U_FolioNum""
                              ,""U_ID_Log""
                              ,""U_Glosa""
                              ,""U_FechaIn""
                          from ""@VID_FELOG"" T0 
                          join ""@VID_FELOGD"" T1 ON T1.""DocEntry"" = T0.""DocEntry""
                         where T0.""DocEntry"" = {0}
                         order by T1.""LineId"" DESC ";
                }

                s = String.Format(s, prmKey);
                dt.ExecuteQuery(s);
                ogrid.AutoResizeColumns();

                ogrid.Columns.Item("U_TipoDoc").Type = BoGridColumnType.gct_EditText;
                oColumn = (GridColumn)(ogrid.Columns.Item("U_TipoDoc"));
                var oEditColumn = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Tipo Documento";
                oEditColumn.RightJustified      = true;

                ogrid.Columns.Item("U_FolioNum").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(ogrid.Columns.Item("U_FolioNum"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Número Folio";
                oEditColumn.RightJustified      = true;

                ogrid.Columns.Item("U_ID_Log").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(ogrid.Columns.Item("U_ID_Log"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "ID Log Portal";
                oEditColumn.RightJustified      = true;

                ogrid.Columns.Item("U_Glosa").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(ogrid.Columns.Item("U_Glosa"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Glosa";
                oEditColumn.RightJustified      = false;

                ogrid.Columns.Item("U_FechaIn").Type = BoGridColumnType.gct_EditText;
                oColumn                         = (GridColumn)(ogrid.Columns.Item("U_FechaIn"));
                oEditColumn                     = (EditTextColumn)(oColumn);
                oEditColumn.Editable            = false;
                oEditColumn.TitleObject.Caption = "Fecha Movimiento";
                oEditColumn.RightJustified      = false;

                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
Ejemplo n.º 29
0
        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
Ejemplo n.º 30
0
        public new bool InitForm(string uid, string xmlPath, ref Application application, ref SAPbobsCOM.Company company, ref CSBOFunctions SBOFunctions, ref TGlobalVid _GlobalSettings)
        {
            Int32 CantRol;

            SAPbouiCOM.ComboBox oCombo;
            SAPbouiCOM.EditText oEditText;
            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_DarBaja.srf", uid);
                //EnableCrystal := true;
                oForm = FSBOApp.Forms.Item(uid);
                oForm.Freeze(true);
                oForm.AutoManaged    = true;
                oForm.SupportedModes = -1;             // afm_All

                oCombo = (ComboBox)(oForm.Items.Item("TipoDoc").Specific);
                oCombo.ValidValues.Add("01", "Factura");
                oCombo.ValidValues.Add("01A", "Factura de Anticipo");
                oCombo.ValidValues.Add("01X", "Factura de Exportación");
                oCombo.ValidValues.Add("03", "Boleta Venta");
                oCombo.ValidValues.Add("07", "Nota de Credito");
                oCombo.ValidValues.Add("08", "Nota de Debito");
                oCombo.ValidValues.Add("09T", "Guia Remisión x Transferencia");
                oCombo.ValidValues.Add("09D", "Guia Remisión x Devol. Compra");
                oCombo.ValidValues.Add("09", "Guia Remisión x Entrega");
                oCombo.ValidValues.Add("20", "Comprobante Retención");
                oCombo.Select("01", BoSearchKey.psk_ByValue);
                oForm.Items.Item("TipoDoc").DisplayDesc = true;

                oEditText = (EditText)(oForm.Items.Item("FDesde").Specific);
                //oEditText.Value = DateTime.Now.ToString("yyyyMMdd");

                oEditText = (EditText)(oForm.Items.Item("FHasta").Specific);
                //oEditText.Value = DateTime.Now.ToString("yyyyMMdd");

                var oGrid = ((SAPbouiCOM.Grid)oForm.Items.Item("grid").Specific);
                oGrid.DataTable = oForm.DataSources.DataTables.Add("dt");


                // Ok Ad  Fnd Vw Rq Sec
                Lista.Add("TipoDoc  , f,  t,  t,  f, r, 1");
                Lista.Add("FDesde   , f,  t,  f,  f, r, 1");
                Lista.Add("FHasta   , f,  t,  f,  f, r, 1");
                Lista.Add("Razon    , t,  t,  f,  f, r, 1");
                Lista.Add("DocEntry , f,  f,  t,  f, r, 1");
                FSBOf.SetAutoManaged(ref oForm, Lista);
                oForm.Mode = BoFormMode.fm_ADD_MODE;
            }
            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