|
|
@@ -211,6 +211,74 @@ public class Accountbalance extends BaseClass {
|
|
|
return sqlList;
|
|
|
}
|
|
|
|
|
|
+ public static ArrayList<String> createCashbillIncome(Controller controller, long sys_enterpriseid, long sa_accountclassid,CashbillEntity cashbillEntity,Boolean ischeck,String type,String typemx) throws YosException {
|
|
|
+ ArrayList<String> sqlList = new ArrayList<>();
|
|
|
+ long sa_cashbillid = controller.createTableID("sa_cashbill");
|
|
|
+ String billcode = controller.createBillCode("cashbill");
|
|
|
+ SQLFactory sqlFactory = new SQLFactory(new Accountbalance(), "收支凭证新增-分类分类明细");
|
|
|
+ sqlFactory.addParameter("billno", billcode);
|
|
|
+ sqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
|
|
|
+ sqlFactory.addParameter("sa_accountclassid", sa_accountclassid);
|
|
|
+ sqlFactory.addParameter("type", 1);
|
|
|
+ sqlFactory.addParameter("siteid", controller.siteid);
|
|
|
+ sqlFactory.addParameter("remarks", cashbillEntity.getRemarks());
|
|
|
+ sqlFactory.addParameter("amount", cashbillEntity.getAmount());
|
|
|
+ sqlFactory.addParameter("sa_cashbillid", sa_cashbillid);
|
|
|
+ sqlFactory.addParameter("userid", controller.userid);
|
|
|
+ sqlFactory.addParameter("username", controller.username);
|
|
|
+ sqlFactory.addParameter("ownertable", cashbillEntity.getOwnertable());
|
|
|
+ sqlFactory.addParameter("ownerid", cashbillEntity.getOwnerid());
|
|
|
+ sqlFactory.addParameter("source", cashbillEntity.getSource());
|
|
|
+ sqlFactory.addParameter("sourcenote", cashbillEntity.getSourcenote());
|
|
|
+ sqlFactory.addParameter("sa_cashbillid_rebate", "null");
|
|
|
+ sqlFactory.addParameter("class", type);
|
|
|
+ sqlFactory.addParameter("subclass", typemx);
|
|
|
+ if (ischeck) {
|
|
|
+ BigDecimal balance; //当前账户余额
|
|
|
+ sqlFactory.addParameter("status", "审核");
|
|
|
+ sqlFactory.addParameter("checkby", controller.username);
|
|
|
+ sqlFactory.addParameter_SQL("checkdate", "CURRENT_TIME");
|
|
|
+
|
|
|
+ // 审核逻辑判断
|
|
|
+ Rows rowsaccountbalance = controller.dbConnect.runSqlQuery(
|
|
|
+ "select sa_accountbalanceid,balance,creditquota from sa_accountbalance where sys_enterpriseid ='"
|
|
|
+ + sys_enterpriseid + "' and sa_accountclassid='" + sa_accountclassid + "' and siteid='"
|
|
|
+ + controller.siteid + "'");
|
|
|
+
|
|
|
+ if (rowsaccountbalance.isEmpty()) {
|
|
|
+ SQLFactory accountbalanceaddSqlFactory = new SQLFactory(new Accountbalance(), "营销账户余额新增");
|
|
|
+ accountbalanceaddSqlFactory.addParameter("sa_accountbalanceid",
|
|
|
+ controller.createTableID("sa_accountbalance"));
|
|
|
+ accountbalanceaddSqlFactory.addParameter("sys_enterpriseid", sys_enterpriseid);
|
|
|
+ accountbalanceaddSqlFactory.addParameter("sa_accountclassid", sa_accountclassid);
|
|
|
+ accountbalanceaddSqlFactory.addParameter("siteid", controller.siteid);
|
|
|
+ accountbalanceaddSqlFactory.addParameter("balance", cashbillEntity.getAmount());
|
|
|
+ accountbalanceaddSqlFactory.addParameter("userid", controller.userid);
|
|
|
+ accountbalanceaddSqlFactory.addParameter("username", controller.username);
|
|
|
+ balance = cashbillEntity.getAmount();
|
|
|
+ sqlList.add(accountbalanceaddSqlFactory.getSQL());
|
|
|
+ } else {
|
|
|
+ BigDecimal newbalance = cashbillEntity.getAmount().add(rowsaccountbalance.get(0).getBigDecimal("balance"));
|
|
|
+ sqlList.add("update sa_accountbalance set balance='" + newbalance
|
|
|
+ + "',changedate=CURRENT_TIME,changeby ='" + controller.username + "',changeuserid='"
|
|
|
+ + controller.userid + "' where sys_enterpriseid ='" + sys_enterpriseid
|
|
|
+ + "' and sa_accountclassid='" + sa_accountclassid + "' and siteid='" + controller.siteid
|
|
|
+ + "'");
|
|
|
+ balance = newbalance;
|
|
|
+ }
|
|
|
+ sqlFactory.addParameter("balance", balance);
|
|
|
+ } else {
|
|
|
+ sqlFactory.addParameter("status", "新建");
|
|
|
+ sqlFactory.addParameter("checkby", "null");
|
|
|
+ sqlFactory.addParameter("checkdate", "null");
|
|
|
+ sqlFactory.addParameter("balance", 0);
|
|
|
+ }
|
|
|
+ sqlList.add(sqlFactory.getSQL());
|
|
|
+ String content = "您有一项来自【" + cashbillEntity.getSource() + "】金额为" + cashbillEntity.getAmount() + "的【收入】凭证";
|
|
|
+ new Accountbalance().sendMsg(controller, content, cashbillEntity.getOwnerid(), sys_enterpriseid);
|
|
|
+ return sqlList;
|
|
|
+ }
|
|
|
+
|
|
|
public static ArrayList<String> createCashbillPay(Controller controller, long sys_enterpriseid, long sa_accountclassid, CashbillEntity cashbillEntity, boolean ischeck, Long sa_cashbillid_rebate) throws YosException {
|
|
|
ArrayList<String> sqlList = new ArrayList<>();
|
|
|
long sa_cashbillid = controller.createTableID("sa_cashbill");
|