Exemple #1
0
        public Boolean ModificarDB(imp_Parametros_Info Info)
        {
            try
            {
                try
                {
                    using (EntitiesImportacion Context = new EntitiesImportacion())
                    {
                        var contact = Context.imp_Parametros.FirstOrDefault(var => var.IdEmpresa == Info.IdEmpresa);
                        if (contact != null)
                        {
                            contact.IdTipoCbte_DiarioFob              = Info.IdTipoCbte_DiarioFob;
                            contact.IdTipoCbte_DiarioFob_Anul         = Info.IdTipoCbte_DiarioFob_Anul;
                            contact.IdTipoCbte_DiarioLiquidacion      = Info.IdTipoCbte_DiarioLiquidacion;
                            contact.IdTipoCbte_DiarioLiquidacion_Anul = Info.IdTipoCbte_DiarioLiquidacion_Anul;
                            contact.IdCtaCble_para_Importaciones      = Info.IdCtaCble_para_Importaciones;
                            Context.SaveChanges();
                        }
                    }
                    return(true);
                }
                catch (Exception ex)
                {
                    string arreglo = ToString();
                    tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                    tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                              "", "", "", "", DateTime.Now);
                    oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                    mensaje = ex.ToString() + " " + ex.Message;

                    if (ex.Message.ToString() == "Sequence contains no elements")
                    {
                        using (EntitiesImportacion Context = new EntitiesImportacion())
                        {
                            var address = new imp_Parametros();
                            address.IdEmpresa                         = Info.IdEmpresa;
                            address.IdTipoCbte_DiarioFob              = Info.IdTipoCbte_DiarioFob;
                            address.IdTipoCbte_DiarioFob_Anul         = Info.IdTipoCbte_DiarioFob_Anul;
                            address.IdTipoCbte_DiarioLiquidacion      = Info.IdTipoCbte_DiarioLiquidacion;
                            address.IdTipoCbte_DiarioLiquidacion_Anul = Info.IdTipoCbte_DiarioLiquidacion_Anul;
                            address.IdCtaCble_para_Importaciones      = Info.IdCtaCble_para_Importaciones;
                            Context.imp_Parametros.Add(address);
                            Context.SaveChanges();
                        }
                        return(true);
                    }
                    return(false);
                }
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
                tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                          "", "", "", "", DateTime.Now);
                oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
                mensaje = ex.ToString() + " " + ex.Message;
                throw new Exception(ex.ToString());
            }
        }
 private void ucGe_Menu_tab3_event_btnGuardar_y_Salir_Click(object sender, EventArgs e)
 {
     try
     {
         txtNADA.Focus();
         imp_Parametros_Info Info = new imp_Parametros_Info();
         Info.IdEmpresa = param.IdEmpresa;
         Info.IdCtaCble_para_Importaciones      = ucCon_PlanCtaCmbCtaCombleImporta.get_PlanCtaInfo().IdCtaCble; //Convert.ToString(cmbCtaCombleImporta.EditValue);
         Info.IdTipoCbte_DiarioFob              = ucCon_TipoCbteCbleFOBGenera.get_TipoCbteCble().IdTipoCbte;    //(int)searchLookUpEditFOB.EditValue;
         Info.IdTipoCbte_DiarioFob_Anul         = ucCon_TipoCbteCbleFOBAnul.get_TipoCbteCble().IdTipoCbte;      //(int)searchLookUpEdit2FOBAnul.EditValue;
         Info.IdTipoCbte_DiarioLiquidacion      = ucCon_TipoCbteCbleLiquidacion.get_TipoCbteCble().IdTipoCbte;  //(int)searchLookUpEditLiqu.EditValue;
         Info.IdTipoCbte_DiarioLiquidacion_Anul = ucCon_TipoCbteCbleAnula_Liqui.get_TipoCbteCble().IdTipoCbte;  //(int)searchLookUpEditLiquAnul.EditValue;
         imp_Parametros_Bus _Parametros_B = new imp_Parametros_Bus();
         if (_Parametros_B.ModificarDB(Info))
         {
             MessageBox.Show("Registros Actualizados Correctamente");
             CargarCombosTab3();
         }
     }
     catch (Exception ex)
     {
         Log_Error_bus.Log_Error(ex.ToString());
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #3
0
 public imp_Parametros_Info Get_Info_Parametros(int IdEmpresa)
 {
     try
     {
         EntitiesImportacion Imp = new EntitiesImportacion();
         imp_Parametros_Info obj = new imp_Parametros_Info();
         var item = Imp.imp_Parametros.FirstOrDefault(q => q.IdEmpresa == IdEmpresa);
         if (item != null)
         {
             obj.IdTipoCbte_DiarioFob              = Convert.ToInt32((item.IdTipoCbte_DiarioFob == null) ? 0 : item.IdTipoCbte_DiarioFob);
             obj.IdTipoCbte_DiarioFob_Anul         = Convert.ToInt32((item.IdTipoCbte_DiarioFob_Anul == null) ? 0 : item.IdTipoCbte_DiarioFob_Anul);
             obj.IdTipoCbte_DiarioLiquidacion      = Convert.ToInt32((item.IdTipoCbte_DiarioLiquidacion == null) ? 0 : item.IdTipoCbte_DiarioLiquidacion);
             obj.IdTipoCbte_DiarioLiquidacion_Anul = Convert.ToInt32((item.IdTipoCbte_DiarioLiquidacion_Anul == null) ? 0 : item.IdTipoCbte_DiarioLiquidacion_Anul);
             obj.IdCtaCble_para_Importaciones      = item.IdCtaCble_para_Importaciones;
         }
         return(obj);
     }
     catch (Exception ex)
     {
         string arreglo = ToString();
         tb_sis_Log_Error_Vzen_Data oDataLog      = new tb_sis_Log_Error_Vzen_Data();
         tb_sis_Log_Error_Vzen_Info Log_Error_sis = new tb_sis_Log_Error_Vzen_Info(ex.ToString(), "", arreglo, "",
                                                                                   "", "", "", "", DateTime.Now);
         oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje);
         mensaje = ex.ToString() + " " + ex.Message;
         throw new Exception(ex.ToString());
     }
 }
Exemple #4
0
        public Boolean AnularDB(imp_ordencompra_ext_Info Info)
        {
            try
            {
                Info.IdUsuarioUltAnu = Param.IdUsuario;
                Info.Fecha_UltAnu    = Param.Fecha_Transac;
                Info.nom_pc          = Param.nom_pc;
                Info.ip = Param.ip;

                //    return oData.Anular(Info);
                oData.AnularDB(Info);


                imp_ordencompra_ext_x_ct_cbtecble_Bus _BusImpxCbte = new imp_ordencompra_ext_x_ct_cbtecble_Bus();
                ct_Cbtecble_Bus            Buscbte = new ct_Cbtecble_Bus();
                cl_parametrosGenerales_Bus param   = cl_parametrosGenerales_Bus.Instance;

                imp_Parametros_Info ParemtrosImportacion = new imp_Parametros_Info();
                imp_Parametros_Bus  BusParametros        = new imp_Parametros_Bus();

                ParemtrosImportacion = BusParametros.Get_Info_Parametros(param.IdEmpresa);

                imp_ordencompra_ext_x_ct_cbtecble_Info ordCompraxCbte_info = new imp_ordencompra_ext_x_ct_cbtecble_Info();
                imp_ordencompra_ext_x_ct_cbtecble_Bus  DataOrdxCbt         = new imp_ordencompra_ext_x_ct_cbtecble_Bus();

                if (Info.GenDiarioTipImpo == true)
                {
                    decimal IdComprobanteAnulado = 0;
                    string  msj  = "";
                    var     cbte = _BusImpxCbte.Get_Info_ordencompra_ext_x_ct_cbtecble(param.IdEmpresa, Info.IdSucusal, Info.IdOrdenCompraExt);
                    Buscbte.ReversoCbteCble(param.IdEmpresa, cbte.ct_IdCbteCble, ParemtrosImportacion.IdTipoCbte_DiarioFob, ParemtrosImportacion.IdTipoCbte_DiarioFob_Anul, ref IdComprobanteAnulado, ref msj, param.IdUsuario, Info.MotiAnula);

                    ordCompraxCbte_info.ct_IdEmpresa         = ordCompraxCbte_info.imp_IdEmpresa = Info.IdEmpresa;
                    ordCompraxCbte_info.imp_IdOrdenCompraExt = Info.IdOrdenCompraExt;
                    ordCompraxCbte_info.imp_IdSucusal        = Info.IdSucusal;
                    ordCompraxCbte_info.ct_IdTipoCbte        = ParemtrosImportacion.IdTipoCbte_DiarioFob_Anul;
                    ordCompraxCbte_info.ct_IdCbteCble        = IdComprobanteAnulado;
                    ordCompraxCbte_info.TipoReg = "FOB";
                    DataOrdxCbt.GuardarDB(ordCompraxCbte_info, ref msj);
                }

                return(true);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Anular", ex.Message), ex)
                      {
                          EntityType = typeof(imp_ordencompra_ext_Bus)
                      };
            }
        }
Exemple #5
0
 public Boolean ModificarDB(imp_Parametros_Info Info)
 {
     try
     {
         return(odata.ModificarDB(Info));
     }
     catch (Exception ex)
     {
         Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
         throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Modificar", ex.Message), ex)
               {
                   EntityType = typeof(imp_Parametros_Bus)
               };
     }
 }
Exemple #6
0
        public Boolean Liquidar(imp_ordencompra_ext_Info Obj, ref string mensaje, Cl_Enumeradores.eTipo_action accion)
        {
            try
            {
                decimal IdCbteLiquidacion = 0;

                ct_Cbtecble_det_Info                _detCbteCble_Info  = new ct_Cbtecble_det_Info();
                List <ct_Cbtecble_det_Info>         LstCbteCble        = new List <ct_Cbtecble_det_Info>();
                ct_Cbtecble_Info                    CbteCble_I         = new ct_Cbtecble_Info();
                imp_ordencompra_ext_det_Bus         ImporDet_bus       = new imp_ordencompra_ext_det_Bus();
                List <imp_ordencompra_ext_det_Info> ListInfo_det_Impor = new List <imp_ordencompra_ext_det_Info>();
                in_categorias_data                  dataCategoria      = new in_categorias_data();
                ct_Periodo_Bus  Per_B = new ct_Periodo_Bus();
                ct_Periodo_Info Per_I = new ct_Periodo_Info();

                in_Parametro_Data       dataInParametro                    = new in_Parametro_Data();
                imp_ordencompra_ext_Bus BusImportacion                     = new imp_ordencompra_ext_Bus();
                ct_Cbtecble_Bus         Buscbte                            = new ct_Cbtecble_Bus();
                imp_ordencompra_ext_x_ct_cbtecble_Bus BusOrdxCbt           = new imp_ordencompra_ext_x_ct_cbtecble_Bus();
                ct_cbtecble_Reversado_Bus             BusReverso           = new ct_cbtecble_Reversado_Bus();
                imp_Parametros_Info                    tip                 = new imp_Parametros_Info();
                imp_Parametros_Bus                     Data_parametros     = new imp_Parametros_Bus();
                cl_parametrosGenerales_Bus             param               = cl_parametrosGenerales_Bus.Instance;
                imp_ordencompra_ext_x_ct_cbtecble_Info ordCompraxCbte_info = new imp_ordencompra_ext_x_ct_cbtecble_Info();

                tip = Data_parametros.Get_Info_Parametros(param.IdEmpresa);

                ordCompraxCbte_info.ct_IdEmpresa         = ordCompraxCbte_info.imp_IdEmpresa = param.IdEmpresa;
                ordCompraxCbte_info.imp_IdOrdenCompraExt = Obj.IdOrdenCompraExt;
                ordCompraxCbte_info.imp_IdSucusal        = Obj.IdSucusal;

                //   var DiarioLiqui = BusImportacion.consultaDiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI")
                //   var CobteLiquidacion = Buscbte.ObtenerObjeto(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte);


                switch (accion)
                {
                case Cl_Enumeradores.eTipo_action.grabar:

                    if (Obj.ci_tonelaje == null || Obj.ci_tonelaje == 0)
                    {
                        mensaje = "Error al generar Diario de Importación ya que no se puede dividir el total de liquidación para un valor de tonelaje = 0 ";
                    }
                    else
                    {
                        string  cod_CbteCble = "";
                        decimal idCbteCble   = 0;
                        string  MensajeError = "";

                        cp_proveedor_Data _Prove_D = new cp_proveedor_Data();
                        var proveedor = _Prove_D.Get_Info_Proveedor(param.IdEmpresa, Obj.IdProveedor);

                        Per_I = Per_B.Get_Info_Periodo(Obj.IdEmpresa, Obj.ci_fecha_liquidacion, ref MensajeError);

                        string Observacion = "Cont. x Imp. #" + Obj.CodOrdenCompraExt + "'\'" + Obj.IdOrdenCompraExt + " Liquidacion de Importacion :" + proveedor.pr_nombre + "//" + Obj.ci_Observacion;
                        ListInfo_det_Impor = ImporDet_bus.Get_List_ordencompra_ext_det(Obj);

                        int contItems = ListInfo_det_Impor.Count();

                        foreach (var item in ListInfo_det_Impor)
                        {
                            _detCbteCble_Info = new ct_Cbtecble_det_Info();

                            var Categoria = dataCategoria.Get_Info_categorias(param.IdEmpresa, item.IdCategoria);

                            if (Categoria.IdCtaCtble_Inve == null)
                            {
                                in_Parametro_Info Info_InParametro = new in_Parametro_Info();

                                Info_InParametro = dataInParametro.Get_Info_Parametro(param.IdEmpresa);

                                _detCbteCble_Info.IdCtaCble      = Info_InParametro.IdCtaCble_Inven;
                                _detCbteCble_Info.dc_Observacion = "Cta. Ctble tomada de los parámetros de inventario / " + Observacion;
                            }
                            else
                            {
                                _detCbteCble_Info.IdCtaCble      = Categoria.IdCtaCtble_Inve;
                                _detCbteCble_Info.dc_Observacion = Observacion;
                            }
                            _detCbteCble_Info.IdEmpresa  = param.IdEmpresa;
                            _detCbteCble_Info.IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion;
                            _detCbteCble_Info.dc_Valor   = Convert.ToDouble(item.di_subtotal) + (Obj.TotGastosImp / contItems); // debe
                            LstCbteCble.Add(_detCbteCble_Info);
                        }

                        ct_Cbtecble_det_Info obj2 = new ct_Cbtecble_det_Info();
                        obj2.IdCtaCble      = Obj.IdCtaCble_import;
                        obj2.dc_Observacion = Observacion;//"Contabilizacion por Importacion Diario Importacion FOB" + Obj.ci_Observacion;
                        obj2.IdCtaCble      = Obj.IdCtaCble_import;
                        obj2.IdTipoCbte     = tip.IdTipoCbte_DiarioLiquidacion;
                        obj2.IdEmpresa      = Obj.IdEmpresa;

                        obj2.dc_Valor = Obj.TotalLiquidacion * -1; //haber

                        LstCbteCble.Add(obj2);

                        // cabecer ade diario
                        CbteCble_I.IdEmpresa                = param.IdEmpresa;
                        CbteCble_I.IdTipoCbte               = tip.IdTipoCbte_DiarioLiquidacion;
                        CbteCble_I.CodCbteCble              = "IM";
                        CbteCble_I.IdPeriodo                = Per_I.IdPeriodo;
                        CbteCble_I.cb_Fecha                 = Obj.ci_fecha_liquidacion;
                        CbteCble_I.cb_Observacion           = Observacion;// "Cont. de la  Importacion #" + Obj.CodOrdenCompraExt + " Diario FOB" + Obj.ci_Observacion + Categoria.ca_Categoria;
                        CbteCble_I.Secuencia                = 0;
                        CbteCble_I.Estado                   = "A";
                        CbteCble_I.Anio                     = Obj.ci_fecha.Year;
                        CbteCble_I.Mes                      = Obj.ci_fecha.Month;
                        CbteCble_I.IdUsuario                = param.IdUsuario;
                        CbteCble_I.IdUsuarioUltModi         = param.IdUsuario;
                        CbteCble_I.cb_FechaTransac          = param.GetDateServer();
                        CbteCble_I.cb_FechaUltModi          = param.GetDateServer();
                        CbteCble_I.Mayorizado               = "N";
                        CbteCble_I.cb_Valor                 = Obj.TotalLiquidacion;
                        CbteCble_I._cbteCble_det_lista_info = LstCbteCble;

                        Buscbte.GrabarDB(CbteCble_I, ref idCbteCble, ref MensajeError);
                        IdCbteLiquidacion = idCbteCble;

                        ordCompraxCbte_info.ct_IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion;
                        ordCompraxCbte_info.ct_IdCbteCble = idCbteCble;
                        ordCompraxCbte_info.TipoReg       = "LQUI";
                        BusOrdxCbt.GuardarDB(ordCompraxCbte_info, ref MensajeError);

                        var DiarioLiqui      = BusImportacion.Get_List_DiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI");
                        var Diario_Reverso   = BusReverso.Get_Info_cbtecble_Reversado(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte);
                        var CobteLiquidacion = Buscbte.Get_Info_CbteCble(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte, ref mensaje);
                        Obj.CodCbteCble = CobteLiquidacion.CodCbteCble.ToString();

                        return(oData.Liquidar(Obj, ref mensaje));
                    }

                    break;

                case Cl_Enumeradores.eTipo_action.Anular:

                    decimal IdComprobanteAnulado = 0;
                    string  msj = "";
                    if (IdCbteLiquidacion == 0)
                    {
                        var DiarioLiqui      = BusImportacion.Get_List_DiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI");
                        var CobteLiquidacion = Buscbte.Get_Info_CbteCble(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte, ref mensaje);
                        IdCbteLiquidacion = CobteLiquidacion.IdCbteCble;
                    }

                    string motiAnulacion = Obj.motiAnulacion;

                    if (Buscbte.ReversoCbteCble(param.IdEmpresa, IdCbteLiquidacion, tip.IdTipoCbte_DiarioLiquidacion, tip.IdTipoCbte_DiarioLiquidacion_Anul, ref IdComprobanteAnulado, ref msj, param.IdUsuario, motiAnulacion))
                    {
                        // MessageBox.Show("Anulado");
                        mensaje = "*** Anulado ***";

                        ordCompraxCbte_info.ct_IdTipoCbte = tip.IdTipoCbte_DiarioLiquidacion_Anul;
                        ordCompraxCbte_info.ct_IdCbteCble = IdComprobanteAnulado;
                        ordCompraxCbte_info.TipoReg       = "ALQUI";
                        BusOrdxCbt.GuardarDB(ordCompraxCbte_info, ref msj);

                        var DiarioLiqui      = BusImportacion.Get_List_DiariosxImportacion(param.IdEmpresa, Obj.IdSucusal, Obj.IdOrdenCompraExt).Last(var => var.TipoReg == "LQUI");
                        var CobteLiquidacion = Buscbte.Get_Info_CbteCble(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte, ref mensaje);

                        var Diario_Reverso = BusReverso.Get_Info_cbtecble_Reversado(param.IdEmpresa, DiarioLiqui.ct_IdTipoCbte, DiarioLiqui.IdCbte);

                        if (Diario_Reverso.IdTipoCbte_Anu != 0)
                        {
                            var CobteLiquidacionAnulado = Buscbte.Get_Info_CbteCble(param.IdEmpresa, Diario_Reverso.IdTipoCbte_Anu, Diario_Reverso.IdCbteCble_Anu, ref mensaje);

                            Obj.msgAnuladoReverso = "**Anulado ** Reversado Con diario" + "\n" + CobteLiquidacionAnulado.CodCbteCble;
                        }
                        return(oData.Liquidar(Obj, ref mensaje));
                    }

                    break;

                default:

                    break;
                }


                return(true);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Liquidar", ex.Message), ex)
                      {
                          EntityType = typeof(imp_ordencompra_ext_Bus)
                      };
            }
        }
Exemple #7
0
        public Boolean ModificarDB(imp_ordencompra_ext_Info Info)
        {
            try
            {
                Info.IdUsuarioUltMod = Param.IdUsuario;
                Info.Fecha_UltMod    = Param.Fecha_Transac;
                Info.nom_pc          = Param.nom_pc;
                Info.ip = Param.ip;

                // return oData.Actualizar(Info);
                oData.ModificarDB(Info);

                imp_ordencompra_ext_x_ct_cbtecble_Bus _BusImpxCbte = new imp_ordencompra_ext_x_ct_cbtecble_Bus();
                ct_Cbtecble_Bus            Buscbte = new ct_Cbtecble_Bus();
                imp_ordencompra_ext_Bus    BUS     = new imp_ordencompra_ext_Bus();
                cl_parametrosGenerales_Bus param   = cl_parametrosGenerales_Bus.Instance;
                imp_Parametros_Info        ParemtrosImportacion = new imp_Parametros_Info();
                imp_Parametros_Bus         BusParametros        = new imp_Parametros_Bus();

                ParemtrosImportacion = BusParametros.Get_Info_Parametros(param.IdEmpresa);

                if (Info.GenDiarioTipImpo == true)
                {
                    if (Info.FOB != Info.setFOB)
                    {
                        string  msj = "";
                        decimal IdComprobanteAnulado = 0;
                        var     cbte = _BusImpxCbte.Get_Info_ordencompra_ext_x_ct_cbtecble(param.IdEmpresa, Info.IdSucusal, Info.IdOrdenCompraExt, "FOB");

                        if (cbte != null)
                        {
                            if (Buscbte.ReversoCbteCble(param.IdEmpresa, cbte.ct_IdCbteCble, ParemtrosImportacion.IdTipoCbte_DiarioFob, ParemtrosImportacion.IdTipoCbte_DiarioFob_Anul, ref IdComprobanteAnulado, ref msj, param.IdUsuario, "Anulacion por Actualizacion") == false)
                            {
                                // MessageBox.Show(msj);
                                Info.msgReversoCbteCble = msj;
                            }
                        }

                        imp_ordencompra_ext_x_ct_cbtecble_Info ordCompraxCbte_info = new imp_ordencompra_ext_x_ct_cbtecble_Info();
                        imp_ordencompra_ext_x_ct_cbtecble_Bus  DataOrdxCbt         = new imp_ordencompra_ext_x_ct_cbtecble_Bus();

                        ordCompraxCbte_info.ct_IdEmpresa         = ordCompraxCbte_info.imp_IdEmpresa = param.IdEmpresa;
                        ordCompraxCbte_info.imp_IdOrdenCompraExt = Info.IdOrdenCompraExt;
                        ordCompraxCbte_info.imp_IdSucusal        = Info.IdSucusal;
                        ordCompraxCbte_info.ct_IdTipoCbte        = ParemtrosImportacion.IdTipoCbte_DiarioFob_Anul;
                        ordCompraxCbte_info.ct_IdCbteCble        = IdComprobanteAnulado;
                        ordCompraxCbte_info.TipoReg = "FOB";
                        DataOrdxCbt.GuardarDB(ordCompraxCbte_info, ref msj);

                        //var idproveedor = gridLookUpEditProveedor.EditValue;
                        //var IdCtaCble_CXP = ((List<cp_proveedor_Info>)gridLookUpEditProveedor.Properties.DataSource).First(var => var.IdProveedor == Convert.ToDecimal(idproveedor)).IdCtaCble_CXP;
                        if (BUS.GenerarDiarioFOB(param.IdEmpresa, Info.IdSucusal, Info.IdOrdenCompraExt, ref msj, ref IdComprobanteAnulado, Info.IdCtaCble_CXP) == false)
                        {
                            // MessageBox.Show(msj);
                            Info.msgGenerarDiarioFOB = msj;
                        }
                    }
                }

                return(true);
            }
            catch (Exception ex)
            {
                Core.Erp.Info.Log_Exception.LoggingManager.Logger.Log(Core.Erp.Info.Log_Exception.LoggingCategory.Error, ex.Message);
                throw new Core.Erp.Info.Log_Exception.DalException(string.Format("", "Actualizar", ex.Message), ex)
                      {
                          EntityType = typeof(imp_ordencompra_ext_Bus)
                      };
            }
        }