8 define(
'MAX_LINES_PAR_PAGE', 42);
18 return ($x == 0) ?
"" :
"{\\tt{" . str_replace(
"-",
"▲", number_format($x)) .
"}}";
24 $csv = file($this->csvfile);
27 for ($i = 0; $i <
$cnt; $i++) {
28 $rec = explode(
"\t", $csv[$i]);
34 $this->dat[$rec[0]] = trim($rec[1]);
37 $this->dat[$rec[0]][
"n"] = trim($rec[1]);
38 $this->dat[$rec[0]][
"m"] = trim($rec[2]);
39 $this->dat[$rec[0]][
"mmdd"] = trim($rec[3]);
40 $this->dat[$rec[0]][
"memo"] = trim($rec[4]);
41 $this->dat[$rec[0]][
"item"] = trim($rec[5]);
42 $this->dat[$rec[0]][
"other"] = trim($rec[6]);
43 $this->dat[$rec[0]][
"amount0"] = trim($rec[7]);
44 $this->dat[$rec[0]][
"amount1"] = trim($rec[8]);
45 $this->dat[$rec[0]][
"remain"] = trim($rec[9]);
46 $this->dat[$rec[0]][
"name"] = trim($rec[10]);
49 $this->dat[$rec[0]][$data_n][
"n"] = trim($rec[1]);
50 $this->dat[$rec[0]][$data_n][
"m"] = trim($rec[2]);
51 $this->dat[$rec[0]][$data_n][
"mmdd"] = trim($rec[3]);
52 $this->dat[$rec[0]][$data_n][
"memo"] = trim($rec[4]);
53 $this->dat[$rec[0]][$data_n][
"item"] = trim($rec[5]);
54 $this->dat[$rec[0]][$data_n][
"other"] = trim($rec[6]);
55 $this->dat[$rec[0]][$data_n][
"amount0"] = trim($rec[7]);
56 $this->dat[$rec[0]][$data_n][
"amount1"] = trim($rec[8]);
57 $this->dat[$rec[0]][$data_n][
"remain"] = trim($rec[9]);
58 $this->dat[$rec[0]][$data_n][
"name"] = trim($rec[10]);
74 $d = $this->dat[
"data"];
75 $name = $this->dat[
"name"];
76 $era = $this->dat[
"era"];
78 $mm = $d[$n][
"m"] % 100;
79 $item = $d[$n][
"item"];
80 $inam = $d[$n][
"name"];
82 echo
"\\begin{center}\n";
83 echo
"\\begin{tabular}{ccc}\n";
84 echo
"\\multicolumn{2}{l}{\\makebox[12.5cm][l]{" . $name .
"}} & ";
85 echo
"\\makebox[2.5cm][r]{\\tt{" . $item .
"}} \\\\\n";
86 echo
"\\makebox[2.5cm][l]{} & ";
87 echo
"\\underline{\\makebox[10cm][c]{\\bf{" . $inam .
"}}} & ";
88 echo
"\\makebox[2.5cm][r]{" . $era .
"年度} \\\\\n";
89 echo
"\\multicolumn{2}{l}{\\makebox[12.5cm][c]{}} & ";
90 echo
"\\makebox[2.5cm][r]{" . $mm .
"月度} \\\\\n";
91 echo
"\\end{tabular}\n";
93 echo
"\\begin{center}\n";
94 echo
"\\begin{tabular}{cccccc}\n";
96 echo
"\\makebox[0.8cm][c]{\\bf{日付}} \\Vline & ";
97 echo
"\\makebox[5.0cm][c]{\\bf{摘 要}} \\Vline & ";
98 echo
"\\makebox[0.5cm][c]{\\bf{丁数\\ \\ }} \\Vline & ";
99 echo
"\\makebox[2.2cm][c]{\\bf{借 方}} \\Vline & ";
100 echo
"\\makebox[2.2cm][c]{\\bf{貸 方}} \\Vline & ";
101 echo
"\\makebox[2.2cm][c]{\\bf{差引残高}} \\\\\n";
109 if (!isset($d[$n][
"item"])) {
113 if ($item != $d[$n][
"item"]) {
117 $mm = $d[$n][
"m"] % 100;
118 $md =
"{\\tt{" . $d[$n][
"mmdd"] .
"}}";
119 $memo = $d[$n][
"memo"];
120 $other = intval($d[$n][
"other"] / 10000);
121 $am0 = $d[$n][
"amount0"];
122 $am1 = $d[$n][
"amount1"];
123 $rem = $d[$n][
"remain"];
125 $other = ($other == 0) ?
"" :
"{\\tt{" . $other .
"}}";
126 $am0 = ($am0 == 0) ?
"" : $this->
amount($am0);
127 $am1 = ($am1 == 0) ?
"" : $this->
amount($am1);
128 $rem = ($rem == 0) ?
"" : $this->
amount($rem);
139 echo
"\\makebox[0.8cm][c]{" . $md .
"} & ";
140 echo
"\\makebox[5.0cm][l]{" . $memo .
"} & ";
141 echo
"\\makebox[0.5cm][c]{" . $other .
"} & ";
142 echo
"\\makebox[2.2cm][r]{" . $am0 .
"} & ";
143 echo
"\\makebox[2.2cm][r]{" . $am1 .
"} & ";
144 echo
"\\makebox[2.2cm][r]{" . $rem .
"} \\\\\n";
150 echo
"\\end{tabular}\n";
151 echo
"\\end{center}\n";
160 echo
"title = " . $this->dat[
"title"] .
"\n\n";
161 echo
"name = " . $this->dat[
"name"] .
"\n\n";
162 echo
"era = " . $this->dat[
"era"] .
"\n\n";
163 echo
"rows = " . $this->dat[
"rows"] .
"\n\n";
165 echo $this->dat[
"field"][
"n"] .
", " .
166 $this->dat[
"field"][
"m"] .
", " .
167 $this->dat[
"field"][
"mmdd"] .
", " .
168 $this->dat[
"field"][
"memo"] .
", " .
169 $this->dat[
"field"][
"item"] .
", " .
170 $this->dat[
"field"][
"other"] .
", " .
171 $this->dat[
"field"][
"amount0"] .
", " .
172 $this->dat[
"field"][
"amount1"] .
", " .
173 $this->dat[
"field"][
"remain"] .
", " .
174 $this->dat[
"field"][
"name"] .
"\n\n";
176 $cnt = $this->dat[
"rows"];
177 for ($i = 0; $i <
$cnt; $i++) {
178 echo $this->dat[
"data"][$i][
"n"] .
", " .
179 $this->dat[
"data"][$i][
"m"] .
", " .
180 $this->dat[
"data"][$i][
"mmdd"] .
", " .
181 $this->dat[
"data"][$i][
"memo"] .
", " .
182 $this->dat[
"data"][$i][
"item"] .
", " .
183 $this->dat[
"data"][$i][
"other"] .
", " .
184 $this->dat[
"data"][$i][
"amount0"] .
", " .
185 $this->dat[
"data"][$i][
"amount1"] .
", " .
186 $this->dat[
"data"][$i][
"remain"] .
", " .
187 $this->dat[
"data"][$i][
"name"] .
"\n\n";
200 $this->csvfile = $filename;
201 $this->dat = array();
209 \documentclass[a4j]{jarticle}
211 \usepackage{supertabular}
224 \def\Hline{\noalign{\hrule height .5mm}}
225 \def\Vline{\vrule width .5mm}
236 $n =
$my->make_a_page($n,
$cnt);