func (VS *Server) newWorkerOrder(c *gin.Context) {
	service, b := VS.getOurService(c, "h_records", "newWorkerOrder", "service, b := VS.getOurService")
	if !b {
		return
	}
	idservicetype, b := VS.getIDParamFromURL(c, "idservicetype")
	if !b {
		return
	}
	quantity, b := VS.getIntFromHTML(c, "quantity", "Worker Order")
	if !b {
		return
	}
	wkOrderID, b := VS.getIDFromHTML(c, "orderID", "Worker Order")
	if !b {
		return
	}
	wkOrder := VS.getServiceOrderByID(c, wkOrderID, "h_records", "newWorkerOrder", "wkOrder := VS.getServiceOrderByID")
	workerID, b := VS.getIDFromHTML(c, "workerID", "Worker Order")
	if !b {
		return
	}
	// Put quantity as the maximun non-realice Products to avoid they make more items thant assigned
	if quantity > (wkOrder.Quantity - wkOrder.AlreadyMade) {
		quantity = wkOrder.Quantity - wkOrder.AlreadyMade
	}
	wOrder := WorkerOrder{
		ID:          bson.NewObjectId(),
		IDService:   service.ID,
		IDProduct:   wkOrder.IDVideoCourse,
		IDWorker:    workerID,
		Quantity:    quantity,
		Date:        getTime(),
		AlreadyMade: 0,
		IDManager:   ManagerID,
	}
	VS.makeWorkerOrder(c, wOrder)
	VS.addElementToDatabaseWithRegister(c, wOrder, wOrder.ID, service.ID, "h_records", "newWorkerOrder", "VS.addElementToDatabaseWithRegister(c, wOrder")
	VS.goodFeedback(c, "records/worker-orders/"+idservicetype.Hex())
}
// Stores the new WorkerOrder into the DataBase
Stores the new WorkerOrder into the DataBase
// Stores the new WorkerOrder into the DataBase
func (VS *Server) newWorkerOrder(c *gin.Context) {
	service, b := VS.getOurService(c, "h_records", "newWorkerOrder", "service, b := VS.getOurService")
	if !b {
		return
	}
	idservicetype, b := VS.getIDParamFromURL(c, "idservicetype")
	if !b {
		return
	}
	quantity, b := VS.getIntFromHTML(c, "quantity", "Worker Order")
	if !b {
		return
	}
	wkOrderID, b := VS.getIDFromHTML(c, "orderID", "Worker Order")
	if !b {
		return
	}
	wkOrder := VS.getServiceOrderByID(c, wkOrderID, "h_records", "newWorkerOrder", "wkOrder := VS.getServiceOrderByID")
	workerID, b := VS.getIDFromHTML(c, "workerID", "Worker Order")
	if !b {
		return
	}
	if quantity > (wkOrder.Quantity - wkOrder.AlreadyMade) {
		quantity = wkOrder.Quantity - wkOrder.AlreadyMade
	}
	wOrder := WorkerOrder{
		ID:          bson.NewObjectId(),
		IDService:   service.ID,
		IDProduct:   wkOrder.IDVideoCourse,
		IDWorker:    workerID,
		Quantity:    quantity,
		Date:        getTime(),
		AlreadyMade: 0,
		IDManager:   ManagerID,
	}
	VS.makeWorkerOrder(c, wOrder)
	VS.addElementToDatabaseWithRegister(c, wOrder, wOrder.ID, service.ID, "h_records", "newWorkerOrder", "VS.addElementToDatabaseWithRegister(c, wOrder")
	VS.goodFeedback(c, "records/worker-orders/"+idservicetype.Hex())
}
func ( VS * Server ) newWorkerOrder ( c * gin . Context ) { service , b := VS . getOurService ( c , " " , " " , " " ) if ! b { return } idservicetype , b := VS . getIDParamFromURL ( c , " " ) if ! b { return } quantity , b := VS . getIntFromHTML ( c , " " , " " ) if ! b { return } wkOrderID , b := VS . getIDFromHTML ( c , " " , " " ) if ! b { return } wkOrder := VS . getServiceOrderByID ( c , wkOrderID , " " , " " , " " ) workerID , b := VS . getIDFromHTML ( c , " " , " " ) if ! b { return } if quantity > ( wkOrder . Quantity - wkOrder . AlreadyMade ) { quantity = wkOrder . Quantity - wkOrder . AlreadyMade } wOrder := WorkerOrder { ID : bson . NewObjectId ( ) , IDService : service . ID , IDProduct : wkOrder . IDVideoCourse , IDWorker : workerID , Quantity : quantity , Date : getTime ( ) , AlreadyMade : 0 , IDManager : ManagerID , } VS . makeWorkerOrder ( c , wOrder ) VS . addElementToDatabaseWithRegister ( c , wOrder , wOrder . ID , service . ID , " " , " " , " " ) VS . goodFeedback ( c , " " + idservicetype . Hex ( ) ) }
Stores the new WorkerOrder into the DataBase
Stores the new WorkerOrder into the DataBase
// Put quantity as the maximun non-realice Products to avoid they make more items thant assigned