public ActionResult Anular(int IdEmpresa = 0, int IdOrdenPago = 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 cargar_combos(IdEmpresa); cargar_combos_detalle(); cp_orden_pago_Info model = bus_orden_pago.get_info(IdEmpresa, IdOrdenPago); if (model == null) { return(RedirectToAction("Index")); } SessionFixed.TipoPersona = model.IdTipo_Persona; model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual); Session["lst_detalle"] = model.detalle; comprobante_contable_fp.set_list(model.info_comprobante.lst_ct_cbtecble_det, model.IdTransaccionSession); #region Validacion Periodo ViewBag.MostrarBoton = true; if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.Fecha, cl_enumeradores.eModulo.CXP, model.IdSucursal, ref mensaje)) { ViewBag.mensaje = mensaje; ViewBag.MostrarBoton = false; } #endregion return(View(model)); }
public cp_orden_pago_Info get_info(int IdEmpresa, decimal IdOrdenPago) { try { cp_orden_pago_Info info_ = new cp_orden_pago_Info(); info_ = oData.get_info(IdEmpresa, IdOrdenPago); if (info_ == null) { info_ = new cp_orden_pago_Info(); } info_.detalle = odata_detalle.Get_list_cuotas_x_doc_det(IdEmpresa, IdOrdenPago); if (info_.detalle == null) { info_.detalle = new List <cp_orden_pago_det_Info>(); } else { if (info_.detalle.Count() > 0) { info_.Valor_a_pagar = info_.detalle.FirstOrDefault().Valor_a_pagar; } } info_.info_comprobante = bus_contabilidad.get_info(info_.IdEmpresa, Convert.ToInt32(info_.detalle.FirstOrDefault().IdTipoCbte_cxp), Convert.ToInt32(info_.detalle.FirstOrDefault().IdCbteCble_cxp)); if (info_.info_comprobante == null) { info_.info_comprobante = new ct_cbtecble_Info(); } info_.info_comprobante.lst_ct_cbtecble_det = bus_contabilidad_det.get_list(info_.IdEmpresa, info_.info_comprobante.IdTipoCbte, info_.info_comprobante.IdCbteCble); return(info_); } catch (Exception) { throw; } }
public ActionResult Anular(cp_orden_pago_Info model) { string mensaje = ""; if (bus_cancelacion.si_existe_cancelacion(model.IdEmpresa, model.IdOrdenPago)) { mensaje = "La orden de pago tiene cancelaciones no se puede anular"; cargar_combos(model.IdEmpresa); cargar_combos_detalle(); ViewBag.mensaje = mensaje; return(View(model)); } bus_orden_pago = new cp_orden_pago_Bus(); model.IdUsuarioUltAnu = SessionFixed.IdUsuario.ToString(); if (bus_orden_pago.anularDB(model)) { return(RedirectToAction("Index")); } else { cargar_combos(model.IdEmpresa); cargar_combos_detalle(); return(View(model)); } }
public Boolean modificarDB(cp_orden_pago_Info info) { try { using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_orden_pago Entity = Context.cp_orden_pago.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdOrdenPago == info.IdOrdenPago); if (Entity != null) { Entity.Observacion = info.Observacion; Entity.IdTipo_op = info.IdTipo_op; Entity.IdTipo_Persona = info.IdTipo_Persona; Entity.IdPersona = info.IdPersona; Entity.IdEntidad = info.IdEntidad; Entity.Fecha = info.Fecha.Date; Entity.IdEstadoAprobacion = info.IdEstadoAprobacion; Entity.IdFormaPago = info.IdFormaPago; Entity.Fecha_Pago = info.Fecha_Pago.Date; Entity.IdBanco = info.IdBanco; Entity.IdTipoFlujo = info.IdTipoFlujo; Entity.IdTipoMovi = info.IdTipoMovi; Context.SaveChanges(); } } return(true); } catch (Exception) { throw; } }
public Boolean modificarDB(cp_orden_pago_Info info) { try { using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_orden_pago Entity = Context.cp_orden_pago.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdOrdenPago == info.IdOrdenPago); if (Entity != null) { Entity.Observacion = info.Observacion; Entity.IdTipo_op = info.IdTipo_op; Entity.IdTipo_Persona = info.IdTipo_Persona; Entity.IdPersona = info.IdPersona; Entity.IdEntidad = info.IdEntidad; Entity.Fecha = info.Fecha.Date; Entity.IdEstadoAprobacion = info.IdEstadoAprobacion; Entity.IdFormaPago = info.IdFormaPago; Entity.IdUsuarioUltMod = info.IdUsuario; Entity.IdSucursal = info.IdSucursal; Entity.ReferenciaGen = info.ReferenciaGen; Context.SaveChanges(); } } return(true); } catch (Exception ex) { tb_LogError_Data LogData = new tb_LogError_Data(); LogData.GuardarDB(new tb_LogError_Info { Descripcion = ex.Message, InnerException = ex.InnerException == null ? null : ex.InnerException.Message, Clase = "cp_orden_pago_Data", Metodo = "modificarDB", IdUsuario = info.IdUsuario }); return(false); } }
private void gridViewConsulta_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { try { cp_orden_pago_Info row = (cp_orden_pago_Info)gridViewConsulta.GetRow(e.RowHandle); if (row == null) { return; } if (e.Column == col_tipo_flujo) { if (MessageBox.Show("¿Está seguro que desea modificar el tipo de flujo para la OP# " + row.IdOrdenPago.ToString() + "?", param.Nombre_sistema, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (e.Value == null) { Bus_OrdenPago.Modificar_tipo_flujo(row.IdEmpresa, row.IdOrdenPago, null); } else { Bus_OrdenPago.Modificar_tipo_flujo(row.IdEmpresa, row.IdOrdenPago, Convert.ToDecimal(e.Value)); } } CargarGrid(); } } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public Boolean anularDB(cp_orden_pago_Info info) { try { using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_orden_pago Entity = Context.cp_orden_pago.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdOrdenPago == info.IdOrdenPago); if (Entity != null) { Entity.Estado = "I"; Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu; Entity.Fecha_UltAnu = info.Fecha_UltAnu = DateTime.Now; cp_orden_pago_det Entity_de = Context.cp_orden_pago_det.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdOrdenPago == info.IdOrdenPago); if (Entity != null) { Entity_de.IdEmpresa_cxp = null; Entity_de.IdTipoCbte_cxp = null; Entity_de.IdCbteCble_cxp = null; } } Context.SaveChanges(); } return(true); } 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, "CuentasPorPagar", "OrdenPago", "Index"); if (!info.Nuevo) { return(RedirectToAction("Index")); } #endregion cp_orden_pago_Info model = new cp_orden_pago_Info { IdEmpresa = IdEmpresa, Fecha = DateTime.Now.Date, IdTipo_Persona = "PROVEE", IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession), IdSucursal = Convert.ToInt32(SessionFixed.IdSucursal), IdTipo_op = "OTROS_CONC", IdFormaPago = "CHEQUE" }; SessionFixed.TipoPersona = "PROVEE"; lis_cp_orden_pago_det_Info.set_list(new List <cp_orden_pago_det_Info>(), model.IdTransaccionSession); list_ct_cbtecble_det.set_list(new List <ct_cbtecble_det_Info>(), model.IdTransaccionSession); cargar_combos(IdEmpresa); return(View(model)); }
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 cp_orden_pago_Info model = new cp_orden_pago_Info { IdEmpresa = IdEmpresa, Fecha = DateTime.Now.Date, IdTipo_Persona = "PROVEE", IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSession), IdSucursal = Convert.ToInt32(SessionFixed.IdSucursal), IdTipo_op = "OTROS_CONC", IdFormaPago = "CHEQUE", IdTipoFlujo = 1 }; SessionFixed.TipoPersona = "PROVEE"; lis_cp_orden_pago_det_Info.set_list(new List <cp_orden_pago_det_Info>(), model.IdTransaccionSession); comprobante_contable_fp.set_list(new List <ct_cbtecble_det_Info>(), model.IdTransaccionSession); cargar_combos(IdEmpresa); return(View(model)); }
public ActionResult Modificar(int IdEmpresa = 0, int IdOrdenPago = 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 bus_orden_pago = new cp_orden_pago_Bus(); cargar_combos(IdEmpresa); cargar_combos_detalle(); cp_orden_pago_Info model = bus_orden_pago.get_info(IdEmpresa, IdOrdenPago); if (model == null) { return(RedirectToAction("Index")); } SessionFixed.TipoPersona = model.IdTipo_Persona; model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual); comprobante_contable_fp.set_list(model.info_comprobante.lst_ct_cbtecble_det, model.IdTransaccionSession); lis_cp_orden_pago_det_Info.set_list(model.detalle, model.IdTransaccionSession); return(View(model)); }
public Boolean AnularDB(cp_orden_pago_Info Info) { try { using (EntitiesCuentasxPagar Entity = new EntitiesCuentasxPagar()) { cp_orden_pago cab_Ordpag = Entity.cp_orden_pago.FirstOrDefault(v => v.IdEmpresa == Info.IdEmpresa && v.IdOrdenPago == Info.IdOrdenPago); if (cab_Ordpag != null) { cab_Ordpag.Observacion = Info.Observacion; cab_Ordpag.IdUsuarioUltAnu = Info.IdUsuarioUltAnu; cab_Ordpag.Fecha_UltAnu = Info.Fecha_UltAnu; cab_Ordpag.MotivoAnu = Info.MotiAnula; cab_Ordpag.Estado = "I"; Entity.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; throw new Exception(ex.ToString()); } }
public Boolean ModificarDB(cp_orden_pago_Info Info, ref string mensaje) { try { Boolean Res = false; cp_orden_pago_det_Bus BusOp_det = new cp_orden_pago_det_Bus(); Boolean res = false; if (Validar_y_corregir_objeto(Info, ref mensaje) == true) { Res = oData.ModificarDB(Info, ref mensaje); if (Res) { Res = BusOp_det.ModificarDB_Forma_Pago(Info.Detalle); } } return(Res); } 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(cp_orden_pago_Bus) }; } }
public ActionResult Modificar(cp_orden_pago_Info model) { string mensaje = ""; bus_orden_pago_tipo = new cp_orden_pago_tipo_x_empresa_Bus(); bus_orden_pago = new cp_orden_pago_Bus(); bus_cancelacion = new cp_orden_pago_cancelaciones_Bus(); if (bus_cancelacion.si_existe_cancelacion(IdEmpresa, model.IdOrdenPago)) { mensaje = "La orden de pago tiene cancelaciones no se puede modificar"; cargar_combos(model.IdEmpresa); cargar_combos_detalle(); ViewBag.mensaje = mensaje; return(View(model)); } if (model.IdTipo_op == cl_enumeradores.eTipoOrdenPago.FACT_PROVEE.ToString()) { mensaje = "No se puede modificar una orden de pago de tipo factura por proveedor"; cargar_combos(model.IdEmpresa); cargar_combos_detalle(); ViewBag.mensaje = mensaje; return(View(model)); } if (!validar(model, ref mensaje)) { cargar_combos(model.IdEmpresa); ViewBag.mensaje = mensaje; return(View(model)); } model.detalle = lis_cp_orden_pago_det_Info.get_list(); model.info_comprobante.lst_ct_cbtecble_det = comprobante_contable_fp.get_list(); model.IdEmpresa = Convert.ToInt32(Session["IdEmpresa"]); info_param_op = bus_orden_pago_tipo.get_info(model.IdEmpresa, model.IdTipo_op); model.info_comprobante.IdTipoCbte = (int)info_param_op.IdTipoCbte_OP; model.IdEstadoAprobacion = info_param_op.IdEstadoAprobacion; mensaje = bus_orden_pago.validar(model); if (mensaje != "") { cargar_combos(model.IdEmpresa); ViewBag.mensaje = mensaje; cargar_combos_detalle(); return(View(model)); } else { if (bus_orden_pago.modificarDB(model)) { return(RedirectToAction("Index")); } else { ViewBag.mensaje = mensaje; cargar_combos(model.IdEmpresa); cargar_combos_detalle(); return(View(model)); } } }
public List <cp_orden_pago_Info> Get_List_orden_pago(int IdEmpresa, DateTime FechaIni, DateTime FechaFin, ref string mensaje) { try { FechaIni = Convert.ToDateTime(FechaIni.ToShortDateString()); FechaFin = Convert.ToDateTime(FechaFin.ToShortDateString()); List <cp_orden_pago_Info> lM = new List <cp_orden_pago_Info>(); EntitiesCuentasxPagar ECXP = new EntitiesCuentasxPagar(); var Orden_Pago = from selec in ECXP.vwcp_orden_pago where selec.IdEmpresa == IdEmpresa && selec.Fecha >= FechaIni && selec.Fecha <= FechaFin select selec; foreach (var item in Orden_Pago) { cp_orden_pago_Info info = new cp_orden_pago_Info(); info.IdEmpresa = item.IdEmpresa; info.IdOrdenPago = item.IdOrdenPago; info.Observacion = item.Observacion; info.IdTipo_op = item.IdTipo_op; info.IdEntidad = Convert.ToDecimal(item.IdEntidad); info.Fecha = item.Fecha; info.IdEstadoAprobacion = item.IdEstadoAprobacion; info.IdFormaPago = item.IdFormaPago; info.Fecha_Pago = item.Fecha_Pago; info.IdBanco = Convert.ToInt32(item.IdBanco); info.Estado = item.Estado; info.IdPersona = item.IdPersona; info.IdTipo_Persona = item.IdTipo_Persona; info.pe_nombreCompleto = item.pe_nombreCompleto; info.Total_OP = Convert.ToDecimal(item.Total_OP); info.Total_cancelado = Convert.ToDecimal(item.Total_cancelado); info.Saldo = Convert.ToDecimal(item.Saldo); info.IdTipoFlujo = item.IdTipoFlujo; info.IdSucursal = item.IdSucursal; info.EstadoCancelacion = item.EstadoCancelacion; info.Descripcion = item.Descripcion; lM.Add(info); } 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() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public ActionResult Consultar(int IdEmpresa = 0, int IdOrdenPago = 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 bus_orden_pago = new cp_orden_pago_Bus(); cargar_combos(IdEmpresa); cp_orden_pago_Info model = bus_orden_pago.get_info(IdEmpresa, IdOrdenPago); 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, "CuentasPorPagar", "OrdenPago", "Index"); if (model.Estado == "I" || model.EstadoCancelacion == "CANCELADA") { 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 SessionFixed.TipoPersona = model.IdTipo_Persona; model.IdTransaccionSession = Convert.ToDecimal(SessionFixed.IdTransaccionSessionActual); list_ct_cbtecble_det.set_list(model.info_comprobante.lst_ct_cbtecble_det, model.IdTransaccionSession); lis_cp_orden_pago_det_Info.set_list(model.detalle, model.IdTransaccionSession); if (Exito) { ViewBag.MensajeSuccess = MensajeSuccess; } #region Validacion Periodo ViewBag.MostrarBoton = true; if (!bus_periodo.ValidarFechaTransaccion(IdEmpresa, model.Fecha, cl_enumeradores.eModulo.CXP, model.IdSucursal, ref mensaje)) { ViewBag.mensaje = mensaje; ViewBag.MostrarBoton = false; } #endregion return(View(model)); }
private bool validar(cp_orden_pago_Info i_validar, ref string msg) { if (!bus_periodo.ValidarFechaTransaccion(i_validar.IdEmpresa, i_validar.Fecha, cl_enumeradores.eModulo.CXP, ref msg)) { return(false); } if (!bus_periodo.ValidarFechaTransaccion(i_validar.IdEmpresa, i_validar.Fecha, cl_enumeradores.eModulo.CONTA, ref msg)) { return(false); } return(true); }
public Boolean guardar_op_x_fpDB(cp_orden_pago_Info info) { try { oData.guardarDB(info); return(true); } catch (Exception) { throw; } }
public void Get_OrdenPago() { try { Detalle_op = new List <cp_orden_pago_det_Info>(); Info_Orden_Pago = new Info.CuentasxPagar.cp_orden_pago_Info(); Info_Beneficiario = ucGe_Beneficiario.Get_Persona_beneficiario_Info(); Info_Orden_Pago.IdEmpresa = param.IdEmpresa; Info_Orden_Pago.IdOrdenPago = 0; if (Info_General.Observacion == null) { Info_Orden_Pago.Observacion = "Liquidacion de vacaciones de:" + dtpanio_desde.Value.ToString().Substring(0, 10) + " al " + dtpFechaHasta.Value.ToString().Substring(0, 10); } else { Info_Orden_Pago.Observacion = Info_General.Observacion; } Info_Orden_Pago.IdTipo_op = info_parametro.IdTipoOP_LiquidacionVacaciones; Info_Orden_Pago.IdTipo_Persona = Info_Beneficiario.IdTipo_Persona; Info_Orden_Pago.IdPersona = Info_Beneficiario.IdPersona; Info_Orden_Pago.IdEntidad = Info_Beneficiario.IdEntidad; Info_Orden_Pago.Fecha = dtpFechaPago.Value; Info_Orden_Pago.IdEstadoAprobacion = "PENDI"; Info_Orden_Pago.IdFormaPago = info_parametro.IdFormaOP_LiquidacionVacaciones; Info_Orden_Pago.IdBanco = info_parametro.IdBancoOP_LiquidacionVacaciones; Info_Orden_Pago.Fecha_Pago = dtpFechaPago.Value; Info_Orden_Pago.Estado = "A"; Info_Orden_Pago.Fecha = dtpFechaHasta.Value; Info_Orden_Pago.IdUsuario = param.IdUsuario; Info_Orden_Pago.IdTipoFlujo = info_parametro.IdTipoFlujoOP_LiquidacionVacaciones; // detalle cp_orden_pago_det_Info info_detalle = new Info.CuentasxPagar.cp_orden_pago_det_Info(); info_detalle.IdEmpresa = param.IdEmpresa; info_detalle.IdOrdenPago = 0; info_detalle.Secuencia = 1; info_detalle.Valor_a_pagar = Convert.ToDouble(txttotal_cancelar.EditValue); info_detalle.Referencia = "Cancelacion Vacaciones"; info_detalle.IdFormaPago = info_parametro.IdFormaOP_LiquidacionVacaciones; info_detalle.Fecha_Pago = dtpFechaPago.Value; info_detalle.IdEstadoAprobacion = "PENDI"; info_detalle.Idbanco = info_parametro.IdBancoOP_LiquidacionVacaciones; Detalle_op.Add(info_detalle); Info_Orden_Pago.Detalle = Detalle_op; } catch (Exception ex) { MessageBox.Show(ex.Message); Log_Error_bus.Log_Error(ex.ToString()); } }
public ActionResult Modificar(cp_orden_pago_Info model) { string mensaje = ""; bus_orden_pago_tipo = new cp_orden_pago_tipo_x_empresa_Bus(); bus_orden_pago = new cp_orden_pago_Bus(); bus_cancelacion = new cp_orden_pago_cancelaciones_Bus(); model.IdUsuario = SessionFixed.IdUsuario; if (bus_cancelacion.si_existe_cancelacion(model.IdEmpresa, model.IdOrdenPago)) { mensaje = "La orden de pago tiene cancelaciones no se puede modificar"; SessionFixed.IdTransaccionSessionActual = model.IdTransaccionSession.ToString(); cargar_combos(model.IdEmpresa); ViewBag.mensaje = mensaje; return(View(model)); } if (!validar(model, ref mensaje)) { cargar_combos(model.IdEmpresa); ViewBag.mensaje = mensaje; return(View(model)); } model.detalle = lis_cp_orden_pago_det_Info.get_list(model.IdTransaccionSession); model.info_comprobante.lst_ct_cbtecble_det = list_ct_cbtecble_det.get_list(model.IdTransaccionSession); info_param_op = bus_orden_pago_tipo.get_info(model.IdEmpresa, model.IdTipo_op); model.info_comprobante.IdTipoCbte = (int)info_param_op.IdTipoCbte_OP; model.IdEstadoAprobacion = info_param_op.IdEstadoAprobacion; mensaje = bus_orden_pago.validar(model); if (mensaje != "") { cargar_combos(model.IdEmpresa); ViewBag.mensaje = mensaje; return(View(model)); } else { if (bus_orden_pago.modificarDB(model)) { //return RedirectToAction("Index"); return(RedirectToAction("Modificar", new { IdEmpresa = model.IdEmpresa, IdOrdenPago = model.IdOrdenPago, Exito = true })); } else { ViewBag.mensaje = mensaje; cargar_combos(model.IdEmpresa); return(View(model)); } } }
public Boolean GuardaDB(cp_orden_pago_Info Item, ref decimal Id, ref string mensaje) { try { using (EntitiesCuentasxPagar Context = new EntitiesCuentasxPagar()) { cp_orden_pago Cabe = new cp_orden_pago(); Cabe.IdEmpresa = Item.IdEmpresa; Cabe.IdOrdenPago = Id = GetIdOrdenPago(Item.IdEmpresa); Item.IdOrdenPago = Id; Cabe.Observacion = Item.Observacion; Cabe.IdTipo_op = Item.IdTipo_op; Cabe.Fecha = Convert.ToDateTime(Item.Fecha.ToShortDateString()); Cabe.IdFormaPago = Item.IdFormaPago; Cabe.Fecha_Pago = Convert.ToDateTime(Item.Fecha_Pago.ToShortDateString()); Cabe.IdBanco = Item.IdBanco == 0 ? null : Item.IdBanco; Cabe.IdEstadoAprobacion = Item.IdEstadoAprobacion; Cabe.Estado = "A"; Cabe.IdPersona = Item.IdPersona; Cabe.IdTipo_Persona = Convert.ToString(Item.IdTipo_Persona); Cabe.IdEntidad = Item.IdEntidad; Cabe.IdUsuario = Item.IdUsuario == null ? "" : Item.IdUsuario; Cabe.nom_pc = Item.nom_pc; Cabe.ip = Item.ip; Cabe.IdTipoFlujo = Item.IdTipoFlujo; Cabe.IdSucursal = Item.IdSucursal; Cabe.Fecha_Transac = DateTime.Now; Context.cp_orden_pago.Add(Cabe); Context.SaveChanges(); if (Item.Detalle != null) { decimal detalle = Id; string msg = ""; odataDet.GuardarDB(Item.Detalle, ref detalle, ref msg); } } 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; throw new Exception(ex.ToString()); } }
private void gridViewConsulta_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { try { Info = new cp_orden_pago_Info(); Info = this.gridViewConsulta.GetRow(e.FocusedRowHandle) as cp_orden_pago_Info; } catch (Exception ex) { Log_Error_bus.Log_Error(ex.ToString()); MessageBox.Show(ex.ToString(), param.Nombre_sistema, MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public string validar(cp_orden_pago_Info info) { try { string mensaje = ""; if (info.detalle == null) { mensaje = "No existe detalle de pago"; } if (info.detalle.Count() == 0) { mensaje = "No existe detalle de pago"; } if (info.info_comprobante.lst_ct_cbtecble_det == null) { mensaje = "No existe diario contable"; } if (info.info_comprobante.lst_ct_cbtecble_det.Count() == 0) { mensaje = "No existe diario contable"; } if (Math.Round(info.info_comprobante.lst_ct_cbtecble_det.Sum(v => v.dc_Valor), 2) != 0) { mensaje = "El diario contable esta descudrado"; } if (info.IdEstadoAprobacion == null) { mensaje = "Falta esta aprovación en tipo OP"; } if (info.detalle == null) { mensaje = "Falta tipo comprobante contable en tipo OP"; } foreach (var item in info.info_comprobante.lst_ct_cbtecble_det) { if (item.IdCtaCble == null | item.IdCtaCble == "") { mensaje = "Falta cuenta contable"; } } return(mensaje); } catch (Exception) { throw; } }
public Boolean AnularDB(cp_orden_pago_Info Info) { try { return oData.AnularDB(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("", "AnularDB", ex.Message), ex) { EntityType = typeof(cp_orden_pago_Bus) }; } }
public ActionResult Anular(int IdEmpresa = 0, int IdOrdenPago = 0) { cargar_combos(IdEmpresa); cargar_combos_detalle(); IdEmpresa = Convert.ToInt32(SessionFixed.IdEmpresa); cp_orden_pago_Info model = new cp_orden_pago_Info(); model = bus_orden_pago.get_info(IdEmpresa, IdOrdenPago); SessionFixed.TipoPersona = model.IdTipo_Persona; Session["ct_cbtecble_Info"] = model.info_comprobante; Session["lst_detalle"] = model.detalle; comprobante_contable_fp.set_list(model.info_comprobante.lst_ct_cbtecble_det); return(View(model)); }
public Boolean modificarDB(cp_orden_pago_Info info) { try { using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_orden_pago Entity = Context.cp_orden_pago.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdOrdenPago == info.IdOrdenPago); if (Entity != null) { Entity.Observacion = info.Observacion; Entity.IdTipo_op = info.IdTipo_op; Entity.IdTipo_Persona = info.IdTipo_Persona; Entity.IdPersona = info.IdPersona; Entity.IdEntidad = info.IdEntidad; Entity.Fecha = info.Fecha.Date; Entity.IdEstadoAprobacion = info.IdEstadoAprobacion; Entity.IdFormaPago = info.IdFormaPago; Entity.IdTipoFlujo = info.IdTipoFlujo; Entity.IdUsuarioUltMod = info.IdUsuario; Entity.IdSucursal = info.IdSucursal; if (info.IdSolicitudPago != null) { decimal IdSolicitudPago = Convert.ToDecimal(info.IdSolicitudPago); var sol = Context.cp_SolicitudPago.Where(q => q.IdEmpresa == info.IdEmpresa && q.IdSolicitud == IdSolicitudPago).FirstOrDefault(); if (sol != null) { Entity.IdSolicitudPago = sol.IdSolicitud; } else { Entity.IdSolicitudPago = null; } } else { Entity.IdSolicitudPago = null; } Context.SaveChanges(); } } return(true); } catch (Exception) { throw; } }
public Boolean ModificarDB_proceso_cerrado(cp_orden_pago_Info Info, ref string mensaje) { try { return(oData.ModificarDB_proceso_cerrado(Info, ref mensaje)); } 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(cp_orden_pago_Bus) }; } }
public cp_orden_pago_Info Get_Info_orden_pago(int IdEmpresa, decimal IdOrdenPago, ref string mensaje) { try { cp_orden_pago_Info info = new cp_orden_pago_Info(); EntitiesCuentasxPagar ECXP = new EntitiesCuentasxPagar(); var Orden_Pago = from selec in ECXP.cp_orden_pago where selec.IdEmpresa == IdEmpresa && selec.IdOrdenPago == IdOrdenPago select selec; foreach (var item in Orden_Pago) { info.IdEmpresa = item.IdEmpresa; info.IdOrdenPago = item.IdOrdenPago; info.Observacion = item.Observacion; info.IdTipo_op = item.IdTipo_op; info.Fecha = item.Fecha; info.IdFormaPago = item.IdFormaPago; info.Fecha_Pago = item.Fecha_Pago; info.IdBanco = item.IdBanco; info.IdEstadoAprobacion = item.IdEstadoAprobacion; info.Estado = item.Estado; info.IdPersona = item.IdPersona; info.IdTipo_Persona = item.IdTipo_Persona; info.IdEntidad = Convert.ToDecimal(item.IdEntidad); info.IdUsuario = item.IdUsuario; info.nom_pc = item.nom_pc; info.ip = item.ip; info.IdSucursal = item.IdSucursal; info.IdTipoFlujo = item.IdTipoFlujo; } 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() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public Boolean anularDB(cp_orden_pago_Info info) { try { oData = new cp_orden_pago_Data(); if (oData.anularDB(info)) { bus_contabilidad.anularDB(info.info_comprobante); } return(true); } catch (Exception) { throw; } }
private cp_orden_pago_Info GetOrdenPao(ro_Remplazo_x_emplado_Info info) { try { info_parametros = bus_parametros.Get_Parametros(info.IdEmpresa); infoOptipo = bus_ordenpagoTipo.Get_Info_orden_pago_tipo_x_empresa(info.IdEmpresa, info_parametros.IdTipoOP_PagoTerceros); CabOP = new cp_orden_pago_Info(); CabOP.IdTipoFlujo = info_parametros.IdTipoFlujoOP_PagoTerceros; CabOP.IdEmpresa = info.IdEmpresa; CabOP.IdOrdenPago = 0; CabOP.IdTipo_op = info_parametros.IdTipoOP_PagoTerceros; CabOP.IdProveedor = info.IdEmpleado; CabOP.Observacion = info.Observacion; CabOP.Fecha = info.Fecha; CabOP.IdFormaPago = info_parametros.IdFormaOP_PagoTerceros; CabOP.Fecha_Pago = info.Fecha; CabOP.IdBanco = info_parametros.IdBancoOP_PagoTerceros; CabOP.IdEstadoAprobacion = "PENDI"; CabOP.IdPersona = info.IdPersona; CabOP.IdTipo_Persona = "EMPLEA"; CabOP.IdEntidad = info.IdEmpleado_Remplazo; CabOP.IdUsuario = info.IdUsuario; cp_orden_pago_det_Info detalleop = new cp_orden_pago_det_Info(); detalleop.IdEmpresa = info.IdEmpresa; detalleop.Secuencia = 1; detalleop.IdEmpresa_cxp = info.IdEmpresa; detalleop.Valor_a_pagar = Convert.ToDouble(info.Total_pagar_remplazo); detalleop.Referencia = "Pago de eventuale"; detalleop.IdFormaPago = info_parametros.IdFormaOP_PagoTerceros; detalleop.Fecha_Pago = Convert.ToDateTime(info.Fecha); detalleop.Idbanco = info_parametros.IdBancoOP_PagoTerceros; detalleop.IdEstadoAprobacion = "PENDI"; CabOP.Detalle.Add(detalleop); return(CabOP); } catch (Exception ex) { mensaje = ex.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(), "", mensaje, "", "", "", "", "", DateTime.Now); oDataLog.Guardar_Log_Error(Log_Error_sis, ref mensaje); throw new Exception(mensaje); } }
public bool Generar_OP_x_orden_giro(cp_orden_giro_Info info) { try { info_parametro = bus_parametro.get_info(info.IdEmpresa); bus_proveedor = new cp_proveedor_Bus(); decimal IdPersona = bus_proveedor.get_info(info.IdEmpresa, info.IdProveedor).IdPersona; cp_orden_pago_tipo_x_empresa_Info info_tipo_op = new cp_orden_pago_tipo_x_empresa_Info(); cp_orden_pago_tipo_x_empresa_Data op_tipo_data = new cp_orden_pago_tipo_x_empresa_Data(); info_tipo_op = op_tipo_data.get_info(info.IdEmpresa, "FACT_PROVEE"); cp_orden_pago_Info info_op = new cp_orden_pago_Info(); bus_op = new cp_orden_pago_Bus(); info_op.IdEmpresa = info.IdEmpresa; info_op.IdTipo_op = info_tipo_op.IdTipo_op; info_op.Observacion = info.co_observacion; info_op.IdTipo_Persona = "PROVEE"; info_op.IdPersona = IdPersona; info_op.IdEntidad = info.IdProveedor; info_op.IdEstadoAprobacion = info_tipo_op.IdEstadoAprobacion; info_op.IdFormaPago = "CHEQUE"; info_op.Estado = "A"; info_op.IdSucursal = info.IdSucursal; info_op.Fecha = DateTime.Now.Date; info_op.IdUsuario = info.IdUsuario; // crear detalle de op cp_orden_pago_det_Info info_op_det = new cp_orden_pago_det_Info(); info_op_det.IdEmpresa = info.IdEmpresa; info_op_det.IdEmpresa_cxp = info.IdEmpresa; info_op_det.Secuencia = 1; info_op_det.IdCbteCble_cxp = info.IdCbteCble_Ogiro; info_op_det.IdTipoCbte_cxp = info.IdTipoCbte_Ogiro; info_op_det.Valor_a_pagar = info.co_valorpagar; info_op_det.Referencia = info.co_observacion; info_op_det.IdFormaPago = "CHEQUE"; info_op_det.Fecha_Pago = DateTime.Now.Date; info_op_det.IdEstadoAprobacion = info_tipo_op.IdEstadoAprobacion; info_op.detalle.Add(info_op_det); bus_op.guardar_op_x_fpDB(info_op); return(true); } catch (Exception) { throw; } }