buli
2023-07-14 5b5c1e16deaa3a9d6d0ed1ffca390655ed103df7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
function escapeVfId(vfId) {
    return '#' + vfId.replace(/(:|\.)/g,'\\$1');
}
 
function scrollbarWidth() {
    var $inner = jQuery('<div style="width: 100%; height:200px;">test</div>'),
        $outer = jQuery('<div style="width:200px;height:150px; position: absolute; top: 0; left: 0; visibility: hidden; overflow:hidden;"></div>').append($inner),
        inner = $inner[0],
        outer = $outer[0];
     
    jQuery('body').append(outer);
    var width1 = inner.offsetWidth;
    $outer.css('overflow', 'scroll');
    var width2 = outer.clientWidth;
    $outer.remove();
 
    return (width1 - width2);
}
 
function setButtonDisable(object, status){
    if(!(object.id == 'idGetActive' || object.id == 'Page:mainForm:idDayEdit:idReportDate')) {
        object.disabled = status;
    }
    if(object.id != 'idGetActive' && object.tagName.toLowerCase() == "input" && (object.type.toLowerCase() == "button" || object.type.toLowerCase() == "submit")) {
        if(status == true) {
            object.style.cursor = "default";
            object.style.backgroundPosition = "0 -90px";
            object.style.borderColor = "#C4C4C4";
            object.style.color = "#909090";
            
        } else {
            object.style.backgroundPosition = "";
            object.style.color = "";
            object.style.cursor = "pointer";
            object.style.borderColor = "#B5B5B5 #B5B5B5 #7F7F7F";
        }
    }
}
 
function setButtonsDisable(jObj, status){
    jObj.each(function(index) {
        setButtonDisable(this, status);
    });
}
 
function number_format_common (number, decimals, dec_point, thousands_sep) {
  number = (number + '').replace(/[^0-9+\-Ee.]/g, '');
  var n = !isFinite(+number) ? 0 : +number,
    prec = !isFinite(+decimals) ? 0 : Math.abs(decimals),
    sep = (typeof thousands_sep === 'undefined') ? ',' : thousands_sep,
    dec = (typeof dec_point === 'undefined') ? '.' : dec_point,
    s = '',
    toFixedFix = function (n, prec) {
      var k = Math.pow(10, prec);
      return '' + Math.round(n * k) / k;
    };
  // Fix for IE parseFloat(0.55).toFixed(0) = 0;
  s = (prec ? toFixedFix(n, prec) : '' + Math.round(n)).split('.');
  if (s[0].length > 3) {
    s[0] = s[0].replace(/\B(?=(?:\d{3})+(?!\d))/g, sep);
  }
  if ((s[1] || '').length < prec) {
    s[1] = s[1] || '';
    s[1] += new Array(prec - s[1].length + 1).join('0');
  }
  return ( s.join(dec));
}
function toNum( input) {
    return number_format_common( input, 2, ".", "");
}
function toNumComma( input) {
    return number_format_common( input, 2, ".", ",");
}
 
function localParseFloat( input) {
    input += "";
    input = input.split(" ");
    if (input.length > 1) {
        input = input[1];
    } else {
        input = input[0];
    }
    input = input.replace(/,/g, "");
    input = input.replace(/ /g, "");
    // IEの場合、\sが効かない、一旦parseの後再度isNaNをチェック
    //input = input.replace(/^\s+/, '').replace(/\s+$/, '');
    if ( input == '' || isNaN( input)) {
        input = 0.00;
    }
    input = parseFloat(input);
    if (isNaN( input)) input = 0.00;
    return input;
}
function localParseInt( input) {
    input += "";
    input = input.split(" ");
    if (input.length > 1) {
        input = input[1];
    } else {
        input = input[0];
    }
    input = input.replace(/,/g, "");
    input = input.replace(/ /g, "");
    // IEの場合、\sが効かない、一旦parseの後再度isNaNをチェック
    //input = input.replace(/^\s+/, '').replace(/\s+$/, '');
    if ( input == '' || isNaN( input)) {
        input = 0;
    }
    input = parseInt(input);
    if (isNaN( input)) input = 0.00;
    return input;
}
 
/*************************************************
 * prototypeを拡張
 *************************************************/
(function($) {
    /**
     * TODO 値セットのところも対応
     * fromのvalueを取得、radioの場合書き方が違うため、吸収します
     * valueが取れない場合、空文字を返す
     */
    $.fn.value = function() {
        var jQueryObj = this;
        var rtn = [];
        jQueryObj.each(function(i) {
            if (this.tagName.toLowerCase() == "input"
                    || this.tagName.toLowerCase() == "textarea"
                    || this.tagName.toLowerCase() == "select") {
                if (this.type.toLowerCase() == "radio" || this.type.toLowerCase() == "checkbox") {
                    if (this.checked) {
                        rtn.push(this.value);
                    }
                } else {
                    rtn.push($(this).val());
                }
            }
            else if (this.tagName.toLowerCase() == "span" || this.tagName.toLowerCase() == "label") {
                rtn.push($(this).text());
            }
        });
        if (rtn.length == 0) {
            rtn = '';
        }
        else if (rtn.length == 1) {
            rtn = rtn[0];
        }
        return rtn;
    };
})(jQuery);
 
j$ = jQuery.noConflict();
 
function blockme(){
    j$("body").prepend("<div id='sbArea'><div id='sbArea_contentsArea'><div id='sbArea_contentsArea_msg'>Please wait...</div></div><div id='sbArea_backArea'></div></div>");
    j$("#sbArea_contentsArea").css({"opacity":"0"}).fadeTo(500, 0.8);
    j$("#sbArea_backArea").css({"opacity":"0"}).fadeTo(500, 0.4);
    resizeShadowBox();
}
 
function blockme_dark(){
    j$("body").prepend("<div id='sbArea'><div id='sbArea_contentsArea'><div id='sbArea_contentsArea_msg'>Please wait...</div></div><div id='sbArea_backArea'></div></div>");
    j$("#sbArea_contentsArea").css({"opacity":"0"}).fadeTo(500, 0.9);
    j$("#sbArea_backArea").css({"opacity":"0"}).fadeTo(500, 0.8);
    resizeShadowBox();
}
 
//ウィンドのサイズにあわせて位置を調整
function resizeShadowBox(){
    var h = j$(document);
    var winH = j$(window).height();
    var winW = j$(window).width();
    var screanWidth = window.screen.width;
    if (screanWidth < winW) {
        winH = winH * winW / screanWidth;
        winW = winW * winW / screanWidth;
    }
    var contents = j$("#sbArea_contentsArea")
    contents.css({"width":"auto","height":"auto"});
    var iSaBoxH = contents.outerHeight();
    var iSaBoxW = contents.outerWidth();
    
    if(winH >= iSaBoxH+10*2){
        var innerT = (winH-iSaBoxH)/2;
    }else{
        var innerT = 10;
        iSaBoxH = winH-10*2;
        iSaBoxW += 20;
    }
    if(winW >= iSaBoxW+10*2){
        var innerL = (winW-iSaBoxW)/2;
    }else{
        var innerL =10;
        iSaBoxW = winW-10*2;
    }
    var sbTop = h.scrollTop()
    
    var IE6browser = (navigator.userAgent.indexOf("MSIE 6")>=0) ? true : false;
    if(!IE6browser){
        j$("#sbArea").css({"width":winW+"px","height":winH+"px","position":"fixed"});
    }else{
        j$("#sbArea").css({"width":winW+"px","height":winH+"px","top":h.scrollTop()+"px","left":h.scrollLeft()+"px"});
    }
    j$("#sbArea_contentsArea").css({"left":innerL+"px","top":innerT+"px","height":iSaBoxH+"px","width":iSaBoxW+"px"});
    j$("#sbArea_backArea").css({"width":winW+"px","height":winH+"px"});
}
 
function unblockUI(){
    j$("#sbArea").fadeOut(500, function(){
        j$("#sbArea").remove();
    });
}