WMS.Web.YZMManagement.YZMOrderControl.YZMOrderControl_List.aspx
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
|
function ListGrid() {
$( "#Button1" ).click();
}
<a id= "btn-query"
href= "javascript:;"
onclick= "ListGrid();"
class = "buttonHuge button-blue"
style= "color: #fff" >查询</a>
<div style= "margin-top:20px;bottom: 0px; position: absolute; width:100%; text-align:center;" >
<asp:Button ID= "FirstPageText"
runat= "server"
Text= "首 页"
onclick= "FirstPageText_Click"
/>
<asp:Button ID= "PrevPageText"
runat= "server"
Text= "上一页"
onclick= "PrevPageText_Click"
/>
<asp:Label ID= "Label1"
runat= "server"
Text= "第" ></asp:Label>
<input id= "PageIndex"
type= "text"
runat= "server"
value= ""
style= " width:50px;"
class = "txt"
datacol= "No"
checkexpession= "Int"
/>
<asp:Label ID= "Label2"
runat= "server"
Text= "页" ></asp:Label>
<asp:Button ID= "Btn_PageIndex"
runat= "server"
Text= "GO"
onclick= "Btn_PageIndex_Click"
/>
<asp:Button ID= "NextPageText"
runat= "server"
Text= "下一页"
onclick= "NextPageText_Click"
/>
<asp:Button ID= "LastPageText"
runat= "server"
Text= "尾 页"
onclick= "LastPageText_Click"
/>
<asp:Label ID= "Label5"
runat= "server"
Text= "当前页" ></asp:Label>
<asp:Label ID= "CurrentPage"
runat= "server" ></asp:Label>
<asp:Label ID= "Label4"
runat= "server"
Text= "共" ></asp:Label>
<asp:Label ID= "PageCount"
runat= "server" ></asp:Label>
<asp:Label ID= "Label3"
runat= "server"
Text= "页" ></asp:Label>
<asp:Label ID= "Label6"
runat= "server"
Text= "检索到" ></asp:Label>
<asp:Label ID= "CountSum"
runat= "server" ></asp:Label>
<asp:Label ID= "Label8"
runat= "server"
Text= "条数据" ></asp:Label>
</div>
|
cs
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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
|
public
string sel = "" ;
//当前页
public
int _CurrentPage;
//共页
public
int _PageCount;
//首页
public
int _FirstPage;
//上一页
public
int _PrevPage;
//下一页
public
int _NextPage;
//尾页
public
int _LastPage;
//跳转页
public
int _GO = 1;
protected
void Page_Load( object
sender, EventArgs e)
{
if
(!IsPostBack)
{
sel = "sel" ;
loadhtml();
}
}
private
void loadhtml()
{
DataTable dt = new
DataTable();
//查询
if
(sel == "sel" )
{
int
count = 0;
dt = mor_dal.GetOrderDataTablePageList(SqlWhere.ToString(), "order_id" , "asc" , _GO, 20, ref
count);
if
(count % 20 > 0)
{
_PageCount = count / 20 + 1;
}
else
{
_PageCount = count / 20;
}
//给分页赋值
CurrentPage.Text = _GO.ToString();
PageCount.Text = _PageCount.ToString();
CountSum.Text = count.ToString();
if
(_GO == 1)
{
PrevPageText.Enabled = false ;
}
else
{
PrevPageText.Enabled = true ;
}
if
(Convert.ToInt32(PageCount.Text.Trim()) == _GO)
{
NextPageText.Enabled = false ;
}
else
{
NextPageText.Enabled = true ;
}
}
else
{
int
count = 0;
dt = mor_dal.GetOrderDataTablePageList(SqlWhere.ToString(), "order_id" , "asc" , _GO, 20, ref
count);
CurrentPage.Text = _GO.ToString();
}
}
/// <summary>
/// 首页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected
void FirstPageText_Click( object
sender, EventArgs e)
{
_GO = 1;
PrevPageText.Enabled = false ;
if
(Convert.ToInt32(PageCount.Text.Trim()) == _GO)
{
NextPageText.Enabled = false ;
}
else
{
NextPageText.Enabled = true ;
}
loadhtml();
}
/// <summary>
/// 上一页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected
void PrevPageText_Click( object
sender, EventArgs e)
{
_GO = Convert.ToInt32(CurrentPage.Text.Trim()) - 1;
if
(_GO == 1)
{
PrevPageText.Enabled = false ;
}
else
{
PrevPageText.Enabled = true ;
}
if
(Convert.ToInt32(PageCount.Text.Trim()) == _GO)
{
NextPageText.Enabled = false ;
}
else
{
NextPageText.Enabled = true ;
}
loadhtml();
}
/// <summary>
/// 下一页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected
void NextPageText_Click( object
sender, EventArgs e)
{
_GO = Convert.ToInt32(CurrentPage.Text.Trim()) + 1;
if
(_GO == 1)
{
PrevPageText.Enabled = false ;
}
else
{
PrevPageText.Enabled = true ;
}
if
(Convert.ToInt32(PageCount.Text.Trim()) == _GO)
{
NextPageText.Enabled = false ;
}
else
{
NextPageText.Enabled = true ;
}
loadhtml();
}
/// <summary>
/// 尾页
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>NextPageTextLastPage
protected
void LastPageText_Click( object
sender, EventArgs e)
{
_GO = Convert.ToInt32(PageCount.Text.Trim());
NextPageText.Enabled = false ;
if
(_GO == 1)
{
PrevPageText.Enabled = false ;
}
else
{
PrevPageText.Enabled = true ;
}
loadhtml();
}
/// <summary>
/// G O
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected
void Btn_PageIndex_Click( object
sender, EventArgs e)
{
try
{
if
(Convert.ToInt32(PageIndex.Value.Trim()) <= Convert.ToInt32(PageCount.Text.Trim()) && PageIndex.Value.Trim() != "0" )
{
_GO = Convert.ToInt32(PageIndex.Value.Trim());
if
(_GO == 1)
{
PrevPageText.Enabled = false ;
}
else
{
PrevPageText.Enabled = true ;
}
if
(Convert.ToInt32(PageCount.Text.Trim()) == _GO)
{
NextPageText.Enabled = false ;
}
else
{
NextPageText.Enabled = true ;
}
loadhtml();
}
else
{
Page.Response.Write( "<script type=\"text/javascript\">alert(‘已超出索引!‘);</script>" );
}
}
catch
(Exception)
{
Page.Response.Write( "<script type=\"text/javascript\">alert(‘输入有误!‘);</script>" );
}
}
//执行SQL /// <summary> /// 销售订单明细--分页
/// </summary>
/// <param name="sqlwhere">条件</param>
/// <param name="orderField">排序字段</param>
/// <param name="orderType">排序类型</param>
/// <param name="pageIndex">当前页</param>
/// <param name="pageSize">页大小</param>
/// <param name="count">返回查询条数</param>
/// <returns></returns>
public
System.Data.DataTable GetOrderDataTablePageList( string
sqlwhere, string
orderField, string
orderType, int
pageIndex, int
pageSize, ref
int count)
{
StringBuilder strSql = new
StringBuilder();
strSql.Append( @"SELECT
E.order_id,
E.order_no,
E.cust_no,
E.cust_name,
E.or_currency_Name,
E.or_ask_money,
E.or_sale_uname,
E.or_date,
E.touching_uname,
E.touching_date,
E.or_check,
E.or_check_date,
E.or_status,
E.or_remark,
Q.op_id,
Q.op_matno,
Q.op_matname,
Q.op_matStandard,
Q.op_unit,
Q.op_unit_id,
Q.op_quantity,
Q.op_price,
Q.op_money,
Q.op_delivery_date,
Q.IsStockNum,
Q.NotStockNum,
Q.op_remark,
Q.pro_code,
D.dep_type,
D.amount
FROM YZOrder as E LEFT JOIN
YZOrder_product as Q on e.order_no = Q.order_no LEFT JOIN
YZ_Depot as D on q.op_matno= D.mat_no WHERE 1=1" );
strSql.Append(sqlwhere);
return
DataFactory.SqlDataBase().GetPageList(strSql.ToString(), orderField, orderType, pageIndex, pageSize, ref
count);
}
/// <summary>
/// 摘要:
/// 数据分页
/// 参数:
/// sql:传入要执行sql语句
/// param:参数化
/// orderField:排序字段
/// orderType:排序类型
/// pageIndex:当前页
/// pageSize:页大小
/// count:返回查询条数
/// </summary>
public
DataTable GetPageList( string
sql, SqlParam[] param, string
orderField, string
orderType, int
pageIndex, int
pageSize, ref
int count)
{
StringBuilder sb = new
StringBuilder();
try
{
int
num = (pageIndex - 1) * pageSize;
int
num1 = (pageIndex) * pageSize;
sb.Append( "Select * From (Select ROW_NUMBER() Over (Order By "
+ orderField + " "
+ orderType + "" );
sb.Append( ") As rowNum, * From ("
+ sql + ") As T ) As N Where rowNum > "
+ num + " And rowNum <= "
+ num1 + "" );
count = Convert.ToInt32( this .GetObjectValue( new
StringBuilder( "Select Count(1) From ("
+ sql + ") As t" ), param));
return
this .GetDataTableBySQL(sb, param);
}
catch
(Exception e)
{
DbLog.WriteException(e);
return
null ; ;
}
}
|