8 require_once(dirname(__FILE__) .
'/../../lib/View.php');
9 require_once(dirname(__FILE__) .
'/../../lib/Controller.php');
10 require_once(dirname(__FILE__) .
'/../../lib/Tex.php');
11 require_once(dirname(__FILE__) .
'/UserCalcModel.php');
36 $this->bid = $_SESSION[
'minfo'][
'bid'];
38 $this->view =
new View();
39 $this->tex =
new Tex();
41 $this->param[
'base'] = dirname(__FILE__);
43 $basic = $this->model->getBasicByBid($this->bid);
46 $this->
_error(
'基本情報が見つかりません。');
52 $this->begin = str_replace(
'-',
'/', $this->basic[
'term_begin']);
53 $this->end = str_replace(
'-',
'/', $this->basic[
'term_end']);
54 $this->lcdt = str_replace(
'-',
'/', $this->model->lastCalculatedDate);
56 if (empty($this->param[
'act'])) {
59 switch ($this->param[
'act']) {
61 case 'slip': $this->
_slip();
break;
62 case 'ledger': $this->
_ledger();
break;
64 case 'tb': $this->
_tb();
break;
65 case 'pl': $this->
_pl();
break;
66 case 'bs': $this->
_bs();
break;
67 case 'pls': $this->
_pls();
break;
68 case 'bss': $this->
_bss();
break;
69 default: $this->
_menu();
break;
80 $this->viewName =
'user_calc_err';
85 $this->viewName =
'user_calc_menu';
90 $err = $this->model->calculate($this->basic);
93 $this->lcdt = str_replace(
'-',
'/', $this->model->lastCalculatedDate);
99 $this->viewName =
'user_calc_menu';
104 $this->pdf = $this->param[
'tmp_dir'] .
'/' . $this->tex->pdf;
105 $this->tsv = $this->param[
'tmp_dir'] .
'/' . $this->tex->tsv;
106 $this->tmplt = $this->param[
'base'] .
'/tex/tex_tmplt_slip.php';
108 $this->model->setTsvSlip($this->basic, $this->tsv);
109 $this->tex->makePdf($this->param[
'tmp_dir'], $this->tmplt, $this->tsv);
114 $this->pdf = $this->param[
'tmp_dir'] .
'/' . $this->tex->pdf;
115 $this->tsv = $this->param[
'tmp_dir'] .
'/' . $this->tex->tsv;
116 $this->tmplt = $this->param[
'base'] .
'/tex/tex_tmplt_ledger.php';
118 $this->model->setTsvLedger($this->basic, $this->tsv);
119 $this->tex->makePdf($this->param[
'tmp_dir'], $this->tmplt, $this->tsv);
124 $this->pdf = $this->param[
'tmp_dir'] .
'/' . $this->tex->pdf;
125 $this->tsv = $this->param[
'tmp_dir'] .
'/' . $this->tex->tsv;
126 $this->tmplt = $this->param[
'base'] .
'/tex/tex_tmplt_tb_detail.php';
128 $this->model->setTsvTbDetail($this->basic, $this->tsv);
129 $this->tex->makePdf($this->param[
'tmp_dir'], $this->tmplt, $this->tsv);
134 $this->pdf = $this->param[
'tmp_dir'] .
'/' . $this->tex->pdf;
135 $this->tsv = $this->param[
'tmp_dir'] .
'/' . $this->tex->tsv;
136 $this->tmplt = $this->param[
'base'] .
'/tex/tex_tmplt_tb.php';
138 $this->model->setTsvTb($this->basic, $this->tsv);
139 $this->tex->makePdf($this->param[
'tmp_dir'], $this->tmplt, $this->tsv);
144 $this->pdf = $this->param[
'tmp_dir'] .
'/' . $this->tex->pdf;
145 $this->tsv = $this->param[
'tmp_dir'] .
'/' . $this->tex->tsv;
146 $this->tmplt = $this->param[
'base'] .
'/tex/tex_tmplt_pl.php';
148 $this->model->setTsvPl($this->basic, $this->tsv);
149 $this->tex->makePdf($this->param[
'tmp_dir'], $this->tmplt, $this->tsv);
154 $this->pdf = $this->param[
'tmp_dir'] .
'/' . $this->tex->pdf;
155 $this->tsv = $this->param[
'tmp_dir'] .
'/' . $this->tex->tsv;
156 $this->tmplt = $this->param[
'base'] .
'/tex/tex_tmplt_bs.php';
158 $this->model->setTsvBs($this->basic, $this->tsv);
159 $this->tex->makePdf($this->param[
'tmp_dir'], $this->tmplt, $this->tsv);
164 $this->pdf = $this->param[
'tmp_dir'] .
'/' . $this->tex->pdf;
165 $this->tsv = $this->param[
'tmp_dir'] .
'/' . $this->tex->tsv;
166 $this->tmplt = $this->param[
'base'] .
'/tex/tex_tmplt_pls.php';
168 $this->model->setTsvPls($this->basic, $this->tsv);
169 $this->tex->makePdf($this->param[
'tmp_dir'], $this->tmplt, $this->tsv);
174 $this->pdf = $this->param[
'tmp_dir'] .
'/' . $this->tex->pdf;
175 $this->tsv = $this->param[
'tmp_dir'] .
'/' . $this->tex->tsv;
176 $this->tmplt = $this->param[
'base'] .
'/tex/tex_tmplt_bss.php';
178 $this->model->setTsvBss($this->basic, $this->tsv);
179 $this->tex->makePdf($this->param[
'tmp_dir'], $this->tmplt, $this->tsv);
183 header(
'Content-type: application/pdf');
184 header(
'Content-Length: ' . filesize($this->pdf));
185 header(
'Content-Disposition: inline; filename=' . basename($this->pdf));
186 readfile($this->pdf);
190 exec(
UTL_DELETE .
' -f ' . $this->param[
'tmp_dir'] .
'/' . $this->tex->uid .
'.*');