8 require_once(dirname(__FILE__) .
'/../../lib/View.php');
9 require_once(dirname(__FILE__) .
'/../../lib/Controller.php');
10 require_once(dirname(__FILE__) .
'/UserTaxModel.php');
28 $this->bid = $_SESSION[
'minfo'][
'bid'];
30 $this->view =
new View();
32 $this->param[
'base'] = dirname(__FILE__);
34 $basic = $this->model->getBasicByBid($this->bid);
37 $this->
_error(
'基本情報が見つかりません。');
43 if (empty($this->param[
'act'])) {
46 switch ($this->param[
'act']) {
47 case 'create': $this->
_create();
break;
48 case 'drop': $this->
_drop();
break;
49 case 'edit': $this->
_edit();
break;
50 case 'use': $this->
_use();
break;
51 case 'check': $this->
_check();
break;
52 case 'regist': $this->
_regist();
break;
53 default: $this->
_list();
break;
60 $this->viewName =
'user_tax_err';
66 $this->viewName =
'user_tax_list';
68 $this->dat[
'list'] = $this->model->getList();
73 $this->viewName =
'user_tax_create';
78 $this->viewName =
'user_tax_edit';
79 $this->dat = $this->model->getData($this->param[
'id']);
84 $err = $this->model->setValidFlg($this->param);
87 $this->rest = json_encode([
'sts' =>
'OK']);
89 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
97 $insert = (empty($this->param[
'insert'])) ?
false :
true;
98 $name = $this->param[
'name'];
99 @$rate = $this->param[
'rate'] * 1.0;
105 if ($rate < 0.0001 || $rate >= 100.0) {
106 $err[] =
'税率が不正です。rateは、0.0001以上で100未満の間で指定します。';
109 if ($insert && $this->model->chkDup($name) > 0) {
110 $err[] =
'名称は既に存在します。';
114 $this->rest = json_encode([
'sts' =>
'OK']);
116 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
122 $insert = (empty($this->param[
'insert'])) ?
false :
true;
125 $err = $this->model->insert($this->param);
127 $err = $this->model->regist($this->param);
131 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
135 $this->rest = json_encode([
'sts' =>
'OK']);
140 $err = $this->model->delete($this->param);
143 $this->rest = json_encode([
'sts' =>
'NG',
'err' =>
$err]);
147 $this->rest = json_encode([
'sts' =>
'OK']);