func (VS *Server) toViewPayments(c *gin.Context, payments []Payment) []PaymentHTML {
	var paymentsHTML []PaymentHTML
	var pay PaymentHTML
	for i := 0; i < len(payments); i++ {
		pay.ID = payments[i].ID
		pay.DateUnix = time.Unix(payments[i].Date, 0).UnixNano()

		//Here adds the Date
		pay.Date = strconv.Itoa(time.Unix(payments[i].Date, 0).Day()) + "/" + time.Unix(payments[i].Date, 0).Month().String()

		//Here adds the Worker
		worker := VS.getUserByID(c, payments[i].IDWorker, "h_view", "toViewPayments", "worker := VS.getUserByID(c, payments[i].WorkerID")
		pay.Worker = worker.Name + " " + worker.Surname

		//Here adds the Money
		pay.Quantity = payments[i].Quantity
		paymentsHTML = append(paymentsHTML, pay)
	}
	return paymentsHTML
}
// This method takes an array of Payment and returns an array of PaymentHTML
//  so we can represent the information as human readable in the website.
This method takes an array of Payment and returns an array of PaymentHTML
so we can represent the information as human readable in the website.
// This method takes an array of Payment and returns an array of PaymentHTML // so we can represent the information as human readable in the website .
func (VS *Server) toViewPayments(c *gin.Context, payments []Payment) []PaymentHTML {
	var paymentsHTML []PaymentHTML
	var pay PaymentHTML
	for i := 0; i < len(payments); i++ {
		pay.ID = payments[i].ID
		pay.DateUnix = time.Unix(payments[i].Date, 0).UnixNano()
		pay.Date = strconv.Itoa(time.Unix(payments[i].Date, 0).Day()) + "/" + time.Unix(payments[i].Date, 0).Month().String()
		worker := VS.getUserByID(c, payments[i].IDWorker, "h_view", "toViewPayments", "worker := VS.getUserByID(c, payments[i].WorkerID")
		pay.Worker = worker.Name + " " + worker.Surname
		pay.Quantity = payments[i].Quantity
		paymentsHTML = append(paymentsHTML, pay)
	}
	return paymentsHTML
}
func ( VS * Server ) toViewPayments ( c * gin . Context , payments [ ] Payment ) [ ] PaymentHTML { var paymentsHTML [ ] PaymentHTML var pay PaymentHTML for i := 0 ; i < len ( payments ) ; i ++ { pay . ID = payments [ i ] . ID pay . DateUnix = time . Unix ( payments [ i ] . Date , 0 ) . UnixNano ( ) pay . Date = strconv . Itoa ( time . Unix ( payments [ i ] . Date , 0 ) . Day ( ) ) + " " + time . Unix ( payments [ i ] . Date , 0 ) . Month ( ) . String ( ) worker := VS . getUserByID ( c , payments [ i ] . IDWorker , " " , " " , " " ) pay . Worker = worker . Name + " " + worker . Surname pay . Quantity = payments [ i ] . Quantity paymentsHTML = append ( paymentsHTML , pay ) } return paymentsHTML }
This method takes an array of Payment and returns an array of PaymentHTML
so we can represent the information as human readable in the website.
This method takes an array of Payment and returns an array of PaymentHTML so we can represent the information as human readable in the website .
//Here adds the Date //Here adds the Worker //Here adds the Money