public bool Modificar_tipo_flujo(cp_nota_DebCre_Info info_nota) { try { using (EntitiesCuentasxPagar Context = new EntitiesCuentasxPagar()) { cp_nota_DebCre Entity = Context.cp_nota_DebCre.FirstOrDefault(q => q.IdEmpresa == info_nota.IdEmpresa && q.IdTipoCbte_Nota == info_nota.IdTipoCbte_Nota && q.IdCbteCble_Nota == info_nota.IdCbteCble_Nota); if (Entity != null) { Entity.IdTipoFlujo = info_nota.IdTipoFlujo; 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() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public bool anularDB(cp_nota_DebCre_Info info) { try { using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_nota_DebCre Entity = Context.cp_nota_DebCre.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTipoCbte_Nota == info.IdTipoCbte_Nota && q.IdCbteCble_Nota == info.IdCbteCble_Nota); if (Entity == null) { return(false); } { Entity.IdTipoCbte_Anulacion = info.IdTipoCbte_Anulacion; Entity.IdCbteCble_Anulacion = info.IdCbteCble_Anulacion; Entity.IdUsuarioUltAnu = info.IdUsuarioUltAnu; Entity.Fecha_UltAnu = info.Fecha_UltAnu; Entity.Estado = "I"; }; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public bool guardarDB(cp_nota_DebCre_Info info) { try { using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_nota_DebCre Entity = new cp_nota_DebCre { IdEmpresa = info.IdEmpresa, IdCbteCble_Nota = info.IdCbteCble_Nota, IdTipoCbte_Nota = info.IdTipoCbte_Nota, DebCre = info.DebCre, IdProveedor = info.IdProveedor, IdTipoNota = info.IdTipoNota, IdSucursal = info.IdSucursal, cn_fecha = info.cn_fecha, Fecha_contable = info.Fecha_contable, cn_Fecha_vcto = info.cn_Fecha_vcto.Date, cn_serie1 = info.cn_serie1, cn_serie2 = info.cn_serie2, cn_Nota = info.cn_Nota, cn_observacion = info.cn_observacion, cn_subtotal_iva = info.cn_subtotal_iva, cn_subtotal_siniva = info.cn_subtotal_siniva, cn_baseImponible = info.cn_baseImponible, cn_Por_iva = info.cn_Por_iva, cn_Ice_base = info.cn_Ice_base, cn_Ice_por = info.cn_Ice_por, cn_Ice_valor = info.cn_Ice_valor, cn_Serv_por = info.cn_Serv_por, cn_Serv_valor = info.cn_Serv_valor, cn_BaseSeguro = info.cn_BaseSeguro, cn_total = info.cn_total, cn_vaCoa = info.cn_vaCoa, cn_Autorizacion = info.cn_Autorizacion, cn_Autorizacion_Imprenta = info.cn_Autorizacion_Imprenta, cn_num_doc_modificado = info.cn_num_doc_modificado, IdIden_credito = info.IdIden_credito, IdCtaCble_Acre = info.IdCtaCble_Acre, IdTipoFlujo = info.IdTipoFlujo, IdTipoServicio = info.IdTipoServicio, IdCtaCble_IVA = info.IdCtaCble_IVA, IdUsuario = info.IdUsuario, Fecha_Transac = info.Fecha_Transac = DateTime.Now, Estado = info.Estado, ip = info.ip, nom_pc = info.nom_pc, ConvenioTributacion = info.ConvenioTributacion_bool == true ? "SI" : "NO", PagoSujetoRetencion = info.PagoSujetoRetencion_bool == true ? "SI" : "NO", }; Context.cp_nota_DebCre.Add(Entity); Context.SaveChanges(); } return(true); } catch (Exception e) { throw; } }
public cp_nota_DebCre_Info get_info(int IdEmpresa, int IdTipoCbte_Nota, decimal IdCbteCble_Nota) { try { cp_nota_DebCre_Info info = new cp_nota_DebCre_Info(); using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_nota_DebCre Entity = Context.cp_nota_DebCre.Where(q => q.IdEmpresa == IdEmpresa && q.IdTipoCbte_Nota == IdTipoCbte_Nota && q.IdCbteCble_Nota == IdCbteCble_Nota).FirstOrDefault(); if (Entity == null) { return(null); } info = new cp_nota_DebCre_Info { IdEmpresa = Entity.IdEmpresa, IdCbteCble_Nota = Entity.IdCbteCble_Nota, IdTipoCbte_Nota = Entity.IdTipoCbte_Nota, DebCre = Entity.DebCre, IdProveedor = Entity.IdProveedor, IdTipoNota = Entity.IdTipoNota, IdSucursal = Entity.IdSucursal, cn_fecha = Entity.cn_fecha, Fecha_contable = Entity.Fecha_contable, cn_Fecha_vcto = Entity.cn_Fecha_vcto, cn_serie1 = Entity.cn_serie1, cn_serie2 = Entity.cn_serie2, cn_Nota = Entity.cn_Nota, cn_observacion = Entity.cn_observacion, cn_subtotal_iva = Entity.cn_subtotal_iva, cn_subtotal_siniva = Entity.cn_subtotal_siniva, cn_baseImponible = Entity.cn_baseImponible, cn_Por_iva = Entity.cn_Por_iva, cn_Ice_base = Entity.cn_Ice_base, cn_Ice_por = Entity.cn_Ice_por, cn_Ice_valor = Entity.cn_Ice_valor, cn_Serv_por = Entity.cn_Serv_por, cn_Serv_valor = Entity.cn_Serv_valor, cn_BaseSeguro = Entity.cn_BaseSeguro, cn_total = Entity.cn_total, cn_vaCoa = Entity.cn_vaCoa, cn_Autorizacion = Entity.cn_Autorizacion, cn_num_doc_modificado = Entity.cn_num_doc_modificado, IdCod_ICE = Entity.IdCod_ICE, IdIden_credito = Entity.IdIden_credito, IdTipoServicio = Entity.IdTipoServicio, ConvenioTributacion_bool = Entity.ConvenioTributacion == "SI" ? true : false, PagoSujetoRetencion_bool = Entity.PagoSujetoRetencion == "SI" ? true : false }; } return(info); } catch (Exception) { throw; } }
public bool modificarDB(cp_nota_DebCre_Info info) { try { using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_nota_DebCre Entity = Context.cp_nota_DebCre.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTipoCbte_Nota == info.IdTipoCbte_Nota && q.IdCbteCble_Nota == info.IdCbteCble_Nota); if (Entity == null) { return(false); } { Entity.IdEmpresa = info.IdEmpresa; Entity.IdProveedor = info.IdProveedor; Entity.IdTipoNota = info.IdTipoNota; Entity.IdSucursal = info.IdSucursal; Entity.cn_fecha = info.cn_fecha; Entity.cod_nota = info.cod_nota; Entity.Fecha_contable = info.Fecha_contable; Entity.cn_Fecha_vcto = info.cn_Fecha_vcto.Date; Entity.cn_Nota = info.cn_Nota; Entity.cn_observacion = info.cn_observacion; Entity.cn_subtotal_iva = info.cn_subtotal_iva; Entity.cn_subtotal_siniva = info.cn_subtotal_siniva; Entity.cn_baseImponible = info.cn_baseImponible; Entity.cn_Por_iva = info.cn_Por_iva; Entity.cn_Ice_base = info.cn_Ice_base; Entity.cn_Ice_por = info.cn_Ice_por; Entity.cn_Ice_valor = info.cn_Ice_valor; Entity.cn_Serv_por = info.cn_Serv_por; Entity.cn_Serv_valor = info.cn_Serv_valor; Entity.cn_BaseSeguro = info.cn_BaseSeguro; Entity.cn_total = info.cn_total; Entity.cn_Autorizacion = info.cn_Autorizacion; Entity.cn_num_doc_modificado = info.cn_num_doc_modificado; Entity.IdCod_ICE = info.IdCod_ICE; Entity.IdIden_credito = info.IdIden_credito; Entity.IdTipoServicio = info.IdTipoServicio; Entity.ConvenioTributacion = info.ConvenioTributacion_bool == true ? "SI" : "NO"; Entity.PagoSujetoRetencion = info.PagoSujetoRetencion_bool == true ? "SI" : "NO"; Entity.IdUsuarioUltMod = info.IdUsuarioUltMod; Entity.Fecha_UltMod = DateTime.Now; }; 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_nota_DebCre_Data", Metodo = "modificarDB", IdUsuario = info.IdUsuario }); return(false); } }
public bool modificarDB(cp_nota_DebCre_Info info) { try { using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_nota_DebCre Entity = Context.cp_nota_DebCre.FirstOrDefault(q => q.IdEmpresa == info.IdEmpresa && q.IdTipoCbte_Nota == info.IdTipoCbte_Nota && q.IdCbteCble_Nota == info.IdCbteCble_Nota); if (Entity == null) { return(false); } { Entity.IdEmpresa = info.IdEmpresa; Entity.IdProveedor = info.IdProveedor; Entity.IdTipoNota = info.IdTipoNota; Entity.IdSucursal = info.IdSucursal; Entity.cn_fecha = info.cn_fecha; Entity.cod_nota = info.cod_nota; Entity.Fecha_contable = info.Fecha_contable; Entity.cn_Fecha_vcto = info.cn_Fecha_vcto.Date; Entity.cn_Nota = info.cn_Nota; Entity.cn_observacion = info.cn_observacion; Entity.cn_subtotal_iva = info.cn_subtotal_iva; Entity.cn_subtotal_siniva = info.cn_subtotal_siniva; Entity.cn_baseImponible = info.cn_baseImponible; Entity.cn_Por_iva = info.cn_Por_iva; Entity.cn_Ice_base = info.cn_Ice_base; Entity.cn_Ice_por = info.cn_Ice_por; Entity.cn_Ice_valor = info.cn_Ice_valor; Entity.cn_Serv_por = info.cn_Serv_por; Entity.cn_Serv_valor = info.cn_Serv_valor; Entity.cn_BaseSeguro = info.cn_BaseSeguro; Entity.cn_total = info.cn_total; Entity.cn_Autorizacion = info.cn_Autorizacion; Entity.cn_Autorizacion_Imprenta = info.cn_Autorizacion_Imprenta; Entity.cn_num_doc_modificado = info.cn_num_doc_modificado; Entity.IdCod_ICE = info.IdCod_ICE; Entity.IdIden_credito = info.IdIden_credito; Entity.IdCtaCble_Acre = info.IdCtaCble_Acre; Entity.IdTipoFlujo = info.IdTipoFlujo; Entity.IdTipoServicio = info.IdTipoServicio; Entity.IdCtaCble_IVA = info.IdCtaCble_IVA; Entity.ConvenioTributacion = info.ConvenioTributacion_bool == true ? "SI" : "NO"; Entity.PagoSujetoRetencion = info.PagoSujetoRetencion_bool == true ? "SI" : "NO"; }; Context.SaveChanges(); } return(true); } catch (Exception) { throw; } }
public Boolean GrabarDB(cp_nota_DebCre_Info info, ref string mensaje) { try { try { using (EntitiesCuentasxPagar context = new EntitiesCuentasxPagar()) { EntitiesCuentasxPagar EDB = new EntitiesCuentasxPagar(); var Q = from per in EDB.cp_nota_DebCre where per.IdEmpresa == info.IdEmpresa && per.IdCbteCble_Nota == info.IdCbteCble_Nota && per.IdTipoCbte_Nota == info.IdTipoCbte_Nota select per; if (Q.ToList().Count == 0) { cp_nota_DebCre address = new cp_nota_DebCre(); address.IdEmpresa = info.IdEmpresa; address.IdCbteCble_Nota = info.IdCbteCble_Nota; address.IdTipoCbte_Nota = info.IdTipoCbte_Nota; address.IdProveedor = info.IdProveedor; address.cn_fecha = Convert.ToDateTime(info.cn_fecha.ToShortDateString()); address.cn_serie1 = info.cn_serie1; address.cn_serie2 = info.cn_serie2; address.cn_Nota = info.cn_Nota; address.cn_observacion = info.cn_observacion; address.cn_subtotal_iva = info.cn_subtotal_iva; address.cn_subtotal_siniva = info.cn_subtotal_siniva; address.cn_baseImponible = info.cn_baseImponible; address.cn_Por_iva = info.cn_Por_iva; address.cn_valoriva = info.cn_valoriva; address.IdCod_ICE = (info.IdCod_ICE == 0) ? null : info.IdCod_ICE; address.cn_Ice_base = info.cn_Ice_base; address.cn_Ice_por = info.cn_Ice_por; address.cn_Ice_valor = info.cn_Ice_valor; address.cn_Serv_por = info.cn_Serv_por; address.cn_Serv_valor = info.cn_Serv_valor; address.cn_BaseSeguro = info.cn_BaseSeguro; address.cn_total = info.cn_total; address.cn_vaCoa = (info.cn_vaCoa == null) ? "N" : info.cn_vaCoa; address.cn_Autorizacion = info.cn_Autorizacion; address.IdTipoServicio = (info.IdTipoServicio == "") ? null : info.IdTipoServicio; address.IdCtaCble_Acre = info.IdCtaCble_Acre; address.IdCtaCble_IVA = info.IdCtaCble_IVA; address.IdUsuario = (info.IdUsuario == null) ? "" : info.IdUsuario; address.Fecha_Transac = DateTime.Now; address.Estado = info.Estado; address.IdUsuarioUltMod = (info.IdUsuario == null) ? "" : info.IdUsuarioUltMod; address.Fecha_UltMod = info.Fecha_UltMod; address.IdUsuarioUltAnu = info.IdUsuarioUltAnu; address.MotivoAnu = info.MotivoAnu; address.nom_pc = (info.nom_pc == null) ? "" : info.nom_pc; address.ip = (info.ip == null) ? "" : info.ip; address.Fecha_UltAnu = info.Fecha_UltAnu; address.IdCbteCble_Anulacion = info.IdCbteCble_Anulacion; address.IdTipoCbte_Anulacion = info.IdTipoCbte_Anulacion; address.cn_tipoLocacion = info.cn_tipoLocacion; address.IdIden_credito = info.IdIden_credito; address.IdCentroCosto = info.IdCentroCosto; address.IdSucursal = Convert.ToInt32(info.IdSucursal); address.IdTipoFlujo = info.IdTipoFlujo; address.DebCre = info.DebCre; address.cn_Fecha_vcto = Convert.ToDateTime(info.cn_Fecha_vcto.Value.ToShortDateString()); address.Fecha_contable = Convert.ToDateTime(info.Fecha_contable.Value.ToShortDateString()); address.PagoLocExt = info.PagoLocExt; address.PaisPago = info.PaisPago; address.ConvenioTributacion = info.ConvenioTributacion; address.PagoSujetoRetencion = info.PagoSujetoRetencion; address.IdTipoNota = info.IdTipoNota; address.cn_Autorizacion_Imprenta = info.cn_Autorizacion_Imprenta; address.cn_num_doc_modificado = info.cn_num_doc_modificado; address.cod_nota = info.cod_nota == null || info.cod_nota == "" ? info.IdCbteCble_Nota.ToString() : info.cod_nota; address.fecha_autorizacion = info.fecha_autorizacion; context.cp_nota_DebCre.Add(address); context.SaveChanges(); } else { mensaje = "No se grabo a nota"; return(false); } } return(true); } catch (DbEntityValidationException 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; mensaje = "Error al Grabar" + ex.Message; throw new Exception(ex.ToString()); } } 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 = "No se grabo a nota" + " " + ex.ToString() + " " + ex.Message; throw new Exception(ex.ToString()); } }
public bool guardarDB(cp_nota_DebCre_Info info) { try { using (Entities_cuentas_por_pagar Context = new Entities_cuentas_por_pagar()) { cp_nota_DebCre Entity = new cp_nota_DebCre { IdEmpresa = info.IdEmpresa, IdCbteCble_Nota = info.IdCbteCble_Nota, IdTipoCbte_Nota = info.IdTipoCbte_Nota, cod_nota = info.cod_nota, DebCre = info.DebCre, IdProveedor = info.IdProveedor, IdTipoNota = info.IdTipoNota, IdSucursal = info.IdSucursal, cn_fecha = info.cn_fecha, Fecha_contable = info.Fecha_contable, cn_Fecha_vcto = info.cn_Fecha_vcto.Date, cn_serie1 = info.cn_serie1, cn_serie2 = info.cn_serie2, cn_Nota = info.cn_Nota, cn_observacion = info.cn_observacion, cn_subtotal_iva = info.cn_subtotal_iva, cn_subtotal_siniva = info.cn_subtotal_siniva, cn_baseImponible = info.cn_baseImponible, cn_Por_iva = info.cn_Por_iva, cn_Ice_base = info.cn_Ice_base, cn_Ice_por = info.cn_Ice_por, cn_Ice_valor = info.cn_Ice_valor, cn_Serv_por = info.cn_Serv_por, cn_Serv_valor = info.cn_Serv_valor, cn_BaseSeguro = info.cn_BaseSeguro, cn_total = info.cn_total, cn_vaCoa = info.cn_vaCoa, cn_Autorizacion = info.cn_Autorizacion, cn_valoriva = info.cn_valoriva, cn_num_doc_modificado = info.cn_num_doc_modificado, IdIden_credito = info.IdIden_credito, IdTipoServicio = info.IdTipoServicio, IdUsuario = info.IdUsuario, Fecha_Transac = info.Fecha_Transac = DateTime.Now, Estado = info.Estado, ConvenioTributacion = info.ConvenioTributacion_bool == true ? "SI" : "NO", PagoSujetoRetencion = info.PagoSujetoRetencion_bool == true ? "SI" : "NO", }; Context.cp_nota_DebCre.Add(Entity); 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_nota_DebCre_Data", Metodo = "guardarDB", IdUsuario = info.IdUsuario }); return(false); } }