public ActionResult Modificar(int IdEmpresa = 0, decimal IdPlantilla = 0) { #region Validar Session if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession)) { return(RedirectToAction("Login", new { Area = "", Controller = "Account" })); } SessionFixed.IdTransaccionSession = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString(); SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession; #endregion ct_cbtecble_Plantilla_Info model = bus_CbteCble_Plantilla.GetInfo(IdEmpresa, IdPlantilla); if (model == null) { return(RedirectToAction("Index")); } model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession); model.lst_cbtecble_plantilla_det = bus_CbteCblePlantillaDet.GetList(model.IdEmpresa, model.IdPlantilla); CbteCble_PlantillaDet_Lista.set_list(model.lst_cbtecble_plantilla_det, model.IdTransaccionSession); cargar_combos(model.IdEmpresa); return(View(model)); }
public ct_Cbtecble_Info Get_Info_Plantilla_CbteCble(int IdEmpresa, int IdTipoCbte, decimal IdPlantilla) { try { ct_cbtecble_Plantilla_Info info = new ct_cbtecble_Plantilla_Info(); ct_Cbtecble_Info _Info = new ct_Cbtecble_Info(); List <ct_Cbtecble_det_Info> Lst_det = new List <ct_Cbtecble_det_Info>(); info = data.Get_Info_Plantilla(IdEmpresa, IdTipoCbte, IdPlantilla); _Info.Estado = "A"; _Info.cb_Fecha = info.cb_Fecha; _Info.cb_Observacion = info.cb_Observacion; _Info.IdEmpresa = info.IdEmpresa; _Info.IdTipoCbte = info.IdTipoCbte; _Info.IdUsuario = info.IdUsuario; _Info.IdUsuarioUltModi = info.IdUsuarioUltModi; _Info.IdUsuarioAnu = info.IdUsuarioAnu; _Info.cb_FechaAnu = info.cb_FechaAnu; _Info.cb_FechaTransac = info.cb_FechaTransac; _Info.cb_FechaUltModi = info.cb_FechaUltModi; _Info.IdCbteCble = info.IdPlantilla; foreach (var item in info.LstDet) { ct_Cbtecble_det_Info det_i = new ct_Cbtecble_det_Info(); det_i.IdPunto_cargo_grupo = item.IdPunto_cargo_grupo; det_i.IdPunto_cargo = item.IdPunto_cargo; det_i.IdEmpresa = item.IdEmpresa; det_i.IdTipoCbte = item.IdTipoCbte; det_i.IdCtaCble = item.IdCtaCble; det_i.IdCbteCble = item.IdPlantilla; if (item.IdCentroCosto != "") { det_i.IdCentroCosto = item.IdCentroCosto; } det_i.secuencia = item.secuencia; det_i.dc_Valor = item.dc_Valor; det_i.dc_Observacion = item.dc_Observacion; Lst_det.Add(det_i); } _Info._cbteCble_det_lista_info = Lst_det; return(_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("", "Get_Info_Plantilla_CbteCble", ex.Message), ex) { EntityType = typeof(ct_cbtecble_Plantilla_Bus) }; } }
public bool AnularBD(ct_cbtecble_Plantilla_Info info) { try { using (Entities_contabilidad db = new Entities_contabilidad()) { ct_cbtecble_Plantilla entity = db.ct_cbtecble_Plantilla.Where(q => q.IdPlantilla == info.IdPlantilla && q.IdEmpresa == info.IdEmpresa).FirstOrDefault(); if (entity == null) { return(false); } entity.cb_Estado = "I"; entity.IdUsuarioAnulacion = info.IdUsuarioAnulacion; entity.FechaAnulacion = DateTime.Now; entity.MotivoAnulacion = info.MotivoAnulacion; db.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public ActionResult Anular(int IdEmpresa = 0, decimal IdPlantilla = 0) { #region Validar Session if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession)) { return(RedirectToAction("Login", new { Area = "", Controller = "Account" })); } SessionFixed.IdTransaccionSession = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString(); SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession; #endregion #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Contabilidad", "PlantillaComprobanteContable", "Index"); if (!info.Anular) { return(RedirectToAction("Index")); } #endregion ct_cbtecble_Plantilla_Info model = bus_CbteCble_Plantilla.GetInfo(IdEmpresa, IdPlantilla); if (model == null) { return(RedirectToAction("Index")); } model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession); model.lst_cbtecble_plantilla_det = bus_CbteCblePlantillaDet.GetList(model.IdEmpresa, model.IdPlantilla); CbteCble_PlantillaDet_Lista.set_list(model.lst_cbtecble_plantilla_det, model.IdTransaccionSession); cargar_combos(model.IdEmpresa); return(View(model)); }
public ct_cbtecble_Plantilla_Info get_info(int IdEmpresa, decimal IdPlantilla) { try { ct_cbtecble_Plantilla_Info info = new ct_cbtecble_Plantilla_Info(); using (Entities_contabilidad Context = new Entities_contabilidad()) { ct_cbtecble_Plantilla Entity = Context.ct_cbtecble_Plantilla.Where(q => q.IdPlantilla == IdPlantilla && q.IdEmpresa == IdEmpresa).FirstOrDefault(); if (Entity == null) { return(null); } info = new ct_cbtecble_Plantilla_Info { IdEmpresa = Entity.IdEmpresa, IdPlantilla = Entity.IdPlantilla, IdTipoCbte = Entity.IdTipoCbte, cb_Observacion = Entity.cb_Observacion, cb_Estado = Entity.cb_Estado }; } return(info); } catch (Exception) { throw; } }
public ActionResult Nuevo(int IdEmpresa = 0) { #region Validar Session if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession)) { return(RedirectToAction("Login", new { Area = "", Controller = "Account" })); } SessionFixed.IdTransaccionSession = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString(); SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession; #endregion #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Contabilidad", "PlantillaComprobanteContable", "Index"); if (!info.Nuevo) { return(RedirectToAction("Index")); } #endregion ct_cbtecble_Plantilla_Info model = new ct_cbtecble_Plantilla_Info { IdEmpresa = IdEmpresa, IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession), IdUsuarioCreacion = SessionFixed.IdUsuario }; cargar_combos(model.IdEmpresa); CbteCble_PlantillaDet_Lista.set_list(new List <ct_cbtecble_Plantilla_det_Info>(), model.IdTransaccionSession); return(View(model)); }
public ActionResult Index() { #region Validar Session if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession)) { return(RedirectToAction("Login", new { Area = "", Controller = "Account" })); } SessionFixed.IdTransaccionSession = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString(); SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession; #endregion #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Contabilidad", "PlantillaComprobanteContable", "Index"); ViewBag.Nuevo = info.Nuevo; ViewBag.Modificar = info.Modificar; ViewBag.Anular = info.Anular; #endregion ct_cbtecble_Plantilla_Info model = new ct_cbtecble_Plantilla_Info { IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession), IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa), }; var lst = bus_CbteCble_Plantilla.GetList(model.IdEmpresa, true); Lista_PlantillaComprobante.set_list(lst, model.IdTransaccionSession); return(View(model)); }
public ActionResult EditingDelete(int Secuencia) { CbteCble_PlantillaDet_Lista.DeleteRow(Secuencia, Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)); ct_cbtecble_Plantilla_Info model = new ct_cbtecble_Plantilla_Info(); model.lst_cbtecble_plantilla_det = CbteCble_PlantillaDet_Lista.get_list(Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual)); cargar_combos_detalle(); return(PartialView("_GridViewPartial_ComprobanteContablePlantillaDet", model.lst_cbtecble_plantilla_det)); }
public ActionResult Anular(ct_cbtecble_Plantilla_Info model) { model.IdUsuarioAnulacion = SessionFixed.IdUsuario; if (!bus_CbteCble_Plantilla.AnularBD(model)) { cargar_combos(model.IdEmpresa); return(View(model)); } return(RedirectToAction("Index")); }
public bool AnularBD(ct_cbtecble_Plantilla_Info info) { try { return(odata.AnularBD(info)); } catch (Exception) { throw; } }
private void gridViewCbte_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { InfoCbteCble_Plantilla = (ct_cbtecble_Plantilla_Info)gridViewCbte.GetFocusedRow(); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Boolean GrabarDB(ct_cbtecble_Plantilla_Info info, ref decimal IdPlantilla, ref string msg) { try { ct_cbtecble_Plantilla_Info _Info = new ct_cbtecble_Plantilla_Info(); List <ct_cbtecble_Plantilla_det_Info> Lst_det = new List <ct_cbtecble_Plantilla_det_Info>(); _Info.cb_Estado = "A"; _Info.cb_Fecha = info.cb_Fecha; _Info.cb_Observacion = info.cb_Observacion; _Info.IdEmpresa = info.IdEmpresa; _Info.IdTipoCbte = info.IdTipoCbte; _Info.IdUsuario = info.IdUsuario; _Info.IdUsuarioUltModi = info.IdUsuarioUltModi; _Info.IdUsuarioAnu = info.IdUsuarioAnu; _Info.cb_FechaAnu = info.cb_FechaAnu; _Info.cb_FechaTransac = info.cb_FechaTransac; _Info.cb_FechaUltModi = info.cb_FechaUltModi; _Info.IdPlantilla = info.IdPlantilla; _Info.LstDet = info.LstDet; Boolean estado = false; foreach (var item in _Info.LstDet) { if (item.Debe_Aux > 0) { item.dc_Valor = item.Debe_Aux; } if (item.Haber_Aux > 0) { item.dc_Valor = item.Haber_Aux * -1; } if (item.dc_Observacion == "" || info.cb_Observacion != null) { item.dc_Observacion = info.cb_Observacion; } } estado = data.GrabarDB(_Info, ref IdPlantilla, ref msg); return(estado); } 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("", "GrabarDB", ex.Message), ex) { EntityType = typeof(ct_cbtecble_Plantilla_Bus) }; } }
public Boolean ModificarDB(ct_cbtecble_Plantilla_Info Pla_I) { try { List <ct_cbtecble_Plantilla_det_Info> listadetalle = new List <ct_cbtecble_Plantilla_det_Info>(); listadetalle = Pla_I.LstDet; using (EntitiesDBConta context = new EntitiesDBConta()) { var contact = context.ct_cbtecble_Plantilla.FirstOrDefault(v => v.IdEmpresa == Pla_I.IdEmpresa && v.IdTipoCbte == Pla_I.IdTipoCbte && v.IdPlantilla == Pla_I.IdPlantilla); if (contact != null) { contact.cb_Estado = Pla_I.cb_Estado; contact.IdPlantilla = Pla_I.IdPlantilla; contact.IdUsuarioUltModi = (Pla_I.IdUsuarioUltModi != "") ? Pla_I.IdUsuarioUltModi : Pla_I.IdUsuario; contact.cb_Fecha = Pla_I.cb_Fecha; contact.cb_FechaUltModi = Convert.ToDateTime(DateTime.Now.ToShortDateString()); contact.cb_Observacion = Pla_I.cb_Observacion; context.SaveChanges(); ct_cbtecble_Plantilla_det_Data _Pla_Det_Data = new ct_cbtecble_Plantilla_det_Data(); int count = 0; if (_Pla_Det_Data.EliminarDB(Pla_I.IdEmpresa, Pla_I.IdTipoCbte, Pla_I.IdPlantilla)) { ct_cbtecble_Plantilla_det_Data data = new ct_cbtecble_Plantilla_det_Data(); foreach (var reg in listadetalle) { reg.IdEmpresa = Pla_I.IdEmpresa; reg.IdTipoCbte = Pla_I.IdTipoCbte; reg.IdPlantilla = Pla_I.IdPlantilla; //reg.secuencia = count++; data.GrabarDB(reg); } } } } 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 bool ModificarBD(ct_cbtecble_Plantilla_Info info) { try { using (Entities_contabilidad db = new Entities_contabilidad()) { ct_cbtecble_Plantilla entity = db.ct_cbtecble_Plantilla.Where(q => q.IdPlantilla == info.IdPlantilla && q.IdEmpresa == info.IdEmpresa).FirstOrDefault(); if (entity == null) { return(false); } entity.IdTipoCbte = info.IdTipoCbte; entity.cb_Observacion = info.cb_Observacion; entity.IdUsuarioModificacion = info.IdUsuarioModificacion; entity.FechaModificacion = DateTime.Now; var lst_det = db.ct_cbtecble_Plantilla_det.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdPlantilla == info.IdPlantilla).ToList(); db.ct_cbtecble_Plantilla_det.RemoveRange(lst_det); if (info.lst_cbtecble_plantilla_det != null) { int secuencia = 1; foreach (var item in info.lst_cbtecble_plantilla_det) { db.ct_cbtecble_Plantilla_det.Add(new ct_cbtecble_Plantilla_det { IdEmpresa = info.IdEmpresa, IdPlantilla = info.IdPlantilla, secuencia = secuencia, IdCtaCble = item.IdCtaCble, dc_Valor = item.dc_Valor, dc_Observacion = item.dc_Observacion, IdPunto_cargo_grupo = item.IdPunto_cargo_grupo, IdPunto_cargo = item.IdPunto_cargo, IdCentroCosto = item.IdCentroCosto }); secuencia++; } } db.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean ModificarDB(ct_cbtecble_Plantilla_Info Pla_I) { try { return(data.ModificarDB(Pla_I)); } 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("", "ModificarDB", ex.Message), ex) { EntityType = typeof(ct_cbtecble_Plantilla_Bus) }; } }
public bool GuardarBD(ct_cbtecble_Plantilla_Info info) { try { using (Entities_contabilidad db = new Entities_contabilidad()) { db.ct_cbtecble_Plantilla.Add(new ct_cbtecble_Plantilla { IdEmpresa = info.IdEmpresa, IdPlantilla = info.IdPlantilla = get_id(info.IdEmpresa), IdTipoCbte = info.IdTipoCbte, cb_Observacion = info.cb_Observacion, cb_Estado = info.cb_Estado, IdUsuarioCreacion = info.IdUsuarioCreacion, FechaCreacion = DateTime.Now }); //detalle if (info.lst_cbtecble_plantilla_det != null) { int secuencia = 1; foreach (var item in info.lst_cbtecble_plantilla_det) { db.ct_cbtecble_Plantilla_det.Add(new ct_cbtecble_Plantilla_det { IdEmpresa = info.IdEmpresa, IdPlantilla = info.IdPlantilla, secuencia = secuencia, IdCtaCble = item.IdCtaCble, dc_Valor = item.dc_Valor, dc_Observacion = item.dc_Observacion, IdPunto_cargo_grupo = item.IdPunto_cargo_grupo, IdPunto_cargo = item.IdPunto_cargo, IdCentroCosto = item.IdCentroCosto }); secuencia++; } } db.SaveChanges(); } return(true); } catch (Exception) { throw; } }
private void btn_bucarPLantilla_Click(object sender, EventArgs e) { try { ct_cbtecble_Plantilla_Info InfoPlan = new ct_cbtecble_Plantilla_Info(); if (txt_no_plantillacomprobante.Text == "0" || txt_no_plantillacomprobante.Text == "") { frmCon_cbtecble_Plantilla_Consulta frm = new frmCon_cbtecble_Plantilla_Consulta(); frm.LlamaOtraPantalla = true; frm.ShowDialog(); InfoCbteCble = frm.Get_Info_CbteCble(); } else { ct_cbtecble_Plantilla_Bus Pla_B = new ct_cbtecble_Plantilla_Bus(); InfoCbteCble = Pla_B.Get_Info_Plantilla_CbteCble(param.IdEmpresa, Convert.ToInt32(this.cmb_tipocomprobante.EditValue), Convert.ToDecimal(txt_no_plantillacomprobante.Text)); } if (InfoCbteCble != null) { if (InfoCbteCble.cb_Fecha != new DateTime(1, 1, 1)) { List <ct_Cbtecble_det_Info> lm = new List <ct_Cbtecble_det_Info>(); lm = InfoCbteCble._cbteCble_det_lista_info; this.cmb_tipocomprobante.EditValue = InfoCbteCble.IdTipoCbte; dtFecha.Value = InfoCbteCble.cb_Fecha; txt_concepto.Text = InfoCbteCble.cb_Observacion; UC_Diario.setDetalle(lm); } else { MessageBox.Show("Usted ha seleccionado mas de una plantilla, por favor intente de nuevo.", param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); LImpiarDatos(); } } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ct_cbtecble_Plantilla_Info Get_Info_Plantilla(int IdEmpresa, int IdTipoCbte, decimal IdPlantilla) { try { ct_cbtecble_Plantilla_Info Pla_I = new ct_cbtecble_Plantilla_Info(); EntitiesDBConta OECbtecble_Info = new EntitiesDBConta(); var selectCbtecble = from C in OECbtecble_Info.ct_cbtecble_Plantilla where C.IdEmpresa == IdEmpresa && C.IdTipoCbte == IdTipoCbte && C.IdPlantilla == IdPlantilla select C; foreach (var item in selectCbtecble) { Pla_I.IdEmpresa = item.IdEmpresa; Pla_I.IdTipoCbte = item.IdTipoCbte; Pla_I.IdPlantilla = item.IdPlantilla; Pla_I.cb_Fecha = Convert.ToDateTime(item.cb_Fecha); Pla_I.cb_Observacion = item.cb_Observacion; Pla_I.cb_Estado = item.cb_Estado; Pla_I.IdUsuario = item.IdUsuario; Pla_I.IdUsuarioAnu = item.IdUsuarioAnu; Pla_I.cb_MotivoAnu = item.cb_MotivoAnu; Pla_I.IdUsuarioUltModi = item.IdUsuarioUltModi; Pla_I.cb_FechaAnu = Convert.ToDateTime(item.cb_FechaAnu); Pla_I.cb_FechaTransac = Convert.ToDateTime(item.cb_FechaTransac); Pla_I.cb_FechaUltModi = Convert.ToDateTime(item.cb_FechaUltModi); ct_cbtecble_Plantilla_det_Data data = new ct_cbtecble_Plantilla_det_Data(); Pla_I.LstDet = data.Get_list_Planilla_det(IdEmpresa, IdTipoCbte, IdPlantilla); } return(Pla_I); } 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 ActionResult Modificar(ct_cbtecble_Plantilla_Info model) { model.lst_cbtecble_plantilla_det = CbteCble_PlantillaDet_Lista.get_list(model.IdTransaccionSession); model.IdUsuarioModificacion = SessionFixed.IdUsuario; if (!Validar(model, ref mensaje)) { ViewBag.mensaje = mensaje; cargar_combos(model.IdEmpresa); return(View(model)); } if (!bus_CbteCble_Plantilla.ModificarBD(model)) { cargar_combos(model.IdEmpresa); return(View(model)); } return(RedirectToAction("Consultar", new { IdEmpresa = model.IdEmpresa, IdPlantilla = model.IdPlantilla, Exito = true })); }
public ActionResult Modificar(ct_cbtecble_Plantilla_Info model) { model.lst_cbtecble_plantilla_det = CbteCble_PlantillaDet_Lista.get_list(model.IdTransaccionSession); model.IdUsuarioModificacion = Session["IdUsuario"].ToString(); if (!Validar(model, ref mensaje)) { ViewBag.mensaje = mensaje; cargar_combos(model.IdEmpresa); return(View(model)); } if (!bus_CbteCble_Plantilla.ModificarBD(model)) { cargar_combos(model.IdEmpresa); return(View(model)); } return(RedirectToAction("Index")); }
public ActionResult Consultar(int IdEmpresa = 0, decimal IdPlantilla = 0, bool Exito = false) { #region Validar Session if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession)) { return(RedirectToAction("Login", new { Area = "", Controller = "Account" })); } SessionFixed.IdTransaccionSession = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString(); SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession; #endregion ct_cbtecble_Plantilla_Info model = bus_CbteCble_Plantilla.GetInfo(IdEmpresa, IdPlantilla); if (model == null) { return(RedirectToAction("Index")); } #region Permisos seg_Menu_x_Empresa_x_Usuario_Info info = bus_permisos.get_list_menu_accion(Convert.ToInt32(SessionFixed.IdEmpresa), SessionFixed.IdUsuario, "Contabilidad", "PlantillaComprobanteContable", "Index"); if (model.cb_Estado == "I") { info.Modificar = false; info.Anular = false; } model.Nuevo = (info.Nuevo == true ? 1 : 0); model.Modificar = (info.Modificar == true ? 1 : 0); model.Anular = (info.Anular == true ? 1 : 0); #endregion model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession); model.lst_cbtecble_plantilla_det = bus_CbteCblePlantillaDet.GetList(model.IdEmpresa, model.IdPlantilla); CbteCble_PlantillaDet_Lista.set_list(model.lst_cbtecble_plantilla_det, model.IdTransaccionSession); cargar_combos(model.IdEmpresa); if (Exito) { ViewBag.MensajeSuccess = MensajeSuccess; } return(View(model)); }
private void LlamaFrm(Cl_Enumeradores.eTipo_action Accion, ct_cbtecble_Plantilla_Info Info) { try { frm = new frmCon_cbtecble_Plantilla(); frm._Accion = Accion; frm.MdiParent = this.MdiParent; frm.event_frmCon_cbtecble_Plantilla_FormClosing += new frmCon_cbtecble_Plantilla.delegate_frmCon_cbtecble_Plantilla_FormClosing(frm_event_frmCon_cbtecble_Plantilla); if (!(Accion == Cl_Enumeradores.eTipo_action.grabar)) { frm.Info_Plantilla = Info; } frm.Show(); } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void gridViewCbte_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e) { try { if (LlamaOtraPantalla) { c++; if (c == 2) { InfoCbteCble_Plantilla = BusCbteCble_plantilla.Get_Info_Plantilla(param.IdEmpresa, InfoCbteCble_Plantilla.IdTipoCbte, InfoCbteCble_Plantilla.IdPlantilla); this.Close(); } } } 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; Info_Plantilla = new ct_cbtecble_Plantilla_Info(); ListDetalle = new List <ct_cbtecble_Plantilla_det_Info>(); //gridControlDiario.DataSource = BingListDetalle; cmbTipoCbte.EditValue = null; lbl_no_comprobante.Text = "0"; txt_concepto.Text = ""; dtFecha.Value = DateTime.Now; } catch (Exception ex) { string NameMetodo = System.Reflection.MethodBase.GetCurrentMethod().Name; MessageBox.Show(NameMetodo + " - " + ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); Log_Error_bus.Log_Error(NameMetodo + " - " + ex.ToString()); } }
public Boolean EliminarDB(ct_cbtecble_Plantilla_Info info) { try { using (EntitiesDBConta context = new EntitiesDBConta()) { var contact = context.ct_cbtecble_Plantilla.FirstOrDefault(tb => tb.IdEmpresa == info.IdEmpresa && tb.IdTipoCbte == info.IdTipoCbte && tb.IdPlantilla == info.IdPlantilla); if (contact != null) { contact.cb_Estado = "I"; contact.IdUsuarioAnu = info.IdUsuarioAnu; contact.cb_MotivoAnu = info.cb_MotivoAnu; contact.cb_Observacion = "*** ANULADO *** - " + info.cb_Observacion; contact.cb_FechaAnu = DateTime.Now; context.SaveChanges(); ct_cbtecble_Plantilla_det_Data PLa_Data = new ct_cbtecble_Plantilla_det_Data(); List <ct_cbtecble_Plantilla_det_Info> Lista_detalle = new List <ct_cbtecble_Plantilla_det_Info>(); Lista_detalle = PLa_Data.Get_list_Planilla_det(info.IdEmpresa, info.IdTipoCbte, info.IdPlantilla); foreach (var item in Lista_detalle) { item.dc_Observacion = "***ANULADO*** - " + item.dc_Observacion; PLa_Data.ModificarDB(item); } } } 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.InnerException + " " + ex.Message; throw new Exception(ex.InnerException.ToString()); } }
private void gridViewCbte_DoubleClick(object sender, EventArgs e) { try { if (LlamaOtraPantalla) { InfoCbteCble_Plantilla = BusCbteCble_plantilla.Get_Info_Plantilla(param.IdEmpresa, InfoCbteCble_Plantilla.IdTipoCbte, InfoCbteCble_Plantilla.IdPlantilla); InfoCbte.IdTipoCbte = InfoCbteCble_Plantilla.IdTipoCbte; InfoCbte.cb_Fecha = InfoCbteCble_Plantilla.cb_Fecha; InfoCbte.cb_Observacion = InfoCbteCble_Plantilla.cb_Observacion; InfoCbte._cbteCble_det_lista_info = new List <ct_Cbtecble_det_Info>(); foreach (var item in InfoCbteCble_Plantilla.LstDet) { ct_Cbtecble_det_Info infoDet = new ct_Cbtecble_det_Info(); infoDet.IdTipoCbte = item.IdTipoCbte; infoDet.IdCtaCble = item.IdCtaCble; infoDet.dc_Observacion = item.dc_Observacion; infoDet.IdCentroCosto = item.IdCentroCosto; infoDet.IdPunto_cargo_grupo = item.IdPunto_cargo_grupo; infoDet.IdPunto_cargo = item.IdPunto_cargo; infoDet.dc_Valor = item.dc_Valor; infoDet.dc_Valor_D = (item.dc_Valor > 0) ? item.dc_Valor : 0; infoDet.dc_Valor_H = (item.dc_Valor < 0) ? item.dc_Valor * -1 : 0; InfoCbte._cbteCble_det_lista_info.Add(infoDet); } this.Close(); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public ActionResult Nuevo(int IdEmpresa = 0) { #region Validar Session if (string.IsNullOrEmpty(SessionFixed.IdTransaccionSession)) { return(RedirectToAction("Login", new { Area = "", Controller = "Account" })); } SessionFixed.IdTransaccionSession = (Convert.ToDecimal(SessionFixed.IdTransaccionSession) + 1).ToString(); SessionFixed.IdTransaccionSessionActual = SessionFixed.IdTransaccionSession; #endregion ct_cbtecble_Plantilla_Info model = new ct_cbtecble_Plantilla_Info { IdEmpresa = IdEmpresa, IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession), IdUsuarioCreacion = SessionFixed.IdUsuario }; cargar_combos(model.IdEmpresa); CbteCble_PlantillaDet_Lista.set_list(new List <ct_cbtecble_Plantilla_det_Info>(), model.IdTransaccionSession); return(View(model)); }
public ActionResult Nuevo(ct_cbtecble_Plantilla_Info model) { model.IdUsuarioCreacion = SessionFixed.IdUsuario; model.cb_Estado = "A"; model.lst_cbtecble_plantilla_det = CbteCble_PlantillaDet_Lista.get_list(model.IdTransaccionSession); if (!Validar(model, ref mensaje)) { ViewBag.mensaje = mensaje; SessionFixed.IdTransaccionSessionActual = model.IdTransaccionSession.ToString(); cargar_combos(model.IdEmpresa); return(View(model)); } if (!bus_CbteCble_Plantilla.GuardarBD(model)) { SessionFixed.IdTransaccionSessionActual = model.IdTransaccionSession.ToString(); cargar_combos(model.IdEmpresa); return(View(model)); } return(RedirectToAction("Consultar", new { IdEmpresa = model.IdEmpresa, IdPlantilla = model.IdPlantilla, Exito = true })); }
private bool Validar(ct_cbtecble_Plantilla_Info i_validar, ref string msg) { i_validar.lst_cbtecble_plantilla_det = CbteCble_PlantillaDet_Lista.get_list(i_validar.IdTransaccionSession); if (i_validar.lst_cbtecble_plantilla_det.Count == 0) { mensaje = "Debe ingresar al menos una cuenta contable"; return(false); } if (i_validar.lst_cbtecble_plantilla_det.Where(q => string.IsNullOrEmpty(q.IdCtaCble)).Count() > 0) { mensaje = "Existen detalles sin cuenta contable"; return(false); } if (Math.Round(i_validar.lst_cbtecble_plantilla_det.Sum(q => q.dc_Valor_debe), 2) != Math.Round(i_validar.lst_cbtecble_plantilla_det.Sum(q => q.dc_Valor_haber), 2)) { mensaje = "La suma del detalle del debe y del haber debe coincidir"; return(false); } return(true); }
public ct_cbtecble_Plantilla_Info GetInfo(int IdEmpresa, decimal IdPlantilla) { try { ct_cbtecble_Plantilla_Info info = new ct_cbtecble_Plantilla_Info(); info = odata.get_info(IdEmpresa, IdPlantilla); if (info == null) { info = new ct_cbtecble_Plantilla_Info(); } info.lst_cbtecble_plantilla_det = odata_det.get_list(IdEmpresa, IdPlantilla); if (info.lst_cbtecble_plantilla_det == null) { info.lst_cbtecble_plantilla_det = new List <ct_cbtecble_Plantilla_det_Info>(); } return(info); } catch (Exception) { throw; } }