}//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.ItemUID == "btnBuscar") && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction))
                {
                    if (Validar())
                    {
                        CargarGrid();
                    }
                }

                if ((pVal.ItemUID == "btnExp") && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction))
                {
                    Exportar();
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
Пример #2
0
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.ItemUID == "87") && (pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (pVal.BeforeAction))
                {
                    oComboBox     = (ComboBox)(oForm.Items.Item("87").Specific);
                    SerieAnterior = (System.String)(oComboBox.Value);
                }

                if ((pVal.ItemUID == "87") && (pVal.EventType == BoEventTypes.et_COMBO_SELECT) && (!pVal.BeforeAction))
                {
                    oComboBox = (ComboBox)(oForm.Items.Item("87").Specific);
                    var sSeries = (System.String)(oComboBox.Value);

                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"select LEFT(ISNULL(UPPER(BeginStr),''),1) 'Valor', DocSubType, SUBSTRING(ISNULL(UPPER(BeginStr),''),2,LEN(ISNULL(UPPER(BeginStr),''))) 'Doc', ObjectCode, SeriesName
                                from NNM1 where Series = {0} --AND ObjectCode = '{1}' ";
                    }
                    else
                    {
                        s = @"select LEFT(IFNULL(UPPER(""BeginStr""),''),1) ""Valor"", ""DocSubType"", SUBSTRING(IFNULL(UPPER(""BeginStr""),''),2,LENGTH(IFNULL(UPPER(""BeginStr""),''))) ""Doc"", ""ObjectCode"", ""SeriesName""
                                from ""NNM1"" where ""Series"" = {0} --AND ""ObjectCode"" = '{1}' ";
                    }
                    s = String.Format(s, sSeries, oForm.BusinessObject.Type);
                    oRecordSet.DoQuery(s);
                    if (oRecordSet.RecordCount > 0)
                    {
                        if ((System.String)(oRecordSet.Fields.Item("Valor").Value) == "E")
                        {
                            oForm.Items.Item("VID_Estado").Visible = true;
                            oForm.Items.Item("lblEstado").Visible  = true;
                            oForm.Items.Item("VID_FEDCTO").Visible = true;
                        }
                        else
                        {
                            oForm.Items.Item("VID_Estado").Visible = false;
                            oForm.Items.Item("lblEstado").Visible  = false;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
        }//fin MenuEvent

        private void GuardarRegistros()
        {
            TFunctions Reg;
            Int32      i;
            Int32      DocEntryAsig;
            String     User, Pass;

            try
            {
                if (ValidarMatrix())
                {
                    Reg       = new TFunctions();
                    Reg.SBO_f = FSBOf;
                    oMtx.FlushToDataSource();
                    FCmpny.StartTransaction();

                    i = 0;
                    while (i < oMtx.RowCount)
                    {
                        User = (System.String)(oDBDSH.GetValue("U_Usuario", i));

                        Pass = (System.String)(oDBDSH.GetValue("U_Password", i));
                        //s = Reg.Encriptar(Pass);
                        oDBDSH.SetValue("U_Password", i, Pass);

                        if ((System.String)(oDBDSH.GetValue("DocEntry", i)) == "")
                        {
                            DocEntryAsig = Reg.FEMultiSocAdd((System.String)(oDBDSH.GetValue("U_Servidor", i)), (System.String)(oDBDSH.GetValue("U_RUT", i)), (System.String)(oDBDSH.GetValue("U_Base", i)), (System.String)(oDBDSH.GetValue("U_Usuario", i)), (System.String)(oDBDSH.GetValue("U_Password", i)), (System.String)(oDBDSH.GetValue("U_Sociedad", i)), (System.String)(oDBDSH.GetValue("U_Habilitada", i)));
                            oDBDSH.SetValue("DocEntry", i, DocEntryAsig.ToString());
                        }
                        else
                        {
                            Reg.FEMultiSocUpt((System.String)(oDBDSH.GetValue("DocEntry", i)), (System.String)(oDBDSH.GetValue("U_Servidor", i)), (System.String)(oDBDSH.GetValue("U_RUT", i)), (System.String)(oDBDSH.GetValue("U_Base", i)), (System.String)(oDBDSH.GetValue("U_Usuario", i)), (System.String)(oDBDSH.GetValue("U_Password", i)), (System.String)(oDBDSH.GetValue("U_Sociedad", i)), (System.String)(oDBDSH.GetValue("U_Habilitada", i)));
                        }

                        //oDBDSH.SetValue("U_Password", i, Pass);
                        i++;
                    }
                    FCmpny.EndTransaction(BoWfTransOpt.wf_Commit);
                    oDBDSH.InsertRecord(i);
                    oMtx.LoadFromDataSource();
                    oMtx.AutoResizeColumns();
                    FSBOApp.StatusBar.SetText("Sociedades registradas satisfactoriamente", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                }
            }
            catch (Exception e)
            {
                FSBOApp.MessageBox(e.Message + " ** Trace: " + e.StackTrace, 1, "Ok", "", "");
                OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace);
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
            }
        }//fin GuardarRegistros
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            //SAPbouiCOM.DataTable oDataTable;
            //SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            Boolean bRes = false;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

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

                        if (oForm.Mode == BoFormMode.fm_ADD_MODE)
                        {
                            oDBDSHeader.SetValue("Code", 0, "1");
                            bRes = Funciones.AddDataSource1("VID_mSU", oDBDSHeader, "", null, "", null, "", null, "", null);
                        }
                        else if (oForm.Mode == BoFormMode.fm_UPDATE_MODE)
                        {
                            bRes = Funciones.UpdDataSource1("M", ((System.String)oDBDSHeader.GetValue("Code", 0)).Trim(), "VID_mSU", oDBDSHeader, "", null, "", null, "", null, "", null);
                        }


                        if (bRes)
                        {
                            oForm.Mode = BoFormMode.fm_OK_MODE;
                            FSBOApp.StatusBar.SetText("Se registraron satisfactoriamente los datos", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                        }
                        else
                        {
                            FSBOApp.StatusBar.SetText("No se ha registrado los datos", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.ItemUID == "Buscar") && (!pVal.BeforeAction))
                {
                    var      DateD            = DateTime.ParseExact(((EditText)oForm.Items.Item("FechaD").Specific).Value, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                    var      DateH            = DateTime.ParseExact(((EditText)oForm.Items.Item("FechaH").Specific).Value, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture);
                    TimeSpan ts               = DateH - DateD;
                    var      differenceInDays = ts.Days + 1;
                    if (differenceInDays > 31)
                    {
                        FSBOApp.StatusBar.SetText("El intervalo de fechas no puede ser superior a 30 dias", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                    }
                    else
                    {
                        BuscarDatos();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_DOUBLE_CLICK) && (!pVal.BeforeAction) && (pVal.ColUID == "Folio"))
                {
                    var TipoDTE = ((System.String)((ComboBox)oForm.Items.Item("TipoDTE").Specific).Selected.Value).Trim();
                    if (TipoDTE == "C")
                    {
                        MostrarPDF(pVal.Row);
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
Пример #6
0
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

            try
            {
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
Пример #7
0
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

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

                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction))
                {
                    if (pVal.ItemUID == "btnBuscar" && oForm.Mode == BoFormMode.fm_ADD_MODE)
                    {
                        if (Validar(false))
                        {
                            BuscarRegistros();
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            //SAPbouiCOM.DataTable oDataTable;
            //inherited FormEvent(FormUID,var pVal,var BubbleEvent);
            String Local;

            SAPbouiCOM.CheckBox oCheckBox;
            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);


            try
            {
                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (pVal.BeforeAction == true))
                {
                    if ((pVal.ItemUID == "1") && ((oForm.Mode == BoFormMode.fm_ADD_MODE) || (oForm.Mode == BoFormMode.fm_UPDATE_MODE)))
                    {
                        s = "1";
                        oDBDSHeader.SetValue("Code", 0, s);
                        if (1 != FSBOApp.MessageBox("¿ Desea actualizar los parametros ?", 1, "Ok", "Cancelar", ""))
                        {
                            BubbleEvent = false;
                        }
                        else
                        {
                            BubbleEvent = false;

                            if (oForm.SupportedModes == 1)
                            {
                                s = "1";
                            }
                            else
                            {
                                s = "3";
                            }

                            if (AddDatos(s))
                            {
                                FSBOApp.StatusBar.SetText("Datos actualizados satisfactoriamente", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Success);
                                oForm.Mode = BoFormMode.fm_OK_MODE;
                                //Remover menu y colocar los nuevos segun parametros


                                System.Xml.XmlDocument oXmlDoc = null;
                                oXmlDoc = new System.Xml.XmlDocument();
                                oXmlDoc.Load(System.IO.Path.GetDirectoryName(TMultiFunctions.ParamStr(0)) + "\\Menus\\RemoveMenuPE.xml");

                                string sXML = oXmlDoc.InnerXml.ToString();
                                FSBOApp.LoadBatchActions(ref sXML);

                                oXmlDoc.Load(System.IO.Path.GetDirectoryName(TMultiFunctions.ParamStr(0)) + "\\Menus\\Menu.xml");

                                sXML = oXmlDoc.InnerXml.ToString();
                                FSBOApp.LoadBatchActions(ref sXML);
                            }
                        }
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction))
                {
                    if (pVal.ItemUID == "btnProcFE")
                    {
                        CargarProcedimientos();
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            String sValue;
            String sValue2;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

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

                    if ((pVal.BeforeAction == false) && (pVal.ItemUID == "btn_Borrar"))
                    {
                        BorrarLinea();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_CHOOSE_FROM_LIST) && (!pVal.BeforeAction))
                {
                    oForm.Freeze(true);
                    if (pVal.ColUID == "U_CardCode")
                    {
                        oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)(pVal);
                        oDataTable = oCFLEvento.SelectedObjects;
                        if (oDataTable != null)
                        {
                            sValue  = ((System.String)oDataTable.GetValue("CardCode", 0)).Trim();
                            sValue2 = ((System.String)oDataTable.GetValue("CardName", 0)).Trim();
                            for (Int32 iCont_1 = 0; iCont_1 < odt.Rows.Count; iCont_1++)
                            {
                                if (((System.String)odt.GetValue("U_CardCode", iCont_1)).Length > 0)
                                {
                                    var CardCode = ((System.String)odt.GetValue("U_CardCode", iCont_1));
                                    if (CardCode == sValue)
                                    {
                                        FSBOApp.StatusBar.SetText("Proveedor ya se encuentra en la lista Negra", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                        return;
                                    }
                                }
                            }

                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"SELECT COUNT(*) 'count' FROM [@VID_FELISTABL] WHERE U_CardCode = '{0}'";
                            }
                            else
                            {
                                s = @"SELECT COUNT(*) ""count"" FROM ""@VID_FELISTABL"" WHERE ""U_CardCode"" = '{0}'";
                            }
                            s = String.Format(s, sValue);
                            oRecordSet.DoQuery(s);
                            if (((System.Int32)oRecordSet.Fields.Item("count").Value) > 0)
                            {
                                FSBOApp.StatusBar.SetText("Codigo Proveedor se encuentra en la lista blanca, no se puede seleccionar -> Codigo " + sValue, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                                return;
                            }

                            odt.SetValue("U_CardCode", pVal.Row, sValue);
                            odt.SetValue("U_CardName", pVal.Row, sValue2);
                            odt.SetValue("U_Activado", pVal.Row, "Y");

                            if ((odt.Rows.Count - 1 == pVal.Row) && (sValue != ""))
                            {
                                odt.Rows.Add(1);
                            }
                            ogrid.AutoResizeColumns();
                            if (oForm.Mode == BoFormMode.fm_OK_MODE)
                            {
                                oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                if (oForm != null)
                {
                    oForm.Freeze(false);
                }
            }
        }//fin FormEvent
        }//fin InitForm

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

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

                if ((pVal.ItemUID == "btnCtaSAP") && (!pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED))
                {
                    var bpaso = false;
                    for (Int32 iCant = 0; iCant <= oGrid.Rows.Count - 1; iCant++)
                    {
                        if (oGrid.Rows.IsSelected(iCant))
                        {
                            bpaso = true;
                            if (((System.Int32)oDataTable.GetValue("DocEntry", iCant)) == 0)
                            {
                                FSBOApp.StatusBar.SetText("Debe guardar registro de Plan de Cuentas SII", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                            }
                            else
                            {
                                CuentaSAP(iCant);
                                break;
                            }
                        }
                    }
                    if (!bpaso)
                    {
                        FSBOApp.StatusBar.SetText("Debe seleccionar una linea", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                    }
                }

                if ((pVal.ItemUID == "btnCrear") && (!pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED))
                {
                    if (!oForm.Items.Item("Cuenta").Visible)
                    {
                        oForm.Items.Item("Cuenta").Visible = true;
                        oForm.Items.Item("Descr").Visible  = true;
                    }
                    else
                    {
                        if (CrearNuevaCta())
                        {
                            oForm.Freeze(true);
                            oForm.DataSources.UserDataSources.Item("Cuenta").Value = "";
                            oForm.DataSources.UserDataSources.Item("Descr").Value  = "";
                            //((EditText)oForm.Items.Item("Cuenta").Specific).Value = "";
                            //((EditText)oForm.Items.Item("Descr").Specific).Value = "";
                            s = "XXX";
                            oForm.Items.Item("XXX").Click(BoCellClickType.ct_Regular);
                            oForm.Items.Item("Cuenta").Visible = false;
                            oForm.Items.Item("Descr").Visible  = false;
                            CargarGrilla();
                        }
                    }
                }

                if ((pVal.ItemUID == "btnBorrar") && (!pVal.BeforeAction) && (pVal.EventType == BoEventTypes.et_ITEM_PRESSED))
                {
                    BorrarCta();
                }


                if ((pVal.ItemUID == "grid") && (pVal.ColUID == "Cuenta") && (pVal.EventType == BoEventTypes.et_VALIDATE) && (!pVal.BeforeAction))
                {
                    ValidarDataTable(((System.String)oDataTable.GetValue("Cuenta", pVal.Row)), pVal.Row);
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                oForm.Freeze(false);
            }
        }//fin FormEvent
Пример #11
0
        private void GuardarRegistros()
        {
            SAPbouiCOM.Grid oGrid;
            Boolean         Paso = false;
            String          ObjType;
            Int32           DocEntry;
            String          Tipo;
            String          Serie;
            String          Folio;
            Int32           lRetCode;
            String          errMsg;
            Int32           errCode;
            XDocument       miXMLDoc;
            XmlDocument     oXml;
            String          UserWS        = "";
            String          PassWS        = "";
            String          TaxIdNum      = "";
            String          URL           = "";
            String          ExternalFolio = "";
            XmlNode         oNode;

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

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

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

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

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

                                        oXml.LoadXml(s);

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

                                        string ticket = oNode.InnerText;

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

                                        string errorText = oNode.InnerText;

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

                                        string idDocument = oNode.InnerText;

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

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

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

                if (!Paso)
                {
                    FSBOApp.StatusBar.SetText("Debe seleccionar un documento minimo", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                }
                else
                {
                    if (FCmpny.InTransaction)
                    {
                        FCmpny.EndTransaction(BoWfTransOpt.wf_Commit);
                    }
                }
            }
            catch (Exception e)
            {
                FSBOApp.StatusBar.SetText("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("GuardarRegistros: " + e.Message + " ** Trace: " + e.StackTrace);
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
            }
        }
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            IvkFormInterface oFormVk;
            String           oUid;
            String           prmKey;

            SAPbouiCOM.EditTextColumn oEditColumn;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);
            try
            {
                if ((pVal.EventType == BoEventTypes.et_MATRIX_LINK_PRESSED) && (pVal.BeforeAction) && (pVal.ItemUID == "grid"))
                {
                    s           = (System.String)(oDataTable.GetValue("ObjType", pVal.Row));
                    oColumn     = (GridColumn)(oGrid.Columns.Item("DocEntry"));
                    oEditColumn = (EditTextColumn)(oColumn);
                    oEditColumn.LinkedObjectType = s;
                }

                if ((pVal.EventType == BoEventTypes.et_ITEM_PRESSED) && (!pVal.BeforeAction))
                {
                    if (pVal.ItemUID == "ActGrilla")
                    {
                        CargarDatosPE();
                    }

                    if (pVal.ItemUID == "chk_Todo")
                    {
                        CargarDatosPE();
                    }

                    if (pVal.ItemUID == "Rechazados")
                    {
                        CargarDatosPE();
                    }

                    if (pVal.ItemUID == "Pendientes")
                    {
                        CargarDatosPE();
                    }

                    if (pVal.ItemUID == "Aceptados")
                    {
                        CargarDatosPE();
                    }

                    if (pVal.ItemUID == "DadoBaja")
                    {
                        CargarDatosPE();
                    }

                    if (pVal.ItemUID == "Errores")
                    {
                        CargarDatosPE();
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_VALIDATE) && (pVal.BeforeAction) && (pVal.ItemUID == "FechaD"))
                {
                    oEditText = (EditText)(oForm.Items.Item("FechaD").Specific);
                    if ((System.String)(oEditText.Value) == "")
                    {
                        FSBOApp.StatusBar.SetText("Debe ingresar una fecha desde", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                        BubbleEvent = false;
                    }
                }

                if ((pVal.EventType == BoEventTypes.et_VALIDATE) && (pVal.BeforeAction) && (pVal.ItemUID == "FechaH"))
                {
                    oEditText = (EditText)(oForm.Items.Item("FechaH").Specific);
                    if ((System.String)(oEditText.Value) == "")
                    {
                        FSBOApp.StatusBar.SetText("Debe ingresar una fecha hasta", BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Warning);
                        BubbleEvent = false;
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }

                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
        }//fin FormEvent
Пример #13
0
        }//fin InitForm

        public new void FormEvent(String FormUID, ref SAPbouiCOM.ItemEvent pVal, ref Boolean BubbleEvent)
        {
            SAPbouiCOM.DataTable            oDataTable;
            SAPbouiCOM.IChooseFromListEvent oCFLEvento = null;
            String sValue;
            String sValue2;

            base.FormEvent(FormUID, ref pVal, ref BubbleEvent);

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

                if ((pVal.EventType == BoEventTypes.et_CHOOSE_FROM_LIST) && (!pVal.BeforeAction))
                {
                    oForm.Freeze(true);
                    if (pVal.ColUID == "U_CtaSAP")
                    {
                        oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)(pVal);
                        oDataTable = oCFLEvento.SelectedObjects;
                        if (oDataTable != null)
                        {
                            sValue  = ((System.String)oDataTable.GetValue("FormatCode", 0)).Trim();
                            sValue2 = ((System.String)oDataTable.GetValue("AcctName", 0)).Trim();

                            if (ValidarDataTable(sValue))
                            {
                                odt.SetValue("U_CtaSAP", pVal.Row, sValue);
                                odt.SetValue("U_DescSAP", pVal.Row, sValue2);

                                if ((odt.Rows.Count - 1 == pVal.Row) && (sValue != ""))
                                {
                                    odt.Rows.Add(1);
                                }
                                oGrid.AutoResizeColumns();
                                if (oForm.Mode == BoFormMode.fm_OK_MODE)
                                {
                                    oForm.Mode = BoFormMode.fm_UPDATE_MODE;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
                FSBOApp.StatusBar.SetText(e.Message + " ** Trace: " + e.StackTrace, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);
                OutLog("FormEvent: " + e.Message + " ** Trace: " + e.StackTrace);
            }
            finally
            {
                oForm.Freeze(false);
            }
        }//fin FormEvent
Пример #14
0
        }//fin FormDataEvent

        private void IngresarFolio(String sDocEntry, String ObjType)
        {
            Boolean FolioUnico = false;
            Int32   lRetCode;

            try
            {
                if (GlobalSettings.RunningUnderSQLServer)
                {
                    s = @"select isnull(U_FolioGuia,'N') FolioUnico from [@VID_FEPARAM] where code = '1'";
                }
                else
                {
                    s = @"select IFNULL(""U_FolioGuia"",'N') ""FolioUnico"" from ""@VID_FEPARAM"" where ""Code"" = '1'";
                }

                oRecordSet.DoQuery(s);
                if (oRecordSet.RecordCount > 0)
                {
                    if ((System.String)(oRecordSet.Fields.Item("FolioUnico").Value) == "Y")
                    {
                        FolioUnico = true;
                    }
                }

                if (FolioUnico)
                {
                    var oTransfer = (SAPbobsCOM.StockTransfer)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oStockTransfer));
                    FCmpny.StartTransaction();
                    if (GlobalSettings.RunningUnderSQLServer)
                    {
                        s = @"SELECT 'GE' BeginStr, NextNumber FROM NNM1 WHERE (ObjectCode = 'VD_FEEntreg')";
                    }
                    else
                    {
                        s = @"SELECT 'GE' ""BeginStr"", ""NextNumber"" FROM ""NNM1"" WHERE (""ObjectCode"" = 'VD_FEEntreg')";
                    }
                    oRecordSet.DoQuery(s);

                    if (ObjType == "67")
                    {
                        if (oTransfer.GetByKey(Convert.ToInt32(sDocEntry)))
                        {
                            oTransfer.FolioNumber       = (System.Int32)(oRecordSet.Fields.Item("NextNumber").Value);
                            oTransfer.FolioPrefixString = (System.String)(oRecordSet.Fields.Item("BeginStr").Value);
                            lRetCode = oTransfer.Update();
                            if (lRetCode != 0)
                            {
                                if (GlobalSettings.RunningUnderSQLServer)
                                {
                                    s = @"UPDATE OWTR SET FolioPref = '{0}', FolioNum = '{1}', Printed = 'Y' WHERE DocEntry = {3}";
                                }
                                else
                                {
                                    s = @"UPDATE ""OWTR"" SET ""FolioPref"" = '{0}', ""FolioNum"" = '{1}', ""Printed"" = 'Y' WHERE ""DocEntry"" = {3}";
                                }
                                s = String.Format(s, oTransfer.FolioPrefixString, Convert.ToString(oTransfer.FolioNumber), oTransfer.DocEntry);
                                oRecordSet.DoQuery(s);
                            }

                            //actualiza siguiente numero folio para documento
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"UPDATE NNM1 SET NextFolio = {0} WHERE (Series = {1})";
                            }
                            else
                            {
                                s = @"UPDATE ""NNM1"" SET ""NextFolio"" = {0} WHERE (""Series"" = {1})";
                            }
                            s = String.Format(s, oTransfer.FolioNumber + 1, oTransfer.Series);
                            oRecordSet.DoQuery(s);
                            //actualiza siguiente numero folio para serie del addon entrega electronica
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"UPDATE NNM1 SET NextNumber = {0} WHERE (ObjectCode = 'VD_FEEntreg')";
                            }
                            else
                            {
                                s = @"UPDATE ""NNM1"" SET ""NextNumber"" = {0} WHERE (""ObjectCode"" = 'VD_FEEntreg')";
                            }
                            s = String.Format(s, oTransfer.FolioNumber + 1);
                            oRecordSet.DoQuery(s);
                            //actualiza LPgFolioN
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"update OWTR set LPgFolioN = FolioNum where DocEntry = {0}";
                            }
                            else
                            {
                                s = @"update ""OWTR"" set ""LPgFolioN"" = ""FolioNum"" where ""DocEntry"" = {0}";
                            }
                            s = String.Format(s, oTransfer.DocEntry);
                            oRecordSet.DoQuery(s);
                        }
                    }
                    else if (ObjType == "15")
                    {
                        var oDocumento = (SAPbobsCOM.Documents)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oDeliveryNotes));
                        if (oDocumento.GetByKey(Convert.ToInt32(sDocEntry)))
                        {
                            oDocumento.FolioNumber       = (System.Int32)(oRecordSet.Fields.Item("NextNumber").Value);
                            oDocumento.FolioPrefixString = (System.String)(oRecordSet.Fields.Item("BeginStr").Value);

                            lRetCode = oDocumento.Update();
                            if (lRetCode != 0)
                            {
                                if (GlobalSettings.RunningUnderSQLServer)
                                {
                                    s = @"UPDATE ODLN SET FolioPref = '{0}', FolioNum = '{1}', Printed = 'Y' WHERE DocEntry = {3}";
                                }
                                else
                                {
                                    s = @"UPDATE ""ODLN"" SET ""FolioPref"" = '{0}', ""FolioNum"" = '{1}', ""Printed"" = 'Y' WHERE ""DocEntry"" = {3}";
                                }
                                s = String.Format(s, oDocumento.FolioPrefixString, Convert.ToString(oDocumento.FolioNumber), oDocumento.DocEntry);
                                oRecordSet.DoQuery(s);
                            }

                            //actualiza siguiente numero folio para documento
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"UPDATE NNM1 SET NextFolio = {0} WHERE (Series = {1})";
                            }
                            else
                            {
                                s = @"UPDATE ""NNM1"" SET ""NextFolio"" = {0} WHERE (""Series"" = {1})";
                            }
                            s = String.Format(s, oDocumento.FolioNumber + 1, oDocumento.Series);
                            oRecordSet.DoQuery(s);
                            //actualiza siguiente numero folio para serie del addon entrega electronica
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"UPDATE NNM1 SET NextNumber = {0} WHERE (ObjectCode = 'VD_FEEntreg')";
                            }
                            else
                            {
                                s = @"UPDATE ""NNM1"" SET ""NextNumber"" = {0} WHERE (""ObjectCode"" = 'VD_FEEntreg')";
                            }
                            s = String.Format(s, oDocumento.FolioNumber + 1);
                            oRecordSet.DoQuery(s);
                            //actualiza LPgFolioN
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"update ODLN set LPgFolioN = FolioNum where DocEntry = {0}";
                            }
                            else
                            {
                                s = @"update ""ODLN"" set ""LPgFolioN"" = ""FolioNum"" where ""DocEntry"" = {0}";
                            }
                            s = String.Format(s, oDocumento.DocEntry);
                            oRecordSet.DoQuery(s);
                        }
                    }
                    else if (ObjType == "21")
                    {
                        var oDocumento = (SAPbobsCOM.Documents)(FCmpny.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oPurchaseReturns));
                        if (oDocumento.GetByKey(Convert.ToInt32(sDocEntry)))
                        {
                            oDocumento.FolioNumber       = (System.Int32)(oRecordSet.Fields.Item("NextNumber").Value);
                            oDocumento.FolioPrefixString = (System.String)(oRecordSet.Fields.Item("BeginStr").Value);

                            lRetCode = oDocumento.Update();
                            if (lRetCode != 0)
                            {
                                if (GlobalSettings.RunningUnderSQLServer)
                                {
                                    s = @"UPDATE ORPD SET FolioPref = '{0}', FolioNum = '{1}', Printed = 'Y' WHERE DocEntry = {3}";
                                }
                                else
                                {
                                    s = @"UPDATE ""ORPD"" SET ""FolioPref"" = '{0}', ""FolioNum"" = '{1}', ""Printed"" = 'Y' WHERE ""DocEntry"" = {3}";
                                }
                                s = String.Format(s, oDocumento.FolioPrefixString, Convert.ToString(oDocumento.FolioNumber), oDocumento.DocEntry);
                                oRecordSet.DoQuery(s);
                            }

                            //actualiza siguiente numero folio para documento
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"UPDATE NNM1 SET NextFolio = {0} WHERE (Series = {1})";
                            }
                            else
                            {
                                s = @"UPDATE ""NNM1"" SET ""NextFolio"" = {0} WHERE (""Series"" = {1})";
                            }
                            s = String.Format(s, oDocumento.FolioNumber + 1, oDocumento.Series);
                            oRecordSet.DoQuery(s);
                            //actualiza siguiente numero folio para serie del addon entrega electronica
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"UPDATE NNM1 SET NextNumber = {0} WHERE (ObjectCode = 'VD_FEEntreg')";
                            }
                            else
                            {
                                s = @"UPDATE ""NNM1"" SET ""NextNumber"" = {0} WHERE (""ObjectCode"" = 'VD_FEEntreg')";
                            }
                            s = String.Format(s, oDocumento.FolioNumber + 1);
                            oRecordSet.DoQuery(s);
                            //actualiza LPgFolioN
                            if (GlobalSettings.RunningUnderSQLServer)
                            {
                                s = @"update ORPD set LPgFolioN = FolioNum where DocEntry = {0}";
                            }
                            else
                            {
                                s = @"update ""ORPD"" set ""LPgFolioN"" = ""FolioNum"" where ""DocEntry"" = {0}";
                            }
                            s = String.Format(s, oDocumento.DocEntry);
                            oRecordSet.DoQuery(s);
                        }
                    }

                    FCmpny.EndTransaction(BoWfTransOpt.wf_Commit);
                }
            }
            catch (Exception e)
            {
                OutLog("IngresarFolio " + e.Message + " ** Trace: " + e.StackTrace);
                FSBOApp.StatusBar.SetText(e.Message, BoMessageTime.bmt_Short, BoStatusBarMessageType.smt_Error);  // Captura errores no manejados
                if (FCmpny.InTransaction)
                {
                    FCmpny.EndTransaction(BoWfTransOpt.wf_RollBack);
                }
            }
        }//fin IngresarFolio