}//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            Int32  nErr;
            String sErr;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);
            IvkFormInterface oFormB;
            String           oUid;

            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction))
                {
                    if (pVal.ItemUID == "btn1")
                    {
                        oFormB            = (IvkFormInterface)(new TLibros());
                        TLibros.TipoLibro = "C";
                        oEditText         = (EditText)(oForm.Items.Item("Desde").Specific);
                        TLibros.Desde     = oEditText.Value;
                        oEditText         = (EditText)(oForm.Items.Item("Hasta").Specific);
                        TLibros.Hasta     = oEditText.Value;
                        oUid = FSBOf.generateFormId(FGlobalSettings.SBOSpaceName, FGlobalSettings);
                        oFormB.InitForm(oUid, "forms\\", ref FSBOApp, ref FCmpny, ref FSBOf, ref FGlobalSettings);
                        FoForms.Add(oFormB);
                    }
                }
            }
            catch (Exception e)
            {
                FCmpny.GetLastError(out nErr, out sErr);
                FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
        private void CuentaSAP(Int32 Linea)
        {
            IvkFormInterface oFormvk  = null;
            String           oPath    = System.IO.Path.GetDirectoryName(TMultiFunctions.ParamStr(0));
            String           sArchivo = "";
            String           oUid;

            try
            {
                oDBDSHeader.Clear();
                oDBDSHeader.InsertRecord(0);
                oDBDSHeader.SetValue("DocEntry", 0, oDataTable.GetValue("DocEntry", Linea).ToString().Trim());
                oDBDSHeader.SetValue("U_Cuenta", 0, ((System.String)oDataTable.GetValue("Cuenta", Linea)).Trim());
                oDBDSHeader.SetValue("U_Desc", 0, ((System.String)oDataTable.GetValue("Descripcion", Linea)).Trim());
                oDBDSHeader.SetValue("U_Clasif", 0, ((System.String)oDataTable.GetValue("Clasificacion", Linea)).Trim());

                oFormvk                = (IvkFormInterface)(new TCuentaSAP());
                TCuentaSAP.DocEntry    = ((System.Int32)oDataTable.GetValue("DocEntry", Linea));
                TCuentaSAP.oDBDSHeader = oDBDSHeader;

                oUid = FSBOf.generateFormId(FGlobalSettings.SBOSpaceName, FGlobalSettings);
                oFormvk.InitForm(oUid, "forms\\", ref FSBOApp, ref FCmpny, ref FSBOf, ref FGlobalSettings);
                FoForms.Add(oFormvk);
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("Error Abrri Sueldos: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            Int32  nErr;
            String sErr;

            SAPbouiCOM.ComboBox oComboBox;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction))
                {
                    if ((pVal.ItemUID == "1") && (oForm.Mode == BoFormMode.fm_ADD_MODE))
                    {
                        BubbleEvent = false;
                        GuardarRegistros();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (!pVal.BeforeAction))
                {
                    if ((pVal.ItemUID == "TipoDoc") && (oForm.Mode == BoFormMode.fm_ADD_MODE))
                    {
                        //carga Rango de Folios
                        if (GlobalSettings.RunningUnderSQLServer)
                        {
                            s = @"select Code 'Code', CAST(U_Desde as varchar(20)) + '-' + CAST(U_Hasta as varchar(20))  'Name' 
                                    from [@VID_FECAF]
                                    where U_TipoDoc = '{0}'";
                        }
                        else
                        {
                            s = @"select ""Code"" ""Code"", CAST(""U_Desde"" as varchar(20)) + '-' + CAST(""U_Hasta"" as varchar(20))  ""Name""
                                    from ""@VID_FECAF""
                                   where ""U_TipoDoc"" = '{0}' ";
                        }
                        oComboBox = (ComboBox)(oForm.Items.Item("TipoDoc").Specific);
                        s         = String.Format(s, (System.String)(oComboBox.Value).Trim());
                        oRecordSet.DoQuery(s);
                        FSBOf.FillCombo((ComboBox)(oForm.Items.Item("RangoF").Specific), ref oRecordSet, true);
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction) && (pVal.ItemUID == "btnDist") && (oForm.Mode == BoFormMode.fm_ADD_MODE))
                {
                    if (Validar())
                    {
                        Distribuir();
                    }
                }
            }
            catch (Exception e)
            {
                FCmpny.GetLastError(out nErr, out sErr);
                FSBOApp.StatusBar.SetText("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
        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.º 5
0
        }//fin LimpiarGrid

        private Boolean CrearDatos()
        {
            Boolean    _result;
            Int32      i;
            TFunctions Functions;

            try
            {
                _result = true;
                i       = 0;
                oDBDSHeader.Clear();
                Functions       = new TFunctions();
                Functions.SBO_f = FSBOf;
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = "select Code, U_CodImpto, U_Desc, U_Porc from [@VID_FEIMPADIC]";
                }
                else
                {
                    s = @"select ""Code"", ""U_CodImpto"", ""U_Desc"", ""U_Porc"" from ""@VID_FEIMPADIC"" ";
                }
                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount > 0)
                {
                    Functions.ImpAdicDel(ref oRecordSet);
                }

                while (i < oDataTable.Rows.Count)
                {
                    oDBDSHeader.InsertRecord(0);
                    oDBDSHeader.SetValue("Code", 0, (System.String)(oDataTable.GetValue("Code", i)).ToString().Trim());
                    oDBDSHeader.SetValue("U_CodImpto", 0, (System.String)(oDataTable.GetValue("U_CodImpto", i)).ToString().Trim());
                    oDBDSHeader.SetValue("U_Desc", 0, (System.String)(oDataTable.GetValue("U_Desc", i)).ToString().Trim());
                    oDBDSHeader.SetValue("U_Porc", 0, FSBOf.DoubleToStr(((System.Double)oDataTable.GetValue("U_Porc", i))).Trim());

                    _result = Functions.ImpAdicAdd(oDBDSHeader);

                    i++;
                }

                oDataTable.Rows.Add(1);
                oDataTable.SetValue("Code", oDataTable.Rows.Count - 1, "");
                oDataTable.SetValue("U_CodImpto", oDataTable.Rows.Count - 1, "");
                oDataTable.SetValue("U_Desc", oDataTable.Rows.Count - 1, "");
                oDataTable.SetValue("U_Porc", oDataTable.Rows.Count - 1, 0);

                return(_result);
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText(e.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("CrearDatos " + e.Message + " ** Trace: " + e.StackTrace);
                return(false);
            }
        } //fin CrearDatos
Ejemplo n.º 6
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
        }//fin MenuEvent

        private void Borrar()
        {
            Int32   i;
            Boolean Paso = false;
            String  DocEntry;

            SAPbouiCOM.EditText oEditText;
            TFunctions          Reg;

            try
            {
                oForm.Freeze(true);
                Reg       = new TFunctions();
                Reg.SBO_f = FSBOf;
                i         = 1;
                while (i <= oMtx.RowCount)
                {
                    if (oMtx.IsRowSelected(i))
                    {
                        oEditText = (EditText)(oMtx.Columns.Item("DocEntry").Cells.Item(i).Specific);
                        DocEntry  = (System.String)(oEditText.Value).Trim();
                        if (DocEntry != "")
                        {
                            Reg.DelDataSource("D", "VID_FEPROCED", "", FSBOf.StrToInteger(DocEntry));
                            oMtx.DeleteRow(i);
                            Paso = true;
                            i    = oMtx.RowCount;
                        }
                    }
                    i++;
                }
                if (!Paso)
                {
                    FSBOApp.StatusBar.SetText("Debe seleccionar una linea", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                }
                else
                {
                    oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                }
            }
            catch (Exception x)
            {
                oForm.Freeze(false);
            }
        }
        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
        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
Ejemplo n.º 12
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.º 13
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
Ejemplo n.º 14
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)
        {
            //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
        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
        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.º 18
0
        private void MostrarPDF(Int32 Linea)
        {
            String  Code;
            String  sXml;
            String  TipoDoc;
            String  Folio;
            String  RUTEmisor;
            String  oPath;
            String  sNombreArchivo;
            String  sNombrePDF;
            Boolean flag = true;
            String  Pass = "";

            try
            {
                oGrid     = (Grid)(oForm.Items.Item("grid").Specific);
                Code      = Convert.ToString(((System.Int32)oGrid.DataTable.GetValue("DocEntry", Linea)), _nf);
                sXml      = ((System.String)oGrid.DataTable.GetValue("xml", Linea));
                TipoDoc   = ((System.String)oGrid.DataTable.GetValue("TipoDoc", Linea));
                RUTEmisor = ((System.String)oGrid.DataTable.GetValue("RUT", Linea));
                Folio     = Convert.ToString(((System.Int32)oGrid.DataTable.GetValue("Folio", Linea)), _nf);
                if (sXml != "")
                {
                    oPath = System.IO.Path.GetDirectoryName(TMultiFunctions.ParamStr(0));
                    try
                    {
                        if (GlobalSettings.RunningUnderSQLServer)
                        {
                            sNombreArchivo = oPath + "\\Reports\\CL\\SQL\\ReporteXML.rpt";
                        }
                        else
                        {
                            sNombreArchivo = oPath + "\\Reports\\CL\\HANA\\ReporteXML.rpt";
                        }
                        sNombrePDF = oPath + @"\PDF\" + RUTEmisor + "_" + TipoDoc + "_" + Folio + ".pdf";
                        if (File.Exists(sNombrePDF))
                        {
                            System.Diagnostics.Process proc = new System.Diagnostics.Process();
                            proc.StartInfo.FileName = sNombrePDF;
                            proc.Start();
                        }
                        else
                        {
                            FSBOf.AddRepKey(Code, "FEREPORTXML", "FEREPORTXML");//oForm.TypeEx);
                            GlobalSettings.CrystalReportFileName = sNombreArchivo;
                            try
                            {
                                FSBOApp.Menus.Item("4873").Activate();
                            }
                            catch { }

                            /*FSBOApp.Menus.Item("4873").Activate();
                             * var oFormB = FSBOApp.Forms.ActiveForm;
                             * ((EditText)oFormB.Items.Item("410000004").Specific).Value = sNombreArchivo;
                             * oFormB.Items.Item("410000005").Click(BoCellClickType.ct_Regular);*/
                        }
                    }
                    catch (Exception p)
                    {
                        FSBOApp.StatusBar.SetText(p.Message + " ** Trace: " + p.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        OutLog("Cargar Crystal: " + p.Message + " ** Trace: " + p.StackTrace);
                    }
                }
                else
                {
                    FSBOApp.StatusBar.SetText("No se ha encontrado xml que genera PDF", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                }
            }
            catch (Exception x)
            {
                FSBOApp.StatusBar.SetText(x.Message + " ** Trace: " + x.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("MostrarPDF: " + x.Message + " ** Trace: " + x.StackTrace);
            }
        }
        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
Ejemplo n.º 20
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
        private void CargarCtaSII()
        {
            SAPbouiCOM.ProgressBar oProgressBar = null;
            Int32 NroLineas;

            System.Data.DataTable dtConceptos;
            Boolean bRegistroOk;
            String  sHojaExcel;
            String  sCuenta;
            String  sRegistro;
            String  Padre;
            //String Hijo;
            String           sPeriodoActual;
            String           strConn;
            Boolean          bIngresaConceptos = false;
            DataSet          ADOQueryExcel;
            Int32            Entry;
            OleDbDataAdapter adapter;
            String           sPathArchivo = "";

            try
            {
                sPathArchivo = Directory.GetCurrentDirectory() + "\\SQLs\\CL\\Carga\\DiccionarioSII.xls";
                sHojaExcel   = "[CTASII$]";
                strConn      = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Extended Properties=Excel 8.0;Mode=ReadWrite";
                strConn      = String.Format(strConn, sPathArchivo);

                adapter       = new OleDbDataAdapter("Select * from [CTASII$]", strConn);
                ADOQueryExcel = new DataSet();
                try
                {
                    adapter.Fill(ADOQueryExcel, "CTASII");
                    dtConceptos = new System.Data.DataTable();
                    dtConceptos = ADOQueryExcel.Tables["CTASII"];
                }
                catch //(Exception y)
                {
                    FSBOApp.StatusBar.SetText("Error leyendo archivo excel...", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    return;
                }

                if (dtConceptos.Rows.Count == 0)
                {
                    FSBOApp.StatusBar.SetText("No existen Cuentas SII para importar...", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                    return;
                }

                oProgressBar = FSBOApp.StatusBar.CreateProgressBar("Importando Cuentas SII...", dtConceptos.Rows.Count + 2, false);
                NroLineas    = 1;
                foreach (DataRow oRow in dtConceptos.Rows)
                {
                    bIngresaConceptos = false;
                    sCuenta           = oRow.Field <String>("Cuenta");
                    if (sCuenta != null)
                    {
                        sRegistro = Convert.ToString(oRow.Field <Double>("Registro"));

                        if (Convert.ToString(oRow.Field <String>("Glosa")).Trim() == "")
                        {
                            s = @"UPDATE {0} SET validacion = 'Debe ingresar Glosa' where [Registro] = {1}";
                            s = String.Format(s, sHojaExcel, sRegistro);
                            Funciones.EjecutarSQLOleDb(s, strConn);
                        }
                        else
                        {
                            bIngresaConceptos = true;
                        }


                        if (bIngresaConceptos)
                        {
                            oDBDSHeader.Clear();

                            oDBDSHeader.InsertRecord(0);
                            oDBDSHeader.SetValue("U_Cuenta", 0, Convert.ToString(oRow.Field <String>("Cuenta")).Trim());
                            oDBDSHeader.SetValue("U_Desc", 0, Convert.ToString(oRow.Field <String>("Glosa")).Trim());
                            oDBDSHeader.SetValue("U_Clasif", 0, Convert.ToString(oRow.Field <String>("Clasificacion")).Trim());

                            Entry = Funciones.AddDataSourceInt1("VID_FEPLANCTA", oDBDSHeader, "", null, "", null, "", null);


                            if (Entry > 0)
                            {
                                var ss = FCmpny.GetNewObjectKey();
                                s = @"UPDATE {0} SET validacion = 'OK' WHERE [Registro] = {1}";
                                s = String.Format(s, sHojaExcel, sRegistro);
                            }
                            else
                            {
                                var err = FCmpny.GetLastErrorDescription();
                                s = @"UPDATE {0} SET validacion = 'Error al crear {1}' WHERE [Registro] = {2}";
                                s = String.Format(s, sHojaExcel, err, sRegistro);
                            }
                            Funciones.EjecutarSQLOleDb(s, strConn);
                        }
                    }
                    else
                    {
                        oProgressBar.Value = oProgressBar.Maximum;
                        break;
                    }

                    oProgressBar.Value = NroLineas;
                    NroLineas          = NroLineas + 1;
                }

                FSBOApp.StatusBar.SetText("Fin de la importación", BoMessageTime.bmt_Long, BoStatusBarMessageType.smt_Success);
                FSBOApp.MessageBox("Fin de la importación", 1, "Ok", "", "");
            }
            catch (Exception e)
            {
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
                OutLog("Error importando Conceptos desde: " + sPathArchivo + ". Error: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                if (oProgressBar != null)
                {
                    oProgressBar.Stop();
                }
                FSBOf._ReleaseCOMObject(oProgressBar);
            }
        }
        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
Ejemplo n.º 23
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
Ejemplo n.º 24
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.º 25
0
        }//fin MenuEvent

        private void BuscarDatos()
        {
            String FechaD;
            String FechaH;
            String TipoDTE;

            try
            {
                oForm.Freeze(true);
                FechaD  = ((System.String)((EditText)oForm.Items.Item("FechaD").Specific).Value);
                FechaH  = ((System.String)((EditText)oForm.Items.Item("FechaH").Specific).Value);
                TipoDTE = ((System.String)((ComboBox)oForm.Items.Item("TipoDTE").Specific).Selected.Value).Trim();

                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"SELECT T0.DocEntry
                              ,T0.U_TipoDoc TipoDoc
	                          ,T0.U_Folio Folio
	                          ,T0.U_RUT RUT
                              ,T0.U_Razon Razon
	                          ,T0.U_FechaEmi FechaEmi
	                          ,CAST(REPLACE(CONVERT(CHAR(10), T0.U_FechaRecep, 102),'.','-') +'  '+ 
								                            CASE WHEN LEN(T0.U_HoraRecep) = 4 THEN LEFT(CAST(T0.U_HoraRecep AS VARCHAR(10)),2) + ':' + RIGHT(CAST(T0.U_HoraRecep AS VARCHAR(10)),2) + ':00'
									                             WHEN LEN(T0.U_HoraRecep) = 3 THEN '0' + LEFT(CAST(T0.U_HoraRecep AS VARCHAR(10)),1) + ':' + RIGHT(CAST(T0.U_HoraRecep AS VARCHAR(10)),2) + ':00'
									                             WHEN LEN(T0.U_HoraRecep) = 2 THEN '00:'+ CAST(T0.U_HoraRecep AS VARCHAR(10)) + ':00'
										                         WHEN LEN(T0.U_HoraRecep) = 1 THEN '00:0' + CAST(T0.U_HoraRecep AS VARCHAR(10)) + ':00'
										                         ELSE '00:00:00'
								                            END AS VARCHAR(50)) FechaRecep
	                          ,T0.U_Monto Monto
	                          ,T0.U_IVA IVA
	                          ,T0.U_EstadoC EstadoC
	                          ,T0.U_EstadoSII EstadoSII
	                          ,T0.U_EstadoLey EstadoLey
                              ,CAST(T0.U_DocEntry AS INT) DocEntryDoc
                              ,{4} 'xml'  
                          FROM [{2}] T0
                         WHERE 1 = 1
                           AND T0.{3} BETWEEN '{0}' AND '{1}'";
                }
                else
                {
                    s = @"SELECT T0.""DocEntry""
                              ,T0.""U_TipoDoc"" ""TipoDoc""
	                          ,T0.""U_Folio"" ""Folio""
	                          ,T0.""U_RUT"" ""RUT""
                              ,T0.""U_Razon"" ""Razon""
	                          ,T0.""U_FechaEmi"" ""FechaEmi""
	                          ,CAST(TO_VARCHAR(T0.""U_FechaRecep"", 'yyyy-MM-dd') ||'  '|| 
								   CASE WHEN LENGTH(T0.""U_HoraRecep"") = 4 THEN LEFT(CAST(T0.""U_HoraRecep"" AS VARCHAR(10)),2) || ':' || RIGHT(CAST(T0.""U_HoraRecep"" AS VARCHAR(10)),2) || ':00'
										WHEN LENGTH(T0.""U_HoraRecep"") = 3 THEN '0' || LEFT(CAST(T0.""U_HoraRecep"" AS VARCHAR(10)),1) || ':' || RIGHT(CAST(T0.""U_HoraRecep"" AS VARCHAR(10)),2) || ':00'
										WHEN LENGTH(T0.""U_HoraRecep"") = 2 THEN '00:' || CAST(T0.""U_HoraRecep"" AS VARCHAR(10)) || ':00'
										WHEN LENGTH(T0.""U_HoraRecep"") = 1 THEN '00:0' || CAST(T0.""U_HoraRecep"" AS VARCHAR(10)) || ':00'
										ELSE '00:00:00'
								   END AS VARCHAR(50)) ""FechaRecep""
	                          ,T0.""U_Monto"" ""Monto""
	                          ,T0.""U_IVA"" ""IVA""
	                          ,T0.""U_EstadoC"" ""EstadoC""
	                          ,T0.""U_EstadoSII"" ""EstadoSII""
	                          ,T0.""U_EstadoLey"" ""EstadoLey""
                              ,TO_INT(T0.""U_DocEntry"") ""DocEntryDoc""
                              ,{4} ""xml""  
                          FROM ""{2}"" T0
                         WHERE 1 = 1
                           AND T0.""{3}"" BETWEEN '{0}' AND '{1}'";
                }
                s = String.Format(s, FechaD, FechaH, (TipoDTE == "V" ? "@VID_FEDTEVTA" : "@VID_FEDTECPRA"), (DSOpFec.Value == "1" ? "U_FechaEmi" : "U_FechaRecep"), (TipoDTE == "C" ? (GlobalSettings.RunningUnderSQLServer ? @"T0.U_Xml" : @"T0.""U_Xml"" ") : "''"));

                if (((System.String)((ComboBox)oForm.Items.Item("Cliente").Specific).Selected.Value).Trim() != "Todos")
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = s + @" AND T0.U_EstadoC = '{0}'";
                    }
                    else
                    {
                        s = s + @" AND T0.""U_EstadoC"" = '{0}'";
                    }
                    s = String.Format(s, ((System.String)((ComboBox)oForm.Items.Item("Cliente").Specific).Selected.Value).Trim());
                }

                if (((System.String)((ComboBox)oForm.Items.Item("SII").Specific).Selected.Value).Trim() != "Todos")
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = s + @" AND T0.U_EstadoSII = '{0}'";
                    }
                    else
                    {
                        s = s + @" AND T0.""U_EstadoSII"" = '{0}'";
                    }
                    s = String.Format(s, ((System.String)((ComboBox)oForm.Items.Item("SII").Specific).Selected.Value).Trim());
                }

                if (((System.String)((ComboBox)oForm.Items.Item("Ley").Specific).Selected.Value).Trim() != "Todos")
                {
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = s + @" AND T0.U_EstadoLey = '{0}'";
                    }
                    else
                    {
                        s = s + @" AND T0.""U_EstadoLey"" = '{0}'";
                    }
                    s = String.Format(s, ((System.String)((ComboBox)oForm.Items.Item("Ley").Specific).Selected.Value).Trim());
                }

                oDataTable.ExecuteQuery(s);

                oGrid.Columns.Item("DocEntry").Type = BoGridColumnType.gct_EditText;
                var col = (EditTextColumn)(oGrid.Columns.Item("DocEntry"));
                col.Visible = false;

                oGrid.Columns.Item("TipoDoc").Type = BoGridColumnType.gct_EditText;
                col                      = (EditTextColumn)(oGrid.Columns.Item("TipoDoc"));
                col.Editable             = false;
                col.TitleObject.Caption  = "Tipo DTE";
                col.TitleObject.Sortable = true;

                oGrid.Columns.Item("Folio").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("Folio"));
                col.Editable             = false;
                col.RightJustified       = true;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "Nro Folio";

                oGrid.Columns.Item("RUT").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("RUT"));
                col.Editable             = false;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "RUT";
                if (TipoDTE == "C")
                {
                    col.Visible = true;
                }
                else
                {
                    col.Visible = false;
                }

                oGrid.Columns.Item("Razon").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("Razon"));
                col.Editable             = false;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "Razon Social";

                oGrid.Columns.Item("FechaEmi").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("FechaEmi"));
                col.Editable             = false;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "Fecha Emisión";

                oGrid.Columns.Item("FechaRecep").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("FechaRecep"));
                col.Editable             = false;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "Fecha Recepción";

                oGrid.Columns.Item("Monto").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("Monto"));
                col.Editable             = false;
                col.RightJustified       = true;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "Monto";

                oGrid.Columns.Item("IVA").Type = BoGridColumnType.gct_EditText;
                col                      = ((EditTextColumn)oGrid.Columns.Item("IVA"));
                col.Editable             = false;
                col.RightJustified       = true;
                col.TitleObject.Sortable = true;
                col.TitleObject.Caption  = "IVA";

                oGrid.Columns.Item("EstadoC").Type = BoGridColumnType.gct_ComboBox;
                var colCombo = ((ComboBoxColumn)oGrid.Columns.Item("EstadoC"));
                colCombo.Editable             = false;
                colCombo.DisplayType          = BoComboDisplayType.cdt_both;
                colCombo.TitleObject.Sortable = true;
                colCombo.TitleObject.Caption  = "Estado Cliente";
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"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 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, (TipoDTE == "V" ? "@VID_FEDTEVTA" : "@VID_FEDTECPRA"));
                oRecordSet.DoQuery(s);
                FSBOf.FillComboGrid(((GridColumn)oGrid.Columns.Item("EstadoC")), ref oRecordSet, false);

                oGrid.Columns.Item("EstadoSII").Type = BoGridColumnType.gct_ComboBox;
                colCombo                      = ((ComboBoxColumn)oGrid.Columns.Item("EstadoSII"));
                colCombo.Editable             = false;
                colCombo.DisplayType          = BoComboDisplayType.cdt_both;
                colCombo.TitleObject.Sortable = true;
                colCombo.TitleObject.Caption  = "Estado SII";
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"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 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, (TipoDTE == "V" ? "@VID_FEDTEVTA" : "@VID_FEDTECPRA"));
                oRecordSet.DoQuery(s);
                FSBOf.FillComboGrid(((GridColumn)oGrid.Columns.Item("EstadoSII")), ref oRecordSet, false);

                oGrid.Columns.Item("EstadoLey").Type = BoGridColumnType.gct_ComboBox;
                colCombo                      = ((ComboBoxColumn)oGrid.Columns.Item("EstadoLey"));
                colCombo.Editable             = false;
                colCombo.DisplayType          = BoComboDisplayType.cdt_both;
                colCombo.TitleObject.Sortable = true;
                colCombo.TitleObject.Caption  = "Estado Ley 20.956";
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"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 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, (TipoDTE == "V" ? "@VID_FEDTEVTA" : "@VID_FEDTECPRA"));
                oRecordSet.DoQuery(s);
                FSBOf.FillComboGrid(((GridColumn)oGrid.Columns.Item("EstadoLey")), ref oRecordSet, false);

                oGrid.Columns.Item("DocEntryDoc").Type = BoGridColumnType.gct_EditText;
                col                = ((EditTextColumn)oGrid.Columns.Item("DocEntryDoc"));
                col.Editable       = false;
                col.RightJustified = true;
                if (TipoDTE == "V")
                {
                    col.Visible = false;
                }
                else
                {
                    col.Visible = true;
                }
                col.TitleObject.Sortable = false;
                col.TitleObject.Caption  = "Factura en SAP";
                col.LinkedObjectType     = "18";

                oGrid.Columns.Item("xml").Type = BoGridColumnType.gct_EditText;
                col          = ((EditTextColumn)oGrid.Columns.Item("xml"));
                col.Editable = false;
                col.Visible  = false;

                oGrid.AutoResizeColumns();
            }
            catch (Exception x)
            {
                FSBOApp.StatusBar.SetText(x.Message + " ** Trace: " + x.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("BuscarDatos: " + x.Message + " ** Trace: " + x.StackTrace);
            }
            finally
            {
                oForm.Freeze(false);
            }
        }
        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
Ejemplo n.º 27
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.º 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
        }//fin FormEvent

        public new void FormDataEvent(ref BusinessObjectInfo BusinessObjectInfo, ref Boolean BubbleEvent)
        {
            String DocEntry;
            String Tabla;

            String[] FE52 = { "15", "67", "21" };

            base.FormDataEvent(ref BusinessObjectInfo, ref BubbleEvent);
            try
            {
                if ((BusinessObjectInfo.EventType == BoEventTypes.et_FORM_DATA_LOAD) && (!BusinessObjectInfo.BeforeAction))
                {
                }

                if ((BusinessObjectInfo.BeforeAction == true) && (BusinessObjectInfo.EventType == BoEventTypes.et_FORM_DATA_UPDATE) && (!BusinessObjectInfo.ActionSuccess))
                {
                    if (Localidad == "CL")
                    {
                        //if (oForm.BusinessObject.Type in ['15','67'])
                        if (FE52.Contains(oForm.BusinessObject.Type))
                        {
                            if (oForm.BusinessObject.Type == "15")
                            {
                                Tabla = "ODLN";
                            }
                            else if (oForm.BusinessObject.Type == "21")
                            {
                                Tabla = "ORPD";
                            }
                            else
                            {
                                Tabla = "OWTR";
                            }

                            DocEntry = FSBOf.GetDocEntryBusinessObjectInfo(BusinessObjectInfo.ObjectKey);
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"SELECT Count(*) Cont
                                    FROM NNM1 T0
                                    JOIN {0} T1 ON T1.Series = T0.Series
                                   WHERE (SUBSTRING(UPPER(T0.BeginStr), 1, 1) = 'E') 
                                     AND T1.DocEntry = {1}
                                     --AND T0.ObjectCode = '{2}'";
                            }
                            else
                            {
                                s = @"SELECT Count(*) ""Cont""
                                    FROM ""NNM1"" T0
                                    JOIN ""{0}"" T1 ON T1.""Series"" = T0.""Series""
                                   WHERE (SUBSTRING(UPPER(T0.""BeginStr""), 1, 1) = 'E') 
                                     AND T1.""DocEntry"" = {1}
                                     --AND T0.""ObjectCode"" = '{2}'";
                            }
                            s = String.Format(s, Tabla, DocEntry, oForm.BusinessObject.Type);

                            if ((System.Int32)(oRecordSet.Fields.Item("Cont").Value) > 0)
                            {
                                BubbleEvent = false;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                OutLog("FormDataEvent: " + e.Message + " ** TRACE ** " + e.StackTrace);
            }
        } //fin FormDataEvent
Ejemplo n.º 30
0
        private void Guardar_Registros()
        {
            String CardCode;
            String CardName;
            String Activado;
            Int32  DocEntry;
            Int32  lRetCode;

            SAPbouiCOM.ProgressBar oProgressBar = null;

            oForm.Freeze(true);
            try
            {
                FSBOApp.StatusBar.SetText("Inicio de actualización lista negra", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                oProgressBar = FSBOApp.StatusBar.CreateProgressBar("Actualizando lista negra...", odt.Rows.Count, false);

                for (Int32 iCont_1 = 0; iCont_1 < odt.Rows.Count; iCont_1++)
                {
                    if (((System.String)odt.GetValue("U_CardCode", iCont_1)).Trim().Length > 0)
                    {
                        oDBDSHeader.Clear();
                        oDBDSHeader.InsertRecord(0);

                        DocEntry = ((System.Int32)odt.GetValue("DocEntry", iCont_1));
                        CardCode = ((System.String)odt.GetValue("U_CardCode", iCont_1)).Trim();
                        CardName = ((System.String)odt.GetValue("U_CardName", iCont_1)).Trim();
                        s        = ((System.String)odt.GetValue("U_Activado", iCont_1)).Trim();
                        if (s == "")
                        {
                            Activado = "N";
                        }
                        else
                        {
                            Activado = s;
                        }
                        oDBDSHeader.SetValue("U_CardCode", 0, CardCode);
                        oDBDSHeader.SetValue("U_CardName", 0, CardName);
                        oDBDSHeader.SetValue("U_Activado", 0, Activado);

                        if (DocEntry != 0)
                        {
                            oDBDSHeader.SetValue("DocEntry", 0, DocEntry.ToString());
                            lRetCode = Funciones.UpdDataSourceInt1("VID_FELISTANE", oDBDSHeader, "", null, "", null, "", null);
                        }
                        else
                        {
                            lRetCode = Funciones.AddDataSourceInt1("VID_FELISTANE", oDBDSHeader, "", null, "", null, "", null);
                        }

                        if (lRetCode == 0)
                        {
                            FSBOApp.StatusBar.SetText("No se ha actualizado proveedor " + CardCode, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                        else
                        {
                            FSBOApp.StatusBar.SetText("Se ha actualizado proveedor " + CardCode, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                        }
                    }
                    oProgressBar.Value = iCont_1 + 1;
                }
                oProgressBar.Value = oProgressBar.Maximum;

                oForm.Mode = SAPbouiCOM.BoFormMode.fm_OK_MODE;
                CargarGrid();
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText(e.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("Guardar_Registros: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                oForm.Freeze(false);
                oProgressBar.Stop();
                FSBOf._ReleaseCOMObject(oProgressBar);
            }
        }