public Boolean ModificarDB(ct_Plancta_nivel_Info _PCninfo) { try { using (EntitiesDBConta context = new EntitiesDBConta()) { var contact = context.ct_plancta_nivel.FirstOrDefault(Pcta_info => Pcta_info.IdNivelCta == _PCninfo.IdNivelCta && Pcta_info.IdEmpresa == _PCninfo.IdEmpresa); if (contact != null) { contact.IdEmpresa = _PCninfo.IdEmpresa; contact.IdNivelCta = Convert.ToByte(_PCninfo.IdNivelCta); contact.nv_NumDigitos = Convert.ToByte(_PCninfo.nv_NumDigitos); contact.nv_Descripcion = _PCninfo.nv_Descripcion; contact.Estado = _PCninfo.Estado; 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(); throw new Exception(ex.ToString()); } }
private void ucGe_Menu_event_btnModificar_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { try { _PlanCtaNivelInfo = (ct_Plancta_nivel_Info)gridViewNivel.GetFocusedRow(); if (_PlanCtaNivelInfo != null) { frm = new frmCon_PlanCuenta_Niveles_Mant(); frm.event_frmCon_PlanCuenta_Niveles_Mant_FormClosing += frm_event_frmCon_PlanCuenta_Niveles_Mant_FormClosing; frm.Text = frm.Text + "***MODIFICAR REGISTRO***"; frm._PlanCtaNivel_info = _PlanCtaNivelInfo; frm.set_PlanCtaNivel(_PlanCtaNivelInfo); frm.set_Accion(Cl_Enumeradores.eTipo_action.actualizar); frm.MdiParent = this.MdiParent; frm.Show(); } else { MessageBox.Show("Seleccione un Registro ", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Boolean AnularDB(ct_Plancta_nivel_Info _PCninfo) { try { using (EntitiesDBConta context = new EntitiesDBConta()) { var contact = context.ct_plancta_nivel.FirstOrDefault(Pcta_info => Pcta_info.IdEmpresa == _PCninfo.IdEmpresa && Pcta_info.IdNivelCta == _PCninfo.IdNivelCta); if (contact != null) { contact.IdUsuarioUltAnu = _PCninfo.IdUsuarioUltAnu; contact.Fecha_UltAnu = DateTime.Now; contact.MotivoAnulacion = _PCninfo.MotivoAnulacion; contact.Estado = "I"; 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(); throw new Exception(ex.ToString()); } }
private void gridViewNivel_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { _PlanCtaNivelInfo = (ct_Plancta_nivel_Info)gridViewNivel.GetFocusedRow(); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Boolean AnularDB(ct_Plancta_nivel_Info _PlanCtaNivelInfo) { try { ct_Plancta_nivel_Data data = new ct_Plancta_nivel_Data(); return(data.AnularDB(_PlanCtaNivelInfo)); } 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("", "EliminarDB", ex.Message), ex) { EntityType = typeof(ct_Plancta_nivel_Bus) }; } }
public void set_PlanCtaNivel(ct_Plancta_nivel_Info _PlanCtaNivelInfo) { try { this.txt_id.Text = _PlanCtaNivelInfo.IdNivelCta.ToString(); this.num_dig.EditValue = _PlanCtaNivelInfo.nv_NumDigitos; this.txt_descripcion.Text = _PlanCtaNivelInfo.nv_Descripcion; this.chk_estado.Checked = (_PlanCtaNivelInfo.Estado == "I") ? false : true; lblAnulado.Visible = (_PlanCtaNivelInfo.Estado == "I") ? true : false; _PlanCtaNivel_info = _PlanCtaNivelInfo; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void LimpiarDatos() { try { _Accion = Cl_Enumeradores.eTipo_action.grabar; _PlanCtaNivel_info = new ct_Plancta_nivel_Info(); txt_id.Text = ""; num_dig.EditValue = ""; txt_descripcion.Text = ""; chk_estado.Checked = true; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private Boolean Grabacion_Niveles(List <ct_Plancta_Info> lista) { Boolean respuesta = false; try { ct_Plancta_nivel_Bus BusNivel = new ct_Plancta_nivel_Bus(); List <ct_Plancta_nivel_Info> ListNiveles = new List <ct_Plancta_nivel_Info>(); var results = from p in lista group new { p.IdEmpresa, p.IdNivelCta, num_digitos = p.IdCtaCble.Length } by p into grupo orderby grupo.Key select grupo; foreach (var item in results) { ct_Plancta_nivel_Info Info = new ct_Plancta_nivel_Info(); Info.IdEmpresa = item.Key.IdEmpresa; Info.IdNivelCta = item.Key.IdNivelCta; Info.nv_Descripcion = "Nivel " + item.Key.IdNivelCta; Info.nv_NumDigitos = 0; //ListNiveles.Add(Info); } for (int i = ListNiveles.Count(); i < 0; i--) { } respuesta = BusNivel.GrabarDB(ListNiveles); return(respuesta); } catch (Exception ex) { lblMensaje.Text = "Error al cargar " + ex.ToString(); lblMensaje.Visible = true; return(respuesta); } }
public Boolean GrabarDB(ct_Plancta_nivel_Info _PCninfo) { try { using (EntitiesDBConta context = new EntitiesDBConta()) { EntitiesDBConta EDB = new EntitiesDBConta(); var Q = from per in EDB.ct_plancta_nivel where per.IdNivelCta == _PCninfo.IdNivelCta && per.IdEmpresa == _PCninfo.IdEmpresa select per; if (Q.ToList().Count == 0) { var address = new ct_plancta_nivel(); int IdNivel = 0; IdNivel = (_PCninfo.IdNivelCta != 0) ? _PCninfo.IdNivelCta : getId_Plancta_nivel(); address.IdEmpresa = _PCninfo.IdEmpresa; address.IdNivelCta = IdNivel; address.nv_NumDigitos = _PCninfo.nv_NumDigitos; address.nv_Descripcion = _PCninfo.nv_Descripcion; address.Estado = "A"; context.ct_plancta_nivel.Add(address); context.SaveChanges(); } else { return(false); } } 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(); throw new Exception(ex.ToString()); } }
public ct_Plancta_nivel_Info Get_info_plancta_nivel(int IdEmpresa, int IdNivelCta) { try { ct_Plancta_nivel_Info info = new ct_Plancta_nivel_Info(); using (EntitiesDBConta OEselectPlancta_nivel = new EntitiesDBConta()) { var selectPlancta_nivel = from C in OEselectPlancta_nivel.vwct_plancta_nivel where C.IdEmpresa == IdEmpresa && C.IdNivelCta == IdNivelCta select C; foreach (var item in selectPlancta_nivel) { info = new ct_Plancta_nivel_Info(); info.IdEmpresa = item.IdEmpresa; info.IdNivelCta = item.IdNivelCta; info.nv_NumDigitos = item.nv_NumDigitos; info.nv_Descripcion = item.nv_Descripcion; info.nv_NumDigitos_total = item.nv_NumDigitos_total; info.Estado = item.Estado; } } return(info); } 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(); throw new Exception(ex.ToString()); } }
public List <ct_Plancta_nivel_Info> Get_list_Plancta_nivel(int IdEmpresa) { try { List <ct_Plancta_nivel_Info> lM = new List <ct_Plancta_nivel_Info>(); using (EntitiesDBConta OEselectPlancta_nivel = new EntitiesDBConta()) { var selectPlancta_nivel = from C in OEselectPlancta_nivel.ct_plancta_nivel where C.IdEmpresa == IdEmpresa select C; ct_Plancta_nivel_Info _PlantaCtaNivelInfo; foreach (var item in selectPlancta_nivel) { _PlantaCtaNivelInfo = new ct_Plancta_nivel_Info(); _PlantaCtaNivelInfo.IdEmpresa = item.IdEmpresa; _PlantaCtaNivelInfo.IdNivelCta = item.IdNivelCta; _PlantaCtaNivelInfo.nv_NumDigitos = item.nv_NumDigitos; _PlantaCtaNivelInfo.nv_Descripcion = item.nv_Descripcion; _PlantaCtaNivelInfo.Estado = item.Estado; lM.Add(_PlantaCtaNivelInfo); } return(lM); } } 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(); throw new Exception(ex.ToString()); } }
public Boolean Valida_Nivel(ct_Plancta_nivel_Info _PCninfo) { try { using (EntitiesDBConta context = new EntitiesDBConta()) { var Q = from PCta_info in context.ct_plancta where PCta_info.IdEmpresa == _PCninfo.IdEmpresa && PCta_info.IdNivelCta == _PCninfo.IdNivelCta select PCta_info; return((Q.ToList().Count > 0) ? true : 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(); throw new Exception(ex.ToString()); } }
private Boolean Proceso_Grabacion() { Boolean respuesta = false; int c = 1; int Total_Reg = 0; string IdCta = ""; string IdCta_Padre = ""; string Nom_cta = ""; BindingList <cl_estado_grabacion> ListEstadoGrabacion = new BindingList <cl_estado_grabacion>(); try { string MensajeLog = "Ingreso Exitoso."; string MensajeWarning = ""; string listaLog = ""; this.rtbLog.Text = ""; bool B_Proceso_anulacion = true; lblMensaje.Text = ""; lblMensaje.Visible = false; gridControlProceGrabado.DataSource = ListEstadoGrabacion; if (treeListPlanCta.DataSource != null) { if (rgImportar.SelectedIndex == 0) { MensajeWarning = "Atención esta a punto de eliminar toda la información actual, y reemplazarla con la nueva. Está seguro de continuar?"; } else { MensajeWarning = "Atención esta a punto de proceder. Está seguro de continuar?"; } lblmsg3.Visible = true; if (MessageBox.Show(MensajeWarning, "SISTEMAS", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { if (rgImportar.SelectedIndex == 0) { splashScreenManager.ShowWaitForm(); B_Proceso_anulacion = _PlanCtaBus.EliminarDB(param.IdEmpresa, ref MensajeError); if (B_Proceso_anulacion) { ListEstadoGrabacion.Add(new cl_estado_grabacion(0, "", "Eliminado Plan de cuenta", "", "OK", "Eliminado Ok")); gridControlProceGrabado.Refresh(); } splashScreenManager.CloseWaitForm(); } if (B_Proceso_anulacion == true) { splashScreenManager.ShowWaitForm(); Total_Reg = _ListPlanCtaInfo.Count(); progressBar.Maximum = Total_Reg; progressBar.Minimum = 1; progressBar.Step = 1; lblNumRegistros.Text = "0 registros de " + Total_Reg; c = 1; ct_Plancta_nivel_Bus BusPlan_nivel = new ct_Plancta_nivel_Bus(); List <ct_Plancta_nivel_Info> list_niveles = new List <ct_Plancta_nivel_Info>(); List <ct_Plancta_nivel_Info> list_niveles_Aux = new List <ct_Plancta_nivel_Info>(); var QNiveles = from Cb in _ListPlanCtaInfo orderby Cb.IdNivelCta descending group Cb by new { Cb.IdEmpresa, Cb.IdNivelCta, Cb.IdCtaCble.Length } into grouping select new { grouping.Key }; if (QNiveles.Count() > 0) { foreach (var item in QNiveles) { ct_Plancta_nivel_Info InfoPlan_nivel = new ct_Plancta_nivel_Info(); InfoPlan_nivel.IdEmpresa = item.Key.IdEmpresa; InfoPlan_nivel.IdNivelCta = item.Key.IdNivelCta; InfoPlan_nivel.nv_Descripcion = "Nivel " + item.Key.IdNivelCta;; InfoPlan_nivel.nv_NumDigitos = item.Key.Length; InfoPlan_nivel.Estado = "A"; list_niveles_Aux.Add(InfoPlan_nivel); } } // recorre desde el nivel mas grande hasta el nivel mas pequeño foreach (var item in list_niveles_Aux) { int num_Digito_x_Nivel_Actual = 0; int num_Digito_x_Nivel_Anterior = 0; ct_Plancta_nivel_Info InfoPlan_nivel_Anterior = list_niveles_Aux.FirstOrDefault(v => v.IdNivelCta == item.IdNivelCta - 1); num_Digito_x_Nivel_Anterior = (InfoPlan_nivel_Anterior == null) ? 0 : InfoPlan_nivel_Anterior.nv_NumDigitos; num_Digito_x_Nivel_Actual = item.nv_NumDigitos - num_Digito_x_Nivel_Anterior; ct_Plancta_nivel_Info InfoPlan_nivel = new ct_Plancta_nivel_Info(); InfoPlan_nivel.IdEmpresa = item.IdEmpresa; InfoPlan_nivel.IdNivelCta = item.IdNivelCta; InfoPlan_nivel.nv_Descripcion = item.nv_Descripcion; InfoPlan_nivel.nv_NumDigitos = num_Digito_x_Nivel_Actual; InfoPlan_nivel.Estado = "A"; list_niveles.Add(InfoPlan_nivel); } //BusPlan_nivel.EliminarDB(param.IdEmpresa); BusPlan_nivel.GrabarDB(list_niveles); foreach (ct_Plancta_Info item in _ListPlanCtaInfo) { IdCta = item.IdCtaCble; Nom_cta = item.pc_Cuenta; IdCta_Padre = item.IdCtaCblePadre; item.IdUsuario = "migrado2"; respuesta = _PlanCtaBus.GrabarDB(item, ref MensajeError); if (respuesta) { ListEstadoGrabacion.Add(new cl_estado_grabacion(c, item.IdCtaCble, item.pc_Cuenta, IdCta_Padre, "OK", "Migrado Ok")); gridControlProceGrabado.Refresh(); progressBar.Value = c; lblNumRegistros.Text = c + " registros de " + Total_Reg; progressBar.Refresh(); Application.DoEvents(); } c++; } if (listaLog != "") { MensajeLog += " pero con errores:" + "\n" + listaLog + MensajeError; } } } else { MensajeLog = "No se efectuó la operación. Operación cancelada por el usuario."; } lblmsg3.Visible = false; } else { MensajeLog = "No existen Datos para importación."; } this.rtbLog.Text = MensajeLog; splashScreenManager.CloseWaitForm(); return(respuesta); } catch (Exception ex) { splashScreenManager.CloseWaitForm(); ListEstadoGrabacion.Add(new cl_estado_grabacion(c++, IdCta, Nom_cta, IdCta_Padre, "ERROR", "No Migrado:" + ex.ToString())); gridControlProceGrabado.Refresh(); lblMensaje.Text = "Error al cargar " + ex.ToString(); lblMensaje.Visible = true; return(respuesta); } }
public List <ct_Plancta_Info> Get_List_Plancta_x_Tipo_Balance(int IdEmpresa, string Tipo_Balance, ref string MensajeError) { try { string ClaveCorta = ""; List <ct_Plancta_Info> lM = new List <ct_Plancta_Info>(); EntitiesDBConta OEselectPlancta = new EntitiesDBConta(); var selectPlancta = from C in OEselectPlancta.ct_plancta join N in OEselectPlancta.ct_plancta_nivel on new { C.IdEmpresa, C.IdNivelCta } equals new { N.IdEmpresa, N.IdNivelCta } join G in OEselectPlancta.ct_grupocble on new { C.IdGrupoCble } equals new { G.IdGrupoCble } join M in OEselectPlancta.ct_grupocble_Mayor on new { G.IdGrupo_Mayor } equals new { M.IdGrupo_Mayor } where C.IdEmpresa == IdEmpresa && G.gc_estado_financiero == Tipo_Balance orderby C.IdCtaCble select new { C.IdEmpresa, C.IdCtaCble, C.pc_Cuenta, C.IdCtaCblePadre, C.IdCatalogo, C.pc_Naturaleza, C.IdNivelCta, C.IdGrupoCble, C.pc_Estado, C.pc_EsMovimiento, C.pc_es_flujo_efectivo, N.nv_NumDigitos, C.pc_clave_corta, C.IdTipoCtaCble, G.gc_GrupoCble, G.gc_estado_financiero, G.gc_Orden, M.IdGrupo_Mayor, M.nom_grupo_mayor, M.orden, C.IdTipo_Gasto }; foreach (var item in selectPlancta) { ct_Plancta_Info _PlantaCtaInfo = new ct_Plancta_Info(); ct_Plancta_nivel_Info NivelO = new ct_Plancta_nivel_Info(); ClaveCorta = (item.pc_clave_corta == null || item.pc_clave_corta == "") ? "" : "{" + item.pc_clave_corta + "}"; _PlantaCtaInfo.IdEmpresa = item.IdEmpresa; _PlantaCtaInfo.IdCtaCble = item.IdCtaCble.Trim(); _PlantaCtaInfo.pc_Cuenta = item.pc_Cuenta.Trim(); _PlantaCtaInfo.pc_Cuenta2 = ClaveCorta + "[" + item.IdCtaCble.Trim() + "] - " + item.pc_Cuenta.Trim(); _PlantaCtaInfo.IdCtaCblePadre = (item.IdCtaCblePadre == null) ? "" : item.IdCtaCblePadre.Trim(); _PlantaCtaInfo.IdCatalogo = Convert.ToDecimal(item.IdCatalogo); _PlantaCtaInfo.pc_Naturaleza = item.pc_Naturaleza; _PlantaCtaInfo.IdNivelCta = item.IdNivelCta; _PlantaCtaInfo.IdGrupoCble = item.IdGrupoCble.Trim(); _PlantaCtaInfo.pc_Estado = item.pc_Estado; _PlantaCtaInfo.pc_EsMovimiento = item.pc_EsMovimiento; _PlantaCtaInfo._Plancta_nivel_Info = NivelO; _PlantaCtaInfo._Plancta_nivel_Info.IdEmpresa = item.IdEmpresa; _PlantaCtaInfo._Plancta_nivel_Info.IdNivelCta = item.IdNivelCta; _PlantaCtaInfo.pc_es_flujo_efectivo = item.pc_es_flujo_efectivo; _PlantaCtaInfo._Plancta_nivel_Info.nv_NumDigitos = item.nv_NumDigitos; _PlantaCtaInfo.pc_clave_corta = item.pc_clave_corta; _PlantaCtaInfo.IdTipoCtaCble = item.IdTipoCtaCble; _PlantaCtaInfo.Nom_GrupoCble = item.gc_GrupoCble; _PlantaCtaInfo.gc_estado_financiero = item.gc_estado_financiero; _PlantaCtaInfo.OrderGrupoCble = item.gc_Orden; _PlantaCtaInfo.orden = item.orden; _PlantaCtaInfo.IdGrupo_Mayor = item.IdGrupo_Mayor; _PlantaCtaInfo.nom_grupo_mayor = item.nom_grupo_mayor; _PlantaCtaInfo.IdTipo_Gasto = item.IdTipo_Gasto; lM.Add(_PlantaCtaInfo); } return(lM); } catch (Exception ex) { MensajeError = ex.Message; 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(), "", MensajeError, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public List <ct_Plancta_Info> Get_List_Plancta(int IdEmpresa, ref string MensajeError) { try { string ClaveCorta = ""; List <ct_Plancta_Info> lM = new List <ct_Plancta_Info>(); EntitiesDBConta OEselectPlancta = new EntitiesDBConta(); var selectPlancta = from C in OEselectPlancta.ct_plancta join N in OEselectPlancta.ct_plancta_nivel on new { C.IdEmpresa, C.IdNivelCta } equals new { N.IdEmpresa, N.IdNivelCta } where C.IdEmpresa == IdEmpresa select new { C.IdEmpresa, C.IdCtaCble, C.pc_Cuenta, C.IdCtaCblePadre, C.pc_Naturaleza, C.IdNivelCta, C.IdGrupoCble, C.pc_Estado, C.pc_EsMovimiento, N.nv_NumDigitos , C.pc_clave_corta, C.IdTipo_Gasto }; foreach (var item in selectPlancta) { ct_Plancta_Info _PlantaCtaInfo = new ct_Plancta_Info(); ct_Plancta_nivel_Info NivelO = new ct_Plancta_nivel_Info(); ClaveCorta = (item.pc_clave_corta == null || item.pc_clave_corta == "") ? "" : "{" + item.pc_clave_corta + "}"; _PlantaCtaInfo.IdEmpresa = item.IdEmpresa; _PlantaCtaInfo.IdCtaCble = item.IdCtaCble.Trim(); _PlantaCtaInfo.pc_Cuenta = item.pc_Cuenta.Trim(); _PlantaCtaInfo.pc_Cuenta2 = ClaveCorta + "[" + item.IdCtaCble.Trim() + "] - " + item.pc_Cuenta.Trim(); _PlantaCtaInfo.IdCtaCblePadre = (item.IdCtaCblePadre == null)?"":item.IdCtaCblePadre.Trim(); _PlantaCtaInfo.pc_Naturaleza = item.pc_Naturaleza; _PlantaCtaInfo.IdNivelCta = item.IdNivelCta; _PlantaCtaInfo.IdGrupoCble = item.IdGrupoCble.Trim(); _PlantaCtaInfo.pc_Estado = item.pc_Estado; _PlantaCtaInfo.pc_EsMovimiento = item.pc_EsMovimiento; _PlantaCtaInfo._Plancta_nivel_Info = NivelO; _PlantaCtaInfo._Plancta_nivel_Info.IdEmpresa = item.IdEmpresa; _PlantaCtaInfo._Plancta_nivel_Info.IdNivelCta = item.IdNivelCta; _PlantaCtaInfo._Plancta_nivel_Info.nv_NumDigitos = item.nv_NumDigitos; _PlantaCtaInfo.pc_clave_corta = item.pc_clave_corta; _PlantaCtaInfo.IdTipo_Gasto = item.IdTipo_Gasto; lM.Add(_PlantaCtaInfo); } return(lM); } catch (Exception ex) { MensajeError = ex.Message; 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(), "", MensajeError, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref MensajeError); MensajeError = ex.ToString(); throw new Exception(ex.ToString()); } }
public List <XCONTA_NATU_Rpt004_Info> consultar_data(int IdEmpresa, DateTime FechaIni, DateTime FechaFin, string IdCentroCosto, int IdNivel_a_mostrar , int IdPunto_cargo_grupo , int IdPunto_cargo , bool Mostrar_reg_en_cero , bool MostrarCC, bool Considerar_Asiento_cierre_anual, string IdUsuario, ref String MensajeError) { try { List <XCONTA_NATU_Rpt004_Info> listadedatos = new List <XCONTA_NATU_Rpt004_Info>(); FechaIni = Convert.ToDateTime(FechaIni.ToShortDateString()); FechaFin = Convert.ToDateTime(FechaFin.ToShortDateString()); using (EntitiesDBConta Estado_Resultado = new EntitiesDBConta()) { Estado_Resultado.SetCommandTimeOut(30000);//timeout 3 minutos //IList<spCON_Mayorizar_x_fecha_corte_Result> listBalance = IEnumerable <spCON_Mayorizar_x_fecha_corte_Result> listBalance = from q in Estado_Resultado.spCON_Mayorizar_x_fecha_corte(IdEmpresa, FechaIni, FechaFin, IdCentroCosto, IdPunto_cargo_grupo, IdPunto_cargo, Mostrar_reg_en_cero, MostrarCC, Considerar_Asiento_cierre_anual, IdUsuario) select q; var Querry_x_UTILIDAD = from C in listBalance where C.CtaUtilidad == true select C; var Querry_x_ER = from C in listBalance where C.gc_estado_financiero == "ER" && C.IdNivelCta <= IdNivel_a_mostrar select C; ct_Plancta_nivel_Info info_nivel_2 = new ct_Plancta_nivel_Info(); ct_Plancta_nivel_Info info_nivel_3 = new ct_Plancta_nivel_Info(); ct_Plancta_nivel_Info info_nivel_4 = new ct_Plancta_nivel_Info(); ct_Plancta_nivel_Info info_nivel_5 = new ct_Plancta_nivel_Info(); ct_Plancta_nivel_Info info_nivel_6 = new ct_Plancta_nivel_Info(); ct_Plancta_nivel_Bus bus_nivel = new ct_Plancta_nivel_Bus(); info_nivel_2 = bus_nivel.Get_info_plancta_nivel(IdEmpresa, 2); info_nivel_3 = bus_nivel.Get_info_plancta_nivel(IdEmpresa, 3); info_nivel_4 = bus_nivel.Get_info_plancta_nivel(IdEmpresa, 4); info_nivel_5 = bus_nivel.Get_info_plancta_nivel(IdEmpresa, 5); info_nivel_6 = bus_nivel.Get_info_plancta_nivel(IdEmpresa, 6); List <ct_Plancta_Info> lst_nivel_2 = new List <ct_Plancta_Info>(); List <ct_Plancta_Info> lst_nivel_3 = new List <ct_Plancta_Info>(); List <ct_Plancta_Info> lst_nivel_4 = new List <ct_Plancta_Info>(); List <ct_Plancta_Info> lst_nivel_5 = new List <ct_Plancta_Info>(); List <ct_Plancta_Info> lst_nivel_6 = new List <ct_Plancta_Info>(); ct_Plancta_Bus bus_plancta = new ct_Plancta_Bus(); lst_nivel_2 = bus_plancta.Get_List_Plancta(IdEmpresa, 2); lst_nivel_3 = bus_plancta.Get_List_Plancta(IdEmpresa, 3); lst_nivel_4 = bus_plancta.Get_List_Plancta(IdEmpresa, 4); lst_nivel_5 = bus_plancta.Get_List_Plancta(IdEmpresa, 5); lst_nivel_6 = bus_plancta.Get_List_Plancta(IdEmpresa, 6); foreach (var item in Querry_x_ER) { if (item.IdNivelCta == IdNivel_a_mostrar) { XCONTA_NATU_Rpt004_Info itemInfo = new XCONTA_NATU_Rpt004_Info(); itemInfo.IdEmpresa = item.IdEmpresa; itemInfo.IdCtaCble = item.IdCtaCble; itemInfo.nom_cuenta = item.nom_cuenta; itemInfo.nom_cuenta2 = item.IdCtaCble + " " + item.nom_cuenta; itemInfo.IdNivelCta = item.IdNivelCta; itemInfo.IdCtaCblePadre = item.IdCtaCblePadre; itemInfo.GrupoCble = item.GrupoCble; itemInfo.OrderGrupoCble = Convert.ToInt32(item.OrderGrupoCble); itemInfo.gc_estado_financiero = item.gc_estado_financiero; itemInfo.Saldo_Inicial = item.Saldo_Inicial; itemInfo.Debito_Mes = item.Debito_Mes; itemInfo.Credito_Mes = item.Credito_Mes; itemInfo.Saldo = item.Saldo; itemInfo.Saldo_inicial_x_Movi = item.Saldo_inicial_x_Movi; itemInfo.Debito_Mes_x_Movi = item.Debito_Mes_x_Movi; itemInfo.Credito_Mes_x_Movi = item.Credito_Mes_x_Movi; itemInfo.Saldo_x_Movi = item.Saldo_x_Movi; itemInfo.pc_EsMovimiento = item.pc_EsMovimiento; //itemInfo.GrupoCble = item.OrderGrupoCble + " " + item.GrupoCble; itemInfo.gc_signo_operacion = item.gc_signo_operacion; itemInfo.IdPuntoCargo = item.IdPunto_cargo; itemInfo.IdPuntoCargo_Grupo = item.IdPunto_cargo_grupo; itemInfo.IdCentroCosto = item.IdCentroCosto; itemInfo.nom_PuntoCargo = item.nom_punto_cargo; itemInfo.nom_PuntoCargo_Grupo = item.nom_punto_cargo_grupo; itemInfo.nom_CentroCosto = item.nom_centro_costo; itemInfo.nom_empresa = item.nom_empresa; itemInfo.IdGrupo_Mayor = item.IdGrupo_Mayor; itemInfo.nom_grupo_mayor = item.nom_grupo_mayor; itemInfo.order_grupo_mayor = item.order_grupo_mayor; //Nivel 2 itemInfo.IdCtaCble_nivel2 = item.IdCtaCble.Length > info_nivel_2.nv_NumDigitos_total ? itemInfo.IdCtaCble.Substring(0, Convert.ToInt32(info_nivel_2.nv_NumDigitos_total)) : null; if (itemInfo.IdCtaCble_nivel2 != null) { itemInfo.pc_cuenta_nivel2 = lst_nivel_2.FirstOrDefault(q => q.IdCtaCble == itemInfo.IdCtaCble_nivel2).pc_Cuenta; } //Nivel 3 itemInfo.IdCtaCble_nivel3 = item.IdCtaCble.Length > info_nivel_3.nv_NumDigitos_total ? itemInfo.IdCtaCble.Substring(0, Convert.ToInt32(info_nivel_3.nv_NumDigitos_total)) : null; if (itemInfo.IdCtaCble_nivel3 != null) { itemInfo.pc_cuenta_nivel3 = lst_nivel_3.FirstOrDefault(q => q.IdCtaCble == itemInfo.IdCtaCble_nivel3).pc_Cuenta; } //Nivel 4 itemInfo.IdCtaCble_nivel4 = item.IdCtaCble.Length > info_nivel_4.nv_NumDigitos_total ? itemInfo.IdCtaCble.Substring(0, Convert.ToInt32(info_nivel_4.nv_NumDigitos_total)) : null; if (itemInfo.IdCtaCble_nivel4 != null) { itemInfo.pc_cuenta_nivel4 = lst_nivel_4.FirstOrDefault(q => q.IdCtaCble == itemInfo.IdCtaCble_nivel4).pc_Cuenta; } //Nivel 5 itemInfo.IdCtaCble_nivel5 = item.IdCtaCble.Length > info_nivel_5.nv_NumDigitos_total ? itemInfo.IdCtaCble.Substring(0, Convert.ToInt32(info_nivel_5.nv_NumDigitos_total)) : null; if (itemInfo.IdCtaCble_nivel5 != null) { itemInfo.pc_cuenta_nivel5 = lst_nivel_5.FirstOrDefault(q => q.IdCtaCble == itemInfo.IdCtaCble_nivel5).pc_Cuenta; } //Nivel 6 itemInfo.IdCtaCble_nivel6 = item.IdCtaCble.Length > info_nivel_6.nv_NumDigitos_total ? itemInfo.IdCtaCble.Substring(0, Convert.ToInt32(info_nivel_6.nv_NumDigitos_total)) : null; if (itemInfo.IdCtaCble_nivel6 != null) { itemInfo.pc_cuenta_nivel6 = lst_nivel_6.FirstOrDefault(q => q.IdCtaCble == itemInfo.IdCtaCble_nivel6).pc_Cuenta; } listadedatos.Add(itemInfo); } } } return(listadedatos); } catch (Exception ex) { string mensaje = ""; 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(); throw new Exception(ex.ToString()); } }
public List <XCONTA_Rpt022_Info> consultar_data(int IdEmpresa, DateTime FechaIni, DateTime FechaFin, string IdCentroCosto, int IdNivel_a_mostrar , int IdPunto_cargo_grupo , int IdPunto_cargo , bool Mostrar_reg_Cero , bool MostrarCC, bool Considerar_Asiento_cierre_anual, string IdUsuario, ref String MensajeError) { try { List <XCONTA_Rpt022_Info> listadedatos = new List <XCONTA_Rpt022_Info>(); FechaIni = Convert.ToDateTime(FechaIni.ToShortDateString()); FechaFin = Convert.ToDateTime(FechaFin.ToShortDateString()); using (EntitiesContabilidadRptGeneral BalanceGeneral = new EntitiesContabilidadRptGeneral()) { BalanceGeneral.SetCommandTimeOut(30000);//timeout 3 minutos IList <spCON_Mayorizar_x_fecha_corte_Result> listBalance = BalanceGeneral.spCON_Mayorizar_x_fecha_corte(IdEmpresa, FechaIni, FechaFin, IdCentroCosto, IdPunto_cargo_grupo, IdPunto_cargo, Mostrar_reg_Cero, MostrarCC, Considerar_Asiento_cierre_anual, IdUsuario).Where(v => v.gc_estado_financiero == "BG" && v.IdNivelCta <= IdNivel_a_mostrar).ToList(); ct_Plancta_nivel_Info info_nivel_2 = new ct_Plancta_nivel_Info(); ct_Plancta_nivel_Info info_nivel_3 = new ct_Plancta_nivel_Info(); ct_Plancta_nivel_Info info_nivel_4 = new ct_Plancta_nivel_Info(); ct_Plancta_nivel_Info info_nivel_5 = new ct_Plancta_nivel_Info(); ct_Plancta_nivel_Info info_nivel_6 = new ct_Plancta_nivel_Info(); ct_Plancta_nivel_Bus bus_nivel = new ct_Plancta_nivel_Bus(); info_nivel_2 = bus_nivel.Get_info_plancta_nivel(IdEmpresa, 2); info_nivel_3 = bus_nivel.Get_info_plancta_nivel(IdEmpresa, 3); info_nivel_4 = bus_nivel.Get_info_plancta_nivel(IdEmpresa, 4); info_nivel_5 = bus_nivel.Get_info_plancta_nivel(IdEmpresa, 5); info_nivel_6 = bus_nivel.Get_info_plancta_nivel(IdEmpresa, 6); List <ct_Plancta_Info> lst_nivel_2 = new List <ct_Plancta_Info>(); List <ct_Plancta_Info> lst_nivel_3 = new List <ct_Plancta_Info>(); List <ct_Plancta_Info> lst_nivel_4 = new List <ct_Plancta_Info>(); List <ct_Plancta_Info> lst_nivel_5 = new List <ct_Plancta_Info>(); List <ct_Plancta_Info> lst_nivel_6 = new List <ct_Plancta_Info>(); ct_Plancta_Bus bus_plancta = new ct_Plancta_Bus(); lst_nivel_2 = bus_plancta.Get_List_Plancta(IdEmpresa, 2); lst_nivel_3 = bus_plancta.Get_List_Plancta(IdEmpresa, 3); lst_nivel_4 = bus_plancta.Get_List_Plancta(IdEmpresa, 4); lst_nivel_5 = bus_plancta.Get_List_Plancta(IdEmpresa, 5); lst_nivel_6 = bus_plancta.Get_List_Plancta(IdEmpresa, 6); foreach (var item in listBalance) { if (item.IdNivelCta == IdNivel_a_mostrar) { XCONTA_Rpt022_Info itemInfo = new XCONTA_Rpt022_Info(); itemInfo.IdEmpresa = item.IdEmpresa; itemInfo.IdCtaCble = item.IdCtaCble; itemInfo.nom_cuenta = item.nom_cuenta; itemInfo.IdNivelCta = item.IdNivelCta; itemInfo.IdCtaCblePadre = item.IdCtaCblePadre; itemInfo.GrupoCble = item.GrupoCble; itemInfo.OrderGrupoCble = Convert.ToInt32(item.OrderGrupoCble); itemInfo.gc_estado_financiero = item.gc_estado_financiero; itemInfo.Saldo_Inicial = item.Saldo_Inicial; itemInfo.Debito_Mes = item.Debito_Mes; itemInfo.Credito_Mes = item.Credito_Mes; itemInfo.Saldo = item.Saldo; itemInfo.Saldo_inicial_x_Movi = item.Saldo_inicial_x_Movi; itemInfo.Debito_Mes_x_Movi = item.Debito_Mes_x_Movi; itemInfo.Credito_Mes_x_Movi = item.Credito_Mes_x_Movi; itemInfo.Saldo_x_Movi = item.Saldo_x_Movi; itemInfo.pc_EsMovimiento = item.pc_EsMovimiento; itemInfo.nom_cuenta2 = item.IdCtaCble + " - " + item.nom_cuenta; itemInfo.nom_cuenta = item.nom_cuenta; itemInfo.IdPuntoCargo = item.IdPunto_cargo; itemInfo.IdPuntoCargo_Grupo = item.IdPunto_cargo_grupo; itemInfo.IdCentroCosto = item.IdCentroCosto; itemInfo.nom_PuntoCargo = item.nom_punto_cargo; itemInfo.nom_PuntoCargo_Grupo = item.nom_punto_cargo_grupo; itemInfo.nom_CentroCosto = item.nom_centro_costo; itemInfo.nom_empresa = item.nom_empresa; try { //Nivel 2 itemInfo.IdCtaCble_nivel2 = item.IdCtaCble.Length > info_nivel_2.nv_NumDigitos_total ? itemInfo.IdCtaCble.Substring(0, Convert.ToInt32(info_nivel_2.nv_NumDigitos_total)) : null; if (itemInfo.IdCtaCble_nivel2 != null) { itemInfo.pc_cuenta_nivel2 = lst_nivel_2.FirstOrDefault(q => q.IdCtaCble == itemInfo.IdCtaCble_nivel2).pc_Cuenta; } } catch (Exception ex) { } try { //Nivel 3 itemInfo.IdCtaCble_nivel3 = item.IdCtaCble.Length > info_nivel_3.nv_NumDigitos_total ? itemInfo.IdCtaCble.Substring(0, Convert.ToInt32(info_nivel_3.nv_NumDigitos_total)) : null; if (itemInfo.IdCtaCble_nivel3 != null) { itemInfo.pc_cuenta_nivel3 = lst_nivel_3.FirstOrDefault(q => q.IdCtaCble == itemInfo.IdCtaCble_nivel3).pc_Cuenta; } } catch (Exception ex) { } try { //Nivel 4 itemInfo.IdCtaCble_nivel4 = item.IdCtaCble.Length > info_nivel_4.nv_NumDigitos_total ? itemInfo.IdCtaCble.Substring(0, Convert.ToInt32(info_nivel_4.nv_NumDigitos_total)) : null; if (itemInfo.IdCtaCble_nivel4 != null) { itemInfo.pc_cuenta_nivel4 = lst_nivel_4.FirstOrDefault(q => q.IdCtaCble == itemInfo.IdCtaCble_nivel4).pc_Cuenta; } } catch (Exception ex) { } try { //Nivel 5 itemInfo.IdCtaCble_nivel5 = item.IdCtaCble.Length > info_nivel_5.nv_NumDigitos_total ? itemInfo.IdCtaCble.Substring(0, Convert.ToInt32(info_nivel_5.nv_NumDigitos_total)) : null; if (itemInfo.IdCtaCble_nivel5 != null) { itemInfo.pc_cuenta_nivel5 = lst_nivel_5.FirstOrDefault(q => q.IdCtaCble == itemInfo.IdCtaCble_nivel5).pc_Cuenta; } } catch (Exception ex) { } try { //Nivel 6 itemInfo.IdCtaCble_nivel6 = item.IdCtaCble.Length > info_nivel_6.nv_NumDigitos_total ? itemInfo.IdCtaCble.Substring(0, Convert.ToInt32(info_nivel_6.nv_NumDigitos_total)) : null; if (itemInfo.IdCtaCble_nivel6 != null) { itemInfo.pc_cuenta_nivel6 = lst_nivel_6.FirstOrDefault(q => q.IdCtaCble == itemInfo.IdCtaCble_nivel6).pc_Cuenta; } } catch (Exception ex) { } listadedatos.Add(itemInfo); } } } return(listadedatos.OrderBy(Q => Q.IdCtaCble).ToList()); } catch (Exception ex) { string mensaje = ""; 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(); throw new Exception(ex.ToString()); } }