|
|
@@ -483,19 +483,27 @@ public class cashbill extends Controller {
|
|
|
}
|
|
|
pageSorting = " sa_cashbillid desc";
|
|
|
int oldpageSize = pageSize;
|
|
|
- Rows rows = queryList(where, 1, "新建", pageSize).query();
|
|
|
+ Rows rows = queryList(where, 1, "新建", pageSize, pageNumber).query();
|
|
|
Rows checkRows = new Rows();
|
|
|
|
|
|
if (rows.size() < pageSize) {
|
|
|
- checkRows = queryList(where, 1, "审核", pageSize - rows.size()).query();
|
|
|
+ if (rows.size() % pageSize == 0) {
|
|
|
+ checkRows = queryList(where, 1, "审核", pageSize, pageNumber - Double.valueOf(Math.ceil((double) rows.totalRows / (double) pageSize)).intValue()).query();
|
|
|
+ } else {
|
|
|
+ checkRows = queryList(where, 1, "审核", pageSize - rows.size(), pageNumber - Double.valueOf(Math.ceil((double) rows.totalRows / (double) pageSize)).intValue() + 1).query();
|
|
|
+ }
|
|
|
} else {
|
|
|
- checkRows.totalRows = queryList(where, 1, "审核", 1).query().totalRows;
|
|
|
+ checkRows.totalRows = queryList(where, 1, "审核", 1, 1).query().totalRows;
|
|
|
}
|
|
|
Rows voidRows = new Rows();
|
|
|
if (rows.size() + checkRows.size() < pageSize) {
|
|
|
- voidRows = queryList(where, 1, "作废", pageSize - rows.size() - checkRows.size()).query();
|
|
|
+ if ((rows.size() + checkRows.size()) % pageSize == 0) {
|
|
|
+ voidRows = queryList(where, 1, "作废", pageSize, pageNumber - Double.valueOf(Math.ceil((double) (rows.totalRows + checkRows.totalRows) / (double) pageSize)).intValue()).query();
|
|
|
+ } else {
|
|
|
+ voidRows = queryList(where, 1, "作废", pageSize - rows.size() - checkRows.size(), pageNumber - Double.valueOf(Math.ceil((double) (rows.totalRows + checkRows.totalRows) / (double) pageSize)).intValue() + 1).query();
|
|
|
+ }
|
|
|
} else {
|
|
|
- voidRows.totalRows = queryList(where, 1, "作废", 1).query().totalRows;
|
|
|
+ voidRows.totalRows = queryList(where, 1, "作废", 1, 1).query().totalRows;
|
|
|
}
|
|
|
rows.pageSize = oldpageSize;
|
|
|
rows.addAll(checkRows);
|
|
|
@@ -572,19 +580,27 @@ public class cashbill extends Controller {
|
|
|
|
|
|
pageSorting = " sa_cashbillid desc";
|
|
|
int oldpageSize = pageSize;
|
|
|
- Rows rows = queryList(where, 0, "新建", pageSize).query();
|
|
|
+ Rows rows = queryList(where, 0, "新建", pageSize, pageNumber).query();
|
|
|
Rows checkRows = new Rows();
|
|
|
|
|
|
if (rows.size() < pageSize) {
|
|
|
- checkRows = queryList(where, 0, "审核", pageSize - rows.size()).query();
|
|
|
+ if (rows.size() % pageSize == 0) {
|
|
|
+ checkRows = queryList(where, 0, "审核", pageSize, pageNumber - Double.valueOf(Math.ceil((double) rows.totalRows / (double) pageSize)).intValue()).query();
|
|
|
+ } else {
|
|
|
+ checkRows = queryList(where, 0, "审核", pageSize - rows.size(), pageNumber - Double.valueOf(Math.ceil((double) rows.totalRows / (double) pageSize)).intValue() + 1).query();
|
|
|
+ }
|
|
|
} else {
|
|
|
- checkRows.totalRows = queryList(where, 0, "审核", 1).query().totalRows;
|
|
|
+ checkRows.totalRows = queryList(where, 0, "审核", 1, 1).query().totalRows;
|
|
|
}
|
|
|
Rows voidRows = new Rows();
|
|
|
if (rows.size() + checkRows.size() < pageSize) {
|
|
|
- voidRows = queryList(where, 0, "作废", pageSize - rows.size() - checkRows.size()).query();
|
|
|
+ if ((rows.size() + checkRows.size()) % pageSize == 0) {
|
|
|
+ voidRows = queryList(where, 0, "作废", pageSize, pageNumber - Double.valueOf(Math.ceil((double) (rows.totalRows + checkRows.totalRows) / (double) pageSize)).intValue()).query();
|
|
|
+ } else {
|
|
|
+ voidRows = queryList(where, 0, "作废", pageSize - rows.size() - checkRows.size(), pageNumber - Double.valueOf(Math.ceil((double) (rows.totalRows + checkRows.totalRows) / (double) pageSize)).intValue() + 1).query();
|
|
|
+ }
|
|
|
} else {
|
|
|
- voidRows.totalRows = queryList(where, 0, "作废", 1).query().totalRows;
|
|
|
+ voidRows.totalRows = queryList(where, 0, "作废", 1, 1).query().totalRows;
|
|
|
}
|
|
|
rows.pageSize = oldpageSize;
|
|
|
rows.addAll(checkRows);
|
|
|
@@ -610,7 +626,7 @@ public class cashbill extends Controller {
|
|
|
return getSucReturnObject().setData(rows).toString();
|
|
|
}
|
|
|
|
|
|
- public QuerySQL queryList(String where, int type, String status, int pageSize) throws YosException {
|
|
|
+ public QuerySQL queryList(String where, int type, String status, int pageSize, int pageNumber) throws YosException {
|
|
|
QuerySQL querySQL = SQLFactory.createQuerySQL(this, "sa_cashbill", "*").setTableAlias("t1");
|
|
|
if (type == 1) {
|
|
|
querySQL.addQueryFields("unwriteoffamount", "t1.amount - t1.writeoffamount");
|