1684 lines
51 KiB
JavaScript
1684 lines
51 KiB
JavaScript
/*
|
||
@config : next999.json
|
||
@filename : ${psFileBasename}
|
||
@title : 1.マスターシートメインスクリプト
|
||
@name :
|
||
@siteIds : 189112
|
||
@siteTitles : ★マスターシート
|
||
@disabled: false
|
||
*/
|
||
|
||
|
||
//jexcel next-hd.netサーバ配置
|
||
/*
|
||
loadcdn('script', 'https://cdnjs.cloudflare.com/ajax/libs/xlsx-populate/1.21.0/xlsx-populate.min.js');
|
||
loadcdn('script', 'https://next-hd.net/jexcel/jexcel.min.js');
|
||
loadcdn('css', 'https://next-hd.net/jexcel/jexcel.min.css');
|
||
loadcdn('script', 'https://next-hd.net/jexcel/jsuites.min.js');
|
||
loadcdn('css', 'https://next-hd.net/jexcel/jsuites.min.css');
|
||
loadcdn('script', 'https://jpostal-1006.appspot.com/jquery.jpostal.js');
|
||
loadcdn('script', 'https://cdnjs.cloudflare.com/ajax/libs/FileSaver.js/1.3.8/FileSaver.min.js');
|
||
loadcdn('script', 'https://cdnjs.cloudflare.com/ajax/libs/axios/1.3.4/axios.min.js');
|
||
loadcdn('script', 'https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js');
|
||
|
||
loadcdn('script', 'https://cdn.geolonia.com/community-geocoder.js');
|
||
loadcdn('script', 'https://html2canvas.hertzen.com/dist/html2canvas.min.js');
|
||
loadcdn('script', 'https://cdnjs.cloudflare.com/ajax/libs/jquery.qrcode/1.0/jquery.qrcode.min.js');
|
||
*/
|
||
|
||
let apiKey = '6504c8a807677a3a576e10327f3c19876c55736ee45d4a845796b9e7f5e087bfd4bd0d8184863da8cf1733ca635111432ab334aea59102b06a96ee6d2c05190d';
|
||
|
||
let pageLoading = 0;
|
||
|
||
let myTable1a; //支払情報
|
||
let myTable2a; //A.建物工事見積書
|
||
let myTable3a; //B.追加変更工事見積書
|
||
let myTable4a; //C.付帯工事見積書
|
||
let myTable5a; //D.値引きなど
|
||
let myTable6a; //■総計
|
||
let myTable7a; //■太陽光システム 瑕疵担保計算
|
||
|
||
let editableFlag = 1;
|
||
//$('#LockedRecord').val();
|
||
|
||
let onchangeFlag = 0;
|
||
let tableLoad = 0;
|
||
|
||
let templateFiles = {
|
||
|
||
};
|
||
|
||
let userList = {};
|
||
//let userList = $('#userList').length > 0 ? JSON.parse($('#userList').val()) : {};
|
||
|
||
let syukyaku = {};
|
||
let tenpoList = {};
|
||
|
||
let readtime_date = {
|
||
keiyaku_date: '', //契約日 Date001
|
||
zukaku_date0: '', //図確日 Date002
|
||
zukaku_date1: '', //実図確日 Date003
|
||
hikitsugi_date1: '', //図確引継日1 Date004
|
||
hikitsugi_date2: '', //図確引継日2 Date005
|
||
jizen_date1: '', //事前提出日 Date006
|
||
jizen_date2: '', //事前決済日 Date007
|
||
kakunin_date1: '', //確認提出日 Date008
|
||
kakunin_date2: '', //確認決裁日 Date009
|
||
fusezu_date: '', //伏せ図チェック日 Date010
|
||
shiyo_kanryo_date: '', //仕様打ち完了日 Date011
|
||
yonsya_date: '', //四者承認図前 Date012
|
||
shonin14_date: '', //承認図14日前 Date013
|
||
kaitai_date1: '', //解体工事着手日 Date014
|
||
kaitai_date2: '', //解体工事完了日 Date015
|
||
chitai_chousa_date: '', //地耐力調査 Date016
|
||
choki_tanso_date1: '', //長期・低炭素申込日 Date017
|
||
seinohyouka_date: '', //性能評価発行日 Date018
|
||
choki_tanso_date2: '', //長期・低炭素決済日 Date019
|
||
hoken_date: '', //保険登録 Date020
|
||
jiban_date: '', //地盤改良着手日 Date021
|
||
chakko_yotei_date: '', //着工予定日 Date022
|
||
maizo_chakko_date: '', //埋蔵有着工日 Date023
|
||
shiyo_kanryo_date2: '' //仕様打ち完了日
|
||
};
|
||
|
||
|
||
window.addEventListener('load', function () {
|
||
tableLoad = 0;
|
||
if (pageLoading == 0) {
|
||
console.log('load Event');
|
||
onLoad();
|
||
}
|
||
|
||
//郵便番号から住所
|
||
jpostalSetting();
|
||
});
|
||
|
||
$p.events.on_editor_load = function () {
|
||
tableLoad = 0;
|
||
if (pageLoading == 1) {
|
||
console.log('on Editor Load');
|
||
onLoad();
|
||
}
|
||
};
|
||
|
||
function onLoad() {
|
||
pageLoading = 1;
|
||
|
||
if ($p.action() != 'new') {
|
||
getMyData();
|
||
getKeiyakuCodeData();
|
||
getNo9_Files();
|
||
}
|
||
|
||
//コメント欄の上にメッセージ表示
|
||
//addCommentsBeforeCommentField();
|
||
|
||
//ステータス項目を操作不能に
|
||
//InputReadOnly('Status');
|
||
//InputReadOnly('ClassB');
|
||
|
||
//WF申請関連項目の調整
|
||
InputWfColumn();
|
||
InputReadOnly();
|
||
|
||
//色付
|
||
$('#Results_Num040Field').css('background-color', 'yellow');
|
||
|
||
//タブの色の設定
|
||
setTabColorClass(0);
|
||
|
||
if ($('#Results_Status').attr('data-value')) {
|
||
console.log(parseFloat($('#Results_Status').attr('data-value')));
|
||
if (parseFloat($('#Results_Status').attr('data-value')) > 200) {
|
||
editableFlag = 0;
|
||
}
|
||
} else {
|
||
console.log(parseFloat($('#Results_Status').val()));
|
||
if (parseFloat($('#Results_Status').val()) > 200) {
|
||
editableFlag = 0;
|
||
}
|
||
}
|
||
console.log(editableFlag);
|
||
|
||
houjinCheck2();
|
||
|
||
getUserList(0);
|
||
|
||
flag = 0;
|
||
createShiharaiGrid();
|
||
createMitsumoriGrid();
|
||
table2Calc();
|
||
table3Calc();
|
||
table4Calc();
|
||
table5Calc();
|
||
|
||
createReadTimeTable();
|
||
|
||
//添付ファイル一括DLボタン追加 コメント追加
|
||
let attachColumns = $('.control-attachments');
|
||
$.each(attachColumns, function (index, value) {
|
||
let attach = value.dataset.name;
|
||
attachmentComments(attach);
|
||
attachFileCheckbox(attach);
|
||
});
|
||
|
||
//
|
||
columnsComments('Class007', 'red');
|
||
|
||
if ($p.action() != 'new') {
|
||
getTemplateFiles();
|
||
createMapButton();
|
||
jizenKakunin();
|
||
|
||
//お客様データファイルを開くボタン
|
||
createOkyakusamFilesButton();
|
||
|
||
//ワークフロー状況ウインドウを開くボタン
|
||
createWorkFlowViewButton();
|
||
createWorkFlowViewButton2();
|
||
}
|
||
|
||
$p.ex.readonlyColumn();
|
||
|
||
haseiCodeCheck();
|
||
|
||
getSyukyakuTable();
|
||
getTenpoTable();
|
||
|
||
//太陽光計算シート非表示
|
||
$('#myTable7').hide();
|
||
|
||
}
|
||
|
||
function getSyukyakuTable() {
|
||
$p.apiGet({
|
||
'id': '211715',
|
||
'data': {
|
||
'ApiVersion': 1.1,
|
||
'ApiKey': apiKey,
|
||
},
|
||
'done': function (data) {
|
||
$.each(data.Response.Data, function (index, value) {
|
||
syukyaku[value.ResultId] = {
|
||
'ResultId': value.ResultId,
|
||
'Group': value.ClassHash.ClassA,
|
||
}
|
||
})
|
||
|
||
//console.log(syukyaku);
|
||
|
||
},
|
||
});
|
||
}
|
||
|
||
|
||
//顧客コードが抜けている場合、契約コードテーブルからデータを引っ張ってきて顧客コードを更新する
|
||
function getKeiyakuCodeData() {
|
||
let keiyakuCodeTable = myData.ClassHash.ClassC;
|
||
if (keiyakuCodeTable) {
|
||
$p.apiGet({
|
||
'id': keiyakuCodeTable,
|
||
'data': {
|
||
'ApiVersion': 1.1,
|
||
'ApiKey': apiKey,
|
||
},
|
||
'done': function (data) {
|
||
//console.log(data);
|
||
if (myData.ClassHash.ClassB == "") {
|
||
$p.apiUpdate({
|
||
'id': $p.id(),
|
||
'data': {
|
||
'ApiVersion': 1.1,
|
||
'ApiKey': apiKey,
|
||
'ClassHash': {
|
||
'ClassB': data.Response.Data[0].ClassHash.ClassT,
|
||
}
|
||
},
|
||
done: function (data) {
|
||
console.log(data);
|
||
},
|
||
fail: function (data) {
|
||
console.log(data);
|
||
}
|
||
});
|
||
}
|
||
},
|
||
});
|
||
}
|
||
}
|
||
|
||
function getTenpoTable() {
|
||
/*
|
||
$p.apiGet({
|
||
'id': '96243',
|
||
'data': {
|
||
'ApiVersion': 1.1,
|
||
'ApiKey': apiKey,
|
||
},
|
||
'done': function (data) {
|
||
$.each(data.Response.Data, function (index, value) {
|
||
tenpoList[value.ResultId] = {
|
||
'ResultId': value.ResultId,
|
||
'ShopName': value.ClassHash.ClassT,
|
||
}
|
||
})
|
||
|
||
//console.log(tenpoList);
|
||
|
||
},
|
||
});
|
||
*/
|
||
|
||
let tenpoListStr = $('#tenpoList').length > 0 ? JSON.parse($('#tenpoList').val()) : [];
|
||
|
||
for (tenpo of tenpoListStr) {
|
||
tenpoList[tenpo.ResultId] = {
|
||
'ResultId': tenpo.ResultId,
|
||
'ShopName': tenpo.ShopName,
|
||
'ShopName0': tenpo.ShopName0,
|
||
'QRFile': tenpo.QRFile,
|
||
'QRGuid': tenpo.QRGuid,
|
||
}
|
||
}
|
||
|
||
if ($('#Results_ClassF').val()) {
|
||
let tenpoId = $('#Results_ClassF').val();
|
||
if (tenpoList[tenpoId]) {
|
||
console.log(tenpoList[tenpoId]);
|
||
let guid = tenpoList[tenpoId].QRGuid;
|
||
|
||
if (guid) {
|
||
let downloadUrl = '/pleasanter/binaries/' + guid + '/download';
|
||
let button = document.createElement('button');
|
||
button.type = 'button';
|
||
button.id = 'openQRCodeFile';
|
||
button.innerHTML = 'Google口コミQRコードDL';
|
||
button.setAttribute('onclick', 'window.open("' + downloadUrl + '", "_blank")');
|
||
button.style.margin = '5px';
|
||
|
||
$('#reportButtons').append(button);
|
||
$('#openQRCodeFile').button({
|
||
icon: 'ui-icon-image'
|
||
});
|
||
} else {
|
||
console.log('QRコードファイルがありません。');
|
||
|
||
}
|
||
|
||
} else {
|
||
console.log('該当する店舗IDがありません。');
|
||
|
||
}
|
||
} else {
|
||
console.log('店舗IDが設定されていません。');
|
||
}
|
||
|
||
//console.log(tenpoList);
|
||
}
|
||
|
||
//添付ファイル入力欄にコメントを追加する汎用関数
|
||
function attachmentComments(attach) {
|
||
let comments = '';
|
||
|
||
//説明欄にコメントがある場合、追加
|
||
if ($('#Results_' + attach + 'Field>div.field-control').attr('title')) {
|
||
comments = $('#Results_' + attach + 'Field>div.field-control').attr('title');
|
||
}
|
||
|
||
if (comments) {
|
||
let div1 = document.createElement('div');
|
||
div1.innerHTML = comments;
|
||
div1.style.marginLeft = '121px';
|
||
div1.style.fontWeight = 'bold';
|
||
div1.style.color = '#00F';
|
||
|
||
//位置調整とコメント追加
|
||
$('#Results_' + attach + 'Field').append(div1);
|
||
$('#Results_' + attach + 'Field').css('margin-bottom', '10px');
|
||
}
|
||
|
||
}
|
||
|
||
function columnsComments(column, color) {
|
||
let comments = '';
|
||
|
||
//説明欄にコメントがある場合、追加
|
||
if ($('#Results_' + column + 'Field>div.field-control').attr('title')) {
|
||
comments = $('#Results_' + column + 'Field>div.field-control').attr('title');
|
||
}
|
||
let div1 = document.createElement('div');
|
||
div1.innerHTML = comments;
|
||
div1.style.marginLeft = '121px';
|
||
div1.style.fontWeight = 'bold';
|
||
div1.style.color = color;
|
||
|
||
//位置調整とコメント追加
|
||
$('#Results_' + column + 'Field').append(div1);
|
||
if ($('#Results_' + column + 'Field').hasClass('field-normal')) {
|
||
$('#Results_' + column + 'Field').css('margin-bottom', '15px');
|
||
}
|
||
|
||
if ($('#Results_' + column + 'Field').hasClass('field-wide')) {
|
||
$('#Results_' + column + 'Field').css('margin-bottom', '0px');
|
||
}
|
||
}
|
||
|
||
function addCommentsBeforeCommentField() {
|
||
let comDiv = document.createElement('div');
|
||
comDiv.innerHTML = '【承認】【差戻】処理時のコメントはボタンを押す前に下記へ記入すること。';
|
||
comDiv.style.margin = '5px';
|
||
comDiv.style.fontSize = '1.2em';
|
||
comDiv.style.fontWeight = 'bold';
|
||
comDiv.style.color = '#00F';
|
||
|
||
$('#CommentField').before(comDiv);
|
||
}
|
||
|
||
//タブクリック時に色を変更するスクリプト
|
||
$(document).on('click', '.ui-tabs-anchor', function (e) {
|
||
let hash = e.currentTarget.hash.split('#')[1];
|
||
setTabColorClass(hash);
|
||
});
|
||
|
||
function setTabColorClass(hash) {
|
||
//タブ色 赤
|
||
let list1 = ['FieldSetTab11', 'FieldSetTab12', 'FieldSetTab14'];
|
||
let color1 = 'tabColor1';
|
||
let color2 = 'tabColor2';
|
||
|
||
$.each(list1, function (index, tabName) {
|
||
removeTabColorClass(tabName, color2);
|
||
addTabColorClass(tabName, color1);
|
||
})
|
||
|
||
if (list1.includes(hash)) {
|
||
removeTabColorClass(hash, color1);
|
||
addTabColorClass(hash, color2);
|
||
}
|
||
|
||
//タブ色 青
|
||
let list2 = ['FieldSetTab16', 'FieldSetTab17'];
|
||
color1 = 'tabColor3';
|
||
color2 = 'tabColor4';
|
||
|
||
$.each(list2, function (index, tabName) {
|
||
removeTabColorClass(tabName, color2);
|
||
addTabColorClass(tabName, color1);
|
||
})
|
||
|
||
if (list2.includes(hash)) {
|
||
removeTabColorClass(hash, color1);
|
||
addTabColorClass(hash, color2);
|
||
}
|
||
|
||
//タブ色 赤2
|
||
let list3 = ['FieldSetTab18'];
|
||
color1 = 'tabColor5';
|
||
color2 = 'tabColor6';
|
||
|
||
$.each(list3, function (index, tabName) {
|
||
removeTabColorClass(tabName, color2);
|
||
addTabColorClass(tabName, color1);
|
||
})
|
||
|
||
if (list3.includes(hash)) {
|
||
removeTabColorClass(hash, color1);
|
||
addTabColorClass(hash, color2);
|
||
}
|
||
|
||
}
|
||
|
||
//タブの色を初期化
|
||
function removeTabColorClass(tabName, colorNum) {
|
||
$('li[aria-controls="' + tabName + '"]').removeClass(colorNum);
|
||
}
|
||
function addTabColorClass(tabName, colorNum) {
|
||
$('li[aria-controls="' + tabName + '"]').addClass(colorNum);
|
||
}
|
||
|
||
|
||
|
||
function createMapButton() {
|
||
let div = document.createElement('div');
|
||
let button = document.createElement('button');
|
||
button.type = 'button';
|
||
button.id = 'openMapWindow';
|
||
button.innerHTML = '現場案内図';
|
||
button.setAttribute('onclick', 'createMapReport()');
|
||
button.style.margin = '5px';
|
||
div.append(button);
|
||
$('#Results_Description050Field').after(div);
|
||
$('#openMapWindow').button({
|
||
icon: 'ui-icon-document'
|
||
});
|
||
}
|
||
|
||
function getUserList(offset) {
|
||
let json = {
|
||
'ApiVersion': 1.1,
|
||
'ApiKey': apiKey,
|
||
'Offset': offset,
|
||
'View': {
|
||
'ApiGetMailAddresses': true,
|
||
},
|
||
};
|
||
let url = 'https://' + location.hostname + '/pleasanter/api/users/get';
|
||
|
||
$.ajax({
|
||
type: 'post',
|
||
url: url,
|
||
contentType: 'application/json',
|
||
data: JSON.stringify(json),
|
||
success: function (data) {
|
||
//console.log(data);
|
||
$.each(data.Response.Data, function (index, value) {
|
||
let name = value.Name;
|
||
let deptId = value.DeptId;
|
||
let userId = value.UserId;
|
||
let mailAddress = value.MailAddresses[0];
|
||
|
||
userList[userId] = {
|
||
name: name,
|
||
userId: userId,
|
||
deptId: deptId,
|
||
mailAddress: mailAddress,
|
||
};
|
||
});
|
||
//console.log(data.Response.Data.length);
|
||
if ((offset + data.Response.Data.length) < data.Response.TotalCount) {
|
||
let offset2 = offset + 200;
|
||
getUserList(offset2);
|
||
}
|
||
},
|
||
error: function (data) {
|
||
console.log(data);
|
||
},
|
||
});
|
||
}
|
||
|
||
function getTemplateFiles() {
|
||
//添付ファイルのGuid取得
|
||
$p.apiGet({
|
||
'id': '189122',
|
||
'data': {
|
||
'ApiVersion': 1.1,
|
||
'ApiKey': apiKey,
|
||
'View': {
|
||
'ColumnFilterHash': {
|
||
'Status': 100,
|
||
},
|
||
'ColumnSorterHash': {
|
||
'NumA': 'asc',
|
||
},
|
||
},
|
||
},
|
||
done: function (data) {
|
||
//console.log(data);
|
||
let div = document.createElement('div');
|
||
div.id = 'reportButtons';
|
||
$('#Guide').after(div);
|
||
|
||
let button = document.createElement('button');
|
||
button.type = 'button';
|
||
button.id = 'oboegakiReport';
|
||
button.innerHTML = '覚書閲覧(仮)';
|
||
button.setAttribute('onclick', 'oboegaki()');
|
||
button.style.margin = '5px';
|
||
div.append(button);
|
||
$('#oboegakiReport').button({
|
||
icon: 'ui-icon-star'
|
||
});
|
||
|
||
$.each(data.Response.Data, function (index, data) {
|
||
let fileName = data.Title;
|
||
let guid = data.AttachmentsHash.AttachmentsA[0].Guid;
|
||
templateFiles[fileName] = guid;
|
||
|
||
let button = document.createElement('button');
|
||
button.type = 'button';
|
||
button.id = guid;
|
||
button.innerHTML = fileName;
|
||
button.setAttribute('onclick', 'getTemplateRecord("' + fileName + '")');
|
||
button.style.margin = '5px';
|
||
div.append(button);
|
||
$('#' + guid).button({
|
||
icon: 'ui-icon-document'
|
||
});
|
||
});
|
||
|
||
|
||
},
|
||
});
|
||
}
|
||
|
||
function createWorkFlowViewButton() {
|
||
let div = document.createElement('div');
|
||
div.id = 'wfView';
|
||
div.style.float = "left";
|
||
$('#Guide').after(div);
|
||
|
||
let button = document.createElement('button');
|
||
button.type = 'button';
|
||
button.id = 'wfViewButton';
|
||
button.innerHTML = '契約WFステータス';
|
||
button.setAttribute('onclick', '$p.ex.createArrayData()');
|
||
button.style.margin = '5px';
|
||
div.append(button);
|
||
$('#wfViewButton').button({
|
||
icon: 'ui-icon-star'
|
||
});
|
||
}
|
||
|
||
function createWorkFlowViewButton2() {
|
||
let div = document.createElement('div');
|
||
div.id = 'wfView2';
|
||
$('#SectionFields40Container').before(div);
|
||
|
||
let button = document.createElement('button');
|
||
button.type = 'button';
|
||
button.id = 'wfViewButton2';
|
||
button.innerHTML = '契約WFステータス';
|
||
button.setAttribute('onclick', '$p.ex.createArrayData()');
|
||
button.style.margin = '5px';
|
||
div.append(button);
|
||
$('#wfViewButton2').button({
|
||
icon: 'ui-icon-star'
|
||
});
|
||
}
|
||
|
||
function createShiharaiGrid() {
|
||
let shiharai_ary = new Array();
|
||
shiharai_ary.push('設計契約時');
|
||
shiharai_ary.push('契約時');
|
||
shiharai_ary.push('着工時');
|
||
shiharai_ary.push('上棟時');
|
||
shiharai_ary.push('引き渡し時');
|
||
|
||
//契約日
|
||
let keiyaku_date_Str = '';
|
||
if ($p.getControl('DateD').val() != '') {
|
||
let keiyaku_date = new Date($p.getControl('DateD').val());
|
||
keiyaku_date_Str = dateToStr(keiyaku_date);
|
||
//keiyaku_date.getFullYear() + '/' + ('0' + (keiyaku_date.getMonth() + 1)).slice(-2) + '/' + ('0' + keiyaku_date.getDate()).slice(-2) + '';
|
||
shiharai_ary.push(keiyaku_date_Str);
|
||
}
|
||
|
||
//設計契約日
|
||
let s_keiyaku_date_Str = '';
|
||
if ($p.getControl('DateE').val() != '') {
|
||
let s_keiyaku_date = new Date($p.getControl('DateE').val());
|
||
s_keiyaku_date_Str = dateToStr(s_keiyaku_date);
|
||
//s_keiyaku_date.getFullYear() + '/' + ('0' + (s_keiyaku_date.getMonth() + 1)).slice(-2) + '/' + ('0' + s_keiyaku_date.getDate()).slice(-2) + '';
|
||
shiharai_ary.push(s_keiyaku_date_Str);
|
||
}
|
||
|
||
//着工予定日
|
||
let chakkou_date_Str = '';
|
||
if ($p.getControl('DateH').val() != '') {
|
||
let chakkou_date = new Date($p.getControl('DateH').val());
|
||
chakkou_date_Str = dateToStr(chakkou_date);
|
||
//chakkou_date.getFullYear() + '/' + ('0' + (chakkou_date.getMonth() + 1)).slice(-2) + '/' + ('0' + chakkou_date.getDate()).slice(-2) + '';
|
||
shiharai_ary.push(chakkou_date_Str);
|
||
}
|
||
|
||
//上棟日
|
||
let joutou_date_Str = '';
|
||
if ($p.getControl('DateK').val() != '') {
|
||
let joutou_date = new Date($p.getControl('DateK').val());
|
||
joutou_date_Str = dateToStr(joutou_date);
|
||
//joutou_date.getFullYear() + '年' + ('0' + (joutou_date.getMonth() + 1)).slice(-2) + '月' + ('0' + joutou_date.getDate()).slice(-2) + '日';
|
||
shiharai_ary.push(joutou_date_Str);
|
||
}
|
||
|
||
//引渡日
|
||
let hikiwatashi_date_Str = '';
|
||
if ($p.getControl('DateI').val() != '') {
|
||
let hikiwatashi_date = new Date($p.getControl('DateI').val());
|
||
hikiwatashi_date_Str = dateToStr(hikiwatashi_date);
|
||
//hikiwatashi_date.getFullYear() + '年' + ('0' + (hikiwatashi_date.getMonth() + 1)).slice(-2) + '月' + ('0' + hikiwatashi_date.getDate()).slice(-2) + '日';
|
||
shiharai_ary.push(hikiwatashi_date_Str);
|
||
}
|
||
|
||
//console.log(shiharai_ary);
|
||
|
||
let myTable1 = document.createElement('div');
|
||
let myTable1Data = JSON.parse($('#Results_DescriptionA').val());
|
||
myTable1.id = 'myTable1';
|
||
myTable1.style.cssText = 'float: left; clear: both;';
|
||
|
||
$('#Results_DescriptionAField').after(myTable1);
|
||
|
||
myTable1a = jspreadsheet(document.getElementById('myTable1'), {
|
||
data: myTable1Data,
|
||
columns: [{
|
||
type: 'text',
|
||
title: '項目',
|
||
width: 120,
|
||
align: 'left',
|
||
readOnly: true,
|
||
},
|
||
{
|
||
type: 'dropdown',
|
||
title: '支払方法',
|
||
width: 120,
|
||
align: 'left',
|
||
source: ['自己資金', 'フラット35S', '銀行ローン', '住宅ローン', '財形', 'その他'],
|
||
},
|
||
{
|
||
type: 'number',
|
||
title: '金額(税込)',
|
||
width: 120,
|
||
mask: '#,##0;[Red](#,##0)',
|
||
align: 'right',
|
||
},
|
||
{
|
||
type: 'dropdown',
|
||
title: '支払予定日',
|
||
width: 120,
|
||
align: 'left',
|
||
source: shiharai_ary,
|
||
},
|
||
{
|
||
type: 'calendar',
|
||
title: '支払予定日(任意)',
|
||
width: 120,
|
||
align: 'left',
|
||
options: {
|
||
format: 'YYYY/MM/DD',
|
||
months: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
|
||
weekdays: ['日曜日', '月曜日', '木曜日', '水曜日', '木曜日', '金曜日', '土曜日'],
|
||
weekdays_short: ['日', '月', '火', '水', '木', '金', '土']
|
||
},
|
||
},
|
||
{
|
||
type: 'dropdown',
|
||
title: '支払状況',
|
||
width: 120,
|
||
align: 'left',
|
||
source: ['支払済', '支払予定'],
|
||
},
|
||
{
|
||
type: 'number',
|
||
title: '合計',
|
||
width: 150,
|
||
mask: '#,##0;[Red](#,##0)',
|
||
align: 'right',
|
||
readOnly: true,
|
||
},
|
||
],
|
||
allowInsertColumn: false,
|
||
allowInsertRow: false,
|
||
allowManualInsertRow: false,
|
||
allowDeleteColumn: false,
|
||
allowDeletingAllRows: false,
|
||
columnSorting: false,
|
||
columnResize: false,
|
||
minSpareRows: 0,
|
||
editable: editableFlag,
|
||
contextMenu: false,
|
||
onbeforepaste: function (el, cell, x, y, value, oldValue) {
|
||
if (x == 1 || x == 3 || x == 5) return false;
|
||
//return false;
|
||
},
|
||
onbeforechange: function (el, cell, x, y, value, oldValue) {
|
||
if (x == 2 && value == "") return 0;
|
||
//return true;
|
||
},
|
||
onchange: function (el, cell, x, y, value, oldValue) {
|
||
if (tableLoad) {
|
||
if (x == 2) {
|
||
//console.log('onchange0');
|
||
table1CalcA();
|
||
}
|
||
|
||
if (x == 3) {
|
||
if (onchangeFlag == 0) {
|
||
//console.log('onchange1');
|
||
onchangeFlag = 1;
|
||
table1CalcB();
|
||
onchangeFlag = 0;
|
||
}
|
||
}
|
||
|
||
if (x == 4) {
|
||
if (onchangeFlag == 0) {
|
||
//console.log('onchange2');
|
||
onchangeFlag = 1;
|
||
table1CalcC();
|
||
onchangeFlag = 0;
|
||
}
|
||
}
|
||
|
||
$p.set($('#Results_DescriptionA'), JSON.stringify(myTable1a.getJson()));
|
||
console.log('Set Results_DescriptionA');
|
||
}
|
||
},
|
||
});
|
||
|
||
myTable1a.setMerge('A1', 1, 2);
|
||
myTable1a.setMerge('A3', 1, 2);
|
||
myTable1a.setMerge('A5', 1, 2);
|
||
myTable1a.setMerge('A7', 1, 2);
|
||
myTable1a.setMerge('G1', 1, 2);
|
||
myTable1a.setMerge('G3', 1, 2);
|
||
myTable1a.setMerge('G5', 1, 2);
|
||
myTable1a.setMerge('G7', 1, 2);
|
||
|
||
myTable1a.hideIndex();
|
||
}
|
||
|
||
function createMitsumoriGrid() {
|
||
//A.建物工事見積書
|
||
let myTable2 = document.createElement('div');
|
||
let myTable2Data = JSON.parse($('#Results_DescriptionB').val());
|
||
myTable2.id = 'myTable2';
|
||
myTable2.style.cssText = 'float: left; clear: both;';
|
||
|
||
$('#Results_DescriptionBField').after(myTable2);
|
||
|
||
myTable2a = jspreadsheet(document.getElementById('myTable2'), {
|
||
data: myTable2Data,
|
||
columns: [{
|
||
type: 'text',
|
||
title: '名称',
|
||
width: 120,
|
||
align: 'left',
|
||
},
|
||
{
|
||
type: 'text',
|
||
title: '仕様',
|
||
width: 600,
|
||
align: 'left',
|
||
},
|
||
{
|
||
type: 'number',
|
||
title: '工事見積金額',
|
||
width: 120,
|
||
mask: '#,##0;[Red](#,##0)',
|
||
align: 'right',
|
||
},
|
||
{
|
||
type: 'dropdown',
|
||
title: '正式/概算',
|
||
width: 120,
|
||
align: 'center',
|
||
source: ['正式', '概算'],
|
||
},
|
||
],
|
||
allowInsertColumn: false,
|
||
allowInsertRow: true,
|
||
allowManualInsertRow: false,
|
||
allowDeleteColumn: false,
|
||
allowDeletingAllRows: false,
|
||
columnSorting: false,
|
||
columnResize: false,
|
||
minSpareRows: 1,
|
||
editable: editableFlag,
|
||
contextMenu: false,
|
||
onbeforechange: function (el, cell, x, y, value, oldValue) {
|
||
if (x == 2 && value == "") return 0;
|
||
//return true;
|
||
},
|
||
onchange: function (el, cell, x, y, value, oldValue) {
|
||
if (tableLoad) {
|
||
//console.log('onChange Table2')
|
||
table2Calc();
|
||
}
|
||
},
|
||
onblur: function (el, cell, x, y, value, oldValue) {
|
||
//console.log(el);
|
||
deleteBlankRow();
|
||
},
|
||
});
|
||
myTable2a.hideIndex();
|
||
|
||
//B.追加変更工事見積書
|
||
let myTable3 = document.createElement('div');
|
||
let myTable3Data = JSON.parse($('#Results_DescriptionC').val());
|
||
myTable3.id = 'myTable3';
|
||
myTable3.style.cssText = 'float: left; clear: both;';
|
||
|
||
$('#Results_DescriptionCField').after(myTable3);
|
||
|
||
myTable3a = jspreadsheet(document.getElementById('myTable3'), {
|
||
data: myTable3Data,
|
||
columns: [{
|
||
type: 'text',
|
||
title: '項目名',
|
||
width: 120,
|
||
align: 'left',
|
||
},
|
||
{
|
||
type: 'dropdown',
|
||
title: '区分',
|
||
width: 60,
|
||
align: 'center',
|
||
source: ['追加', '不行'],
|
||
},
|
||
{
|
||
type: 'text',
|
||
title: '仕様',
|
||
width: 360,
|
||
align: 'left',
|
||
},
|
||
{
|
||
type: 'number',
|
||
title: '数量',
|
||
width: 120,
|
||
mask: '#,##0;[Red](#,##0)',
|
||
align: 'right',
|
||
},
|
||
{
|
||
type: 'dropdown',
|
||
title: '単位',
|
||
width: 60,
|
||
align: 'center',
|
||
source: ['セット', '式', 'kw', '個'],
|
||
},
|
||
{
|
||
type: 'number',
|
||
title: '単価',
|
||
width: 120,
|
||
mask: '#,##0;[Red](#,##0)',
|
||
align: 'right',
|
||
},
|
||
{
|
||
type: 'number',
|
||
title: '合計金額',
|
||
width: 120,
|
||
mask: '#,##0;[Red](#,##0)',
|
||
align: 'right',
|
||
},
|
||
],
|
||
allowInsertColumn: false,
|
||
allowInsertRow: true,
|
||
allowManualInsertRow: false,
|
||
allowDeleteColumn: false,
|
||
allowDeletingAllRows: false,
|
||
columnSorting: false,
|
||
columnResize: false,
|
||
minSpareRows: 1,
|
||
editable: editableFlag,
|
||
contextMenu: false,
|
||
onbeforechange: function (el, cell, x, y, value, oldValue) {
|
||
if ((x == 3 || x == 5) && value == "") return 0;
|
||
//return true;
|
||
},
|
||
onchange: function (el, cell, x, y, value, oldValue) {
|
||
if (tableLoad) {
|
||
//console.log('onChange Table3')
|
||
if (x <= 5) {
|
||
table3Calc();
|
||
}
|
||
}
|
||
},
|
||
onblur: function (el, cell, x, y, value, oldValue) {
|
||
//console.log(el);
|
||
deleteBlankRow();
|
||
},
|
||
});
|
||
myTable3a.hideIndex();
|
||
|
||
//C.付帯工事見積書
|
||
let myTable4 = document.createElement('div');
|
||
let myTable4Data = JSON.parse($('#Results_DescriptionD').val());
|
||
myTable4.id = 'myTable4';
|
||
myTable4.style.cssText = 'float: left; clear: both;';
|
||
|
||
$('#Results_DescriptionDField').after(myTable4);
|
||
|
||
//console.log(myTable4Data.length);
|
||
for (i = myTable4Data.length; i < 33; i++) {
|
||
let data = {
|
||
"0": "",
|
||
"1": "",
|
||
"2": 0,
|
||
"3": ""
|
||
};
|
||
|
||
myTable4Data.push(data);
|
||
}
|
||
|
||
myTable4a = jspreadsheet(document.getElementById('myTable4'), {
|
||
data: myTable4Data,
|
||
columns: [{
|
||
type: 'text',
|
||
title: '分類',
|
||
width: 60,
|
||
align: 'left',
|
||
readOnly: true,
|
||
},
|
||
{
|
||
type: 'text',
|
||
title: '項目名',
|
||
width: 240,
|
||
align: 'left',
|
||
},
|
||
{
|
||
type: 'number',
|
||
title: '確定額',
|
||
width: 120,
|
||
mask: '#,##0;[Red](#,##0)',
|
||
align: 'right',
|
||
},
|
||
{
|
||
type: 'text',
|
||
title: '備考',
|
||
width: 360,
|
||
align: 'left',
|
||
},
|
||
],
|
||
allowInsertColumn: false,
|
||
allowInsertRow: false,
|
||
allowManualInsertRow: false,
|
||
allowDeleteColumn: false,
|
||
allowDeletingAllRows: false,
|
||
columnSorting: false,
|
||
columnResize: false,
|
||
editable: editableFlag,
|
||
contextMenu: false,
|
||
onbeforechange: function (el, cell, x, y, value, oldValue) {
|
||
if (x == 2 && value == "") return 0;
|
||
//return true;
|
||
},
|
||
onchange: function (el, cell, x, y, value, oldValue) {
|
||
if (tableLoad) {
|
||
//console.log('onChange Table4')
|
||
table4Calc();
|
||
}
|
||
},
|
||
});
|
||
myTable4a.hideIndex();
|
||
|
||
myTable4a.setMerge('A1', 1, 6);
|
||
myTable4a.setMerge('A7', 1, 2);
|
||
myTable4a.setMerge('A9', 1, 2);
|
||
myTable4a.setMerge('A11', 1, 2);
|
||
myTable4a.setMerge('A13', 1, 3);
|
||
myTable4a.setMerge('A19', 1, 5);
|
||
myTable4a.setMerge('A24', 1, myTable4Data.length - 23);
|
||
|
||
//D.値引きなど
|
||
let myTable5 = document.createElement('div');
|
||
let myTable5Data = JSON.parse($('#Results_DescriptionE').val());
|
||
myTable5.id = 'myTable5';
|
||
myTable5.style.cssText = 'float: left; clear: both;';
|
||
|
||
$('#Results_DescriptionEField').after(myTable5);
|
||
|
||
myTable5a = jspreadsheet(document.getElementById('myTable5'), {
|
||
data: myTable5Data,
|
||
columns: [{
|
||
type: 'text',
|
||
title: '項目',
|
||
width: 180,
|
||
align: 'left',
|
||
readOnly: true,
|
||
},
|
||
{
|
||
type: 'number',
|
||
title: '金額',
|
||
width: 180,
|
||
mask: '#,##0;[Red](#,##0)',
|
||
align: 'right',
|
||
},
|
||
],
|
||
allowInsertColumn: false,
|
||
allowInsertRow: false,
|
||
allowManualInsertRow: false,
|
||
allowDeleteColumn: false,
|
||
allowDeletingAllRows: false,
|
||
columnSorting: false,
|
||
columnResize: false,
|
||
minSpareRows: 0,
|
||
editable: editableFlag,
|
||
contextMenu: false,
|
||
onbeforechange: function (el, cell, x, y, value, oldValue) {
|
||
if (x == 1 && value == "") return 0;
|
||
//return true;
|
||
},
|
||
onchange: function (el, cell, x, y, value, oldValue) {
|
||
if (tableLoad) {
|
||
//console.log('onChange Table5')
|
||
table5Calc();
|
||
}
|
||
},
|
||
});
|
||
myTable5a.hideIndex();
|
||
|
||
//総計
|
||
let myTable6 = document.createElement('div');
|
||
let myTable6Data = JSON.parse($('#Results_DescriptionF').val());
|
||
myTable6.id = 'myTable6';
|
||
myTable6.style.cssText = 'float: left; clear: both;';
|
||
|
||
$('#Results_DescriptionFField').after(myTable6);
|
||
|
||
myTable6a = jspreadsheet(document.getElementById('myTable6'), {
|
||
data: myTable6Data,
|
||
columns: [{
|
||
type: 'text',
|
||
title: '項目',
|
||
width: 180,
|
||
align: 'left',
|
||
readOnly: true,
|
||
},
|
||
{
|
||
type: 'number',
|
||
title: '金額',
|
||
width: 180,
|
||
mask: '#,##0;[Red](#,##0)',
|
||
align: 'right',
|
||
readOnly: true,
|
||
},
|
||
],
|
||
allowInsertColumn: false,
|
||
allowInsertRow: false,
|
||
allowManualInsertRow: false,
|
||
allowDeleteColumn: false,
|
||
allowDeletingAllRows: false,
|
||
columnSorting: false,
|
||
columnResize: false,
|
||
minSpareRows: 0,
|
||
editable: editableFlag,
|
||
contextMenu: false,
|
||
});
|
||
myTable6a.hideIndex();
|
||
|
||
//太陽光計算
|
||
let myTable7 = document.createElement('div');
|
||
let myTable7Data = JSON.parse($('#Results_DescriptionG').val());
|
||
myTable7.id = 'myTable7';
|
||
myTable7.style.cssText = 'float: left; clear: both;';
|
||
|
||
$('#Results_DescriptionGField').after(myTable7);
|
||
|
||
myTable7a = jspreadsheet(document.getElementById('myTable7'), {
|
||
data: myTable7Data,
|
||
columns: [{
|
||
type: 'text',
|
||
title: '項目',
|
||
width: 180,
|
||
align: 'left',
|
||
readOnly: true,
|
||
},
|
||
{
|
||
type: 'number',
|
||
title: '金額',
|
||
width: 180,
|
||
mask: '#,##0;[Red](#,##0)',
|
||
align: 'right',
|
||
readOnly: true,
|
||
},
|
||
{
|
||
type: 'text',
|
||
title: '備考',
|
||
width: 360,
|
||
align: 'left',
|
||
readOnly: true,
|
||
},
|
||
],
|
||
allowInsertColumn: false,
|
||
allowInsertRow: false,
|
||
allowManualInsertRow: false,
|
||
allowDeleteColumn: false,
|
||
allowDeletingAllRows: false,
|
||
columnSorting: false,
|
||
columnResize: false,
|
||
minSpareRows: 0,
|
||
editable: editableFlag,
|
||
contextMenu: false,
|
||
});
|
||
myTable7a.hideIndex();
|
||
|
||
tableLoad = 1;
|
||
}
|
||
|
||
function table2Calc() {
|
||
let myData2 = myTable2a.getData();
|
||
let sumValue = 0;
|
||
|
||
$.each(myData2, function (index, value) {
|
||
if (value[2].toString() != '') {
|
||
let val0 = parseFloat(value[2].toString().replaceAll(/[¥,]/g, ''));
|
||
sumValue = sumValue + val0;
|
||
} else {
|
||
let val0 = 0;
|
||
sumValue = sumValue + val0;
|
||
}
|
||
});
|
||
|
||
if ($('#Results_Num045').val().toString().replaceAll(/[¥,]/g, '') != sumValue) {
|
||
$p.set($('#Results_Num045'), sumValue.toLocaleString());
|
||
console.log('Set Results_Num045');
|
||
}
|
||
|
||
if ($('#Results_DescriptionB').val() != JSON.stringify(myTable2a.getJson())) {
|
||
$p.set($('#Results_DescriptionB'), JSON.stringify(myTable2a.getJson()));
|
||
console.log('Set Results_DescriptionB');
|
||
}
|
||
|
||
table6Calc();
|
||
}
|
||
|
||
function table3Calc() {
|
||
let myData3 = myTable3a.getData();
|
||
let sumValue = 0;
|
||
|
||
$.each(myData3, function (index, value) {
|
||
let i = index + 1;
|
||
if (value[3].toString() != '' && value[5].toString() != '') {
|
||
let val3 = parseFloat(value[3].toString().replaceAll(/[¥,]/g, ''));
|
||
let val5 = parseFloat(value[5].toString().replaceAll(/[¥,]/g, ''));
|
||
|
||
if (val3 == '') val3 = 0;
|
||
if (val5 == '') val5 = 0;
|
||
let val6 = 0;
|
||
val6 = val3 * val5;
|
||
myTable3a.setValue('G' + i, val6, true);
|
||
sumValue = sumValue + val6;
|
||
} else {
|
||
myTable3a.setValue('G' + i, '', true);
|
||
}
|
||
});
|
||
|
||
if ($('#Results_Num046').val().toString().replaceAll(/[¥,]/g, '') != sumValue) {
|
||
$p.set($('#Results_Num046'), sumValue.toLocaleString());
|
||
console.log('Set Results_Num046');
|
||
}
|
||
|
||
if ($('#Results_DescriptionC').val() != JSON.stringify(myTable3a.getJson())) {
|
||
$p.set($('#Results_DescriptionC'), JSON.stringify(myTable3a.getJson()));
|
||
console.log('Set Results_DescriptionC');
|
||
}
|
||
|
||
table6Calc();
|
||
}
|
||
|
||
function table4Calc() {
|
||
let myData4 = myTable4a.getData();
|
||
let sumValue = 0;
|
||
|
||
$.each(myData4, function (index, value) {
|
||
if (value[2].toString() != '') {
|
||
let val2 = parseFloat(value[2].toString().replaceAll(/[¥,]/g, ''));
|
||
sumValue = sumValue + val2;
|
||
} else {
|
||
let val2 = 0;
|
||
sumValue = sumValue + val2;
|
||
}
|
||
});
|
||
|
||
if ($('#Results_Num047').val().toString().replaceAll(/[¥,]/g, '') != sumValue) {
|
||
$p.set($('#Results_Num047'), sumValue.toLocaleString());
|
||
console.log('Set Results_Num047');
|
||
}
|
||
|
||
if ($('#Results_DescriptionD').val() != JSON.stringify(myTable4a.getJson())) {
|
||
$p.set($('#Results_DescriptionD'), JSON.stringify(myTable4a.getJson()));
|
||
console.log('Set Results_DescriptionD');
|
||
}
|
||
|
||
table6Calc();
|
||
}
|
||
|
||
function table5Calc() {
|
||
if ($('#Results_DescriptionE').val() != JSON.stringify(myTable5a.getJson())) {
|
||
$p.set($('#Results_DescriptionE'), JSON.stringify(myTable5a.getJson()));
|
||
console.log('Set Results_DescriptionE');
|
||
}
|
||
table6Calc();
|
||
}
|
||
|
||
function table6Calc() {
|
||
//console.log('table6Calc');
|
||
let dataA = parseFloat($('#Results_Num045').val().toString().replaceAll(/[¥,]/g, ''));
|
||
let dataB = parseFloat($('#Results_Num046').val().toString().replaceAll(/[¥,]/g, ''));
|
||
let dataC = parseFloat($('#Results_Num047').val().toString().replaceAll(/[¥,]/g, ''));
|
||
let myData5 = myTable5a.getData();
|
||
//D.値引きなど
|
||
let dataD = 0;
|
||
let dataE = 0;
|
||
let dataF = 0;
|
||
let dataG = 0;
|
||
|
||
if (myData5[0][1].toString() != '') {
|
||
dataD = parseFloat(myData5[0][1].toString().replaceAll(/[¥,]/g, ''));
|
||
}
|
||
if (myData5[1][1].toString() != '') {
|
||
dataE = parseFloat(myData5[1][1].toString().replaceAll(/[¥,]/g, ''));
|
||
}
|
||
if (myData5[2][1].toString() != '') {
|
||
dataF = parseFloat(myData5[2][1].toString().replaceAll(/[¥,]/g, ''));
|
||
}
|
||
if (myData5[3][1].toString() != '') {
|
||
dataG = parseFloat(myData5[3][1].toString().replaceAll(/[¥,]/g, ''));
|
||
}
|
||
|
||
let tsubo1 = 0;
|
||
if ($('#Results_Num018').val()) tsubo1 = parseFloat($('#Results_Num018').val().toString().replaceAll(/[¥,]/g, ''));
|
||
let sum1 = dataA + dataB + dataC + dataD;
|
||
let zei1 = Math.floor(sum1 * 0.1);
|
||
let tsubo2 = 0;
|
||
if (tsubo1 > 0) tsubo2 = Math.floor(sum1 / tsubo1);
|
||
let sum2 = sum1 + zei1;
|
||
|
||
let sum3 = sum1 + dataE;
|
||
let zei2 = Math.floor(sum3 * 0.1);
|
||
let dataX = sum3 + zei2;
|
||
|
||
let dataGzei = Math.floor(dataG * 0.1);
|
||
let dataY = dataF + dataG + dataGzei;
|
||
|
||
let allSum = dataX + dataY;
|
||
|
||
myTable6a.setValue('B1', dataA, true);
|
||
myTable6a.setValue('B2', dataB, true);
|
||
myTable6a.setValue('B3', dataC, true);
|
||
myTable6a.setValue('B4', dataD, true);
|
||
myTable6a.setValue('B5', sum1, true);
|
||
myTable6a.setValue('B6', tsubo1, true);
|
||
myTable6a.setValue('B7', tsubo2, true);
|
||
myTable6a.setValue('B8', zei2, true);
|
||
myTable6a.setValue('B9', sum2, true);
|
||
myTable6a.setValue('B10', dataE, true);
|
||
myTable6a.setValue('B11', sum3, true);
|
||
myTable6a.setValue('B12', zei2, true);
|
||
myTable6a.setValue('B13', dataX, true);
|
||
myTable6a.setValue('B14', dataF, true);
|
||
myTable6a.setValue('B15', dataG, true);
|
||
myTable6a.setValue('B16', dataGzei, true);
|
||
myTable6a.setValue('B17', dataY, true);
|
||
myTable6a.setValue('B18', allSum, true);
|
||
|
||
if ($('#Results_Num050').val().toString().replaceAll(/[¥,]/g, '') != sum2) {
|
||
$p.set($('#Results_Num050'), sum2.toLocaleString());
|
||
console.log('Set Results_Num050');
|
||
}
|
||
|
||
if ($('#Results_DescriptionF').val() != JSON.stringify(myTable6a.getJson())) {
|
||
$p.set($('#Results_DescriptionF'), JSON.stringify(myTable6a.getJson()));
|
||
console.log('Set Results_DescriptionF');
|
||
}
|
||
|
||
table7Calc();
|
||
}
|
||
|
||
$p.on('change', 'Num051', function () {
|
||
table7Calc();
|
||
});
|
||
|
||
function table7Calc() {
|
||
let myData5 = myTable5a.getData();
|
||
let myData7 = myTable7a.getData();
|
||
|
||
let ukeoi = parseFloat($('#Results_Num050').val().toString().replaceAll(/[¥,]/g, '')); //請負金額税込
|
||
let dataA = parseFloat(myData7[1][1].toString().replaceAll(/[¥,]/g, '')); //地盤調査費
|
||
let dataB = 0;
|
||
|
||
if (myData5[0][1].toString() != '') {
|
||
dataB = parseFloat(myData5[0][1].toString().replaceAll(/[¥,]/g, '')); //値引き
|
||
}
|
||
|
||
let dataC = parseFloat($('#Results_Num051').val().toString().replaceAll(/[¥,]/g, '')); //太陽光システム請負金額
|
||
let tatemono = parseFloat($('#Results_Num045').val().toString().replaceAll(/[¥,]/g, '')); //太陽光システム請負金額
|
||
|
||
let zeiritsu = parseFloat($('#Results_Num039').val().toString().replaceAll(/[¥,]/g, ''));
|
||
|
||
let dataD = (tatemono + dataA + dataB + dataC) * (1 + zeiritsu / 100);
|
||
let dataX = Math.floor(dataD / 10000);
|
||
let dataY = Math.floor((ukeoi / 10000) * 0.9);
|
||
let dataZ = 0;
|
||
if (dataX > dataY) {
|
||
dataZ = dataY;
|
||
} else {
|
||
dataZ = dataX;
|
||
}
|
||
/*
|
||
Class063
|
||
0,10年
|
||
1,20年
|
||
2,30年
|
||
3,60年
|
||
*/
|
||
//let class063 = $('#Results_Class063').val();
|
||
/*
|
||
let class063;
|
||
|
||
if (typeof myData !== 'undefined') {
|
||
class063 = myData.ClassHash.Class063;
|
||
} else {
|
||
class063 = $('#Results_Class063').val();
|
||
}
|
||
|
||
let kashi = 0;
|
||
|
||
if (class063 != '3') {
|
||
kashi = 2000;
|
||
if ($('#Results_Class064').val() != 0) {
|
||
$p.set($('#Results_Class064'), 0);
|
||
console.log('Set Results_Class064 0');
|
||
}
|
||
|
||
} else {
|
||
if (dataZ < 2000) {
|
||
kashi = 2000;
|
||
if ($('#Results_Class064').val() != 0) {
|
||
$p.set($('#Results_Class064'), 0);
|
||
console.log('Set Results_Class064 0');
|
||
}
|
||
} else if (dataZ <= 3000) {
|
||
kashi = 3000;
|
||
if ($('#Results_Class064').val() != 1) {
|
||
$p.set($('#Results_Class064'), 1);
|
||
console.log('Set Results_Class064 1');
|
||
}
|
||
|
||
} else if (dataZ <= 4000) {
|
||
kashi = 4000;
|
||
if ($('#Results_Class064').val() != 2) {
|
||
$p.set($('#Results_Class064'), 2);
|
||
console.log('Set Results_Class064 2');
|
||
}
|
||
|
||
} else if (dataZ <= 5000) {
|
||
kashi = 5000;
|
||
if ($('#Results_Class064').val() != 3) {
|
||
$p.set($('#Results_Class064'), 3);
|
||
console.log('Set Results_Class064 3');
|
||
}
|
||
|
||
} else if (dataZ > 5000) {
|
||
kashi = 0;
|
||
if ($('#Results_Class064').val() != 4) {
|
||
$p.set($('#Results_Class064'), 4);
|
||
console.log('Set Results_Class064 4');
|
||
}
|
||
}
|
||
}
|
||
*/
|
||
kashi = 2000;
|
||
|
||
myTable7a.setValue('B1', ukeoi, true);
|
||
myTable7a.setValue('B2', dataA, true);
|
||
myTable7a.setValue('B3', dataB, true);
|
||
myTable7a.setValue('B4', dataC, true);
|
||
myTable7a.setValue('B5', dataD, true);
|
||
myTable7a.setValue('B6', dataX, true);
|
||
myTable7a.setValue('B7', dataY, true);
|
||
myTable7a.setValue('B8', dataZ, true);
|
||
myTable7a.setValue('B9', kashi, true);
|
||
myTable7a.setValue('C9', "既定値:2000万円", true);
|
||
|
||
if ($('#Results_DescriptionG').val() != JSON.stringify(myTable7a.getData())) {
|
||
$p.set($('#Results_DescriptionG'), JSON.stringify(myTable7a.getJson()));
|
||
console.log('Set Results_DescriptionG');
|
||
}
|
||
|
||
calcDiffer();
|
||
}
|
||
|
||
function calcDiffer() {
|
||
let ukeoi = parseFloat($('#Results_Num050').val().toString().replaceAll(/[¥,]/g, '')); //請負金額税込
|
||
let shiharai = parseFloat($('#Results_Num040').val().toString().replaceAll(/[¥,]/g, '')); //支払金額税込
|
||
|
||
let diff = 0;
|
||
diff = ukeoi - shiharai;
|
||
//console.log("ukeoi : " + ukeoi);
|
||
//console.log("shiharai : " + shiharai);
|
||
//console.log("diff : " + diff);
|
||
|
||
if (diff != 0) {
|
||
$('#Results_Num053').css({
|
||
'font-size': '1.3em',
|
||
'font-weight': 'bold',
|
||
color: 'red',
|
||
});
|
||
$('#Num053_comments').css('color', 'red');
|
||
$('#Num053_comments').text('差異あり');
|
||
} else {
|
||
$('#Results_Num053').css({
|
||
'font-size': '1em',
|
||
'font-weight': 'normal',
|
||
color: 'black',
|
||
});
|
||
$('#Num053_comments').css('color', 'blue');
|
||
$('#Num053_comments').text('差異なし');
|
||
}
|
||
|
||
if ($('#Results_Num053').val().toString().replaceAll(/[¥,]/g, '') != diff) {
|
||
$p.set($('#Results_Num053'), diff.toLocaleString());
|
||
console.log('Set Results_Num053');
|
||
}
|
||
|
||
}
|
||
|
||
function deleteBlankRow() {
|
||
let myData2 = myTable2a.getData();
|
||
$.each(myData2, function (index, value) {
|
||
let flag = true;
|
||
$.each(value, function (index2, value2) {
|
||
if (value2 != '') {
|
||
flag = false;
|
||
}
|
||
});
|
||
|
||
if (index == myData2.length - 1) flag = false;
|
||
|
||
if (flag) {
|
||
myTable2a.deleteRow(index, 1);
|
||
}
|
||
});
|
||
|
||
let myData3 = myTable3a.getData();
|
||
$.each(myData3, function (index, value) {
|
||
let flag = true;
|
||
$.each(value, function (index2, value2) {
|
||
if (value2 != '') {
|
||
flag = false;
|
||
}
|
||
});
|
||
|
||
if (index == myData3.length - 1) flag = false;
|
||
|
||
if (flag) {
|
||
myTable3a.deleteRow(index, 1);
|
||
}
|
||
});
|
||
}
|
||
|
||
function table1CalcA() {
|
||
let myData1 = myTable1a.getData();
|
||
//console.log(myTable1data);
|
||
|
||
let sumA = [0, 0, 0, 0];
|
||
sumA[0] = parseFloat(myData1[0][2].toString().replaceAll(/[¥,]/g, '')) + parseFloat(myData1[1][2].toString().replaceAll(/[¥,]/g, ''));
|
||
sumA[1] = parseFloat(myData1[2][2].toString().replaceAll(/[¥,]/g, '')) + parseFloat(myData1[3][2].toString().replaceAll(/[¥,]/g, ''));
|
||
sumA[2] = parseFloat(myData1[4][2].toString().replaceAll(/[¥,]/g, '')) + parseFloat(myData1[5][2].toString().replaceAll(/[¥,]/g, ''));
|
||
sumA[3] = parseFloat(myData1[6][2].toString().replaceAll(/[¥,]/g, '')) + parseFloat(myData1[7][2].toString().replaceAll(/[¥,]/g, ''));
|
||
|
||
myTable1a.setValue('G1', sumA[0], true);
|
||
myTable1a.setValue('G3', sumA[1], true);
|
||
myTable1a.setValue('G5', sumA[2], true);
|
||
myTable1a.setValue('G7', sumA[3], true);
|
||
|
||
if ($('#Results_DescriptionA').val() != JSON.stringify(myTable1a.getData())) {
|
||
$p.set($('#Results_DescriptionA'), JSON.stringify(myTable1a.getJson()));
|
||
console.log('Set Results_DescriptionA');
|
||
}
|
||
|
||
let shouhizei = $p.getControl('Num039').val();
|
||
let sum1 = sumA[0] + sumA[1] + sumA[2] + sumA[3];
|
||
let uchizei = sum1 - Math.ceil(sum1 / (1 + shouhizei / 100));
|
||
let sum2 = sum1 - uchizei;
|
||
|
||
if ($('#Results_Num040').val().toString().replaceAll(/[¥,]/g, '') != sum1) {
|
||
$p.set($('#Results_Num040'), sum1.toLocaleString());
|
||
console.log('Set Results_Num040');
|
||
}
|
||
if ($('#Results_Num041').val().toString().replaceAll(/[¥,]/g, '') != uchizei) {
|
||
$p.set($('#Results_Num041'), uchizei.toLocaleString());
|
||
console.log('Set Results_Num041');
|
||
}
|
||
if ($('#Results_Num042').val().toString().replaceAll(/[¥,]/g, '') != sum2) {
|
||
$p.set($('#Results_Num042'), sum2.toLocaleString());
|
||
console.log('Set Results_Num042');
|
||
}
|
||
|
||
calcDiffer();
|
||
}
|
||
|
||
function table1CalcB() {
|
||
let myData1 = myTable1a.getData();
|
||
let dateList = [4];
|
||
dateList[0] = myData1[0][3].toString();
|
||
dateList[1] = myData1[1][3].toString();
|
||
dateList[2] = myData1[2][3].toString();
|
||
dateList[3] = myData1[3][3].toString();
|
||
|
||
if (dateList[0] != '') {
|
||
myTable1a.setValue('E1', '');
|
||
}
|
||
if (dateList[1] != '') {
|
||
myTable1a.setValue('E2', '');
|
||
}
|
||
if (dateList[2] != '') {
|
||
myTable1a.setValue('E3', '');
|
||
}
|
||
if (dateList[3] != '') {
|
||
myTable1a.setValue('E4', '');
|
||
}
|
||
|
||
if ($('#Results_DescriptionA').val() != JSON.stringify(myTable1a.getData())) {
|
||
$p.set($('#Results_DescriptionA'), JSON.stringify(myTable1a.getJson()));
|
||
console.log('Set Results_DescriptionA');
|
||
}
|
||
|
||
calcDiffer();
|
||
}
|
||
|
||
function table1CalcC() {
|
||
let myData1 = myTable1a.getData();
|
||
let dateList = [4];
|
||
dateList[0] = myData1[0][4].toString();
|
||
dateList[1] = myData1[1][4].toString();
|
||
dateList[2] = myData1[2][4].toString();
|
||
dateList[3] = myData1[3][4].toString();
|
||
|
||
if (dateList[0] != '') {
|
||
myTable1a.setValue('D1', '');
|
||
}
|
||
if (dateList[1] != '') {
|
||
myTable1a.setValue('D2', '');
|
||
}
|
||
if (dateList[2] != '') {
|
||
myTable1a.setValue('D3', '');
|
||
}
|
||
if (dateList[3] != '') {
|
||
myTable1a.setValue('D4', '');
|
||
}
|
||
|
||
if ($('#Results_DescriptionA').val() != JSON.stringify(myTable1a.getData())) {
|
||
$p.set($('#Results_DescriptionA'), JSON.stringify(myTable1a.getJson()));
|
||
console.log('Set Results_DescriptionA');
|
||
}
|
||
|
||
calcDiffer();
|
||
}
|
||
|
||
//リードタイム算定表から日付取得
|
||
function createReadTimeTable() {
|
||
let readtime_val = $('#Results_DescriptionR').val();
|
||
if (readtime_val != '') {
|
||
readtime_date = JSON.parse(readtime_val);
|
||
//console.log(readtime_date);
|
||
|
||
}
|
||
|
||
}
|
||
|
||
function InputReadOnly() {
|
||
//console.log($('.code-readonly'));
|
||
let readOnlyList = $('.code-readonly');
|
||
$('.code-readonly').each(function (index, value) {
|
||
//console.log(value.id);
|
||
if ($('label[for="' + value.id + '"')) {
|
||
//console.log(value.id);
|
||
$('label[for="' + value.id + '"').css('pointer-events', 'none');
|
||
}
|
||
});
|
||
}
|
||
|
||
function InputWfColumn() {
|
||
|
||
for (colnum = 124; colnum <= 128; colnum++) {
|
||
InputWfColumnReadOnly1('Class' + colnum);
|
||
InputWfColumnReadOnly1('Date' + colnum);
|
||
InputWfColumnReadOnly3('Description' + colnum);
|
||
|
||
}
|
||
for (colnum = 130; colnum <= 139; colnum++) {
|
||
InputWfColumnReadOnly1('Class' + colnum);
|
||
InputWfColumnReadOnly1('Date' + colnum);
|
||
}
|
||
for (colnum = 150; colnum <= 158; colnum++) {
|
||
InputWfColumnReadOnly1('Class' + colnum);
|
||
InputWfColumnReadOnly1('Date' + colnum);
|
||
}
|
||
for (colnum = 169; colnum <= 170; colnum++) {
|
||
InputWfColumnReadOnly1('Class' + colnum);
|
||
InputWfColumnReadOnly1('Date' + colnum);
|
||
}
|
||
for (colnum = 195; colnum <= 198; colnum++) {
|
||
InputWfColumnReadOnly1('Class' + colnum);
|
||
InputWfColumnReadOnly1('Date' + colnum);
|
||
InputWfColumnReadOnly3('Description' + colnum);
|
||
|
||
}
|
||
|
||
for (colnum = 140; colnum <= 147; colnum++) {
|
||
InputWfColumnReadOnly2('Class' + colnum);
|
||
}
|
||
for (colnum = 160; colnum <= 167; colnum++) {
|
||
InputWfColumnReadOnly2('Class' + colnum);
|
||
}
|
||
|
||
}
|
||
|
||
//項目の読み取り専用設定1
|
||
function InputWfColumnReadOnly1(col) {
|
||
$('#Results_' + col).prop('tabindex', '-1');
|
||
$('#Results_' + col).next().css('display', 'none');
|
||
$('label[for="Results_' + col + '"').css('pointer-events', 'none');
|
||
}
|
||
|
||
//項目の読み取り専用設定2
|
||
function InputWfColumnReadOnly2(col) {
|
||
$('#Results_' + col).prop('tabindex', '-1');
|
||
$('label[for="Results_' + col + '"').css('pointer-events', 'none');
|
||
}
|
||
|
||
//説明項目の読み取り専用設定1
|
||
function InputWfColumnReadOnly3(col) {
|
||
$('#Results_' + col).prop('tabindex', '-1');
|
||
$('#Results_' + col + '\\.viewer').prop('ondblclick', '-1');
|
||
$('#Results_' + col + '\\.editor').css('display', 'none');
|
||
//$('#Results_' + col).css('display', 'block');
|
||
$('#Results_' + col).next().css('display', 'none');
|
||
$('#Results_' + col).next().next().css('display', 'none');
|
||
}
|
||
|
||
$p.ex.readonlyColumn = function () {
|
||
//readonlyクラス Tab移動禁止
|
||
$('.code-readonly').each(function (index, value) {
|
||
//console.log(value.id);
|
||
$('#' + value.id).attr('tabindex', -1);
|
||
$('label[for="' + value.id + '"]').css('pointer-events', 'none');
|
||
});
|
||
|
||
$('.code-readonly2').each(function (index, value) {
|
||
//console.log(value.id);
|
||
$('#' + value.id).attr('tabindex', -1);
|
||
$('label[for="' + value.id + '"]').css('pointer-events', 'none');
|
||
});
|
||
} |