ここでは、ON-REVのホームページにあるiREVのサンプルではなく、独自のirevスクリプトを掲載しています。
サンプル「売上集計」をより実用的に変更しています。
変更点は;
全体を罫線付の表形式としてより見易くしました。
項目のヘッダーとフッターを付加しました。
日別合計を表示させるようにしました。
部門別月間合計を表示させるようにしました。
サンプルデータを別ページに移動しました。
デバグ用の表示を隠しました。
集計対象データの期間よりも、開始日・終了日の期間が短い場合に表示が崩れるバグを修正しました。
その他、色々を修正しました。

以下がそのスクリプトです;


iRevによるアプリケーション:Calc_Uriage.irev

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
	<head>
		<meta http-equiv="content-type" content="text/html;charset=utf-8">
		<title>例えば売上金額を管理する</title>
		<br>
		<big>例えば売上金額を管理する β3 20090710</big><br>
	</head>
<br>
	<form action="calc_Uriage_Table.irev" method="POST" name="collect" >
			開始日:<input name="sDate" type="text" /><br><br>
			終了日:<input name="eDate" type="text" /><br><br>
			<textarea name="RawData" rows="10" cols="50" /></textarea><br><br>
			<input type="submit" name="submit" value="計算する"><br><br>
	</form>
<br>
【注】サンプルデータはありません。開始日、終了日は「YYYYMMDD」形式で、また計算の対象になるデータは全て半角英数字で入力します。<br>
<center><A href="http://yokotafumitaka.on-rev.com/irev-test/calc_Uriage_sampleData.txt" target="_blank">こちらでサンプルデータを入手することもできます。</A></center><br>
【重要】計算対象データの形式は「ABCDの内の1字」「,(半角コンマ)」「YYMMDD形式の日付」「,(半角コンマ)」「数値データ(半角数字のみ)」<br>
<br>
<br>

<?rev
	put $_POST["RawData"] into tRawData

	if ($_POST["RawData"] <> empty) and ($_POST["sDate"] <> empty and the length of $_POST["sDate"] is 8) and ($_POST["eDate"] <> empty and the length of $_POST["eDate"] is 8) then
		put $_POST["sDate"] into tSDate
		put $_POST["eDate"] into tEDate
		put $_SERVER["REMOTE_ADDR"] into tIPAdr

		put char 1 to 4 of tSDate into tSDateY
		put char 5 to 6 of tSDate into tSDateM
		put char 7 to 8 of tSDate into tSDateD
		put tSDateM & "/" & tSDateD & "/" & tSDateY into tStartDay

		put char 1 to 4 of tEDate into tEDateY
		put char 5 to 6 of tEDate into tEDateM
		put char 7 to 8 of tEDate into tEDateD
		put tEDateM & "/" & tEDateD & "/" & tEDateY into tEndDay

		put tStartDay into tSSeconds
		put tEndDay  into tESeconds

		convert tSSeconds to seconds
		convert tESeconds to seconds

		put ((tESeconds - tSSeconds)/86400 + 1) into tDaysCNT

		if tDaysCNT <> 0 then
			put "開始日には:<strong>" & tStartDay & "</strong>  終了日には:<strong>" & tEndDay & "</strong> が設定されました。"
		else
			put "開始日、終了日を正しく入力してください。"
		end if

		repeat with LC = 1 to tDaysCNT
			put (86400*(LC-1) + tSSeconds) into tFK
			convert tFK to dateitems
			put char 3 to 4 of item 1 of tFK into tYY
			if the number of chars of item 2 of tFK = 1 then
				put "0" & char 1 of item 2 of tFK into tMM
			else
				put char 1 to 2 of item 2 of tFK into tMM
			end if
			if the number of chars of item 3 of tFK = 1 then
				put "0" & char 1 of item 3 of tFK into tDD
			else
				put char 1 to 2 of item 3 of tFK into tDD
			end if
			put tYY & tMM & tDD into line LC of tDaysTable
		end repeat

		sort lines of tRawData by item 1 of each
		sort lines of tRawData by item 2 of each

		repeat for each line ThisLine in tRawData
			if item 1 of ThisLine = "A" and lineOffSet (item 2 of ThisLine,tDaysTable) <> 0 then
				add item 3 of ThisLine to line lineOffSet (item 2 of ThisLine,tDaysTable) of tATable
				add item 3 of ThisLine to item 2 of line lineOffSet (item 2 of ThisLine,tDaysTable) of tDaysTable
				add item 3 of ThisLine to line lineOffSet (item 2 of ThisLine,tDaysTable) of tETable
				add item 3 of ThisLine to item 6 of line lineOffSet (item 2 of ThisLine,tDaysTable) of tDaysTable
			end if
			if item 1 of ThisLine = "B" and lineOffSet (item 2 of ThisLine,tDaysTable) <> 0 then
				add item 3 of ThisLine to line lineOffSet (item 2 of ThisLine,tDaysTable) of tBTable
				add item 3 of ThisLine to item 3 of line lineOffSet (item 2 of ThisLine,tDaysTable) of tDaysTable
				add item 3 of ThisLine to line lineOffSet (item 2 of ThisLine,tDaysTable) of tETable
				add item 3 of ThisLine to item 6 of line lineOffSet (item 2 of ThisLine,tDaysTable) of tDaysTable
			end if
			if item 1 of ThisLine = "C" and lineOffSet (item 2 of ThisLine,tDaysTable) <> 0 then
				add item 3 of ThisLine to line lineOffSet (item 2 of ThisLine,tDaysTable) of tCTable
				add item 3 of ThisLine to item 4 of line lineOffSet (item 2 of ThisLine,tDaysTable) of tDaysTable
				add item 3 of ThisLine to line lineOffSet (item 2 of ThisLine,tDaysTable) of tETable
				add item 3 of ThisLine to item 6 of line lineOffSet (item 2 of ThisLine,tDaysTable) of tDaysTable
			end if
			if item 1 of ThisLine = "D" and lineOffSet (item 2 of ThisLine,tDaysTable) <> 0 then
				add item 3 of ThisLine to line lineOffSet (item 2 of ThisLine,tDaysTable) of tDTable
				add item 3 of ThisLine to item 5 of line lineOffSet (item 2 of ThisLine,tDaysTable) of tDaysTable
				add item 3 of ThisLine to line lineOffSet (item 2 of ThisLine,tDaysTable) of tETable
				add item 3 of ThisLine to item 6 of line lineOffSet (item 2 of ThisLine,tDaysTable) of tDaysTable
			end if
		end repeat

		put "<br><br>"

--//テーブルの作成//--

		put "<table  border = '1' cellpadding = '5' cellspacing = '5' frame = 'void' >"
			put "<tr>" & "<td><strong>年月日</strong></td>" & "<td><strong>売上A</strong></td>" & "<td><strong>売上B</strong></td>" & "<td><strong>売上C</strong></td>" & "<td><strong>売上D</strong></td>" & "<td><strong>日計</strong></td>" & "</tr>"
			repeat for each line tLine in tDaysTable
				put "<tr>"
					put "<td>" & item 1 of tLine & "</td>" & "<td>" & item 2 of tLine & "</td>" & "<td>" & item 3 of tLine & "</td>" & "<td>" & item 4 of tLine & "</td>" & "<td>" & item 5 of tLine & "</td>" & "<td>" & item 6 of tLine & "</td>"
					add item 2 of tLine to tSumA
					add item 3 of tLine to tSumB
					add item 4 of tLine to tSumC
					add item 5 of tLine to tSumD
					add item 6 of tLine to tSumE
				put "</tr>"
			end repeat
			put "<tr>" & "<td><strong>期間日数</strong></td>" & "<td><strong>期間計A</strong></td>" & "<td><strong>期間計B</strong></td>" & "<td><strong>期間計C</strong></td>" & "<td><strong>期間計D</strong></td>" & "<td><strong>総計</strong></td>" & "</tr>"
			put "<tr>" & "<td>" & round(tDaysCNT) & "</td>" & "<td>" & tSumA & "</td>" & "<td>" & tSumB & "</td>" & "<td>" & tSumC & "</td>" & "<td>" & tSumD & "</td>" & "<td>" & tSumE & "</td>" & "</tr>"
		put "</table>"

--//テーブルの作成終了//--

		put "<br><br>"
	end if 

?>

<br>
<br>
(C)2009.07.07 TAjimiYORI-AraiKey-YF

</html>http://www.on-rev.com/home/http://yokotafumitaka.on-rev.com/irev-test/calc_Uriage_sampleData.txtshapeimage_2_link_0shapeimage_2_link_1