|
|
@@ -219,6 +219,19 @@ public class period extends Controller {
|
|
|
if (rows.isEmpty()) {
|
|
|
return getErrReturnObject().setErrMsg("会计期间不存在").toString();
|
|
|
}
|
|
|
+ int year = rows.get(0).getInteger("year");
|
|
|
+ int month = rows.get(0).getInteger("month");
|
|
|
+
|
|
|
+ int newyear = year;
|
|
|
+ int newmonth;
|
|
|
+ if (month == 12) {
|
|
|
+ newyear = year + 1;
|
|
|
+ newmonth = 1;
|
|
|
+ } else {
|
|
|
+ newmonth = month + 1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
UpdateSQL updateSQL = SQLFactory.createUpdateSQL(this, "st_period");
|
|
|
updateSQL.setUniqueid(st_periodid);
|
|
|
@@ -268,8 +281,7 @@ public class period extends Controller {
|
|
|
// "\t\t\t\t)t3 on t1.itemid = t3.itemid and t0.stockid = t3.stockid and t1.siteid = t3.siteid \n" +
|
|
|
// "\t\t\t\twhere ifnull(t2.qty,0) + ifnull(t3.qty,0)!=0 ");
|
|
|
|
|
|
- int year = rows.get(0).getInteger("year");
|
|
|
- int month = rows.get(0).getInteger("month");
|
|
|
+
|
|
|
SQLFactory sqlFactory = new SQLFactory(this, "本期结账库存查询");
|
|
|
sqlFactory.addParameter("siteid", siteid);
|
|
|
sqlFactory.addParameter("year", year);
|
|
|
@@ -278,16 +290,6 @@ public class period extends Controller {
|
|
|
sqlFactory.addParameter("enddate", rows.get(0).getString("enddate"));
|
|
|
Rows invbalRows = dbConnect.runSqlQuery(sqlFactory.getSQL());
|
|
|
|
|
|
-
|
|
|
- int newyear = year;
|
|
|
- int newmonth;
|
|
|
- if (month == 12) {
|
|
|
- newyear = year + 1;
|
|
|
- newmonth = 1;
|
|
|
- } else {
|
|
|
- newmonth = month + 1;
|
|
|
- }
|
|
|
-
|
|
|
if (invbalRows.isNotEmpty()) {
|
|
|
for (Row row : invbalRows) {
|
|
|
InsertSQL insertSQL = SQLFactory.createInsertSQL(this, "sa_inventoryear");
|
|
|
@@ -310,7 +312,7 @@ public class period extends Controller {
|
|
|
sqlList.add(
|
|
|
DataContrlLog.createLog(this, "st_period", st_periodid, "库存结账", "会计期间库存结账成功").getSQL());
|
|
|
} else {
|
|
|
- sqlList.add("delete from sa_inventoryear where year=" + rows.get(0).getLong("year") + " and month=" + rows.get(0).getLong("month"));
|
|
|
+ sqlList.add("delete from sa_inventoryear where year=" + newyear + " and month=" + newmonth);
|
|
|
sqlList.add(
|
|
|
DataContrlLog.createLog(this, "st_period", st_periodid, "反库存结账", "会计期间反库存结账成功").getSQL());
|
|
|
}
|