private void SetInfo_Depreciacion_x_Controls() { try { //btnProcesarDepre.Enabled = false; txtIdDepre.EditValue = InfoDepre.IdDepreciacion; cmbPeriodo.EditValue = InfoDepre.IdPeriodo; txtCodDepre.EditValue = InfoDepre.Cod_Depreciacion; txtDescripcion.EditValue = InfoDepre.Descripcion; dtpFecha.Value = InfoDepre.Fecha_Depreciacion; txtCantActDepre.EditValue = InfoDepre.Num_Act_Depre; txtTotActivo.EditValue = InfoDepre.Valor_Tot_Act; txtTotDepre.EditValue = InfoDepre.Valor_Tot_Depre; txtTotDepreAcum.EditValue = InfoDepre.Valor_Tot_DepreAcum; txtTotImpLibros.EditValue = InfoDepre.Valot_Tot_Importe; if (InfoDepre.Estado == "I") { lblAnulado.Visible = true; } Af_Depreciacion_Det_Bus BusDep_det = new Af_Depreciacion_Det_Bus(); InfoDepre.lstGridDepre = BusDep_det.Get_List_DepreciacionDetalle(InfoDepre.IdEmpresa, InfoDepre.IdDepreciacion, InfoDepre.IdTipoDepreciacion); txtCantActDepre.Text = InfoDepre.lstGridDepre.Count.ToString(); gridActivoDepre.DataSource = InfoDepre.lstGridDepre; cargarGridContable(); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void CalcularValores() { try { Af_Activo_fijo_Info InfoActiFijo = new Af_Activo_fijo_Info(); List <Af_Mej_Baj_Activo_Info> lstInfoMej = new List <Af_Mej_Baj_Activo_Info>(); Af_Mej_Baj_Activo_Bus busMejBaj = new Af_Mej_Baj_Activo_Bus(); Af_Depreciacion_Det_Bus busDepre = new Af_Depreciacion_Det_Bus(); double ValorDepreTot = 0; if (cmbActivoFijo.EditValue != null && cmbActivoFijo.EditValue != "") { InfoActiFijo = lstInfoAf.Where(q => q.IdActivoFijo == Convert.ToInt32(cmbActivoFijo.EditValue)).First(); txtValorActivo.EditValue = InfoActiFijo.Af_costo_compra; lstInfoMej = busMejBaj.Get_List_Sum_Valor_Mej_Baj_Activo(param.IdEmpresa, Convert.ToDecimal(cmbActivoFijo.EditValue)); if (lstInfoMej.Where(q => q.Id_Tipo == Cl_Enumeradores.eTipoActivoFijo.Baja_Acti.ToString()).ToList().Count > 0) { txtValorBaja.EditValue = lstInfoMej.Where(q => q.Id_Tipo == Cl_Enumeradores.eTipoActivoFijo.Baja_Acti.ToString()).First().Valor_Mej_Baj_Activo; } else { txtValorBaja.EditValue = 0; } if (lstInfoMej.Where(q => q.Id_Tipo == Cl_Enumeradores.eTipoActivoFijo.Mejo_Acti.ToString()).ToList().Count > 0) { txtValorMejora.EditValue = lstInfoMej.Where(q => q.Id_Tipo == Cl_Enumeradores.eTipoActivoFijo.Mejo_Acti.ToString()).First().Valor_Mej_Baj_Activo; } else { txtValorMejora.EditValue = 0; } ValorDepreTot = busDepre.Get_DepreAcum_x_Activo(param.IdEmpresa, Convert.ToInt32(cmbActivoFijo.EditValue)); txtValorDepre.EditValue = Math.Round(Convert.ToDouble((InfoActiFijo.Af_Depreciacion_acum == null ? 0 : InfoActiFijo.Af_Depreciacion_acum) + ValorDepreTot), 2, MidpointRounding.AwayFromZero); txtValorNeto.EditValue = Math.Round((Convert.ToDecimal(txtValorActivo.EditValue) - Convert.ToDecimal(txtValorBaja.EditValue) + Convert.ToDecimal(txtValorMejora.EditValue) - Convert.ToDecimal(txtValorDepre.EditValue)), 2, MidpointRounding.AwayFromZero); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }