import at.clockwork.calculation.CalculationData
import at.clockwork.calculation.GeneralCalculationData
import at.clockwork.time.service.DateTimeService
import at.clockwork.calculation.RestartCalculationException

class Calc999Service {

	static transactional = false

	def run(CalculationData calculationData, GeneralCalculationData generalCalculationData, boolean saving, Map parameters) throws RestartCalculationException {

		calculationData.run("960", calculationData, generalCalculationData, saving, parameters)
	
		if (DateTimeService.isLastDayOfWeek(calculationData.cal))
			calculationData.run("980", calculationData, generalCalculationData, saving, parameters)

		if (DateTimeService.isLastDayOfMonth(calculationData.cal))
			calculationData.run("990", calculationData, generalCalculationData, saving, parameters)

//		calculationData.xValues[0] += 1
//		calculationData.yValues[0] += 1
//
//		calculationData.run("996", calculationData, generalCalculationData, saving, parameters)
//
//		// oder:
//			
//		if (calculationData.yValues[0] < 10)
//			throw new RestartCalculationException(restartCalculation:new RestartCalculation(restartTimeTimeModelString:"107"))
//
//		// oder:
//			
//		if (calculationData.yValues[0] < 10)
//			throw new RestartCalculationException(restartCalculation:new RestartCalculation(restart:true))

	}

}
