func (VS *Server) salesToHTML(c *gin.Context, wkS []Sale) []SaleHTML {
	var wkSales []SaleHTML
	var wkSale SaleHTML
	for _, sale := range wkS {
		wkSale.DateUnix = time.Unix(sale.Date, 0).UnixNano()
		wkSale.ID = sale.ID
		y, m, d := time.Unix(sale.Date, 0).Date()
		wkSale.Date = time.Unix(sale.Date, 0).Weekday().String() + ", " + strconv.Itoa(d) + " of " + m.String() + " of " + strconv.Itoa(y)
		fmt.Print("sale.IDStock")
		fmt.Print(sale.IDStock)
		stock := VS.getStockByID(c, sale.IDStock, "h_view", "salesToHTML", "stock := VS.getStockByID")
		fmt.Print("stock")
		fmt.Print(stock)
		item, b := VS.getItemByID(c, stock.IDVideoCourseOrItem, "h_view", "salesToHTML", "item, b := VS.getItemByID", true)
		fmt.Print("item")
		fmt.Print(item)
		if b {
			fmt.Print("Is an item, not a video, item.IDCategory:")
			fmt.Print(item.IDCategory)
			cat := VS.getCategoryByID(c, item.IDCategory, "h_view", "salesToHTML", "cat := VS.getCategoryByID")
			fmt.Print("Category:")

			fmt.Print(cat)
			tpe := VS.getCategoryTypeByID(c, cat.Type, "h_view", "salesToHTML", "tpe := VS.getCategoryTypeByID(c")
			wkSale.ItemPhoto = "/local/categories/" + tpe.Name + "/" + cat.Name + "/" + item.Photo
			wkSale.ItemName = item.Name
		} else {
			fmt.Print("Acording to the method, is a video:")
			video, _ := VS.getVideoCourseByID(c, sale.IDStock, "h_view", "salesToHTML", "video, _ := VS.getVideoCourseByID", true)
			wkSale.ItemPhoto = "/local/video-courses/" + video.Name + "/" + video.Photo
			wkSale.ItemName = item.Name
		}
		// It is supposed that here will not enter Video Products
		material, _ := VS.getItemByID(c, stock.IDVideoCourseOrItem, "h_view", "salesToHTML", "material, _ := VS.getItemByID", true)
		category := VS.getCategoryByID(c, material.IDCategory, "h_view", "salesToHTML", "category := VS.getCategoryByID")
		wkSale.CategoryName = category.Name
		wkSale.CategoryType = string(category.Type)
		wkSale.Price = sale.Price
		wkSale.ServiceName = VS.getServiceByID(c, sale.IDService, "h_view", "salesToHTML", "wkSale.ServiceName = VS.getServiceByID", true).Name
		user := VS.getUserByID(c, sale.IDWorker, "h_view", "salesToHTML", "user := VS.getUserByID")
		wkSale.UserPhoto = "/local/users/" + "/" + user.Username + "/" + user.Photo

		wkSale.Quantity = sale.Quantity
		wkSale.UserName = VS.getUserByID(c, sale.IDWorker, "h_view", "salesToHTML", "wkSale.Username = VS.getUserByID").Name
		wkSales = append(wkSales, wkSale)
	}
	return wkSales
}
// This method takes an array of Sale and returns an array of SalesHTML
This method takes an array of Sale and returns an array of SalesHTML
// This method takes an array of Sale and returns an array of SalesHTML
func (VS *Server) salesToHTML(c *gin.Context, wkS []Sale) []SaleHTML {
	var wkSales []SaleHTML
	var wkSale SaleHTML
	for _, sale := range wkS {
		wkSale.DateUnix = time.Unix(sale.Date, 0).UnixNano()
		wkSale.ID = sale.ID
		y, m, d := time.Unix(sale.Date, 0).Date()
		wkSale.Date = time.Unix(sale.Date, 0).Weekday().String() + ", " + strconv.Itoa(d) + " of " + m.String() + " of " + strconv.Itoa(y)
		fmt.Print("sale.IDStock")
		fmt.Print(sale.IDStock)
		stock := VS.getStockByID(c, sale.IDStock, "h_view", "salesToHTML", "stock := VS.getStockByID")
		fmt.Print("stock")
		fmt.Print(stock)
		item, b := VS.getItemByID(c, stock.IDVideoCourseOrItem, "h_view", "salesToHTML", "item, b := VS.getItemByID", true)
		fmt.Print("item")
		fmt.Print(item)
		if b {
			fmt.Print("Is an item, not a video, item.IDCategory:")
			fmt.Print(item.IDCategory)
			cat := VS.getCategoryByID(c, item.IDCategory, "h_view", "salesToHTML", "cat := VS.getCategoryByID")
			fmt.Print("Category:")
			fmt.Print(cat)
			tpe := VS.getCategoryTypeByID(c, cat.Type, "h_view", "salesToHTML", "tpe := VS.getCategoryTypeByID(c")
			wkSale.ItemPhoto = "/local/categories/" + tpe.Name + "/" + cat.Name + "/" + item.Photo
			wkSale.ItemName = item.Name
		} else {
			fmt.Print("Acording to the method, is a video:")
			video, _ := VS.getVideoCourseByID(c, sale.IDStock, "h_view", "salesToHTML", "video, _ := VS.getVideoCourseByID", true)
			wkSale.ItemPhoto = "/local/video-courses/" + video.Name + "/" + video.Photo
			wkSale.ItemName = item.Name
		}
		material, _ := VS.getItemByID(c, stock.IDVideoCourseOrItem, "h_view", "salesToHTML", "material, _ := VS.getItemByID", true)
		category := VS.getCategoryByID(c, material.IDCategory, "h_view", "salesToHTML", "category := VS.getCategoryByID")
		wkSale.CategoryName = category.Name
		wkSale.CategoryType = string(category.Type)
		wkSale.Price = sale.Price
		wkSale.ServiceName = VS.getServiceByID(c, sale.IDService, "h_view", "salesToHTML", "wkSale.ServiceName = VS.getServiceByID", true).Name
		user := VS.getUserByID(c, sale.IDWorker, "h_view", "salesToHTML", "user := VS.getUserByID")
		wkSale.UserPhoto = "/local/users/" + "/" + user.Username + "/" + user.Photo
		wkSale.Quantity = sale.Quantity
		wkSale.UserName = VS.getUserByID(c, sale.IDWorker, "h_view", "salesToHTML", "wkSale.Username = VS.getUserByID").Name
		wkSales = append(wkSales, wkSale)
	}
	return wkSales
}
func ( VS * Server ) salesToHTML ( c * gin . Context , wkS [ ] Sale ) [ ] SaleHTML { var wkSales [ ] SaleHTML var wkSale SaleHTML for _ , sale := range wkS { wkSale . DateUnix = time . Unix ( sale . Date , 0 ) . UnixNano ( ) wkSale . ID = sale . ID y , m , d := time . Unix ( sale . Date , 0 ) . Date ( ) wkSale . Date = time . Unix ( sale . Date , 0 ) . Weekday ( ) . String ( ) + " " + strconv . Itoa ( d ) + " " + m . String ( ) + " " + strconv . Itoa ( y ) fmt . Print ( " " ) fmt . Print ( sale . IDStock ) stock := VS . getStockByID ( c , sale . IDStock , " " , " " , " " ) fmt . Print ( " " ) fmt . Print ( stock ) item , b := VS . getItemByID ( c , stock . IDVideoCourseOrItem , " " , " " , " " , true ) fmt . Print ( " " ) fmt . Print ( item ) if b { fmt . Print ( " " ) fmt . Print ( item . IDCategory ) cat := VS . getCategoryByID ( c , item . IDCategory , " " , " " , " " ) fmt . Print ( " " ) fmt . Print ( cat ) tpe := VS . getCategoryTypeByID ( c , cat . Type , " " , " " , " " ) wkSale . ItemPhoto = " " + tpe . Name + " " + cat . Name + " " + item . Photo wkSale . ItemName = item . Name } else { fmt . Print ( " " ) video , _ := VS . getVideoCourseByID ( c , sale . IDStock , " " , " " , " " , true ) wkSale . ItemPhoto = " " + video . Name + " " + video . Photo wkSale . ItemName = item . Name } material , _ := VS . getItemByID ( c , stock . IDVideoCourseOrItem , " " , " " , " " , true ) category := VS . getCategoryByID ( c , material . IDCategory , " " , " " , " " ) wkSale . CategoryName = category . Name wkSale . CategoryType = string ( category . Type ) wkSale . Price = sale . Price wkSale . ServiceName = VS . getServiceByID ( c , sale . IDService , " " , " " , " " , true ) . Name user := VS . getUserByID ( c , sale . IDWorker , " " , " " , " " ) wkSale . UserPhoto = " " + " " + user . Username + " " + user . Photo wkSale . Quantity = sale . Quantity wkSale . UserName = VS . getUserByID ( c , sale . IDWorker , " " , " " , " " ) . Name wkSales = append ( wkSales , wkSale ) } return wkSales }
This method takes an array of Sale and returns an array of SalesHTML
This method takes an array of Sale and returns an array of SalesHTML
// It is supposed that here will not enter Video Products