func (VS *Server) stockToHTML(c *gin.Context, s Stock) StockHTML {
	var stock StockHTML
	stock.ID = s.ID
	y, m, d := time.Unix(s.Date, 0).Date()
	stock.Date = time.Unix(s.Date, 0).Weekday().String() + ", " + strconv.Itoa(d) + " of " + m.String() + " of " + strconv.Itoa(y)
	stock.DateUnix = time.Unix(s.Date, 0).UnixNano()

	stock.VideoOrItemID = s.IDVideoCourseOrItem
	stock.IsTrackable = s.IsTrackable
	prod, b := VS.getVideoCourseByID(c, s.IDVideoCourseOrItem, "h_view", "stockToHTML", "prod, b := VS.getVideoCourseByID", true)
	if b {
		stock.Photo = "/local/video-courses/" + prod.Name + "/purchases/" + s.Photo
		stock.VideoOrItemName = prod.Name
		stock.UnitType = Unit
		stock.Price = stock.Quantity * prod.Price
	} else {
		item, _ := VS.getItemByID(c, s.IDVideoCourseOrItem, "h_view", "stockToHTML", "item, _ := VS.getItemByID(c, purchase.VideoCourseOrItemID", true)
		itemHTML := VS.itemToHTML(c, item)
		stock.UnitType = item.UnitType
		stock.Photo = itemHTML.Photo
		stock.VideoOrItemName = itemHTML.Name
		stock.Price = stock.Quantity * item.Price
	}
	user := VS.getUserByID(c, s.IDUser, "h_view", "stockToHTML", "user := VS.getUserByID(c, purchase.UserID")
	stock.UserPhoto = "/local/users/" + user.Username + "/" + user.Photo
	stock.ItemOrVideoCourseID = prod.ID
	service := VS.getServiceByID(c, s.ServiceCreated, "h_view", "stockToHTML", "service := VS.getServiceByID", false)
	var ser Service
	if service == ser {
		stock.ServiceName = "In delivery"
	} else {
		stock.ServiceName = service.Name
	}
	stock.UserID = s.IDUser
	return stock
}
// This method takes a Stock and returns a StockHTML
// so we can represent properly the information in the website.
This method takes a Stock and returns a StockHTML
so we can represent properly the information in the website.
// This method takes a Stock and returns a StockHTML // so we can represent properly the information in the website .
func (VS *Server) stockToHTML(c *gin.Context, s Stock) StockHTML {
	var stock StockHTML
	stock.ID = s.ID
	y, m, d := time.Unix(s.Date, 0).Date()
	stock.Date = time.Unix(s.Date, 0).Weekday().String() + ", " + strconv.Itoa(d) + " of " + m.String() + " of " + strconv.Itoa(y)
	stock.DateUnix = time.Unix(s.Date, 0).UnixNano()
	stock.VideoOrItemID = s.IDVideoCourseOrItem
	stock.IsTrackable = s.IsTrackable
	prod, b := VS.getVideoCourseByID(c, s.IDVideoCourseOrItem, "h_view", "stockToHTML", "prod, b := VS.getVideoCourseByID", true)
	if b {
		stock.Photo = "/local/video-courses/" + prod.Name + "/purchases/" + s.Photo
		stock.VideoOrItemName = prod.Name
		stock.UnitType = Unit
		stock.Price = stock.Quantity * prod.Price
	} else {
		item, _ := VS.getItemByID(c, s.IDVideoCourseOrItem, "h_view", "stockToHTML", "item, _ := VS.getItemByID(c, purchase.VideoCourseOrItemID", true)
		itemHTML := VS.itemToHTML(c, item)
		stock.UnitType = item.UnitType
		stock.Photo = itemHTML.Photo
		stock.VideoOrItemName = itemHTML.Name
		stock.Price = stock.Quantity * item.Price
	}
	user := VS.getUserByID(c, s.IDUser, "h_view", "stockToHTML", "user := VS.getUserByID(c, purchase.UserID")
	stock.UserPhoto = "/local/users/" + user.Username + "/" + user.Photo
	stock.ItemOrVideoCourseID = prod.ID
	service := VS.getServiceByID(c, s.ServiceCreated, "h_view", "stockToHTML", "service := VS.getServiceByID", false)
	var ser Service
	if service == ser {
		stock.ServiceName = "In delivery"
	} else {
		stock.ServiceName = service.Name
	}
	stock.UserID = s.IDUser
	return stock
}
func ( VS * Server ) stockToHTML ( c * gin . Context , s Stock ) StockHTML { var stock StockHTML stock . ID = s . ID y , m , d := time . Unix ( s . Date , 0 ) . Date ( ) stock . Date = time . Unix ( s . Date , 0 ) . Weekday ( ) . String ( ) + " " + strconv . Itoa ( d ) + " " + m . String ( ) + " " + strconv . Itoa ( y ) stock . DateUnix = time . Unix ( s . Date , 0 ) . UnixNano ( ) stock . VideoOrItemID = s . IDVideoCourseOrItem stock . IsTrackable = s . IsTrackable prod , b := VS . getVideoCourseByID ( c , s . IDVideoCourseOrItem , " " , " " , " " , true ) if b { stock . Photo = " " + prod . Name + " " + s . Photo stock . VideoOrItemName = prod . Name stock . UnitType = Unit stock . Price = stock . Quantity * prod . Price } else { item , _ := VS . getItemByID ( c , s . IDVideoCourseOrItem , " " , " " , " " , true ) itemHTML := VS . itemToHTML ( c , item ) stock . UnitType = item . UnitType stock . Photo = itemHTML . Photo stock . VideoOrItemName = itemHTML . Name stock . Price = stock . Quantity * item . Price } user := VS . getUserByID ( c , s . IDUser , " " , " " , " " ) stock . UserPhoto = " " + user . Username + " " + user . Photo stock . ItemOrVideoCourseID = prod . ID service := VS . getServiceByID ( c , s . ServiceCreated , " " , " " , " " , false ) var ser Service if service == ser { stock . ServiceName = " " } else { stock . ServiceName = service . Name } stock . UserID = s . IDUser return stock }
This method takes a Stock and returns a StockHTML
so we can represent properly the information in the website.
This method takes a Stock and returns a StockHTML so we can represent properly the information in the website .