/// <summary> /// Detalle de factura para tratamientos por ID /// </summary> /// <param name="IdTreat">Id del producto</param> /// <param name="IdUser">Id del usuario (sucursal)</param> /// <param name="fechaCompra">Fecha del tratamiento</param> public Struct_DetalleFactura(int IdTreat, int IdUser, DateTime fechaCompra) { TRATAMIENTO = Struct_Treatment.GetTreatmentById(IdTreat); FECHACOMPRA = fechaCompra; isdec = false; DETALLEINT = 1; InitAccessKey(); }
//fix para tratamientos a la hora de consultar una factura public Struct_DetalleFactura(DataRow p_DR, int p_IdUser) { DETALLEINT = int.Parse(p_DR["CantidadINT"].ToString()); DETALLEDEC = Statics.Conversion.GetDecimal(p_DR["CantidadDEC"].ToString()); InitAccessKey(); bool istreat = false; DataRow _DR; if (p_DR["IdArticulo"].ToString() != "0") { _DR = Connection.D_Articles.SelectSingleArticle(p_IdUser, int.Parse(p_DR["IdArticulo"].ToString())); } else { _DR = new Connection.D_Treatment().Select_TreatmentById(int.Parse(p_DR["IdTratamiento"].ToString())); istreat = true; } if (_DR != null) { if (istreat == false) { PRODUCTO = Data2.Class.Struct_Producto.GetById(int.Parse(_DR["Id"].ToString())); if (PRODUCTO != null) { PRODUCTO.PrecioCompra = Statics.Conversion.GetDecimal(p_DR["PrecioCompra"].ToString()); PRODUCTO.PorcentajeGanancia = Statics.Conversion.GetDecimal(p_DR["PorcentajeGanancia"].ToString()); PRODUCTO.PrecioFinal = Statics.Conversion.GetDecimal(p_DR["PrecioFinal"].ToString()); PRODUCTO.IVA = Statics.Conversion.GetDecimal(p_DR["IVA"].ToString()); PRODUCTO.PrecioNeto = Statics.Conversion.GetDecimal(p_DR["PrecioNeto"].ToString()); isdec = new Struct_Unidades(PRODUCTO.IdUnidad).Decimal; } else { PRODUCTO = new Struct_Producto(p_IdUser, 0, "0", "0", "Producto huerfano", 0, 0, 0, 0, 0, 0, false, 0); } } else { TRATAMIENTO = new Struct_Treatment(); TRATAMIENTO.Nombre = _DR["Nombre"].ToString(); TRATAMIENTO.Descripcion = _DR["Descripcion"].ToString(); TRATAMIENTO.Id = int.Parse(_DR["Id"].ToString()); TRATAMIENTO.Precio = Statics.Conversion.GetDecimal(p_DR["PrecioFinal"].ToString()); //pendiente de finalizar la carga del tratamiento desde el detalle de factura y el tratamiento en si... Cargar precios coneglados (Deivit) } } else { PRODUCTO = new Struct_Producto(p_IdUser, 0, "0", "0", "Producto huerfano", 0, 0, 0, 0, 0, 0, false, 0); } }
public static List <Struct_Treatment> GetTreatmentsBySucursal(int LocalId) { Connection.D_Treatment ST = new Connection.D_Treatment(); DataTable DT = ST.GetTreatmentsBySucursales(LocalId); List <Struct_Treatment> Aux = new List <Struct_Treatment>(); if (DT != null) { foreach (DataRow fila in DT.Rows) { Struct_Treatment TreatmentActual = new Struct_Treatment(fila); Aux.Add(TreatmentActual); } return(Aux); } else { return(null); } }