8 require_once(dirname(__FILE__) .
'/../../lib/View.php');
9 require_once(dirname(__FILE__) .
'/../../lib/Controller.php');
10 require_once(dirname(__FILE__) .
'/UserAcitmModel.php');
12 define(
'PAGER_RPP', 10);
32 $this->bid = $_SESSION[
'minfo'][
'bid'];
34 $this->view =
new View();
36 $this->param[
'base'] = dirname(__FILE__);
38 $basic = $this->model->getBasicByBid($this->bid);
42 $this->
_error(
'基本情報が見つかりません。');
48 if (empty($this->param[
'act'])) {
51 switch ($this->param[
'act']) {
52 case 'create': $this->
_create();
break;
53 case 'drop': $this->
_drop();
break;
54 case 'edit': $this->
_edit();
break;
55 case 'remember': $this->
_remember();
break;
56 case 'search': $this->
_search();
break;
57 case 'check': $this->
_check();
break;
58 case 'regist': $this->
_regist();
break;
59 default: $this->
_list();
break;
66 $this->viewName =
'user_acitm_err';
72 $this->viewName =
'user_acitm_list';
77 'pager' => [
'page' => 1,
'rpp' =>
PAGER_RPP],
80 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
82 $_SESSION[
'user_acitm_list_cnd'] = $this->dat[
'cnd'];
86 $this->
const[
'c_c0'] = $this->model->getConst(
'c_c0');
87 $this->
const[
'c_c1'] = $this->model->getConst(
'c_c1');
88 $this->
const[
'c_c2'] = $this->model->getConst(
'c_c2');
89 $this->
const[
'c_c3'] = $this->model->getConst(
'c_c3');
90 $this->
const[
'c_c4'] = $this->model->getConst(
'c_c4');
91 $this->
const[
'c_deb_cre'] = $this->model->getConst(
'c_deb_cre');
92 $this->
const[
'c_item_class'] = $this->model->getConst(
'c_item_class');
93 $this->
const[
'c34'] = $this->model->getC34();
98 $this->viewName =
'user_acitm_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_acitm_list_cnd'] = $this->dat[
'cnd'];
113 $this->viewName =
'user_acitm_list';
114 $this->dat[
'cnd'] = $_SESSION[
'user_acitm_list_cnd'];
115 $this->dat[
'list'] = $this->model->getList($this->dat[
'cnd']);
120 $this->viewName =
'user_acitm_edit';
121 $this->dat = $this->model->getData($this->param[
'id']);
128 $insert = (empty($this->param[
'insert'])) ?
false :
true;
129 $item = $this->param[
'item'];
130 $kana = $this->param[
'kana'];
131 $name = $this->param[
'name'];
134 $err[] =
'勘定名(かな)は必須です。';
138 $err[] =
'勘定名は必須です。';
142 $err[] =
'勘定細分コードは必須です。';
145 if ($v < 0 || $v > 99) {
146 $err[] =
'勘定細分コードが不正です。';
151 if (!empty($this->param[
'insert'])) {
152 if ($this->model->chkDup($this->param) > 0) {
153 $err[] =
'コードが重複しています。';
159 $this->rest = json_encode([
'sts' =>
'OK']);
161 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
167 $insert = (empty($this->param[
'insert'])) ?
false :
true;
170 $err = $this->model->insert($this->param);
172 $err = $this->model->regist($this->param);
176 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
180 $this->rest = json_encode([
'sts' =>
'OK']);
185 $this->viewName =
'user_acitm_create';
190 $err = $this->model->delete($this->param);
193 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
197 $this->rest = json_encode([
'sts' =>
'OK']);