Check-in [4c2b0d3040]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implemented feature request [c961f21c74]
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:4c2b0d304098cabc87340fac0bd46ed6bc48b980
User & Date: xiekevin 2018-01-08 18:21:25
Context
2018-02-07
20:59
Interim code Leaf check-in: 7038629204 user: xiekevin tags: trunk
2018-01-08
18:21
Implemented feature request [c961f21c74] check-in: 4c2b0d3040 user: xiekevin tags: trunk
2018-01-02
16:55
Solution to feature request [67c4ba4175] check-in: 9ddfbbd676 user: xiekevin tags: trunk
Changes

Changes to build.number.

1
2
3
#Build Number for ANT. Do not edit!
#Fri Dec 29 00:35:40 EST 2017
build.number=11

|
|
1
2
3
#Build Number for ANT. Do not edit!
#Fri Jan 05 17:41:15 EST 2018
build.number=12

Changes to src/fanxi/middle/Actor.java.

963
964
965
966
967
968
969
970
971

972
973
974
975
976
977
978
...
990
991
992
993
994
995
996
997
998

999
1000
1001
1002
1003
1004
1005
....
1105
1106
1107
1108
1109
1110
1111
1112
1113

1114
1115
1116
1117
1118
1119
1120
		}else{
			int pageNum  =JSON.getAsInteger(jsonReq, R.Key.PAGE_NUM, 1);
			int pageSize  =JSON.getAsInteger(jsonReq, R.Key.PAGE_SIZE, 30);
			JsonArray jsonResults = new JsonArray();
			try{
				ctx.mConn=this.mEngine.mRepo.getConnection();
				Connection conn = ctx.mConn;
				Recv.getRecvs(conn, pageNum, pageSize, jsonResults, ctx.mSession.mUser);
				ctx.setResponseData(jsonResults);

				ctx.setResponseCount(jsonResults.size());
				conn.commit();
				ctx.setResponseCode(R.CODE.OK);				
			}catch(FanxiException fxe) {
				ctx.setResponseCode(fxe.getCode(), fxe.getMessage());
				ctx.setResponseData(fxe.getData());
			}catch(SQLException e) {
................................................................................
		}else{
			int pageNum  =JSON.getAsInteger(jsonReq, R.Key.PAGE_NUM, 1);
			int pageSize  =JSON.getAsInteger(jsonReq, R.Key.PAGE_SIZE, 30);
			JsonArray jsonResults = new JsonArray();
			try{
				ctx.mConn=this.mEngine.mRepo.getConnection();
				Connection conn = ctx.mConn;
				Sale.getSales(conn, pageNum, pageSize, jsonResults, ctx.mSession.mUser);
				ctx.setResponseData(jsonResults);

				ctx.setResponseCount(jsonResults.size());
				conn.commit();
				ctx.setResponseCode(R.CODE.OK);				
			}catch(FanxiException fxe) {
				ctx.setResponseCode(fxe.getCode(), fxe.getMessage());
				ctx.setResponseData(fxe.getData());
			}catch(SQLException e) {
................................................................................
		}else{
			int pageNum  =JSON.getAsInteger(jsonReq, R.Key.PAGE_NUM, 1);
			int pageSize  =JSON.getAsInteger(jsonReq, R.Key.PAGE_SIZE, 30);
			JsonArray jsonResults = new JsonArray();
			try{
				ctx.mConn=this.mEngine.mRepo.getConnection();
				Connection conn = ctx.mConn;
				Inventory.getInvs(conn, pageNum, pageSize, jsonResults, ctx.mSession.mUser);
				ctx.setResponseData(jsonResults);

				ctx.setResponseCount(jsonResults.size());
				conn.commit();
				ctx.setResponseCode(R.CODE.OK);
			}catch(FanxiException fxe) {
				ctx.setResponseCode(fxe.getCode(), fxe.getMessage());
				ctx.setResponseData(fxe.getData());
			}catch(SQLException e) {







|

>







 







|

>







 







|

>







963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
...
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
....
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
		}else{
			int pageNum  =JSON.getAsInteger(jsonReq, R.Key.PAGE_NUM, 1);
			int pageSize  =JSON.getAsInteger(jsonReq, R.Key.PAGE_SIZE, 30);
			JsonArray jsonResults = new JsonArray();
			try{
				ctx.mConn=this.mEngine.mRepo.getConnection();
				Connection conn = ctx.mConn;
				pageNum = Recv.getList(conn, pageNum, pageSize, jsonResults, ctx.mSession.mUser);
				ctx.setResponseData(jsonResults);
				ctx.setResponsePageNum(pageNum);
				ctx.setResponseCount(jsonResults.size());
				conn.commit();
				ctx.setResponseCode(R.CODE.OK);				
			}catch(FanxiException fxe) {
				ctx.setResponseCode(fxe.getCode(), fxe.getMessage());
				ctx.setResponseData(fxe.getData());
			}catch(SQLException e) {
................................................................................
		}else{
			int pageNum  =JSON.getAsInteger(jsonReq, R.Key.PAGE_NUM, 1);
			int pageSize  =JSON.getAsInteger(jsonReq, R.Key.PAGE_SIZE, 30);
			JsonArray jsonResults = new JsonArray();
			try{
				ctx.mConn=this.mEngine.mRepo.getConnection();
				Connection conn = ctx.mConn;
				pageNum = Sale.getList(conn, pageNum, pageSize, jsonResults, ctx.mSession.mUser);
				ctx.setResponseData(jsonResults);
				ctx.setResponsePageNum(pageNum);
				ctx.setResponseCount(jsonResults.size());
				conn.commit();
				ctx.setResponseCode(R.CODE.OK);				
			}catch(FanxiException fxe) {
				ctx.setResponseCode(fxe.getCode(), fxe.getMessage());
				ctx.setResponseData(fxe.getData());
			}catch(SQLException e) {
................................................................................
		}else{
			int pageNum  =JSON.getAsInteger(jsonReq, R.Key.PAGE_NUM, 1);
			int pageSize  =JSON.getAsInteger(jsonReq, R.Key.PAGE_SIZE, 30);
			JsonArray jsonResults = new JsonArray();
			try{
				ctx.mConn=this.mEngine.mRepo.getConnection();
				Connection conn = ctx.mConn;
				pageNum = Inventory.getList(conn, pageNum, pageSize, jsonResults, ctx.mSession.mUser);
				ctx.setResponseData(jsonResults);
				ctx.setResponsePageNum(pageNum);
				ctx.setResponseCount(jsonResults.size());
				conn.commit();
				ctx.setResponseCode(R.CODE.OK);
			}catch(FanxiException fxe) {
				ctx.setResponseCode(fxe.getCode(), fxe.getMessage());
				ctx.setResponseData(fxe.getData());
			}catch(SQLException e) {

Changes to src/fanxi/middle/ProcessContext.java.

46
47
48
49
50
51
52




53
54
55
56
57
58
59
	public void setResponseData(JsonObject jsonData) {
		this.mJsonResp.add(R.Key.DATA, jsonData);
	};
	
	public void setResponseCount(int count) {
		this.mJsonResp.addProperty(R.Key.COUNT, count);
	}





	public void setResponseData(JsonArray jsonData) {
		this.mJsonResp.add(R.Key.DATA, jsonData);
	};

	public void setResponseCode(int code) {
		this.mJsonResp.addProperty(R.Key.CODE, code);







>
>
>
>







46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	public void setResponseData(JsonObject jsonData) {
		this.mJsonResp.add(R.Key.DATA, jsonData);
	};
	
	public void setResponseCount(int count) {
		this.mJsonResp.addProperty(R.Key.COUNT, count);
	}

	public void setResponsePageNum(int pageNum) {
		this.mJsonResp.addProperty(R.Key.PAGE_NUM, pageNum);
	}

	public void setResponseData(JsonArray jsonData) {
		this.mJsonResp.add(R.Key.DATA, jsonData);
	};

	public void setResponseCode(int code) {
		this.mJsonResp.addProperty(R.Key.CODE, code);

Changes to src/fanxi/middle/entity/Inventory.java.

456
457
458
459
460
461
462
463
464
465
466
467
468
469












470
471



472


473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
...
504
505
506
507
508
509
510
511
512
513
514
		Timestamp resultTs = Timestamp.valueOf(year + "-" + month + "-01 00:00:00");
		
		invTs = resultTs.getTime();
		
		return invTs;
	};
	
	// pageNum starts at 1
	public static JsonArray getInvs(Connection conn, int pageNum, int pageSize, JsonArray jsonArray, User user)
				throws SQLException 
	{
		if(jsonArray==null) {
			jsonArray = new JsonArray();
		}












		
		Inventory inv = new Inventory();



		


		// get all negative balance item first
		String sql = "SELECT * FROM " + D.Inventory.VIEW_PROD_INV
				+ " WHERE " + D.Inventory.QTY_BAL + " < 0 "
				+ " ORDER BY " + D.Inventory.UPDATE_TS
				+ " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
		
		PreparedStatement pstmt = conn.prepareStatement(sql);
		pstmt.setInt(1, (pageNum - 1) * pageSize);
		pstmt.setInt(2, pageSize);
		ResultSet rset = pstmt.executeQuery();
		while(rset.next()) {
			pageSize--;
			inv.clean();
			inv.read(rset);
			jsonArray.add(inv.toJson(null, user));
		}
		rset.close();
................................................................................
				inv.read(rset);
				jsonArray.add(inv.toJson(null, user));
			}
			rset.close();
			pstmt.close();
		}

		return jsonArray;
	}

}







|
|


|
<
|
>
>
>
>
>
>
>
>
>
>
>
>
|
<
>
>
>
|
>
>

|



<
|


|







 







|



456
457
458
459
460
461
462
463
464
465
466
467

468
469
470
471
472
473
474
475
476
477
478
479
480
481

482
483
484
485
486
487
488
489
490
491
492

493
494
495
496
497
498
499
500
501
502
503
...
518
519
520
521
522
523
524
525
526
527
528
		Timestamp resultTs = Timestamp.valueOf(year + "-" + month + "-01 00:00:00");
		
		invTs = resultTs.getTime();
		
		return invTs;
	};
	
	// pageNum starts at 1, if pageNum=0 means go to last page
	public static int getList(Connection conn, int pageNum, int pageSize, JsonArray jsonArray, User user)
				throws SQLException 
	{
		if(jsonArray==null) return 0;

		
		Inventory			inv		= new Inventory();
		String				sql		= null;
		PreparedStatement	pstmt	= null;
		ResultSet			rset	= null;
		if( pageNum==0 ) {
			// calculate the real page #
			int saleCount = 0;
			sql = "SELECT COUNT(*) AS ROW_COUNT FROM " + D.Inventory.VIEW_PROD_INV;
			pstmt = conn.prepareStatement(sql);
			rset = pstmt.executeQuery();
			if(rset.next()) {
				saleCount = rset.getInt("ROW_COUNT");
			}

			pageNum = (int)Math.ceil((double)saleCount/pageSize);
			rset.close();
			pstmt.close();
		}

		
		// get all negative balance item first
		sql = "SELECT * FROM " + D.Inventory.VIEW_PROD_INV
				+ " WHERE " + D.Inventory.QTY_BAL + " < 0 "
				+ " ORDER BY " + D.Inventory.UPDATE_TS
				+ " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";

		pstmt = conn.prepareStatement(sql);
		pstmt.setInt(1, (pageNum - 1) * pageSize);
		pstmt.setInt(2, pageSize);
		rset = pstmt.executeQuery();
		while(rset.next()) {
			pageSize--;
			inv.clean();
			inv.read(rset);
			jsonArray.add(inv.toJson(null, user));
		}
		rset.close();
................................................................................
				inv.read(rset);
				jsonArray.add(inv.toJson(null, user));
			}
			rset.close();
			pstmt.close();
		}

		return pageNum;
	}

}

Changes to src/fanxi/middle/entity/Recv.java.

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
		return this;
	}	

	public static String generateId() {
		return "020" + Long.toString(System.currentTimeMillis(), 10).toUpperCase();
	}
	
	// pageNum starts at 1
	public static JsonArray getRecvs(Connection conn, int pageNum, int pageSize, JsonArray jsonArray, User user)
				throws SQLException 
	{
		if(jsonArray==null) {
			jsonArray = new JsonArray();
		}












		
		Recv recv = new Recv(null);





		String sql = "SELECT * FROM " + D.Recv.TAB_NAME 
				+ " ORDER BY " + D.Recv.TRANS_TS + " DESC "
				+ " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
		
		PreparedStatement pstmt = conn.prepareStatement(sql);
		
		pstmt.setInt(1, (pageNum - 1) * pageSize);
		pstmt.setInt(2, pageSize);
		
		ResultSet rset = pstmt.executeQuery();
		while(rset.next()) {
			recv.read(rset);
			jsonArray.add(recv.toJson(null, user));
		}
		
		rset.close();
		pstmt.close();
		
		return jsonArray;

	}
	
	public static int sumLines(Connection conn, String recvId) throws SQLException {
		// update POS_1.RECV set 
		// TOTAL_QTY = (select sum(qty) from POS_1.RECV_LINE where POS_1.RECV.ID = POS_1.RECV_LINE.RECV_ID)
		// ,TOTAL_AMT = (select sum(amt) from POS_1.RECV_LINE where POS_1.RECV.ID = POS_1.RECV_LINE.RECV_ID)
		// where POS_1.RECV.ID = 'R-IUUR8GQK'







|
|


|
<
|
>
>
>
>
>
>
>
>
>
>
>
>
|
<
>
>
>
>
>
|


<
|
<


<
|








|
>







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
		return this;
	}	

	public static String generateId() {
		return "020" + Long.toString(System.currentTimeMillis(), 10).toUpperCase();
	}
	
	// pageNum starts at 1, if pageNum=0 means go to last page
	public static int getList(Connection conn, int pageNum, int pageSize, JsonArray jsonArray, User user)
				throws SQLException 
	{
		if(jsonArray==null) return 0;

		
		Recv				recv	= new Recv(null);
		String				sql		= null;
		PreparedStatement	pstmt	= null;
		ResultSet			rset	= null;
		if( pageNum==0 ) {
			// calculate the real page #
			int saleCount = 0;
			sql = "SELECT COUNT(*) AS ROW_COUNT FROM " + D.Recv.TAB_NAME;
			pstmt = conn.prepareStatement(sql);
			rset = pstmt.executeQuery();
			if(rset.next()) {
				saleCount = rset.getInt("ROW_COUNT");
			}

			pageNum = (int)Math.ceil((double)saleCount/pageSize);
			rset.close();
			pstmt.close();
		}

		sql = "SELECT * FROM " + D.Recv.TAB_NAME 
				+ " ORDER BY " + D.Recv.TRANS_TS + " DESC "
				+ " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";

		pstmt = conn.prepareStatement(sql);

		pstmt.setInt(1, (pageNum - 1) * pageSize);
		pstmt.setInt(2, pageSize);

		rset = pstmt.executeQuery();
		while(rset.next()) {
			recv.read(rset);
			jsonArray.add(recv.toJson(null, user));
		}
		
		rset.close();
		pstmt.close();
		
		return pageNum;

	}
	
	public static int sumLines(Connection conn, String recvId) throws SQLException {
		// update POS_1.RECV set 
		// TOTAL_QTY = (select sum(qty) from POS_1.RECV_LINE where POS_1.RECV.ID = POS_1.RECV_LINE.RECV_ID)
		// ,TOTAL_AMT = (select sum(amt) from POS_1.RECV_LINE where POS_1.RECV.ID = POS_1.RECV_LINE.RECV_ID)
		// where POS_1.RECV.ID = 'R-IUUR8GQK'

Changes to src/fanxi/middle/entity/Sale.java.

337
338
339
340
341
342
343
344
345
346
347
348
349
350












351
352





353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
		if(sale.insertRecord(ctx.mConn, false)==1) {
			return sale;
		}else{
			return null;
		}
	}
	
	// pageNum starts at 1
	public static JsonArray getSales(Connection conn, int pageNum, int pageSize, JsonArray jsonArray, User user)
				throws SQLException 
	{
		if(jsonArray==null) {
			jsonArray = new JsonArray();
		}












		
		Sale sale = new Sale(null);





		String sql = "SELECT * FROM " + D.Sale.TAB_NAME 
				+ " ORDER BY " + D.Recv.TRANS_TS + " DESC "
				+ " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";
		
		PreparedStatement pstmt = conn.prepareStatement(sql);
		
		pstmt.setInt(1, (pageNum - 1) * pageSize);
		pstmt.setInt(2, pageSize);
		
		ResultSet rset = pstmt.executeQuery();
		while(rset.next()) {
			sale.read(rset);
			jsonArray.add(sale.toJson(null, user));
		}
		
		rset.close();
		pstmt.close();
		
		return jsonArray;
	}

}







|
|


|
<
|
>
>
>
>
>
>
>
>
>
>
>
>
|
<
>
>
>
>
>
|


<
|
<


<
|








|



337
338
339
340
341
342
343
344
345
346
347
348

349
350
351
352
353
354
355
356
357
358
359
360
361
362

363
364
365
366
367
368
369
370

371

372
373

374
375
376
377
378
379
380
381
382
383
384
385
386
		if(sale.insertRecord(ctx.mConn, false)==1) {
			return sale;
		}else{
			return null;
		}
	}
	
	// pageNum starts at 1, if pageNum=0 means go to last page
	public static int getList(Connection conn, int pageNum, int pageSize, JsonArray jsonArray, User user)
				throws SQLException 
	{
		if(jsonArray==null) return 0;

		
		Sale				sale	= new Sale(null);
		String				sql		= null;
		PreparedStatement	pstmt	= null;
		ResultSet			rset	= null;
		if( pageNum==0 ) {
			// calculate the real page #
			int saleCount = 0;
			sql = "SELECT COUNT(*) AS SALE_COUNT FROM " + D.Sale.TAB_NAME;
			pstmt = conn.prepareStatement(sql);
			rset = pstmt.executeQuery();
			if(rset.next()) {
				saleCount = rset.getInt("SALE_COUNT");
			}

			pageNum = (int)Math.ceil((double)saleCount/pageSize);
			rset.close();
			pstmt.close();
		}

		sql = "SELECT * FROM " + D.Sale.TAB_NAME 
				+ " ORDER BY " + D.Recv.TRANS_TS + " DESC "
				+ " OFFSET ? ROWS FETCH NEXT ? ROWS ONLY";

		pstmt = conn.prepareStatement(sql);

		pstmt.setInt(1, (pageNum - 1) * pageSize);
		pstmt.setInt(2, pageSize);

		rset = pstmt.executeQuery();
		while(rset.next()) {
			sale.read(rset);
			jsonArray.add(sale.toJson(null, user));
		}
		
		rset.close();
		pstmt.close();
		
		return pageNum;
	}

}

Changes to src/fanxi/middle/web/css/kxie.css.

1624
1625
1626
1627
1628
1629
1630






































1631
1632
1633
1634
1635
1636
1637
.kxFlexCGS {
    /* flex child */
	display: flex;
    flex: 1 1 auto;
    align-self: auto;
}
/* end of kxFlex classes */







































/* kxTooltip */
.kxTooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted black;
}







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
.kxFlexCGS {
    /* flex child */
	display: flex;
    flex: 1 1 auto;
    align-self: auto;
}
/* end of kxFlex classes */

/* paginator buttons/inputs */
div.kxPaginator > button {
	border-radius:4px;
	width: 3rem;
    border:none;
    white-space:nowrap;
    font-weight:bold;
    padding: 0.5rem;
    font-size: 1rem;
    margin-left: 0.5rem;
}
div.kxPaginator > button > first:before {
	content: "\23b9\25C4"
}
div.kxPaginator > button > prev:before {
	content: "\25C4"
}
div.kxPaginator > button > next:before {
	content: "\25BA"
}
div.kxPaginator > button > last:before {
	content: "\25BA\23b8"
}
div.kxPaginator > button:hover {
	cursor: pointer;
	background: orange;
}
div.kxPaginator > input {
	background: transparent;
    color: white;
	width:4rem;
	text-align:center;
    margin-left: 0.5rem;
    padding:0rem;
}

/* paginator buttons */

/* kxTooltip */
.kxTooltip {
    position: relative;
    display: inline-block;
    border-bottom: 1px dotted black;
}

Changes to src/fanxi/middle/web/html/inventory/inv.html.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<div class="kxPage">
	<div class="kxHead">
		<span class="kxIcon">&#9745;</span>
		<span class="kxTitle">商品库存管理</span>
		<span style="margin-right:1rem;">每页最多&nbsp;<span class="kxText" name="pageSize">10</span>&nbsp;项</span>
		<button class="kxButton" onclick="fx.inv.onPrev(event);"
				style="border-radius:0;">
			<span>上一页</span>
			<span>&#x25C4;</span>
		</button>
		<input type="text" name="pageNum" value="1"
				style="padding:1px;width:3rem;text-align:center;background:beige;"/>
		<button class="kxButton" onclick="fx.inv.onNext(event);"
				style="margin-left:0rem;border-radius:0;">
			<span>&#x25BA;</span>
			<span>下一页</span>
		</button>
	</div>
	<div class="kxContent" style="background:lightyellow;flex-flow:row nowrap;">
		<div class="kxPanelV u22" style="background:beige;">
			<div class="kxField kxSearch" name="search" style="padding:1rem;">
				<div class="kxInput">
					<input type="text" name="productSearchKey" placeholder="商品编码或名称"
							onkeyup="kx.onEnter(event, fx.inv.onSearch)"/>




|
<
<
<
<
<
<
<
<
<
<
<
<







1
2
3
4
5












6
7
8
9
10
11
12
<div class="kxPage">
	<div class="kxHead">
		<span class="kxIcon">&#9745;</span>
		<span class="kxTitle">商品库存管理</span>
		<div class="kxPaginator" name="paginator" pageSize="10"></div>












	</div>
	<div class="kxContent" style="background:lightyellow;flex-flow:row nowrap;">
		<div class="kxPanelV u22" style="background:beige;">
			<div class="kxField kxSearch" name="search" style="padding:1rem;">
				<div class="kxInput">
					<input type="text" name="productSearchKey" placeholder="商品编码或名称"
							onkeyup="kx.onEnter(event, fx.inv.onSearch)"/>

Changes to src/fanxi/middle/web/html/recv/recvs.html.

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
	<div class="kxHead">
		<span class="kxIcon">&#x2714;</span>
		<span class="kxTitle">采购收货入库</span>
		<button class="kxButton" onclick="fx.recvs.onNew(event);">
			<span>&#x2b;</span>
			<span>新入库单</span>
		</button>
		<button class="kxButton" onclick="fx.recvs.onPrev(event);"
				style="border-radius:0;">
			<span>上一页</span>
			<span>&#x25C4;</span>
		</button>
		<input type="hidden" name="pageSize" value="10" />
		<input type="text" name="pageNum" value="1"
				style="padding:1px;width:3rem;text-align:center;background:beige;"/>
		<button class="kxButton" onclick="fx.recvs.onNext(event);"
				style="margin-left:0rem;border-radius:0;">
			<span>&#x25BA;</span>
			<span>下一页</span>
		</button>
	</div>
	<div class="kxContent">
		<div class="kxFlexPV kxFlexCGS">
			<div class="kxFlexPH kxFlexC">
			</div>
			<div class="kxFlexPV kxFlexCGS" name="spinner">
				<table class="kxTable" name="recvs">
				</table>
			</div>
		</div>
	</div>
</div>







|
|
|
<
<
<
<
<
<
<
<
<
<












2
3
4
5
6
7
8
9
10
11










12
13
14
15
16
17
18
19
20
21
22
23
	<div class="kxHead">
		<span class="kxIcon">&#x2714;</span>
		<span class="kxTitle">采购收货入库</span>
		<button class="kxButton" onclick="fx.recvs.onNew(event);">
			<span>&#x2b;</span>
			<span>新入库单</span>
		</button>
		<div>
		<div class="kxPaginator" name="paginator" pageSize="10"></div>
		</div>










	</div>
	<div class="kxContent">
		<div class="kxFlexPV kxFlexCGS">
			<div class="kxFlexPH kxFlexC">
			</div>
			<div class="kxFlexPV kxFlexCGS" name="spinner">
				<table class="kxTable" name="recvs">
				</table>
			</div>
		</div>
	</div>
</div>

Changes to src/fanxi/middle/web/html/sale/sales.html.

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
<div class="kxPage">
	<div class="kxHead">
		<span class="kxIcon">&#x2714;</span>
		<span class="kxTitle">销售数据</span>
		<button class="kxButton" onclick="fx.sales.onPrev(event);"
				style="border-radius:0;">
			<span>上一页</span>
			<span>&#x25C4;</span>
		</button>
		<input type="hidden" name="pageSize" value="10" />
		<input type="text" name="pageNum" value="1"
				style="padding:1px;width:3rem;text-align:center;background:beige;"/>
		<button class="kxButton" onclick="fx.sales.onNext(event);"
				style="margin-left:0rem;border-radius:0;">
			<span>&#x25BA;</span>
			<span>下一页</span>
		</button>
	</div>
	<div class="kxContent">
		<div class="kxFlexPV kxFlexCGS">
			<div class="kxFlexPH kxFlexC">
			</div>
			<div class="kxFlexPV kxFlexCGS" name="spinner">
				<table class="kxTable kxSmall" name="sales">
				</table>
			</div>
		</div>
	</div>
</div>




|
<
<
<
<
<
<
<
<
<
<
<
<












1
2
3
4
5












6
7
8
9
10
11
12
13
14
15
16
17
<div class="kxPage">
	<div class="kxHead">
		<span class="kxIcon">&#x2714;</span>
		<span class="kxTitle">销售数据</span>
		<div class="kxPaginator" name="paginator" pageSize="10"></div>












	</div>
	<div class="kxContent">
		<div class="kxFlexPV kxFlexCGS">
			<div class="kxFlexPH kxFlexC">
			</div>
			<div class="kxFlexPV kxFlexCGS" name="spinner">
				<table class="kxTable kxSmall" name="sales">
				</table>
			</div>
		</div>
	</div>
</div>

Changes to src/fanxi/middle/web/js/fx_inventory.js.

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
..
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
            { id:"QTY_BAL", label:"现有库存<br/>数量", align:"right" },
            { id:"RECV", label:"入库<br/>数量/金额", align:"right" },
            { id:"SALE", label:"销售<br/>数量/金额", align:"right" },
            { id:"ADJUST", label:"盘点(+赢/-亏)<br/>数量/金额", align:"right" },
            { id:"DESCRIPTION", label:"说明", width:"100%", wrap:true }
        ]
    });



    fx.inv.getList(args);








};
fx.inv.page = function(args) {
    if( args===undefined ) args = {};
    kxie.ui.page.show({
        container: args.container,
        url: "html/inventory/inv.html",
        onLoad: fx.inv.init
    });
};
// args.page:<kxWrap>



fx.inv.getList = function(args) {



    const kxWrap = args.page;
    const kxTableInv = $(kxWrap).find("[name=inventory]").get(0);
    const cbOnSuccess = function(argsOnSuccess) {
        const jsonResp = argsOnSuccess.jsonResp;
        const jsonInvs = jsonResp.data;





        kx.ui.table.clear({
            elem: kxTableInv
        });
        var inv, rowObj, view, updateTs, prodId;
        for( var i=0; i<jsonInvs.length; i++) {
            inv = jsonInvs[i];
            updateTs = inv.UPDATE_TS? inv.UPDATE_TS.split(".",1)[0] : "";
................................................................................
                elem: kxTableInv,
                row: rowObj
            });
        }
    };
    const jsonReq = {
        req: "INV_LIST",
        pageNum: kx.number(kx.ui.get(kxWrap, "pageNum"), 1),
        pageSize: kx.number(kx.ui.get(kxWrap, "pageSize"), 10)
    };
    kx.ajax.api({
        data: jsonReq,
        onSuccess: cbOnSuccess,
        spinner: new kx.ui.Spinner(kxTableInv, "请稍候...")
    });
};

fx.inv.onPrev = function(event) {
    const kxWrap = $(event.target).closest(".kxWrap").get(0);
    var pageNum = kx.number(kx.ui.get(kxWrap, "pageNum"), 1);
    if( pageNum>1 ) {
        kx.ui.set(kxWrap, "pageNum", pageNum - 1);
        fx.inv.getList({
            page: kxWrap
        });
    }else{
        kx.ui.msg.info({
            ttl:1, message: "已经是第一页了"
        });
    }
};
fx.inv.onNext = function(event) {
    const kxWrap = $(event.target).closest(".kxWrap").get(0);
    const kxTableInv = $(kxWrap).find("[name=inventory]").get(0);
    const pageSize = kx.number(kx.ui.get(kxWrap, "pageSize"), 10);
    const curSize = kxie.ui.table.rowCount({elem:kxTableInv});
    var pageNum = kx.number(kx.ui.get(kxWrap, "pageNum"), 1);
    if( curSize>=pageSize ) {
        kx.ui.set(kxWrap, "pageNum", pageNum + 1);
        fx.inv.getList({
            page: kxWrap
        });
    }else{
        kx.ui.msg.info({
            ttl:1, message: "已经是最后一页了"
        });
    }
};

fx.inv.onSearch = function(event) {
    const kxWrap = $(event.target).closest(".kxWrap").get(0);
    const divPROD = $(kxWrap).find("[name=PRODUCT]").get(0);
    const divSearch = $(kxWrap).find("[name=search]").get(0);
    const keyword = kx.ui.get(divSearch, "productSearchKey", "");
    if( ! keyword ) return;








>
>
>
|
>
>
>
>
>
>
>
>










>
>
>

>
>
>





>
>
>
>
>







 







|
|








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







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
..
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
































103
104
105
106
107
108
109
            { id:"QTY_BAL", label:"现有库存<br/>数量", align:"right" },
            { id:"RECV", label:"入库<br/>数量/金额", align:"right" },
            { id:"SALE", label:"销售<br/>数量/金额", align:"right" },
            { id:"ADJUST", label:"盘点(+赢/-亏)<br/>数量/金额", align:"right" },
            { id:"DESCRIPTION", label:"说明", width:"100%", wrap:true }
        ]
    });
    kx.ui.paginator.init({
        elem: $(kxWrap).find("[name=paginator]").get(0),
        onPage: function(argsOnPage) {
            return fx.inv.getList({
                page: kxWrap,
                paginator: argsOnPage.elem,
                pageSize: argsOnPage.pageSize,
                pageNum: argsOnPage.pageNum
            });
        },
        refresh: true
    });
};
fx.inv.page = function(args) {
    if( args===undefined ) args = {};
    kxie.ui.page.show({
        container: args.container,
        url: "html/inventory/inv.html",
        onLoad: fx.inv.init
    });
};
// args.page:<kxWrap>
// args.paginator:<div.kxPaginator>
// args.pageSize:<int>
// args.pageNum:<int>
fx.inv.getList = function(args) {
    if( args===undefined || args.page===undefined ) return;
    if( isNaN(args.pageSize) || args.pageSize<1 ) args.pageSize=20;
    if( isNaN(args.pageNum) || args.pageNum<0 ) args.pageNum = 1;
    const kxWrap = args.page;
    const kxTableInv = $(kxWrap).find("[name=inventory]").get(0);
    const cbOnSuccess = function(argsOnSuccess) {
        const jsonResp = argsOnSuccess.jsonResp;
        const jsonInvs = jsonResp.data;
        const pn = isNaN(jsonResp.pageNum)? args.pageNum : jsonResp.pageNum;
        kx.ui.paginator.setPageNum({
            elem: args.paginator,
            pageNum: pn
        });
        kx.ui.table.clear({
            elem: kxTableInv
        });
        var inv, rowObj, view, updateTs, prodId;
        for( var i=0; i<jsonInvs.length; i++) {
            inv = jsonInvs[i];
            updateTs = inv.UPDATE_TS? inv.UPDATE_TS.split(".",1)[0] : "";
................................................................................
                elem: kxTableInv,
                row: rowObj
            });
        }
    };
    const jsonReq = {
        req: "INV_LIST",
        pageNum: args.pageNum,
        pageSize: args.pageSize
    };
    kx.ajax.api({
        data: jsonReq,
        onSuccess: cbOnSuccess,
        spinner: new kx.ui.Spinner(kxTableInv, "请稍候...")
    });
};

































fx.inv.onSearch = function(event) {
    const kxWrap = $(event.target).closest(".kxWrap").get(0);
    const divPROD = $(kxWrap).find("[name=PRODUCT]").get(0);
    const divSearch = $(kxWrap).find("[name=search]").get(0);
    const keyword = kx.ui.get(divSearch, "productSearchKey", "");
    if( ! keyword ) return;

Changes to src/fanxi/middle/web/js/fx_recv.js.

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
..
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
..
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
            { id:"vender", label:"供应商" },
            { id:"QTY", label:"总数量", align:"right" },
            { id:"AMT", label:"总金额", align:"right" },
            { id:"employee", label:"收货人员" },
            { id:"info", label:"说明", width:"100%", wrap:true }
        ]
    });




    fx.recvs.getList(args);








};

fx.recvs.page = function(args) {
    if( args===undefined ) args = {};
    kxie.ui.page.show({
        container: args.container,
        url: "html/recv/recvs.html",
        onLoad: fx.recvs.init
    });
};

// args.page:<kxWrap>



fx.recvs.getList = function(args) {
    const kxWrap = args.page;
    const kxTableRecvs = $(kxWrap).find("[name=recvs]").get(0);
    const divSpinner = $(kxWrap).find("[name=spinner]").get(0);
    const cbOnSuccess = function(argsOnSuccess) {
        const jsonResp = argsOnSuccess.jsonResp;
        const jsonRecvs = jsonResp.data;





        kx.ui.table.clear({
            elem: kxTableRecvs
        });
        var recv, rowObj, view, transTs, id, vender;
        for( var i=0; i<jsonRecvs.length; i++) {
            recv = jsonRecvs[i];
            transTs = recv.TRANS_TS? recv.TRANS_TS.split(".",1)[0] : "";
................................................................................
                elem: kxTableRecvs,
                row: rowObj
            });
        }
    };
    const jsonReq = {
        req: "RECV_LIST",
        pageNum: kx.number(kx.ui.get(kxWrap, "pageNum"), 1),
        pageSize: kx.number(kx.ui.get(kxWrap, "pageSize"), 10)
    };
    kx.ajax.api({
        data: jsonReq,
        onSuccess: cbOnSuccess,
        spinner: new kx.ui.Spinner(divSpinner, "请稍候...")
    });
};
................................................................................

    };
    fx.recv.page({
        data: { ID: recvId },
        onData: cbOnData
    });
};
fx.recvs.onPrev = function(event) {
    const kxWrap = $(event.target).closest(".kxWrap").get(0);
    var pageNum = kx.number(kx.ui.get(kxWrap, "pageNum"), 1);
    if( pageNum>1 ) {
        kx.ui.set(kxWrap, "pageNum", pageNum - 1);
        fx.recvs.getList({
            page: kxWrap
        });
    }else{
        kx.ui.msg.info({
            ttl:1, message: "已经是第一页了"
        });
    }
};
fx.recvs.onNext = function(event) {
    const kxWrap = $(event.target).closest(".kxWrap").get(0);
    const kxTableRecvs = $(kxWrap).find("[name=recvs]").get(0);
    const pageSize = kx.number(kx.ui.get(kxWrap, "pageSize"), 10);
    const curSize = kxie.ui.table.rowCount({elem:kxTableRecvs});
    var pageNum = kx.number(kx.ui.get(kxWrap, "pageNum"), 1);
    if( curSize>=pageSize ) {
        kx.ui.set(kxWrap, "pageNum", pageNum + 1);
        fx.recvs.getList({
            page: kxWrap
        });
    }else{
        kx.ui.msg.info({
            ttl:1, message: "已经是最后一页了"
        });
    }
};

fx.recvs.onNew = function(event) {
    const kxWrap = $(event.target).closest(".kxWrap").get(0);
    const cbOnData = function(argsOnData) {
        const recv = argsOnData.data;
        fx.recv.page({
            data: recv
        });







<
>
>
>
|
>
>
>
>
>
>
>
>












>
>
>







>
>
>
>
>







 







|
|







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







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
..
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
...
109
110
111
112
113
114
115
































116
117
118
119
120
121
122
            { id:"vender", label:"供应商" },
            { id:"QTY", label:"总数量", align:"right" },
            { id:"AMT", label:"总金额", align:"right" },
            { id:"employee", label:"收货人员" },
            { id:"info", label:"说明", width:"100%", wrap:true }
        ]
    });

    kx.ui.paginator.init({
        elem: $(kxWrap).find("[name=paginator]").get(0),
        onPage: function(argsOnPage) {
            return fx.recvs.getList({
                page: kxWrap,
                paginator: argsOnPage.elem,
                pageSize: argsOnPage.pageSize,
                pageNum: argsOnPage.pageNum
            });
        },
        refresh: true
    });
};

fx.recvs.page = function(args) {
    if( args===undefined ) args = {};
    kxie.ui.page.show({
        container: args.container,
        url: "html/recv/recvs.html",
        onLoad: fx.recvs.init
    });
};

// args.page:<kxWrap>
// args.paginator:<div.kxPaginator>
// args.pageSize:<int>
// args.pageNum:<int>
fx.recvs.getList = function(args) {
    const kxWrap = args.page;
    const kxTableRecvs = $(kxWrap).find("[name=recvs]").get(0);
    const divSpinner = $(kxWrap).find("[name=spinner]").get(0);
    const cbOnSuccess = function(argsOnSuccess) {
        const jsonResp = argsOnSuccess.jsonResp;
        const jsonRecvs = jsonResp.data;
        const pn = isNaN(jsonResp.pageNum)? args.pageNum : jsonResp.pageNum;
        kx.ui.paginator.setPageNum({
            elem: args.paginator,
            pageNum: pn
        });
        kx.ui.table.clear({
            elem: kxTableRecvs
        });
        var recv, rowObj, view, transTs, id, vender;
        for( var i=0; i<jsonRecvs.length; i++) {
            recv = jsonRecvs[i];
            transTs = recv.TRANS_TS? recv.TRANS_TS.split(".",1)[0] : "";
................................................................................
                elem: kxTableRecvs,
                row: rowObj
            });
        }
    };
    const jsonReq = {
        req: "RECV_LIST",
        pageNum: args.pageNum,
        pageSize: args.pageSize
    };
    kx.ajax.api({
        data: jsonReq,
        onSuccess: cbOnSuccess,
        spinner: new kx.ui.Spinner(divSpinner, "请稍候...")
    });
};
................................................................................

    };
    fx.recv.page({
        data: { ID: recvId },
        onData: cbOnData
    });
};
































fx.recvs.onNew = function(event) {
    const kxWrap = $(event.target).closest(".kxWrap").get(0);
    const cbOnData = function(argsOnData) {
        const recv = argsOnData.data;
        fx.recv.page({
            data: recv
        });

Changes to src/fanxi/middle/web/js/fx_sale.js.

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
..
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
...
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
            { id:"DISCOUNT", label:"打折优惠%", align:"right" },
            { id:"DEDUCTION", label:"折后减免", align:"right" },
            { id:"AMT_DUE", label:"应付金额", align:"right" },
            { id:"PAID_AMT", label:"已支付额", align:"right" },
            { id:"info", label:"说明", width:"100%", wrap:true }
        ]
    });




    fx.sales.getList(args);








};

fx.sales.page = function(args) {
    if( args===undefined ) args = {};
    kxie.ui.page.show({
        container: args.container,
        url: "html/sale/sales.html",
        onLoad: fx.sales.init
    });
};

// args.page:<kxWrap>



fx.sales.getList = function(args) {
    const kxWrap = args.page;
    const kxTableSales = $(kxWrap).find("[name=sales]").get(0);
    const divSpinner = $(kxWrap).find("[name=spinner]").get(0);
    const cbOnSuccess = function(argsOnSuccess) {
        const jsonResp = argsOnSuccess.jsonResp;
        const jsonSales = jsonResp.data;





        kx.ui.table.clear({
            elem: kxTableSales
        });
        var sale, rowObj, view, trans, transTs, id, customer, employee, amtPaid;
        var saleType;
        for( var i=0; i<jsonSales.length; i++) {
            sale = jsonSales[i];
................................................................................
                elem: kxTableSales,
                row: rowObj
            });
        }
    };
    const jsonReq = {
        req: "SALE_LIST",
        pageNum: kx.number(kx.ui.get(kxWrap, "pageNum"), 1),
        pageSize: kx.number(kx.ui.get(kxWrap, "pageSize"), 10)
    };
    kx.ajax.api({
        data: jsonReq,
        onSuccess: cbOnSuccess,
        spinner: new kx.ui.Spinner(divSpinner, "请稍候...")
    });
};
................................................................................

    };
    fx.sale.page({
        data: { ID: saleId },
        onData: cbOnData
    });
};
fx.sales.onPrev = function(event) {
    const kxWrap = $(event.target).closest(".kxWrap").get(0);
    var pageNum = kx.number(kx.ui.get(kxWrap, "pageNum"), 1);
    if( pageNum>1 ) {
        kx.ui.set(kxWrap, "pageNum", pageNum - 1);
        fx.sales.getList({
            page: kxWrap
        });
    }else{
        kx.ui.msg.info({
            ttl:1, message: "已经是第一页了"
        });
    }
};
fx.sales.onNext = function(event) {
    const kxWrap = $(event.target).closest(".kxWrap").get(0);
    const kxTableSales = $(kxWrap).find("[name=sales]").get(0);
    const pageSize = kx.number(kx.ui.get(kxWrap, "pageSize"), 10);
    const curSize = kxie.ui.table.rowCount({elem:kxTableSales});
    var pageNum = kx.number(kx.ui.get(kxWrap, "pageNum"), 1);
    if( curSize>=pageSize ) {
        kx.ui.set(kxWrap, "pageNum", pageNum + 1);
        fx.sales.getList({
            page: kxWrap
        });
    }else{
        kx.ui.msg.info({
            ttl:1, message: "已经是最后一页了"
        });
    }
};
/* end of sales.html */

/* saleEntry.html */
fx.saleEntry = {};

// args.page:<kxWrap>
// args.data:<sale record>







<
>
>
>
|
>
>
>
>
>
>
>
>












>
>
>







>
>
>
>
>







 







|
|







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







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
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
...
129
130
131
132
133
134
135































136
137
138
139
140
141
142
            { id:"DISCOUNT", label:"打折优惠%", align:"right" },
            { id:"DEDUCTION", label:"折后减免", align:"right" },
            { id:"AMT_DUE", label:"应付金额", align:"right" },
            { id:"PAID_AMT", label:"已支付额", align:"right" },
            { id:"info", label:"说明", width:"100%", wrap:true }
        ]
    });

    kx.ui.paginator.init({
        elem: $(kxWrap).find("[name=paginator]").get(0),
        onPage: function(argsOnPage) {
            return fx.sales.getList({
                page: kxWrap,
                paginator: argsOnPage.elem,
                pageSize: argsOnPage.pageSize,
                pageNum: argsOnPage.pageNum
            });
        },
        refresh: true
    });
};

fx.sales.page = function(args) {
    if( args===undefined ) args = {};
    kxie.ui.page.show({
        container: args.container,
        url: "html/sale/sales.html",
        onLoad: fx.sales.init
    });
};

// args.page:<kxWrap>
// args.paginator:<div.kxPaginator>
// args.pageSize:<int>
// args.pageNum:<int>
fx.sales.getList = function(args) {
    const kxWrap = args.page;
    const kxTableSales = $(kxWrap).find("[name=sales]").get(0);
    const divSpinner = $(kxWrap).find("[name=spinner]").get(0);
    const cbOnSuccess = function(argsOnSuccess) {
        const jsonResp = argsOnSuccess.jsonResp;
        const jsonSales = jsonResp.data;
        const pn = isNaN(jsonResp.pageNum)? args.pageNum : jsonResp.pageNum;
        kx.ui.paginator.setPageNum({
            elem: args.paginator,
            pageNum: pn
        });
        kx.ui.table.clear({
            elem: kxTableSales
        });
        var sale, rowObj, view, trans, transTs, id, customer, employee, amtPaid;
        var saleType;
        for( var i=0; i<jsonSales.length; i++) {
            sale = jsonSales[i];
................................................................................
                elem: kxTableSales,
                row: rowObj
            });
        }
    };
    const jsonReq = {
        req: "SALE_LIST",
        pageNum: args.pageNum,
        pageSize: args.pageSize
    };
    kx.ajax.api({
        data: jsonReq,
        onSuccess: cbOnSuccess,
        spinner: new kx.ui.Spinner(divSpinner, "请稍候...")
    });
};
................................................................................

    };
    fx.sale.page({
        data: { ID: saleId },
        onData: cbOnData
    });
};































/* end of sales.html */

/* saleEntry.html */
fx.saleEntry = {};

// args.page:<kxWrap>
// args.data:<sale record>

Changes to src/fanxi/middle/web/js/kxie_ui.js.

1508
1509
1510
1511
1512
1513
1514





















































































































    this.off = function() {
        if( !(this.__spinnerPanel instanceof HTMLElement) ) return;
        $(this.__spinnerPanel).children(".kxSpinner").remove();
    };
};
/** end of kxSpinner */





























































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
    this.off = function() {
        if( !(this.__spinnerPanel instanceof HTMLElement) ) return;
        $(this.__spinnerPanel).children(".kxSpinner").remove();
    };
};
/** end of kxSpinner */

////////////////////////////////////////////////////////////////////////////////////////
// Begin of kxPaginator functionalities
//
kxie.ui.paginator = {};
// args.elem:<div.kxPaginator>
// args.pageSize:<int>
// args.onPage:<function> - called when paginator needs to fetch and show a page.
//      the parameters are args.elem, args.pageSize and args.pageNum, which ranges from
//      to integers, where 0 means last page.
// args.refresh:<boolean> - whether to show the first page right after initialization
kxie.ui.paginator.init = function(args) {
    if( args===undefined || ! (args.elem instanceof HTMLElement )) return;
    const kxPaginator = args.elem;
    if( !$(kxPaginator).is("div") || !$(kxPaginator).hasClass("kxPaginator") ) return;
    if( args.onPage instanceof Function ) {
        kxPaginator.onPage = args.onPage;
    }else{
        // dummy onPage function
        kxPaginator.onPage = function(argsOnPage) {
            console.log("Fetching and show page " + argsOnPage.pageNum + " of size " + argsOnPage.pageSize);
            return argsOnPage.pageNum;
        };
    }
    kxPaginator.pageSize = Number($(kxPaginator).attr("pageSize"));
    if( isNaN(kxPaginator.pageSize) || kxPaginator.pageSize<1 ) {
        // there is no valid pageSize html attribute
        kxPaginator.pageSize = isNaN(args.pageSize)? 20 : args.pageSize;
    }

    var btnFirst = $(kxPaginator).children("button[name=first]").get(0);
    var btnPrev = $(kxPaginator).children("button[name=prev]").get(0);
    var inputPageNum = $(kxPaginator).children("input[name=pageNum]").get(0);
    var btnNext = $(kxPaginator).children("button[name=next]").get(0);
    var btnLast = $(kxPaginator).children("button[name=last]").get(0);
    if( !(btnFirst instanceof HTMLElement ) ) {
        $(kxPaginator).append("<button name='first'><first/></button>");
        btnFirst = $(kxPaginator).children("button[name=first]").get(0);
    }
    if( !(btnPrev instanceof HTMLElement ) ) {
        $(kxPaginator).append("<button name='prev'><prev/></button>");
        btnPrev = $(kxPaginator).children("button[name=prev]").get(0);
    }
    if( !(inputPageNum instanceof HTMLElement ) ) {
        $(kxPaginator).append("<input name='pageNum' type='text' value='1' />");
        inputPageNum = $(kxPaginator).children("input[name=pageNum]").get(0);
    }
    if( !(btnNext instanceof HTMLElement ) ) {
        $(kxPaginator).append("<button name='next'><next/></button>");
        btnNext = $(kxPaginator).children("button[name=next]").get(0);
    }
    if( !(btnLast instanceof HTMLElement ) ) {
        $(kxPaginator).append("<button name='last'><last/></button>");
        btnLast = $(kxPaginator).children("button[name=last]").get(0);
    }
    const onAction = function(act) {
        // get pageNum
        const argsPage = {
            elem: kxPaginator,
            pageNum: kx.number(inputPageNum.value, 1),
            pageSize: kxPaginator.pageSize

        };
        if(argsPage.pageNum<1) argsPage.pageNum=1;
        switch(act) {
        case "first":
            argsPage.pageNum = 1; break;
        case "prev":
            argsPage.pageNum = argsPage.pageNum - 1;
            if(argsPage.pageNum===0) argsPage.pageNum = 1;
            break;
        case "next":
            argsPage.pageNum = argsPage.pageNum + 1;
            break;
        case "last":
            argsPage.pageNum = 0;
            break;
        default:
            break;
        }
        kxPaginator.onPage(argsPage);
    };

    $(btnFirst).click(function() { onAction("first"); });
    $(btnPrev).click(function() { onAction("prev"); });
    $(inputPageNum).change(function() { onAction("enter"); });
    $(btnNext).click(function() { onAction("next"); });
    $(btnLast).click(function() { onAction("last"); });

    // show the inital page, which is always page 1
    if( args.refresh==true ) {
        kxPaginator.onPage({
            elem: kxPaginator,
            pageNum: kx.number(inputPageNum.value, 1),
            pageSize: args.elem.pageSize
        });
    }
};
// args.elem:<div.kxPaginator>
kxie.ui.paginator.refresh = function(args) {
    if( args===undefined || ! (args.elem instanceof HTMLElement )) return;
    const kxPaginator = args.elem;
    if( !$(kxPaginator).is("div") || !$(kxPaginator).hasClass("kxPaginator") ) return;
    kxPaginator.onPage({
        elem: args.elem,
        pageNum: $(args.elem).children("input[name=pageNum]").val(),
        pageSize: args.elem.pageSize
    });
};
// args.elem:<div.kxPaginator>
// args.pageNum:<int>
kxie.ui.paginator.setPageNum = function(args) {
    if( args===undefined || ! (args.elem instanceof HTMLElement )) return;
    $(args.elem).children("input[name=pageNum]").val(args.pageNum);
};
//
// End of kxPaginator
//////////////////////////////////////////////////////////////////////////////////////////