Example #1
0
        public void cargarGridContable()
        {
            try
            {
                decimal IdDepreciacion = 0;
                Af_Depreciacion_x_cta_cbtecble_Bus busDepreCtaCble = new Af_Depreciacion_x_cta_cbtecble_Bus();

                if (txtIdDepre.Text != "")
                {
                    IdDepreciacion = Convert.ToDecimal(txtIdDepre.Text);
                }
                infoDepreCble = busDepreCtaCble.Get_Info_Af_Depreciacion_x_cta_cbtecble(param.IdEmpresa, IdDepreciacion, InfoDepre.IdTipoDepreciacion);
                if (infoDepreCble.ct_IdCbteCble == null || infoDepreCble.ct_IdCbteCble == 0)
                {
                    IdCbteCle = 0;
                    btnContabilizar.Enabled  = true;
                    lblContabilizado.Visible = false;
                }
                else
                {
                    IdCbteCle = infoDepreCble.ct_IdCbteCble;
                    ucCon_GridDiarioContable.setInfo(infoDepreCble.ct_IdEmpresa, infoDepreCble.ct_IdTipoCbte, infoDepreCble.ct_IdCbteCble);
                    btnContabilizar.Enabled  = false;
                    lblContabilizado.Visible = true;
                }
            }

            catch (Exception ex)
            {
                cargarErroresGrid(ex.ToString());
                Log_Error_bus.Log_Error(ex.ToString());
                MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public Af_Depreciacion_x_cta_cbtecble_Info Get_Info_Af_Depreciacion_x_cta_cbtecble(int IdEmpresa, decimal IdDepreciacion, int IdTipoDepreciacion)
        {
            try
            {
                Af_Depreciacion_x_cta_cbtecble_Info infoDepre = new Af_Depreciacion_x_cta_cbtecble_Info();

                using (EntitiesActivoFijo listado = new EntitiesActivoFijo())
                {
                    var select = from q in listado.Af_Depreciacion_x_cta_cbtecble
                                 where q.IdEmpresa == IdEmpresa &&
                                 q.IdDepreciacion == IdDepreciacion && q.IdTipoDepreciacion == IdTipoDepreciacion
                                 select q;

                    foreach (var item in select)
                    {
                        infoDepre.IdEmpresa          = item.IdEmpresa;
                        infoDepre.IdDepreciacion     = item.IdDepreciacion;
                        infoDepre.IdTipoDepreciacion = item.IdTipoDepreciacion;
                        infoDepre.ct_IdEmpresa       = item.ct_IdEmpresa;
                        infoDepre.ct_IdTipoCbte      = item.ct_IdTipoCbte;
                        infoDepre.ct_IdCbteCble      = item.ct_IdCbteCble;
                    }
                }
                return(infoDepre);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                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.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
        public Boolean GuardarDB(Af_Depreciacion_x_cta_cbtecble_Info infoCbteCble)
        {
            try
            {
                using (EntitiesActivoFijo Context = new EntitiesActivoFijo())
                {
                    var Address = new Af_Depreciacion_x_cta_cbtecble();
                    Address.IdEmpresa          = infoCbteCble.IdEmpresa;
                    Address.IdDepreciacion     = infoCbteCble.IdDepreciacion;
                    Address.IdTipoDepreciacion = infoCbteCble.IdTipoDepreciacion;
                    Address.ct_IdEmpresa       = infoCbteCble.ct_IdEmpresa;
                    Address.ct_IdTipoCbte      = infoCbteCble.ct_IdTipoCbte;
                    Address.ct_IdCbteCble      = infoCbteCble.ct_IdCbteCble;

                    Context.Af_Depreciacion_x_cta_cbtecble.Add(Address);
                    Context.SaveChanges();
                }
                return(true);
            }
            catch (Exception ex)
            {
                string arreglo = ToString();
                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.InnerException + " " + ex.Message;
                throw new Exception(ex.InnerException.ToString());
            }
        }
 public Boolean GuardarDB(Af_Depreciacion_x_cta_cbtecble_Info infoCbteCble)
 {
     try
     {
         return(dataDepre.GuardarDB(infoCbteCble));
     }
     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("", "GuardarCbteCble", ex.Message), ex)
               {
                   EntityType = typeof(Af_Depreciacion_x_cta_cbtecble_Bus)
               };
     }
 }
Example #5
0
        public Boolean ContabilizarDepreciacion(int IdEmpresa, decimal IdDepreciacion, int IdPeriodo, Cl_Enumeradores.eForma_Contabilizar sFormaContabiliza, ref decimal IdCbteCble, ref string mensaje)
        {
            try
            {
                bool Respuesta = true;

                Af_Parametros_Bus  busParam  = new Af_Parametros_Bus();
                Af_Parametros_Info infoParam = new Af_Parametros_Info();
                infoParam = busParam.Get_Info_Parametros(IdEmpresa);
                int IdTipoDepreciacion = 1; // depreacion lineal

                Af_Depreciacion_x_cta_cbtecble_Info         infoDepreCble   = new Af_Depreciacion_x_cta_cbtecble_Info();
                List <vwAf_Valores_Depre_Contabilizar_Info> lstValoresDepre = new List <vwAf_Valores_Depre_Contabilizar_Info>();
                lstValoresDepre = get_ValoresDepreciacion(IdEmpresa, IdDepreciacion, IdTipoDepreciacion, IdPeriodo, sFormaContabiliza);
                ct_Cbtecble_Info cbtCbleInfo = new ct_Cbtecble_Info();
                cbtCbleInfo = GetCbtecble_x_Depreacion(IdEmpresa, infoParam.IdTipoCbte, IdPeriodo, lstValoresDepre, sFormaContabiliza, ref mensaje);


                Respuesta = CbteCbleBus.GrabarDB(cbtCbleInfo, ref IdCbteCble, ref mensaje);

                if (Respuesta)
                {
                    infoDepreCble.IdEmpresa          = IdEmpresa;
                    infoDepreCble.IdDepreciacion     = IdDepreciacion;
                    infoDepreCble.IdTipoDepreciacion = IdTipoDepreciacion;
                    infoDepreCble.ct_IdEmpresa       = cbtCbleInfo.IdEmpresa;
                    infoDepreCble.ct_IdTipoCbte      = cbtCbleInfo.IdTipoCbte;
                    infoDepreCble.ct_IdCbteCble      = IdCbteCble;
                    busDepreCtaCble.GuardarDB(infoDepreCble);
                }

                return(Respuesta);
            }
            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("", "ContabilizarDepreciacion", ex.Message), ex)
                      {
                          EntityType = typeof(Af_Depreciacion_Bus)
                      };
            }
        }