Пример #1
0
        public Boolean Anular(in_transferencia_Info info, DateTime fecha_Anulacion, ref string mensaje)
        {
            try
            {
                bool res = false;
                in_transferencia_det_x_in_Guia_x_traspaso_bodega_det_Bus bus_tras_x_guia_det  = new in_transferencia_det_x_in_Guia_x_traspaso_bodega_det_Bus();
                in_transferencia_x_in_Guia_x_traspaso_bodega_Bus         bus_trans_x_guia_cab = new in_transferencia_x_in_Guia_x_traspaso_bodega_Bus();
                in_Guia_x_traspaso_bodega_x_in_transferencia_det_Bus     bus_guia_x_traspaso  = new in_Guia_x_traspaso_bodega_x_in_transferencia_det_Bus();

                if (bus_tras_x_guia_det.EliminarDB(info))
                {
                    if (bus_trans_x_guia_cab.EliminarDB(info))
                    {
                        if (oData_Transferencia.Anular(info))
                        {
                            //ANULACION INGRESO
                            info_ing_egr.IdEmpresa         = info.IdEmpresa_Ing_Egr_Inven_Destino == null ? 0 : Convert.ToInt32(info.IdEmpresa_Ing_Egr_Inven_Destino);
                            info_ing_egr.IdSucursal        = info.IdSucursal_Ing_Egr_Inven_Destino == null ? 0 : Convert.ToInt32(info.IdSucursal_Ing_Egr_Inven_Destino);
                            info_ing_egr.IdMovi_inven_tipo = info.IdMovi_inven_tipo_SucuDest == null ? 0 : Convert.ToInt32(info.IdMovi_inven_tipo_SucuDest);
                            info_ing_egr.IdNumMovi         = info.IdNumMovi_Ing_Egr_Inven_Destino == null ? 0 : Convert.ToDecimal(info.IdNumMovi_Ing_Egr_Inven_Destino);

                            info_ing_egr = bus_Ing_Egr_Inv.Get_Info_Ing_Egr_Inven(info_ing_egr.IdEmpresa, info_ing_egr.IdSucursal, info_ing_egr.IdMovi_inven_tipo, info_ing_egr.IdNumMovi);
                            info_ing_egr.IdusuarioUltAnu = info.IdUsuarioUltAnu;
                            info_ing_egr.MotivoAnulacion = info.MotivoAnu;
                            info_ing_egr.Fecha_UltAnu    = info.Fecha_UltAnu;
                            res = bus_Ing_Egr_Inv.AnularDB(info_ing_egr, ref mensaje);
                            //ANULACION EGRESO
                            info_ing_egr.IdEmpresa         = info.IdEmpresa_Ing_Egr_Inven_Origen == null ? 0 : Convert.ToInt32(info.IdEmpresa_Ing_Egr_Inven_Origen);
                            info_ing_egr.IdSucursal        = info.IdSucursal_Ing_Egr_Inven_Origen == null ? 0 : Convert.ToInt32(info.IdSucursal_Ing_Egr_Inven_Origen);
                            info_ing_egr.IdMovi_inven_tipo = info.IdMovi_inven_tipo_SucuOrig == null ? 0 : Convert.ToInt32(info.IdMovi_inven_tipo_SucuOrig);
                            info_ing_egr.IdNumMovi         = info.IdNumMovi_Ing_Egr_Inven_Origen == null ? 0 : Convert.ToDecimal(info.IdNumMovi_Ing_Egr_Inven_Origen);

                            info_ing_egr = bus_Ing_Egr_Inv.Get_Info_Ing_Egr_Inven(info_ing_egr.IdEmpresa, info_ing_egr.IdSucursal, info_ing_egr.IdMovi_inven_tipo, info_ing_egr.IdNumMovi);
                            info_ing_egr.IdusuarioUltAnu = info.IdUsuarioUltAnu;
                            info_ing_egr.MotivoAnulacion = info.MotivoAnu;
                            info_ing_egr.Fecha_UltAnu    = info.Fecha_UltAnu;
                            res = bus_Ing_Egr_Inv.AnularDB(info_ing_egr, ref mensaje);
                        }
                    }
                }
                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("", "Anular", ex.Message), ex)
                      {
                          EntityType = typeof(in_transferencia_bus)
                      };
            }
        }