3 * @link https://datagram.co.jp/source/bksj for the canonical source repository
4 * @copyright Copyright (c) 2006-2019 Datagram Ltd. (https://datagram.co.jp)
5 * @license https://datagram.co.jp/source/bksj/license.txt
10 $basic = $ctrl->basic;
17 <script type="text/javascript">
37 sname: ['50音順', '使用順'],
44 gotoNext: function(func, act) {
55 val['jid'] = $('#jid').val();
56 val['ymd'] = $('#ymd').val();
58 $('select').each(function(){
59 s = $(this).attr('id');
61 val[s] = $('#' + s).val();
65 $('input[type="hidden"]').each(function(){
66 s = $(this).attr('id');
69 v = '#v_' + a[1] + '_valid';
70 if ($(v).val() == 1) {
71 val[s] = $('#' + s).val();
76 $('input[type="text"]').each(function(){
77 s = $(this).attr('id');
80 v = '#v_' + a[1] + '_valid';
81 if ($(v).val() == 1) {
82 val[s] = $('#' + s).val();
92 for (var i in this.val) {
93 alert(i + ' = ' + this.val[i]);
99 var itm = (this.sid == 0) ? '#item_name' : '#item_time';
101 var debs = 's_' + id + '_deb_name';
102 var debo = 'o_' + id + '_deb_name';
103 var debv = 'v_' + id + '_deb_name';
104 $('#' + debs).html($(itm).html());
105 $('#' + debs + ' select').attr('id', debo);
106 $('#' + debo).attr('onchange', "return my.selChg(" + id + ", 'deb');");
107 $('#' + debo).val($('#' + debv).val());
109 var cres = 's_' + id + '_cre_name';
110 var creo = 'o_' + id + '_cre_name';
111 var crev = 'v_' + id + '_cre_name';
112 $('#' + cres).html($(itm).html());
113 $('#' + cres + ' select').attr('id', creo);
114 $('#' + creo).attr('onchange', "return my.selChg(" + id + ", 'cre');");
115 $('#' + creo).val($('#' + crev).val());
118 selChg: function(id, w) {
119 var o = '#o_' + id + '_' + w + '_name';
120 var v = '#v_' + id + '_' + w + '_name';
125 if (k == this.sundry) {
126 $('#v_' + id + '_' + w + '_amount').val(0);
137 for (var i = 1; i <= this.max; i++) {
138 if ($('#v_' + i + '_valid').val() > 0) {
139 d = $('#v_' + i + '_deb_amount').val();
140 c = $('#v_' + i + '_cre_amount').val()
141 deb += d.replace(/,/g, '') * 1;
142 cre += c.replace(/,/g, '') * 1;
146 $('#v_deb_sum').val(deb);
147 $('#v_cre_sum').val(cre);
150 chgAmount: function(id, w) {
153 var debv = '#v_' + id + '_deb_amount';
154 var crev = '#v_' + id + '_cre_amount';
164 for (var i = 1; i <= this.max; i++) {
166 if ($('#v_' + i + '_valid').val() > 0) {
167 if ($('#v_' + i + '_deb_name').val() == this.sundry) {
168 $('#v_' + i + '_deb_amount').val(0);
170 if ($('#v_' + i + '_cre_name').val() == this.sundry) {
171 $('#v_' + i + '_cre_amount').val(0);
179 chkTax: function(id) {
181 var v = $('#' + id).val();
192 'func': 'UserJournal',
194 'bid': '<?= $bid ?>',
200 $('#modalTaxBody').html(data);
203 $('#modalTaxBody').html('error');
206 $('#modalTax').modal();
211 $('#v_' + i + '_valid').val(1);
212 $('#r_' + i).css('visibility', 'visible');
217 if (this.last >= this.max) {
218 alert('これ以上追加できません。');
224 this.using(this.last);
227 drop: function(seq) {
229 if (this.lines < 2) {
230 alert('これ以上削除できません。');
234 if (!confirm('行番号' + seq + 'を削除しますか?')) {
240 $('#v_' + seq + '_valid').val(0);
241 $('#r_' + seq).css('visibility', 'collapse');
246 this.sid = ++this.sid % 2;
247 this.sort1.html(this.sname[this.sid]);
248 this.sort2.html(this.sname[this.sid]);
250 for (var i = 1; i <= this.max; i++) {
251 if ($('#v_' + i + '_valid').val() > 0) {
257 check: function(arg) {
264 'func': 'UserJournal',
267 'bid': '<?= $bid ?>',
273 eval( 'var dat =' + data );
274 if (dat.sts == 'NG') {
275 this.ans = {"sts": "NG", "err": dat.err};
277 this.ans = {"sts": "OK", "err": ""};
281 this.ans = {"sts": "NG", "err": "ajax error"};
296 for (var i = 1; i <= this.max; i++) {
297 if ($('#v_' + i + '_valid').val() > 0) {
300 v[i]['deb_amount'] = this.val[n + 'deb_amount'];
301 v[i]['deb_name'] = this.val[n + 'deb_name'];
302 v[i]['remark'] = this.val[n + 'remark'];
303 v[i]['cre_name'] = this.val[n + 'cre_name'];
304 v[i]['cre_amount'] = this.val[n + 'cre_amount'];
309 'jid': this.val['jid'],
310 'scd': this.val['scd'],
311 'ymd': this.val['ymd'],
312 'settled_flg': this.val['settled_flg'],
313 'not_use_flg': this.val['not_use_flg'],
317 if (!confirm("登録しますか?")) {
321 if (this.check(arg) == 'NG') {
323 for (var i in this.ans.err) {
324 msg += this.ans.err[i] + '<br>';
327 this.errmsg.html(msg);
336 'func': 'UserJournal',
339 'bid': '<?= $bid ?>',
345 eval("this.ans = " + data);
348 this.ans = {"sts": "NG", "err": "ajax error"};
351 if (this.ans.sts == 'NG') {
352 this.errmsg.html(this.ans.err);
356 this.gotoNext('UserJournal', 'remember');
362 this.errmsg = $('#errmsg');
363 this.next = $('#next');
364 this.func = $('#func');
365 this.act = $('#act');
366 this.jid = $('#jid');
367 this.scd = $('#scd');
368 this.ymd = $('#ymd');
369 this.settled_flg = $('#settled_flg');
370 this.not_use_flg = $('#not_use_flg');
371 this.sort1 = $('#sort1');
372 this.sort2 = $('#sort2');
374 this.ymd.datepicker();
376 this.sort1.html(this.sname[this.sid]);
377 this.sort2.html(this.sname[this.sid]);
379 for (var i = 1; i <= this.lines; i++) {
391 <form method="post" name="next" id="next" action="<?= $base ?>">
392 <input type="hidden" name="func" id="func">
393 <input type="hidden" name="act" id="act">
396 <div id="item_name" style="visibility: hidden;">
398 <option value="-1"> </option>
401 foreach ($item['name'] as $k => $d) {
402 $p = mb_substr($d['kana'], 0, 1);
407 echo '<optgroup label="' . $p . '">';
410 echo '<option value="' . $view->str($k) . '">' . $view->str($d['name']) , '</option>';
419 <div id="item_time" style="visibility: hidden;">
421 <option value="-1"> </option>
423 foreach ($item['time'] as $k => $d) {
424 echo '<option value="' . $view->str($k) . '">' . $view->str($d) . '</option>';
430 <table id="my_header" width="100%">
433 <a onclick="return my.gotoNext('UserMenu', '');">メニュー</a>
434 > <a onclick="return my.gotoNext('UserJournal', 'remember');">仕訳帳</a>
435 > 新規伝票作成
437 <td style="text-align: right;">
438 <button type="button" class="my_magenta" style="width: 120px;" onclick="return my.gotoNext('Login', '');">ログアウト</button>
442 <td colspan="2" style="text-align: center;">
443 <?= $view->strBasic($basic) ?>
448 <div style="height: 5px;"> </div>
453 <table class="my_table" width="100%">
455 <th class="my_border">仕訳帳・新規伝票作成</th>
459 <div style="height: 1px;"> </div><hr>
466 <td style="padding: 8px;">
467 <button type="button" class="my_cyan" style="width: 100px;" onclick="return my.regist();">登録</button>
469 <td style="width: 80px;"> </td>
471 <button type="button" class="my_magenta" style="width: 100px;" onclick="return my.gotoNext('UserJournal', 'remember');">戻る</button>
479 <div style="height: 1px;"> </div><hr>
483 <td><div id="errmsg" class="my_red"></div></td>
487 <table class="my_list" width="100%">
499 <td style="text-align: center;">
500 新番号<input id="jid" type="hidden" value="-1">
502 <td style="text-align: center;">
505 foreach ($sect as $k => $d) {
506 $slct = ($d == '共通') ? ' selected' : '';
507 echo '<option value="' . $view->str($k) . '"' . $slct . '>' . $view->str($d) . '</option>';
512 <td style="text-align: center;">
514 $now = explode('-', date('Y-m-d'));
515 $bgn = explode('-', $basic['term_begin']);
516 $end = explode('-', $basic['term_end']);
517 if ($now[1] . $now[2] < $bgn[1] . $bgn[2]) {
518 $ymd = $end[0] . '/' . $now[1] . '/' . $now[2];
520 $ymd = $bgn[0] . '/' . $now[1] . '/' . $now[2];
523 <input id="ymd" size="10" style="text-align: center;" type="text" value="<?= $ymd ?>">
525 <td style="text-align: center;">
526 <select id="settled_flg">
528 foreach ($stld as $k => $d) {
529 $slct = ($d == '通常伝票') ? ' selected' : '';
530 echo '<option value="' . $view->str($k) . '"' . $slct . '>' . $view->str($d) . '</option>';
535 <td style="text-align: center;">
536 <select id="not_use_flg">
537 <option value="true">不使用伝票</option>
538 <option value="false" selected>使用伝票</option>
545 <div style="height: 4px;"> </div>
546 <!-- <button type="button" class="my_magenta" onclick="return my.debug();">debug</button> -->
551 <table class="my_list">
558 <button type="button" class="my_th" onclick="return my.sort();">
559 <div id="sort1"></div>
565 <button type="button" class="my_th" onclick="return my.sort();">
566 <div id="sort2"></div>
575 for ($i = 0; $i < $max; $i++) {
578 <tr id="r_<?= $seq ?>" style="visibility: collapse;">
579 <td style="text-align: right;">
582 <td style="text-align: center;">
583 <input id="v_<?= $seq ?>_deb_amount" size="10" style="text-align: right;" type="text" value="0" onchange="return my.chgAmount('<?= $seq ?>', 'deb')" ondblclick="my.chkTax('v_<?= $seq ?>_deb_amount')">
585 <td style="text-align: center;">
586 <input id="v_<?= $seq ?>_deb_name" type="hidden" value="-1">
587 <div id="s_<?= $seq ?>_deb_name"> </div>
589 <td style="text-align: center;">
590 <input id="v_<?= $seq ?>_remark" size="40" type="text" value="">
592 <td style="text-align: center;">
593 <input id="v_<?= $seq ?>_cre_name" type="hidden" value="-1">
594 <div id="s_<?= $seq ?>_cre_name"> </div>
596 <td style="text-align: center;">
597 <input id="v_<?= $seq ?>_cre_amount" size="10" style="text-align: right;" type="text" value="0" onchange="return my.chgAmount('<?= $seq ?>', 'cre')" ondblclick="my.chkTax('v_<?= $seq ?>_deb_amount')">
599 <td style="text-align: center;">
600 <input id="v_<?= $seq ?>_valid" type="hidden" value="0">
601 <button type="button" class="my_magenta" onclick="return my.drop(<?= $seq ?>);">削除</button>
608 <td style="text-align: center;">
609 <button type="button" class="my_th" onclick="return my.plus();">+</button>
611 <td style="text-align: center;">
612 <input id="v_deb_sum" size="10" style="text-align: right;" type="text" value="0">
614 <th colspan="3">合計</th>
615 <td style="text-align: center;">
616 <input id="v_cre_sum" size="10" style="text-align: right;" type="text" value="0">
630 <!-- モーダルダイアログ Tax -->
631 <div class="modal" id="modalTax" tabindex="-1" role="dialog" aria-labelledby="staticModalLabel" aria-hidden="true" data-show="true" data-keyboard="false" data-backdrop="static">
632 <div class="modal-dialog">
633 <div class="modal-content">
634 <div class="modal-header">
635 <button type="button" class="close" data-dismiss="modal">
636 <span aria-hidden="true">×</span>
638 <h4 class="modal-tax-title">消費税</h4>
640 <div class="modal-body">
641 <div id="modalTaxBody"></div>
643 <div class="modal-footer">
644 <button type="button" class="my_magenta" data-dismiss="modal">閉じる</button>