BemsWebApplication.DailyReport = function (params, viewInfo) {
'use strict';
var CmBusinessFieldDataSource = BemsWebApplication.db.createDataSource('CmBusinessField');
var CmUserDataSource = BemsWebApplication.db.createDataSource('CmUser');
var SiteId = BWA.UserInfo.SiteId();
var ELECTRICITY = $Code.FacilityType.ELECTRICITY;
var GAS = $Code.FacilityType.GAS;
var style = 'class="jh-width-2-10 jh-multi-line-item" style="width:231px;height:35px;text-align:right"';
var colorstyle = 'class="jh-width-2-10 jh-multi-line-item" style="width:231px;height:35px;background-color:#FFFFCC;text-align:right"';
var borderstyle = "1px solid #CCCCCC";
var endpointSelector = "";
if (BemsWebApplication.config.mode == "production") {
endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.production;
} else {
endpointSelector = new DevExpress.EndpointSelector(BemsWebApplication.config.endpoints).config.db.local;
}
var isVisibleApproalButton = ko.observable(false);
var Datecnt = 0, changeDate = false;
var WATER = $Code.FacilityType.WATER;
var MainFormulaId = 1;
var init;
var temptotalcnt = 0, temptempcnt = 0;
var fuelarray = new Array(ELECTRICITY, GAS, WATER);
var fueltotalarray = new Array(3);
var BemsFormulaDataSource = BemsWebApplication.db.createDataSource('BemsFormula');
var BemsFormulaParameterDataSource = BemsWebApplication.db.createDataSource('BemsFormulaParameter');
var BemsMonitoringPointDataSource = BemsWebApplication.db.createDataSource('BemsMonitoringPoint');
var click = false;
var BusinessFieldArray;
var MaterialCodeClassDataSource = BemsWebApplication.db.createDataSource('FmsMaterialCodeClass');
var materialClass = ko.observableArray();
var materialClassForSearch = ko.observableArray();
var week = new Array('일', '월', '화', '수', '목', '금', '토');
var eq = BWA.DataUtil.constructEqualFilter, and = BWA.DataUtil.andFilter;
var popupGridInfo = {
'gridContainerCommon': 'workCommon',
'gridContainerMaterialUsage': 'fmsMaterial'
};
var tempseq = BemsWebApplication.config.Report.BusinessFieldSeq.Value;
var tempseqEnable = BemsWebApplication.config.Report.BusinessFieldSeq.Enable;
var tempApprove = BemsWebApplication.config.Report.UserSeq.Value;
var tempApproveEnable = BemsWebApplication.config.Report.UserSeq.Enable;
var businessFieldId = BWA.UserInfo.BusinessFieldId();
var commonbusinessFieldId;
var filter = [
eq('SiteId', SiteId),
];
var dataSourceOptions = {
select: [
'SiteId',
'DailyReportId',
'Name',
'Contents',
'RegisterUserId',
'AddDate',
'ApproverUserId',
'ApproveDate',
'ApproverUserId2',
'ApproveDate2',
'ApproverUserId3',
'ApproveDate3',
'ApproverUserId4',
'ApproveDate4',
'ApproverUserId5',
'ApproveDate5',
'CmUser/Name', // 등록자
'BusinessFieldId',
'CmBusinessField/Name',
'Datas',
],
expand: [
'CmUser', 'CmBusinessField'
],
extendOptions: {
forceOriginalField: true
},
filter: filter
};
var viewModel = self.viewModel = BWA.DataGrid.createViewWithDataGrid(params, viewInfo, 'FmsDailyReport', {
dataSourceOptions: dataSourceOptions,
columns: [
{ dataField: 'DailyReportId', caption: '번호', width: '8%', alignment: 'center', allowFiltering: false },
{ dataField: 'CmBusinessField/Name', caption: $G('businessFieldName'), width: '8%', alignment: 'center', visible: false },
{ dataField: 'Name', caption: '제목', width: '52%', alignment: 'center' },
{ dataField: 'CmUser/Name', caption: '등록자', width: '10%', alignment: 'center' },
{
dataField: 'AddDate', caption: '보고일', width: '10%', alignment: 'center', sortOrder: 'desc',
customizeText: function (cellInfo) {
return $G.date(cellInfo.value);
}
},
{ dataField: 'ApproverUserId', caption: '결재자', width: '10%', alignment: 'center', visible: false },
//{
// dataField: 'ApproveDate', caption: '결재일', width: '10%', alignment: 'center', visible: false,
// customizeText: function (cellInfo) {
// return $G.date(cellInfo.value);
// }
//},
{ dataField: 'ApproverUserId2', caption: '결재자2', width: '10%', alignment: 'center', visible: false },
//{
// dataField: 'ApproveDate2', caption: '결재일2', width: '10%', alignment: 'center', visible: false,
// customizeText: function (cellInfo) {
// return $G.date(cellInfo.value);
// }
//},
{ dataField: 'ApproverUserId3', caption: '결재자3', width: '10%', alignment: 'center', visible: false },
//{
// dataField: 'ApproveDate3', caption: '결재일3', width: '10%', alignment: 'center', visible: false,
// customizeText: function (cellInfo) {
// return $G.date(cellInfo.value);
// }
//},
{ dataField: 'ApproverUserId4', caption: '결재자4', width: '10%', alignment: 'center', visible: false },
//{
// dataField: 'ApproveDate4', caption: '결재일4', width: '10%', alignment: 'center', visible: false,
// customizeText: function (cellInfo) {
// return $G.date(cellInfo.value);
// }
//},
{ dataField: 'ApproverUserId5', caption: '결재자5', width: '10%', alignment: 'center', visible: false },
//{
// dataField: 'ApproveDate5', caption: '결재일5', width: '10%', alignment: 'center', visible: false,
// customizeText: function (cellInfo) {
// return $G.date(cellInfo.value);
// }
//}
],
searchViewItems: [
{ id: 'Name' },
{ id: 'AddDate', type: 'dateRange', isOnlyDate: true },
],
handleAfterLoadingModelByKey: function (data, dataViewModel, isNewInPopup) {
},
handleDataGridRowClick: function (id, dataGrid, clickRow, popupVisible) {
click = true;
dataGrid.clearSelection();
var data = clickRow.data;
var dataModel = viewModel.dataModel;
self.businessFieldId = data.BusinessFieldId();
dataModel.DailyReportId(data.DailyReportId());
popupVisible(true);
if (tempApproveEnable) {
var temp = tempApprove.split(';')
for (var i = 0; i < temp.length; i++) {
if (temp[i] == BWA.UserInfo.UserId()) {
switch (i) {
case 0:
if (data.ApproverUserId() == null) {
isVisibleApproalButton(true);
viewModel.visibleEditButton(true);
}
else {
isVisibleApproalButton(false);
viewModel.visibleEditButton(false);
}
break;
case 1:
if (data.ApproverUserId2() == null) {
isVisibleApproalButton(true);
viewModel.visibleEditButton(true);
}
else {
isVisibleApproalButton(false);
viewModel.visibleEditButton(false);
}
break;
case 2:
if (data.ApproverUserId3() == null) {
isVisibleApproalButton(true);
viewModel.visibleEditButton(true);
}
else {
isVisibleApproalButton(false);
viewModel.visibleEditButton(false);
}
break;
case 3:
if (data.ApproverUserId4() == null) {
isVisibleApproalButton(true);
viewModel.visibleEditButton(true);
}
else {
isVisibleApproalButton(false);
viewModel.visibleEditButton(false);
}
break;
case 4:
if (data.ApproverUserId5() == null) {
isVisibleApproalButton(true);
viewModel.visibleEditButton(true);
}
else {
isVisibleApproalButton(false);
viewModel.visibleEditButton(false);
}
break;
}
break;
}
}
}
else {
if (data.ApproverUserId() == null) {
isVisibleApproalButton(true);
viewModel.visibleEditButton(true);
}
else {
isVisibleApproalButton(false);
viewModel.visibleEditButton(false);
}
}
},
handleViewShowing: function (dataModel) {
for (var i = 0; i < 3; i++) {
BemsFormulaDataSource.filter([
['SiteId', '=', SiteId],
'and',
['FacilityTypeId', '=', fuelarray[i]],
'and',
['FormulaId', '=', MainFormulaId]
]);
$.when(
BemsFormulaDataSource.load()
).done(function (result) {
var FacilityCode = result[0].FacilityCode();
BemsFormulaParameterDataSource.filter([
['SiteId', '=', SiteId],
'and',
['FacilityCode', '=', FacilityCode],
'and',
['FormulaId', '=', MainFormulaId]
]);
$.when(
BemsFormulaParameterDataSource.load()
).done(function (result1) {
for (var i = 0; i < fuelarray.length; i++) {
if (fuelarray[i] == result1[0].FacilityTypeId()) {
fueltotalarray[i] = new Array(result1.length);
break;
}
}
var ParameterResult = new Array(result1.length);
for (var i = 0; i < result1.length; i++) {
ParameterResult[i] = {
ParameterFacilityCode: result1[i].ParameterFacilityCode(),
ParameterPropertyId: result1[i].ParameterPropertyId()
}
}
var cnt = 0;
for (var i = 0; i < result1.length; i++) {
BemsMonitoringPointDataSource.filter([
['SiteId', '=', SiteId],
'and',
['FacilityCode', '=', ParameterResult[i].ParameterFacilityCode],
'and',
['PropertyId', '=', ParameterResult[i].ParameterPropertyId]
]);
$.when(
BemsMonitoringPointDataSource.load()
).done(function (result3) {
fueltotalarray[result3[0].FuelTypeId() - 1][cnt] = {
FacilityCode: result3[0].FacilityCode(),
PropertyId: result3[0].PropertyId(),
Name: result3[0].Name(),
FuelTypeId: result3[0].FuelTypeId(),
Today: 0,
Daybefore: 0,
Dailyusage: 0
}
cnt++
});
}
});
});
}
CmBusinessFieldDataSource.filter([
['SiteId', '=', SiteId],
'and',
['IsUse', '=', true]
]);
$.when(
CmBusinessFieldDataSource.load()
).done(function (result) {
BusinessFieldArray = new Array(result.length);
commonbusinessFieldId = result[0].BusinessFieldId();
if (tempseqEnable == false) {
for (var i = 0; i < result.length; i++) {
BusinessFieldArray[i] = {
BusinessFieldId: result[i].BusinessFieldId,
BusinessFieldName: result[i].Name
}
}
}
else {
var tempseqsplit = tempseq.split(';');
for (var i = 0; i < tempseqsplit.length; i++) {
for (var j = 0; j < result.length; j++) {
if (parseInt(tempseqsplit[i]) == result[j].BusinessFieldId()) {
BusinessFieldArray[i] = {
BusinessFieldId: result[j].BusinessFieldId,
BusinessFieldName: result[j].Name
}
break;
}
}
}
}
});
MaterialCodeClassDataSource.filter([
['SiteId', '=', SiteId]
]);
$.when(
MaterialCodeClassDataSource.load()
).done(function (Result) {
materialClass = ko.observableArray();
var cnt = 0;
for (var i = 0; i < Result.length; i++) {
materialClass.push(Result[i]);
}
materialClassForSearch($SearchView.createArrayOfSelectBox('MaterialClassId', materialClass()));
});
// 계속 push되는 현상을 막기위해 필터 초기화
//dataSourceOptions.filter.splice(0, dataSourceOptions.filter.length);
//dataSourceOptions.filter.push([eq('SiteId', SiteId)]);
},
handlePopupShowing: function (isNewInPopup, dataViewModel) {
Datecnt = 0;
var $BusinessDataCommon = $('#BusinessDataCommon'); // finds the
'); result = result.replace(/\?-/g, " -"); container.append($('
' + new Date(tempdate[i]).format("yyyy-MM-dd") + " - " + result + '
')); //container.append($('' + new Date(tempdate[i]).format("yyyy-MM-dd") + " - " + temptext[i] + '
')); } } } } }); } else { var grid = handleGridViewInPopup(gridId, { dataSource: getDataSource(gridId)(), columns: getColumns(gridId), }); } grid.refresh(); } function getColumns(gridId) { if (gridId.substring(13, 19) == 'Common') { return [ { dataField: 'No', caption: '번호', width: '5%', alignment: 'center' }, { dataField: 'WorkTypeId', caption: '작업구분', width: '7%', alignment: 'center' }, { dataField: 'RequestDate', caption: '민원접수일시', width: '20%', alignment: 'center', dataType: 'date', format: 'yyyy-MM-dd HH:mm', visible: false }, { dataField: 'WorkProgressId', caption: '작업상태', width: '8%', alignment: 'center' }, { dataField: 'Title', caption: '작업명', width: '80%', alignment: 'center' } ]; } else { return [ { dataField: 'No', caption: '번호', width: '5%', alignment: 'center', allowFiltering: false }, { dataField: 'ReleaseType', caption: '출고구분', width: '7%', alignment: 'center' }, { dataField: 'FirstClassId', caption: '자재(대)', width: '8%', alignment: 'center', customizeText: function (cellInfo) { for (var i = 1; i < materialClassForSearch().length; i++) { if (materialClassForSearch()[i].MaterialClassId() == cellInfo.value) { return materialClassForSearch()[i].Name(); } } } }, { dataField: 'SecondClassId', caption: '자재(중)', width: '8%', alignment: 'center', customizeText: function (cellInfo) { for (var i = 1; i < materialClassForSearch().length; i++) { if (materialClassForSearch()[i].MaterialClassId() == cellInfo.value) { return materialClassForSearch()[i].Name(); } } } }, { dataField: 'ThirdClassId', caption: '자재(소)', width: '8%', alignment: 'center', customizeText: function (cellInfo) { for (var i = 1; i < materialClassForSearch().length; i++) { if (materialClassForSearch()[i].MaterialClassId() == cellInfo.value) { return materialClassForSearch()[i].Name(); } } } }, { dataField: 'MaterialCode', caption: '자재코드', width: '17%', alignment: 'center', visible: false }, { dataField: 'MaterialName', caption: '자재명', width: '17%', alignment: 'center' }, { dataField: 'Standard', caption: '규격', width: '18%', alignment: 'center' }, { dataField: 'WorkName', caption: '작업명', width: '19%', alignment: 'center' }, { dataField: 'Unit', caption: '단위', width: '5%', alignment: 'center' }, { dataField: 'MaterialCount', caption: '수량', width: '5%', alignment: 'center', allowFiltering: false, format: 'currency' }, { dataField: 'WorkerName', caption: '작업자', width: '10%', alignment: 'center', allowFiltering: false, visible: false }, ]; } } function EnergyDataTable() { var TodayDate = new Date(viewModel.dataModel.AddDate()); var tempcnt = 0; var FacilityCode = 0, PropertyId = 0; var Today = 0, Daybefore = 0, Dailyusage = 0, Monthusage = 0; for (var i = 0; i < 3; i++) { tempcnt += fueltotalarray[i].length; } var datacnt = 0; var EnergtDate = new Array(tempcnt); for (var i = 0; i < tempcnt; i++) { if (i < fueltotalarray[0].length) { EnergtDate[i] = { Name: fueltotalarray[0][i].Name, Fuel: fueltotalarray[0][i].FuelTypeId, FacilityCode: fueltotalarray[0][i].FacilityCode, PropertyId: fueltotalarray[0][i].PropertyId, Today: 0, Daybefore: 0, Dailyusage: 0, Monthusage: 0 } } else if (i < fueltotalarray[0].length + fueltotalarray[1].length) { EnergtDate[i] = { Name: fueltotalarray[1][i - fueltotalarray[0].length].Name, Fuel: fueltotalarray[1][i - fueltotalarray[0].length].FuelTypeId, FacilityCode: fueltotalarray[1][i - fueltotalarray[0].length].FacilityCode, PropertyId: fueltotalarray[1][i - fueltotalarray[0].length].PropertyId, Today: 0, Daybefore: 0, Dailyusage: 0, Monthusage: 0 } } else { EnergtDate[i] = { Name: fueltotalarray[2][i - (fueltotalarray[0].length + fueltotalarray[1].length)].Name, Fuel: fueltotalarray[2][i - (fueltotalarray[0].length + fueltotalarray[1].length)].FuelTypeId, FacilityCode: fueltotalarray[2][i - (fueltotalarray[0].length + fueltotalarray[1].length)].FacilityCode, PropertyId: fueltotalarray[2][i - (fueltotalarray[0].length + fueltotalarray[1].length)].PropertyId, Today: 0, Daybefore: 0, Dailyusage: 0, Monthusage: 0 } } } for (var i = 0; i < EnergtDate.length; i++) { var dataSource = new DevExpress.data.DataSource({ //금일 store: new DevExpress.data.ODataStore({ url: endpointSelector + "/BemsMonitoringPointHistory15minRawData" }), requireTotalCount: true, pageSize: 1 }); dataSource.filter([ ["SiteId", "=", SiteId], "and", ["CreatedDateTime", ">=", new Date(TodayDate.getFullYear(), TodayDate.getMonth(), TodayDate.getDate(), 0, 0, 0)], "and", ["CreatedDateTime", "<=", new Date(TodayDate.getFullYear(), TodayDate.getMonth(), TodayDate.getDate(), 23, 59, 59)], "and", ["FacilityCode", "=", EnergtDate[i].FacilityCode], "and", ["PropertyId", "=", EnergtDate[i].PropertyId], ]); dataSource.sort({ getter: "CreatedDateTime", desc: true }); dataSource.load() .done(function (result) { if (result != null && result.length != 0) { for (var i = 0; i < EnergtDate.length; i++) { if (result[0].FacilityCode == EnergtDate[i].FacilityCode && result[0].PropertyId == EnergtDate[i].PropertyId) { EnergtDate[i].Today = result[0].CurrentValue; break; } } var dataSource1 = new DevExpress.data.DataSource({ //전일 store: new DevExpress.data.ODataStore({ url: endpointSelector + "/BemsMonitoringPointHistory15minRawData" }), requireTotalCount: true, pageSize: 1 }); dataSource1.filter([ ["SiteId", "=", SiteId], "and", ["CreatedDateTime", ">=", new Date(TodayDate.getFullYear(), TodayDate.getMonth(), TodayDate.getDate() - 1, 0, 0, 0)], "and", ["CreatedDateTime", "<=", new Date(TodayDate.getFullYear(), TodayDate.getMonth(), TodayDate.getDate() - 1, 23, 59, 59)], "and", ["FacilityCode", "=", EnergtDate[i].FacilityCode], "and", ["PropertyId", "=", EnergtDate[i].PropertyId], ]); dataSource1.sort({ getter: "CreatedDateTime", desc: true }); dataSource1.load() .done(function (result1) { if (result1 != null) { for (var i = 0; i < EnergtDate.length; i++) { if (result1[0].FacilityCode == EnergtDate[i].FacilityCode && result1[0].PropertyId == EnergtDate[i].PropertyId) { EnergtDate[i].Daybefore = result1[0].CurrentValue; EnergtDate[i].Dailyusage = EnergtDate[i].Today - result1[0].CurrentValue; break; } } var dataSource2 = new DevExpress.data.DataSource({ //월사용량 store: new DevExpress.data.ODataStore({ url: endpointSelector + "/BemsMonitoringPointHistoryDaily" }), requireTotalCount: true, pageSize: 31 }); dataSource2.filter([ ["SiteId", "=", SiteId], "and", ["CreatedDateTime", ">=", new Date(TodayDate.getFullYear(), TodayDate.getMonth(), 1, 0, 0, 0)], "and", ["CreatedDateTime", "<", new Date(TodayDate.getFullYear(), TodayDate.getMonth(), TodayDate.getDate() + 1, 0, 0, 0)], "and", ["FacilityCode", "=", EnergtDate[i].FacilityCode], "and", ["PropertyId", "=", EnergtDate[i].PropertyId], ]); dataSource2.sort({ getter: "CreatedDateTime", desc: true }); dataSource2.load() .done(function (result2) { var temp = 0; datacnt = datacnt + 1; if (result2 != null) { for (var j = 0; j < result2.length; j++) { temp += result2[j].DailyValue } for (var i = 0; i < EnergtDate.length; i++) { if (result2[0].FacilityCode == EnergtDate[i].FacilityCode && result2[0].PropertyId == EnergtDate[i].PropertyId) { EnergtDate[i].Monthusage = temp; break; } } } if (datacnt == EnergtDate.length) { var dataModel = viewModel.dataModel; var powerToday = 0, powerDaybefore = 0, powerDailyusage = 0, powerMonthusage = 0; var gasToday = 0, gasDaybefore = 0, gasDailyusage = 0, gasMonthusage = 0; var waterToday = 0, waterDaybefore = 0, waterDailyusage = 0, waterMonthusage = 0; var fuelcnt = 0; var power = 0, gas = 0, water = 0; for (var i = 0; i < EnergtDate.length; i++) { switch (EnergtDate[i].Fuel) { case 1: power++; break; case 2: gas++; break; case 3: water++; break; } if (EnergtDate[i].Fuel != 3) { var tempnum = i + 1; dataModel['resultEnergy' + tempnum + 'Today'](numberWithCommas(EnergtDate[i].Today.toFixed(2))); dataModel['resultEnergy' + tempnum + 'Daybefore'](numberWithCommas(EnergtDate[i].Daybefore.toFixed(2))); dataModel['resultEnergy' + tempnum + 'Dailyusage'](numberWithCommas(EnergtDate[i].Dailyusage.toFixed(2))); dataModel['resultEnergy' + tempnum + 'Monthusage'](numberWithCommas(EnergtDate[i].Monthusage.toFixed(2))); } else { waterToday += EnergtDate[i].Today; waterDaybefore += EnergtDate[i].Daybefore; waterDailyusage += EnergtDate[i].Dailyusage; waterMonthusage += EnergtDate[i].Monthusage; } } if (power != 0) { fuelcnt++; for (var j = 0; j < power; j++) { powerToday += EnergtDate[j].Today; powerDaybefore += EnergtDate[j].Daybefore; powerDailyusage += EnergtDate[j].Dailyusage; powerMonthusage += EnergtDate[j].Monthusage; } dataModel['resultEnergytotal' + fuelcnt + 'Today'](numberWithCommas(powerToday.toFixed(2))); dataModel['resultEnergytotal' + fuelcnt + 'Daybefore'](numberWithCommas(powerDaybefore.toFixed(2))); dataModel['resultEnergytotal' + fuelcnt + 'Dailyusage'](numberWithCommas(powerDailyusage.toFixed(2))); dataModel['resultEnergytotal' + fuelcnt + 'Monthusage'](numberWithCommas(powerMonthusage.toFixed(2))); } if (gas != 0) { fuelcnt++; for (var j = power; j < power + gas; j++) { gasToday += EnergtDate[j].Today; gasDaybefore += EnergtDate[j].Daybefore; gasDailyusage += EnergtDate[j].Dailyusage; gasMonthusage += EnergtDate[j].Monthusage; } dataModel['resultEnergytotal' + fuelcnt + 'Today'](numberWithCommas(gasToday.toFixed(2))); dataModel['resultEnergytotal' + fuelcnt + 'Daybefore'](numberWithCommas(gasDaybefore.toFixed(2))); dataModel['resultEnergytotal' + fuelcnt + 'Dailyusage'](numberWithCommas(gasDailyusage.toFixed(2))); dataModel['resultEnergytotal' + fuelcnt + 'Monthusage'](numberWithCommas(gasMonthusage.toFixed(2))); } if (water != 0) { fuelcnt++; dataModel['resultEnergytotal' + fuelcnt + 'Today'](numberWithCommas(waterToday.toFixed(2))); dataModel['resultEnergytotal' + fuelcnt + 'Daybefore'](numberWithCommas(waterDaybefore.toFixed(2))); dataModel['resultEnergytotal' + fuelcnt + 'Dailyusage'](numberWithCommas(waterDailyusage.toFixed(2))); dataModel['resultEnergytotal' + fuelcnt + 'Monthusage'](numberWithCommas(waterMonthusage.toFixed(2))); } } }).fail(function (error) { utils.toast.show("[BemsMonitoringPointHistoryDaily] 월 사용량 정보를 읽어올수 없습니다."); }); } }).fail(function (error) { utils.toast.show("[BemsMonitoringPointHistoryDaily] 전일 정보를 읽어올수 없습니다."); }); } }).fail(function (error) { utils.toast.show("[BemsMonitoringPointHistoryDaily] 금일 정보를 읽어올수 없습니다."); }); } } function numberWithCommas(x) { return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); } function getDataSource(gridId) { var urlId = popupGridInfo[gridId]; if (self.viewModel.dataModel['resultWorkCommon']() != null) { if (self.viewModel.dataModel['resultWorkCommon']().length == 0) { $("#componentcommon").hide(); } else { $("#componentcommon").show(); } if (self.viewModel.dataModel['resultFmsMaterial']().length == 0) { $("#componentmaterial").hide(); } else { $("#componentmaterial").show(); } } for (var i = 1; i < BusinessFieldArray.length; i++) { if (self.viewModel.dataModel['resultWorkCommon' + i]() != null) { if (self.viewModel.dataModel['resultWorkCommon' + i]().length == 0) { $("#componentcommon" + i).hide(); } else { $("#componentcommon" + i).show(); } } if (self.viewModel.dataModel['resultFmsMaterial' + i]() != null) { if (self.viewModel.dataModel['resultFmsMaterial' + i]().length == 0) { $("#componentmaterial" + i).hide(); } else { $("#componentmaterial" + i).show(); } } } return self.viewModel.dataModel['result' + initCap(urlId)]; } function handleGridViewInPopup(gridId, options) { var mode = 'single'; $.extend(options, { pager: { visible: false }, selection: { mode: mode } }); return $("#" + gridId).dxDataGrid(utils.datagrid.defaultOptions(options)).dxDataGrid("instance"); }; viewModel.dataModel.ReportUrl = ko.observable(); viewModel.DateChange = DateChange; return viewModel; };