public Boolean AnularFacturaProveedor(cp_orden_giro_Info ordenGiro_I, List<cp_orden_giro_x_com_ordencompra_local_Info> LstImportacionOC, ref decimal IdCbteCbleRev, ref string msg2) { Boolean res = true; try { if (CbteCble_B.ReversoCbteCble(ordenGiro_I.IdEmpresa, ordenGiro_I.IdCbteCble_Ogiro, ordenGiro_I.IdTipoCbte_Ogiro, Convert.ToInt32(ordenGiro_I.IdTipoCbte_Anulacion), ref IdCbteCbleRev, ref msg2, ordenGiro_I.IdUsuarioUltAnu)) { ordenGiro_I.IdCbteCble_Anulacion = IdCbteCbleRev; if (data.EliminarDB(ordenGiro_I, ref msg2)) { #region Anula Retención decimal idrev = 0; cp_retencion_Info Info_retencion = Bus_Retencion.Get_Info_retencion(ordenGiro_I.IdEmpresa, ordenGiro_I.IdCbteCble_Ogiro, ordenGiro_I.IdTipoCbte_Ogiro); //cp_retencion_x_ct_cbtecble_Info ret_x_dia = ret_B.ObtenerObjetoRetXCbteCble(ordenGiro_I.IdEmpresa, ordenGiro_I.IdCbteCble_Ogiro, // ordenGiro_I.IdTipoCbte_Ogiro); if (Info_retencion.IdRetencion != 0) { if (!Bus_Retencion.AnularDB(Info_retencion,ref idrev, ref msg2)) return false; } #endregion #region Eliminar Aprobación de ing a bodega x OC cp_Aprobacion_Ing_Bod_x_OC_Bus bus_aprob_ing_bod_x_OC = new cp_Aprobacion_Ing_Bod_x_OC_Bus(); cp_Aprobacion_Ing_Bod_x_OC_Info info_aprob_ing_bod_x_OC = new cp_Aprobacion_Ing_Bod_x_OC_Info(); info_aprob_ing_bod_x_OC = bus_aprob_ing_bod_x_OC.Get_Info_Aprobacion_Ing_Bod_x_OC(ordenGiro_I.IdEmpresa, ordenGiro_I.IdTipoCbte_Ogiro, ordenGiro_I.IdCbteCble_Ogiro); if (info_aprob_ing_bod_x_OC.IdAprobacion!=0) { bus_aprob_ing_bod_x_OC.EliminarDB(info_aprob_ing_bod_x_OC.IdEmpresa, info_aprob_ing_bod_x_OC.IdAprobacion, ordenGiro_I.IdUsuarioUltAnu, ordenGiro_I.MotivoAnu, ref mensaje); } #endregion ocXgastosxImp_B.AnularXOG(ordenGiro_I.IdEmpresa, ordenGiro_I.IdTipoCbte_Ogiro, ordenGiro_I.IdCbteCble_Ogiro, Convert.ToInt32(ordenGiro_I.IdTipoCbte_Anulacion), Convert.ToDecimal(ordenGiro_I.IdCbteCble_Anulacion)); Importacion_B.EliminarDB(ordenGiro_I.IdEmpresa, ordenGiro_I.IdCbteCble_Ogiro, ordenGiro_I.IdTipoCbte_Ogiro); OC_B.EliminarLista(LstImportacionOC); } else return false; } else return false; } 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("", "AnularFacturaProveedor", ex.Message), ex) { EntityType = typeof(cp_orden_giro_Bus) }; } return res; }
public Boolean EliminarDB(int IdEmpresa, decimal IdAprobacion, string IdUsuario, string MotivoAnula, ref string msg) { try { #region Guaarda las aprobaciones eliminadas en otra tabla //para extraer los datos antes de eliminar cp_Aprobacion_Ing_Bod_x_OC_Info info = new cp_Aprobacion_Ing_Bod_x_OC_Info(); cp_Aprobacion_Ing_Bod_x_OC_Bus Bus_Info = new cp_Aprobacion_Ing_Bod_x_OC_Bus(); List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> Lista_Info = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>(); cp_Aprobacion_Ing_Bod_x_OC_det_Bus Bus_info_detalle = new cp_Aprobacion_Ing_Bod_x_OC_det_Bus(); info = Bus_Info.Get_Info_Aprobacion_Ing_Bod_x_OC(IdEmpresa, IdAprobacion); info.listDetalle = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>(); Lista_Info = Bus_info_detalle.Get_List_Aprobacion_Ing_Bod_x_OC_det(IdEmpresa, IdAprobacion); info.listDetalle = Lista_Info; bool respuesta = false; #endregion if (respuesta) { respuesta = odata.EliminarDB(info.IdEmpresa, info.IdAprobacion, ref msg); } else { msg = "No se pudo eliminar la aprobación seleccionada, favor comuniquese con sistemas"; respuesta = false; } return(respuesta); } 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_Aprobacion_Ing_Bod_x_OC_Bus) }; } }
public Boolean EliminarDB(int IdEmpresa, decimal IdAprobacion, string IdUsuario, string MotivoAnula, ref string msg) { try { #region Guaarda las aprobaciones eliminadas en otra tabla //para extraer los datos antes de eliminar cp_Aprobacion_Ing_Bod_x_OC_Info info = new cp_Aprobacion_Ing_Bod_x_OC_Info(); cp_Aprobacion_Ing_Bod_x_OC_Bus Bus_Info = new cp_Aprobacion_Ing_Bod_x_OC_Bus(); List <cp_Aprobacion_Ing_Bod_x_OC_det_Info> Lista_Info = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>(); cp_Aprobacion_Ing_Bod_x_OC_det_Bus Bus_info_detalle = new cp_Aprobacion_Ing_Bod_x_OC_det_Bus(); info = Bus_Info.Get_Info_Aprobacion_Ing_Bod_x_OC(IdEmpresa, IdAprobacion); info.listDetalle = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Info>(); Lista_Info = Bus_info_detalle.Get_List_Aprobacion_Ing_Bod_x_OC_det(IdEmpresa, IdAprobacion); info.listDetalle = Lista_Info; //para guargar en la tabla cp_Aprobacion_Ing_Bod_x_OC_Eliminados cabecera y detalle cp_Aprobacion_Ing_Bod_x_OC_Eliminados_Info Info_Eliminado = new cp_Aprobacion_Ing_Bod_x_OC_Eliminados_Info(); cp_Aprobacion_Ing_Bod_x_OC_Eliminados_Bus bus_Aprobar_Eliminado = new cp_Aprobacion_Ing_Bod_x_OC_Eliminados_Bus(); List <cp_Aprobacion_Ing_Bod_x_OC_det_Eliminados_Info> Lista = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Eliminados_Info>(); bool respuesta = false; Info_Eliminado.IdEmpresa = info.IdEmpresa; Info_Eliminado.IdAprobacion = info.IdAprobacion; Info_Eliminado.Fecha_aprobacion = info.Fecha_aprobacion; Info_Eliminado.IdEmpresa_Ogiro = info.IdEmpresa_Ogiro; Info_Eliminado.IdCbteCble_Ogiro = info.IdCbteCble_Ogiro; Info_Eliminado.IdTipoCbte_Ogiro = info.IdTipoCbte_Ogiro; Info_Eliminado.IdOrden_giro_Tipo = info.IdOrden_giro_Tipo; Info_Eliminado.IdIden_credito = info.IdIden_credito; Info_Eliminado.IdProveedor = info.IdProveedor; Info_Eliminado.Observacion = info.Observacion; Info_Eliminado.Serie = info.Serie; Info_Eliminado.Serie2 = info.Serie2; Info_Eliminado.num_documento = info.num_documento; Info_Eliminado.num_auto_Proveedor = info.num_auto_Proveedor; Info_Eliminado.num_auto_Imprenta = info.num_auto_Imprenta; Info_Eliminado.Fecha_Factura = info.Fecha_Factura; Info_Eliminado.co_subtotal_iva = info.co_subtotal_iva; Info_Eliminado.co_subtotal_siniva = info.co_subtotal_siniva; Info_Eliminado.Descuento = info.Descuento; Info_Eliminado.co_baseImponible = info.co_baseImponible; Info_Eliminado.co_Por_iva = info.co_Por_iva; Info_Eliminado.co_valoriva = info.co_valoriva; Info_Eliminado.co_total = info.co_total; Info_Eliminado.co_plazo = info.co_plazo; Info_Eliminado.Fecha_Anulacion = DateTime.Now; Info_Eliminado.IdUsuario_Anu = IdUsuario; Info_Eliminado.Motivo_Anu = MotivoAnula; Info_Eliminado.listDetalle = new List <cp_Aprobacion_Ing_Bod_x_OC_det_Eliminados_Info>(); foreach (var item in info.listDetalle) { cp_Aprobacion_Ing_Bod_x_OC_det_Eliminados_Info Eliminado = new cp_Aprobacion_Ing_Bod_x_OC_det_Eliminados_Info(); Eliminado.IdEmpresa = item.IdEmpresa; Eliminado.IdAprobacion = item.IdAprobacion; Eliminado.Secuencia = item.Secuencia; Eliminado.IdEmpresa_Ing_Egr_Inv = item.IdEmpresa_Ing_Egr_Inv; Eliminado.IdSucursal_Ing_Egr_Inv = item.IdSucursal_Ing_Egr_Inv; Eliminado.IdNumMovi_Ing_Egr_Inv = item.IdNumMovi_Ing_Egr_Inv; Eliminado.Secuencia_Ing_Egr_Inv = item.Secuencia_Ing_Egr_Inv; Eliminado.Cantidad = item.Cantidad; Eliminado.Costo_uni = item.Costo_uni; Eliminado.Descuento = item.Descuento; Eliminado.SubTotal = item.SubTotal; Eliminado.PorIva = item.PorIva; Eliminado.valor_Iva = item.valor_Iva; Eliminado.Total = item.Total; Eliminado.IdCtaCble_Gasto = item.IdCtaCble_Gasto; Eliminado.IdCtaCble_IVA = item.IdCtaCble_IVA; Eliminado.IdCentro_Costo_x_Gasto_x_cxp = item.IdCentro_Costo; Eliminado.IdCentroCosto_sub_centro_costo_cxp = item.IdCentroCosto_sub_centro_costo; Eliminado.IdMovi_inven_tipo_Ing_Egr_Inv = item.IdMovi_inven_tipo_Ing_Egr_Inv; Lista.Add(Eliminado); } Info_Eliminado.listDetalle = Lista; respuesta = bus_Aprobar_Eliminado.GuardarDB(Info_Eliminado, ref msg); #endregion if (respuesta) { respuesta = odata.EliminarDB(info.IdEmpresa, info.IdAprobacion, ref msg); } else { msg = "No se pudo eliminar la aprobación seleccionada, favor comuniquese con sistemas"; respuesta = false; } return(respuesta); } 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_Aprobacion_Ing_Bod_x_OC_Bus) }; } }