var datagrid;
var SBGridProperties = {};
var grid_data=[
{"col0": "수입","col1": "매출","col2": "음식판매수입","col3": "10160","col4": "20160","col5": "1670","col6": "250","col7": "750","col8": "650","col9": "950","col10": "750.00","col11": "35000"},
{"col0": "수입","col1": "매출","col2": "농산물판매수입","col3": "10170","col4": "20170","col5": "1680","col6": "260","col7": "760","col8": "660","col9": "960","col10": "760.00","col11": "10000"},
{"col0": "수입","col1": "매출","col2": "농산물가공수입","col3": "10180","col4": "20180","col5": "1690","col6": "270","col7": "770","col8": "670","col9": "970","col10": "770.00","col11": "50000"},
{"col0": "수입","col1": "매출","col2": "기타수입","col3": "10190","col4": "20190","col5": "1700","col6": "280","col7": "780","col8": "680","col9": "980","col10": "780.00","col11": "65000"},
{"col0": "수입","col1": "영업외수입","col2": "이자수입","col3": "10200","col4": "20200","col5": "1710","col6": "290","col7": "790","col8": "690","col9": "990","col10": "790.00","col11": "35000"},
{"col0": "지출","col1": "매출원가","col2": "체험재료비","col3": "10210","col4": "20210","col5": "1720","col6": "300","col7": "800","col8": "700","col9": "815","col10": "800.00","col11": "35000"},
{"col0": "지출","col1": "매출원가","col2": "체험인건비","col3": "10220","col4": "20220","col5": "1730","col6": "310","col7": "810","col8": "710","col9": "825","col10": "810.00","col11": "15000"},
{"col0": "지출","col1": "판매관리비","col2": "급여","col3": "10230","col4": "20230","col5": "1740","col6": "320","col7": "820","col8": "720","col9": "915","col10": "820.00","col11": "20000"},
{"col0": "지출","col1": "판매관리비","col2": "보험료","col3": "10240","col4": "20240","col5": "1750","col6": "330","col7": "830","col8": "730","col9": "925","col10": "830.00","col11": "55000"},
{"col0": "지출","col1": "판매관리비","col2": "복리후생","col3": "10250","col4": "20250","col5": "1760","col6": "340","col7": "840","col8": "740","col9": "790","col10": "840.00","col11": "45000"},
];
function createGrid(){
SBGridProperties.parentid = 'SBGridArea';
SBGridProperties.id = 'datagrid';
SBGridProperties.jsonref = 'grid_data';
SBGridProperties.rowheader = 'seq';
SBGridProperties.selectmode = 'free';
SBGridProperties.mergecells = 'bycol';
SBGridProperties.grouptotal = {
position: 'bottom',
columns: {
standard: [1, 2],
percent: [4],
sum: [5],
count: [3],
avg: [6]
},
subtotalrow: {
titlecol: 1,
titlevalue: '@ 소계',
style: 'background-color: #FDEBD0 ; font-weight: bold; color: #000;',
stylestartcol: 0
},
totalformat: {
3: '#,### 개',
5: '#,###.## 원',
}
};
SBGridProperties.columns = [
{caption : ['구분'], ref : "col0", width : '100px', style : 'text-align:center', type : 'input'},
{caption : ['분류'], ref : "col1", width : '100px', style : 'text-align:center', type : 'input'},
{caption : ['항목'], ref : "col2", width : '150px', style : 'text-align:center', type : 'input'},
{caption : ['1월'], ref : "col3", width : '100px', style : 'text-align:right', type : 'input', format : { type:'number' , rule:'#,##0.00' }, merge:false},
{caption : ['2월'], ref : "col4", width : '100px', style : 'text-align:right', type : 'input', format : { type:'number' , rule:'#,##0.00' }, merge:false},
{caption : ['3월'], ref : "col5", width : '100px', style : 'text-align:right', type : 'input', format : { type:'number' , rule:'#,##0.00' }, merge:false},
{caption : ['4월'], ref : "col6", width : '100px', style : 'text-align:right', type : 'input', format : { type:'number' , rule:'#,##0.00' }, merge:false},
{caption : ['5월'], ref : "col7", width : '100px', style : 'text-align:right', type : 'input', format : { type:'number' , rule:'#,##0.00' }, merge:false},
{caption : ['6월'], ref : "col8", width : '100px', style : 'text-align:right', type : 'input', format : { type:'number' , rule:'#,##0.00' }, merge:false},
{caption : ['7월'], ref : "col9", width : '100px', style : 'text-align:right', type : 'input', format : { type:'number' , rule:'#,##0.00' }, merge:false},
{caption : ['8월'], ref : "col10", width : '100px', style : 'text-align:right', type : 'input', format : { type:'number' , rule:'#,##0.00' }, merge:false},
{caption : ['9월'], ref : "col11", width : '100px', style : 'text-align:right', type : 'input', format : { type:'number' , rule:'#,##0.00' }, merge:false}
];
datagrid = _SBGrid.create(SBGridProperties);
let groupTotalInfo = { // 해당 정보를 파라미터로 사용 -> datagrid.setGroupTotal(groupTotalInfo);
position: 'bottom',
columns: {
standard: [1, 2],
percent: [4],
sum: [5],
count: [3],
avg: [6]
},
subtotalrow: {
titlecol: 1,
titlevalue: '@ 소계',
style: 'background-color: #FDEBD0 ; font-weight: bold; color: #000;',
stylestartcol: 0
},
totalformat: {
3: '#,### 개',
5: '#,###.## 원',
}
}