All pastes #51784 Raw Edit

Something

public text v1 · immutable
#51784 ·published 2006-04-27 16:21 UTC
rendered paste body
SET bills generated TO zero

FOR all children AS child

	SET total TO zero

	FOR each club session enrolled on where paying per session attended AS session
		ADD club session cost TO total
	END LOOP

	FOR each club enrolled on where paying per week AS club
		FOR each week AS week
			SET attended this week TO false
	
				FOR each session of club this week AS session
					IF attended weekly session this week THEN
						SET attended this week TO true
					END IF
				END LOOP

				IF attended this week is true THEN
					ADD club weekly cost TO total
				END IF
			END LOOP
		END LOOP
	END LOOP

	IF total is greater than zero THEN
		generate bill and store in database
		INCREMENT bills generated
	END IF

END LOOP

SHOW USER MESSAGE text “Generated ” AND bills generated AND text “ bills.”