cy
2022-06-21 129904537f66509f97b285e7eb4f42b3dc349dd0
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
[#-- ]
    model:preview预览模式|input输入模式|show展示模式
    row: 报表行
    subRowSize:子项的数量
    column:报表列
    company:COMPANY_INFO信息
    report_date:报表日期
    product:产品模版
    submit_time:填报时间
    data_item:报表指标数据
    data_product:产品数据
    data_reportmain:总数据
    total:合计
    user_model:自用户模式,用于子用户填写报表
[ --]
 
[#macro report model="show" row=[] subRowSize=0 column=[] company={} product=[] data_item={} data_product={} data_reportmain={} total={} report_date="xxxx年xx月" submit_time="XXXX年XX月XX日" 
    user_model="0"
]
 
[#assign company_name=company.COMPANY_NAME!"XXXXXXX有限公司" /]
[#assign person=company.PERSON_NAME!"联系人姓名" /]
[#assign persmon_mobile=company.PERSMON_MOBILE!"联系人电话" /]
<script type="text/javascript" src="${base}/static/plugins/print/LodopFuncs.js"></script>
    <script type="text/javascript">
        
        function printA4(){
            var LODOP; //声明为全局变量 
            LODOP=getLodop();  
            LODOP.PRINT_INIT("报表打印");
            LODOP.ADD_PRINT_HTM("1.0cm","0.5cm","RightMargin:0.9cm","BottomMargin:9mm","<!DOCTYPE>"+document.getElementsByTagName("html")[0].innerHTML);
            LODOP.PREVIEW();
        }
        
        function SaveAsFile(){ 
            LODOP=getLodop();   
            LODOP.PRINT_INIT(""); 
            LODOP.ADD_PRINT_TABLE(100,20,500,80,document.documentElement.innerHTML); 
            LODOP.SET_SAVE_MODE("Orientation",1); //Excel文件的页面设置:横向打印   1-纵向,2-横向;
            LODOP.SET_SAVE_MODE("PaperSize",9);  //Excel文件的页面设置:纸张大小   9-对应A4
            LODOP.SET_SAVE_MODE("Zoom",90);       //Excel文件的页面设置:缩放比例
            LODOP.SET_SAVE_MODE("CenterHorizontally",true);//Excel文件的页面设置:页面水平居中
            LODOP.SET_SAVE_MODE("CenterVertically",true); //Excel文件的页面设置:页面垂直居中
    //        LODOP.SET_SAVE_MODE("QUICK_SAVE",true);//快速生成(无表格样式,数据量较大时或许用到) 
            LODOP.SAVE_TO_FILE("${company_name}-${report_date}.xls"); 
    }
 
    var oldValue = "";    
    //指标变化
    function onZbBlur(input){
        if(input.value != oldValue){
            $.get("${base}/business/companyui/report/onZbBlur.html", {report_id:'${report_id}',name:input.name, vValue: input.value },
              function(data){
                   if(data == 0){ alert('不允许为空');return false; }
                   if(data == 1){ alert('请填入正确的数字');input.value="";input.focus();return false; }
              });
        }
    }
    //产品变化
    function onProductBlur(input){
        if(input.value != oldValue){
            $.get("${base}/business/companyui/report/onProductBlur.html", {report_id:'${report_id}',name:input.name, vValue: input.value },
              function(data){
                   if(data == 0){ alert('不允许为空');return false; }
                   if(data == 1){ alert('请填入正确的数字');input.value="";input.focus();return false; }
              });
        }
    }
    //产品合计变化
    function onProductTotailBlur(input){
        if(input.value != oldValue){
            $.get("${base}/business/companyui/report/onProductTotailBlur.html", {report_id:'${report_id}',name:input.name, vValue: input.value },
              function(data){
                   if(data == 0){ alert('不允许为空');return false; }
                   if(data == 1){ alert('请填入正确的数字');input.value="";input.focus();return false; }
              });
        }
    }
    //问题变化
    function onQuestionBlur(input){
        if(input.value != oldValue){
            $.get("${base}/business/companyui/report/onQuestionBlur.html", {report_id:'${report_id}',vValue: input.value },
              function(data){
                   
              });
        }
    }
    function onZbFocus(input){
        oldValue = input.value;
        input.select();
    }
        
        
        
        
    </script>
<style type="text/css">
body{
    margin:0 auto;
    font: "宋体";
    font-size:14px; 
}
table{
width:190mm;
margin:0px auto;
font:Georgia 11px;
color:#000000;
text-align:center;
border-collapse:collapse;
}
table td{
border:1px solid  #000000;padding:0; margin:0;
}
#nameTr{ border:0px; }
#nameTr td{ border:0px; font-size:14px; }
#titleTr{ border:0px; }
#titleTr td{ border:0px; }
.itemTd{ text-align:left; width:25%; }
input[type="text"] { width:90%; border:0; text-align:right; background-color:#FFFF99; }
textarea { width:90%; height:150px; border:0; text-align:left; background-color:#FFFF99; overflow:hidden; }
</style>
 
<table width="100%" border="0">
  <tr id="titleTr">
    <td colspan="11"><h1>郑州市重点企业月报表</h1></td>
    </tr>
  <tr id="nameTr">
    <td colspan="5" align="left">&nbsp;企业名称:${company_name}</td>
    <td colspan="3" nowrap="nowrap">日期:${report_date}</td>
    <td style="width:8%">&nbsp;</td>
    <td colspan="2" align="right" nowrap="nowrap">单位:万元、%</td>
    </tr>
  <tr>
    <td colspan="3" width="20%">项目</td>
    [#list column as c]
    <td width="10%">${c.COLUMN_NAME}</td>
    [/#list]
  </tr>
  [#assign index=1 /]
  [#list row as r]
  <tr>
  [#if r_index==0]
    <td rowspan="${row?size+subRowSize}" align="center" style="width:5%;"><div style="width:1.5em;text-align:center;">主要经济指标</div></td>
  [/#if]
    <td style="width:5%;">${index}</td>
    <td class="itemTd">${r.ROW_NAME}</td>
    [#list column as c]
    <td>[#if model=="input"]<input type="text" onblur="return onZbBlur(this);" onfocus="return onZbFocus(this);" name="${r.ID}_${c.ID}" value="${data_item[r.ID+'_'+c.ID]}" />[#elseif model=="show"]${data_item[r.ID+'_'+c.ID]}[/#if]</td>
    [/#list]
  </tr>
  
  [#if r.SUBLIST??]
      [#list r.SUBLIST as s]
       [#assign index=index+1 /]
        <tr>
        [#if s_index==0]
        <td style="width:5%;">${index}</td>
        <td class="itemTd">其中:${s.ROW_NAME}</td>
      [#else]
          <td style="width:5%;"></td>
        <td class="itemTd" style="Text-indent:3em;">${s.ROW_NAME}</td>
      [/#if]
        [#list column as c]
        <td>[#if model=="input"]<input onblur="return onZbBlur(this);" onfocus="return onZbFocus(this);" type="text" name="${s.ID}_${c.ID}" value="${data_item[s.ID+'_'+c.ID]}" />[#elseif model=="show"]${data_item[s.ID+'_'+c.ID]}[/#if]</td>
        [/#list]
      </tr>
     [/#list]
  [/#if]
  [#assign index=index+1 /]
  [/#list]
  
  [#if user_model=="0" || entity.isHasProductPermission()]
  [#list product as d]
  <tr>
  [#if d_index == 0]
    <td rowspan="${product?size+1}" align="center" ><div style="width:1.5em;text-align:center;">主要产品产量</div></td>
  [/#if]
    <td>${d_index+1}</td>
    <td align="left"><input type="hidden" name="product" value="${d.ID}" />${d.PRODUCT_NAME}</td>
        [#list column as c]
        <td>[#if model=="input"]<input onblur="return onProductBlur(this);" onfocus="return onZbFocus(this);" type="text" name="product_${d.ID}_${c.ID}" value="${data_product[d.ID+'_'+c.ID]}" />[#elseif model=="show"]${data_product[d.ID+'_'+c.ID]}[/#if]</td>
        [/#list]
  </tr>
  [/#list]
  <tr>
    <td colspan="2" align="right">产量合计:</td>
        [#list column as c]
        <td>[#if model=="input"]<input onblur="return onProductTotailBlur(this);" onfocus="return onZbFocus(this);" type="text" name="total_${c.ID}" value="${total[c.ID]}" />[#elseif model=="show"]${total[c.ID]}[/#if]</td>
        [/#list]
  </tr>
   [/#if]
   [#if user_model=="0" || entity.isHasQuestionPermission()]
  <tr>
    <td align="center" style="height:150px;" ><div style="width:1.5em;text-align:center;">面临的主要问题</div></td>
    <td colspan="${column?size+2}" align="left">
        [#if model=="input"]<textarea onblur="return onQuestionBlur(this);" onfocus="return onZbFocus(this);" name="beiz" id="beiz" cols="45" rows="4" style="width:100%">${data_reportmain.QUESTION}</textarea>[#elseif model=="show"]${StringUtil.str2Html(data_reportmain.QUESTION)}[/#if]
    </td>
  </tr>
   [/#if]
    <tr id="nameTr">
    <td colspan="4" align="left">&nbsp;联系人:${person}</td>
    <td style="width:8%">&nbsp;</td>
    <td colspan="3" nowrap="nowrap">电话:${persmon_mobile}</td>
    <td style="width:8%">&nbsp;</td>
    <td colspan="2" align="right" nowrap="nowrap">填表时间:${submit_time}</td>
    </tr>
</table>
[/#macro]