EXT.NET複雜佈局(二)——報表
前面提到過工作臺(《EXT.NET複雜佈局(一)——工作臺》)了,不知道各位看過之後有什麼感想。這次就介紹介紹使用EXT.NET畫幾個報表。
看圖寫作從小學就開始了,如圖:
圖一
圖二
圖三(1)
圖三(2)
各位看官,不要以為這報表畫起來很難,其實使用EXT.NET來畫的話,還是挺簡單方便的。
1)下面就從圖一開始。
這個報表實現,本人採用的是最原始的手寫程式碼(之所以這麼說,是因為沒怎麼偷懶,老老實實的寫的,因為這是剛接觸EXT.NET的時候畫的)
先上程式碼,然後再說話吧。其實註釋挺全的,所以也不需要說什麼話了:
?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 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
<%@ Register Assembly= "Ext.Net"
Namespace= "Ext.Net"
TagPrefix= "ext"
%>
<style type= "text/css" >
.total-field
{
background-color: #fff;
font-weight: bold !important;
color: #000;
border: solid 1px silver;
padding: 2px;
margin-right: 5px;
}
.headRows1
{
color: Green;
font-weight: bolder; }
.headRows2
{
color: Blue;
font-weight: bolder;
}
</style>
<script type= "text/javascript" >
function getYear()
{
return
<%=txtYear.ClientID %>.getValue();
}
function getMonth()
{
return
<%=cboMonth.ClientID %>.getValue();
}
</script>
<ext:ResourceManager ID= "ResourceManager1"
runat= "server" >
</ext:ResourceManager>
<ext:Viewport runat= "server"
ID= "Viewport1"
Layout= "Fit" >
<Items>
<ext:GridPanel ID= "GridPanel1"
Width= "400"
Height= "230"
TrackMouseOver= "true"
runat= "server"
StripeRows= "true"
Title= "店鋪狀態統計表"
Header= "false"
AutoExpandColumn= "RptId"
Frame= "true" >
<Store>
<ext:Store ID= "Store1"
ShowWarningOnFailure= "false"
AutoLoad= "false"
runat= "server" >
<Proxy>
<ext:HttpProxy runat= "server"
Method= "POST"
Url= "/Ajax/Reports.ashx" >
</ext:HttpProxy>
</Proxy>
<Reader>
<ext:JsonReader IDProperty= "RptId"
TotalProperty= "total"
Root= "data" >
<Fields>
<%--RptId 標識 店鋪狀態統計表--%>
<ext:RecordField Name= "RptId"
/>
<%--報表年份--%>
<ext:RecordField Name= "RptYear"
/>
<%--報表月份--%>
<ext:RecordField Name= "RptMonth"
/>
<%--新概念店目標--%>
<ext:RecordField Name= "TargetNewEntrant"
/>
<%--其他品牌轉新概念店目標--%>
<ext:RecordField Name= "TargetOM"
/>
<%--家樂福店目標--%>
<ext:RecordField Name= "TargetC4"
/>
<%--總數目標--%>
<ext:RecordField Name= "TargetTotal"
/>
<%--新概念店開店數--%>
<ext:RecordField Name= "NewStoreNewEntrant"
/>
<%--其他品牌轉新概念店開店數--%>
<ext:RecordField Name= "NewStoreOM"
/>
<%--家樂福開店數--%>
<ext:RecordField Name= "NewStoreC4"
/>
<%--新概念店開店總數--%>
<ext:RecordField Name= "NewStoreNCSTotal"
/>
<%--美麗健康店開店數--%>
<ext:RecordField Name= "NewStoreHB"
/>
<%--開店總數--%>
<ext:RecordField Name= "NewStoreTotal"
/>
<%--新概念店簽約數--%>
<ext:RecordField Name= "ContractSignedNCS"
/>
<%--美麗健康店簽約數--%>
<ext:RecordField Name= "ContractSignedHB"
/>
<%--簽約總數--%>
<ext:RecordField Name= "ContractSignedTotal"
/>
<%--新概念店施工數--%>
<ext:RecordField Name= "UnderDecoNCS"
/>
<%--美麗康店施工數--%>
<ext:RecordField Name= "UnderDecoHB"
/>
<%--施工總數--%>
<ext:RecordField Name= "UnderDecoTotal"
/>
<%--改型店目標--%>
<ext:RecordField Name= "UpgradingTarget"
/>
<%--改型店數--%>
<ext:RecordField Name= "UpgradingInOperation"
/>
<%--改型店簽約數--%>
<ext:RecordField Name= "UpgradingContractSigned"
/>
<%--改型店施工數--%>
<ext:RecordField Name= "UpgradingUnderDeco"
/>
<%--自動解約數--%>
<ext:RecordField Name= "ClosureNonPerform"
/>
<%--公司解約數--%>
<ext:RecordField Name= "ClosureForcedAttrition"
/>
<%--解約總數--%>
<ext:RecordField Name= "ClosureTotal"
/>
<%--淨店數--%>
<ext:RecordField Name= "StoreStatusNetStore"
/>
<%--新概念店總數--%>
<ext:RecordField Name= "StoreStatusStoreNoNCS"
/>
<%--美麗健康店總數--%>
<ext:RecordField Name= "StoreStatusStoreNoHB"
/>
<%--老店總數--%>
<ext:RecordField Name= "StoreStatusStoreNoOld"
/>
<%--總店數--%>
<ext:RecordField Name= "StoreStatusStoreNoTotal"
/>
<%--報表建立日期--%>
<ext:RecordField Name= "RptDate"
Type= "Date"
/>
<ext:RecordField Name= "DisplayMonth"
/>
</Fields>
</ext:JsonReader>
</Reader>
<BaseParams>
<ext:Parameter Name= "type"
Value= "ShopStatus"
Mode= "Value"
/>
<ext:Parameter Name= "Year"
Value= "getYear()"
Mode= "Raw"
/>
<ext:Parameter Name= "Month"
Value= "getMonth()"
Mode= "Raw"
/>
</BaseParams>
</ext:Store>
</Store>
<ColumnModel ID= "ColumnModel1"
runat= "server" >
<Columns>
<%--National:Start--%>
<ext:Column Header= "Year"
Hideable= "true"
DataIndex= "DisplayMonth"
Locked= "true"
/>
<ext:Column Header= "ID"
ColumnID= "RptId"
Hidden= "true"
DataIndex= "RptId"
/>
<%--National:End--%>
<%--<ext:Column Header= "報表年份"
Hidden= "true"
DataIndex= "RptYear"
/>--%>
<%--NewStore:Start--%>
<%-----------Target:Start--%>
<ext:Column Header= "NewEntrant"
Hideable= "true"
DataIndex= "TargetNewEntrant"
/>
<ext:Column Header= "OM"
Hideable= "true"
DataIndex= "TargetOM"
/>
<ext:Column Header= "C4"
Hideable= "true"
DataIndex= "TargetC4"
/>
<ext:Column Header= "Total"
Hideable= "true"
DataIndex= "TargetTotal"
/>
<%-----------Target:End--%>
<%-----------Actual Store opened:Start--%>
<ext:Column Header= "NewEntrant"
Hideable= "true"
DataIndex= "NewStoreNewEntrant"
/>
<ext:Column Header= "OM"
Hideable= "true"
DataIndex= "NewStoreOM"
/>
<ext:Column Header= "C4"
Hideable= "true"
DataIndex= "NewStoreC4"
/>
<ext:Column Header= "Total"
Hideable= "true"
DataIndex= "NewStoreNCSTotal"
/>
<ext:Column Header= "H&B"
Hideable= "true"
DataIndex= "NewStoreHB"
/>
<ext:Column Header= "Total"
Hideable= "true"
DataIndex= "NewStoreTotal"
/>
<%-----------Actual Store opened:End--%>
<%----------- Contract Signed:Start--%>
<ext:Column Header= "NCS"
Hideable= "true"
DataIndex= "ContractSignedNCS"
/>
<ext:Column Header= "H&B"
Hideable= "true"
DataIndex= "ContractSignedHB"
/>
<ext:Column Header= "Total"
Hideable= "true"
DataIndex= "ContractSignedTotal"
/>
<%----------- Contract Signed:End--%>
<%----------- Under Deco.:Start--%>
<ext:Column Header= "NCS"
Hideable= "true"
DataIndex= "UnderDecoNCS"
/>
<ext:Column Header= "H&B"
Hideable= "true"
DataIndex= "UnderDecoHB"
/>
<ext:Column Header= "Total"
Hideable= "true"
DataIndex= "UnderDecoTotal"
/>
<%----------- Under Deco.:End--%>
<%--NewStore:End--%>
<%--Upgrading:Start--%>
<ext:Column Header= "Target"
Hideable= "true"
DataIndex= "UpgradingTarget"
/>
<ext:Column Header= "InOperation"
Hideable= "true"
DataIndex= "UpgradingInOperation"
/>
<ext:Column Header= "ContractSigned"
Hideable= "true"
DataIndex= "UpgradingContractSigned"
/>
<ext:Column Header= "UnderDeco"
Hideable= "true"
DataIndex= "UpgradingUnderDeco"
/>
<%--Upgrading:End--%>
<%--Closure:Start--%>
<%----------- Drop-Out:Start--%>
<ext:Column Header= "NonPerform"
Hideable= "true"
DataIndex= "ClosureNonPerform"
/>
<ext:Column Header= "ForcedAttrition"
Hideable= "true"
DataIndex= "ClosureForcedAttrition"
/>
<ext:Column Header= "Total"
Hideable= "true"
DataIndex= "ClosureTotal"
/>
<%----------- Drop-Out:End--%>
<%--Closure:End--%>
<%--Store Status:Start--%>
<ext:Column Header= "NetStore"
Hideable= "true"
DataIndex= "StoreStatusNetStore"
/>
<%----------- Store No.:Start--%>
<ext:Column Header= "NCS"
Hideable= "true"
DataIndex= "StoreStatusStoreNoNCS"
/>
<ext:Column Header= "H&B"
Hideable= "true"
DataIndex= "StoreStatusStoreNoHB"
/>
<ext:Column Header= "Old"
Hideable= "true"
DataIndex= "StoreStatusStoreNoOld"
/>
<ext:Column Header= "Total"
Hideable= "true"
DataIndex= "StoreStatusStoreNoTotal"
/>
<%----------- Store No.:End--%>
<%--Store Status:End--%>
<ext:DateColumn Header= "報表建立日期"
Hidden= "true"
DataIndex= "RptDate"
Format= "yyyy-MM-dd"
/>
</Columns>
</ColumnModel>
<LoadMask ShowMask= "true"
/>
<View>
<ext:GroupingView runat= "server" >
<%--隱藏列在分組標頭中,仍佔用列數--%>
<%--一個HeaderGroupRows表示一行--%>
<HeaderGroupRows>
<ext:HeaderGroupRow>
<Columns>
<ext:HeaderGroupColumn Header= "<font class='headRows1'>National</font>"
Align= "Center"
/>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows1'>New Store</font>"
ColSpan= "17"
/>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows1'>Upgrading</font>"
ColSpan= "4"
/>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows1'>Closure</font>"
ColSpan= "3"
/>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows1'>Store Status</font>"
ColSpan= "5"
/>
<ext:HeaderGroupColumn Align= "Center"
/>
</Columns>
</ext:HeaderGroupRow>
</HeaderGroupRows>
<HeaderGroupRows>
<ext:HeaderGroupRow>
<Columns>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows2'>Year/Month</font>"
/>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows2'>Target</font>"
ColSpan= "5"
/>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows2'>Actual Store opened</font>"
ColSpan= "6"
/>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows2'>Contract Signed</font>"
ColSpan= "3"
/>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows2'>Under Deco</font>"
ColSpan= "3"
/>
<ext:HeaderGroupColumn Align= "Center"
ColSpan= "4"
/>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows2'>Drop-Out</font>"
ColSpan= "3"
/>
<ext:HeaderGroupColumn Align= "Center"
/>
<ext:HeaderGroupColumn Align= "Center"
Header= "<font class='headRows2'>Store No.</font>"
ColSpan= "4"
/>
<ext:HeaderGroupColumn Align= "Center"
/>
</Columns>
</ext:HeaderGroupRow>
</HeaderGroupRows>
</ext:GroupingView>
</View>
<TopBar>
<ext:Toolbar ID= "Toolbar1"
runat= "server" >
<Items>
<ext:ToolbarSpacer Width= "10"
runat= "server"
/>
<ext:NumberField runat= "server"
LabelWidth= "74"
ID= "txtYear"
Width= "162"
MinLength= "4"
MinLengthText= "輸入的年份必須為四位數!"
MaxLength= "4"
FieldLabel= "請輸入年份"
/>
<ext:ToolbarSpacer ID= "ToolbarSpacer1"
Width= "10"
runat= "server"
/>
<ext:ComboBox ID= "cboMonth"
LabelWidth= "74"
EmptyText= "請選擇月份!"
FieldLabel= "請選擇月份"
Editable= "false"
runat= "server" >
<Items>
<ext:ListItem Text= "01"
Value= "1"
/>
<ext:ListItem Text= "02"
Value= "2"
/>
<ext:ListItem Text= "03"
Value= "3"
/>
<ext:ListItem Text= "04"
Value= "4"
/>
<ext:ListItem Text= "05"
Value= "5"
/>
<ext:ListItem Text= "06"
Value= "6"
/>
<ext:ListItem Text= "07"
Value= "7"
/>
<ext:ListItem Text= "08"
Value= "8"
/>
<ext:ListItem Text= "09"
Value= "9"
/>
<ext:ListItem Text= "10"
Value=
|