8 require_once(dirname(__FILE__) .
'/../../lib/View.php');
9 require_once(dirname(__FILE__) .
'/../../lib/Controller.php');
10 require_once(dirname(__FILE__) .
'/UserItemModel.php');
12 define(
'PAGER_RPP', 10);
34 $this->bid = $_SESSION[
'minfo'][
'bid'];
36 $this->view =
new View();
38 $this->param[
'base'] = dirname(__FILE__);
40 $basic = $this->model->getBasicByBid($this->bid);
44 $this->
_error(
'基本情報が見つかりません。');
50 if (empty($this->param[
'act'])) {
53 switch ($this->param[
'act']) {
54 case 'create': $this->
_create();
break;
55 case 'drop': $this->
_drop();
break;
56 case 'edit': $this->
_edit();
break;
57 case 'use': $this->
_use();
break;
58 case 'remember': $this->
_remember();
break;
59 case 'search': $this->
_search();
break;
60 case 'check': $this->
_check();
break;
61 case 'regist': $this->
_regist();
break;
62 default: $this->
_list();
break;
69 $this->viewName =
'user_item_err';
75 $this->viewName =
'user_item_list';
80 'pager' => [
'page' => 1,
'rpp' =>
PAGER_RPP],
83 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
84 $this->acitm = $this->model->getAcitm($this->bid);
86 $_SESSION[
'user_item_list_cnd'] = $this->dat[
'cnd'];
90 $this->
const[
'c_c1'] = $this->model->getConst(
'c_c1');
91 $this->
const[
'c_c2'] = $this->model->getConst(
'c_c2');
92 $this->
const[
'c_c3'] = $this->model->getConst(
'c_c3');
93 $this->
const[
'c_c4'] = $this->model->getConst(
'c_c4');
98 $this->viewName =
'user_item_list';
100 $this->dat[
'cnd'] = [
101 'cnd_name' => $this->param[
'cnd_name'],
102 'cnd_kana' => $this->param[
'cnd_kana'],
103 'pager' => [
'page' => $this->param[
'page_curr'],
'rpp' =>
PAGER_RPP],
106 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
108 $_SESSION[
'user_item_list_cnd'] = $this->dat[
'cnd'];
113 $this->viewName =
'user_item_list';
114 $this->dat[
'cnd'] = $_SESSION[
'user_item_list_cnd'];
115 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
116 $this->acitm = $this->model->getAcitm($this->bid);
121 $this->viewName =
'user_item_edit';
122 $this->kcode = $this->model->getKcode($this->bid);
123 $this->dat = $this->model->getData($this->param[
'id']);
128 $err = $this->model->setValidFlg($this->param);
131 $this->rest = json_encode([
'sts' =>
'OK']);
133 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
141 $insert = (empty($this->param[
'insert'])) ?
false :
true;
142 $item = $this->param[
'item'];
143 $kana = $this->param[
'kana'];
144 $name = $this->param[
'name'];
147 $err[] =
'科目名(かな)は必須です。';
151 $err[] =
'科目名は必須です。';
155 $err[] =
'科目細分コードは必須です。';
158 if ($v < 0 || $v > 99) {
159 $err[] =
'科目細分コードが不正です。';
164 if ($this->model->chkDup($this->param) > 0) {
165 $err[] =
'コードが重複しています。';
170 $this->rest = json_encode([
'sts' =>
'OK']);
172 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
178 $insert = (empty($this->param[
'insert'])) ?
false :
true;
181 $err = $this->model->insert($this->param);
183 $err = $this->model->regist($this->param);
187 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
191 $this->rest = json_encode([
'sts' =>
'OK']);
196 $this->viewName =
'user_item_create';
197 $this->kcode = $this->model->getKcode($this->bid);
202 $err = $this->model->delete($this->param);
205 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
209 $this->rest = json_encode([
'sts' =>
'OK']);