Search in sources :

Example 6 with LMSumInfo

use of com.kendy.entity.LMSumInfo in project financial by greatkendy123.

the class LMController method updateTableLMSumOnly.

/**
 * 修改桌费和已结算之后自动更新主表(指单个俱乐部的统计之和)
 * @time 2017年11月25日
 */
private void updateTableLMSumOnly() {
    if (tableLMSum == null || tableLMSum.getItems() == null)
        return;
    double sum_jieyu = 0d;
    for (LMSumInfo info : tableLMSum.getItems()) if (!"结余".equals(info.getLmSumName()))
        sum_jieyu += NumUtil.getNum(info.getLmSumZJ());
    for (LMSumInfo info : tableLMSum.getItems()) if ("结余".equals(info.getLmSumName()))
        info.setLmSumZJ(NumUtil.digit0(sum_jieyu));
    tableLMSum.refresh();
}
Also used : LMSumInfo(com.kendy.entity.LMSumInfo)

Example 7 with LMSumInfo

use of com.kendy.entity.LMSumInfo in project financial by greatkendy123.

the class LMController method initialize.

/**
 * FXML DOM节点加载完毕后的初始化
 */
@Override
public void initialize(URL location, ResourceBundle resources) {
    log.info("联盟对帐页面加载数据开始...");
    // 绑定代理查询中的合计表
    bindCellValue(lmDetailTableId, lmDetailZJ, lmDetailInsure, lmDetailPersonCount);
    // 红色注释
    lmDetailZJ.setCellFactory(MyController.getColorCellFactory(new LMDetailInfo()));
    lmDetailInsure.setCellFactory(MyController.getColorCellFactory(new LMDetailInfo()));
    // 绑定代理查询中的合计表
    tableLMSum.setEditable(true);
    bindCellValue(lmSumName, lmSumZJ, lmSumInsure, lmSumPersonCount);
    // 红色注释
    lmSumInsure.setCellFactory(MyController.getColorCellFactory(new LMSumInfo()));
    lmSumZJ.setCellFactory(TextFieldTableCell.forTableColumn());
    // shishiJine.setCellFactory(redAndEditCellFactory);
    lmSumZJ.setOnEditCommit(new EventHandler<CellEditEvent<LMSumInfo, String>>() {

        @Override
        public void handle(CellEditEvent<LMSumInfo, String> t) {
            String oldValue = t.getOldValue();
            String newValue = t.getNewValue();
            // 修改原值
            LMSumInfo sumInfo = (LMSumInfo) t.getTableView().getItems().get(t.getTablePosition().getRow());
            List<String> noAllowList = Arrays.asList("结余", "当天总帐");
            if (sumInfo == null || noAllowList.contains(sumInfo.getLmSumName())) {
                ShowUtil.show("此行不能编辑!");
                sumInfo.setLmSumZJ(oldValue);
                tableLMSum.refresh();
                return;
            }
            if (sumInfo != null && "桌费".equals(sumInfo.getLmSumName()) && !("0".equals(newValue)) && !(newValue.contains("-"))) {
                ShowUtil.show("桌费只能填写负数!");
                sumInfo.setLmSumZJ(oldValue);
                tableLMSum.refresh();
                return;
            }
            // 因为桌费和已结算在战绩那列
            String zf_or_yiJieSuan = sumInfo.getLmSumZJ();
            try {
                if (!StringUtil.isBlank(newValue))
                    Double.valueOf(newValue);
            } catch (Exception e) {
                ShowUtil.show(newValue + "是非法数据!!");
                sumInfo.setLmSumZJ(oldValue);
                tableLMSum.refresh();
                return;
            }
            // 新旧两值相等,应该不操作
            // 总和表赋新值
            sumInfo.setLmSumZJ(newValue);
            // 缓存赋新值(桌费或已结算)
            Club club = getSelectedClub();
            int lmType = getCurrentLMType();
            if ("桌费".equals(sumInfo.getLmSumName())) {
                // club.setZhuoFei(newValue);
                // 将新桌费设置到不同联盟当中
                set_LM_Zhuofei(club, lmType, newValue);
                // add 2018-2-11 添加到历史联盟桌费
                String date = StringUtil.isBlank(DataConstans.Date_Str) ? "2017-01-01" : DataConstans.Date_Str;
                ClubZhuofei clubZhuofei = new ClubZhuofei(date, club.getClubId(), newValue, "联盟" + lmType);
                DBUtil.saveOrUpdate_club_zhuofei(clubZhuofei);
            } else if ("已结算".equals(sumInfo.getLmSumName())) {
                // club.setYiJieSuan(newValue);
                // 将新桌费设置到不同联盟当中
                set_LM_YiJiesuan(club, lmType, newValue);
            }
            // 更新结余
            updateTableLMSumOnly();
            // 同步到数据库
            DBUtil.updateClub(club);
            // 设置合计桌费(这个没多大影响)
            setNewSumOfZF();
        }
    });
    // 设置俱乐部的ListView监听
    initSingClubListen();
    // 软件一打开就从从数据库中获取所有俱乐部信息
    allClubMap = DBUtil.getAllClub();
    _clubListView = clubListView;
    refreshClubList();
    // 同步所有俱乐部信息总列表
    refresh_eachClubList();
    // 设置合计桌费(这个没多大影响)
    setNewSumOfZF();
    log.info("联盟对帐页面加载数据完成!");
}
Also used : ClubZhuofei(com.kendy.entity.ClubZhuofei) LMSumInfo(com.kendy.entity.LMSumInfo) Club(com.kendy.entity.Club) List(java.util.List) ObservableList(javafx.collections.ObservableList) ArrayList(java.util.ArrayList) CellEditEvent(javafx.scene.control.TableColumn.CellEditEvent) LMDetailInfo(com.kendy.entity.LMDetailInfo)

Example 8 with LMSumInfo

use of com.kendy.entity.LMSumInfo in project financial by greatkendy123.

the class ExportAllLMExcel method loadData.

/**
 * 加载数据,将数据整合成模板所需的key值
 * @return Map 用于替换Excel模板中的数据
 */
private Map<String, String> loadData() {
    Map<String, String> map = new HashMap<String, String>();
    int count = 0;
    for (String clubId : allClubSumMap.keySet()) {
        // 联盟信息
        List<LMSumInfo> lmSumInfos = allClubSumMap.get(clubId);
        String clubName = allClubMap.containsKey(clubId) ? allClubMap.get(clubId).getName() : "";
        map.put("clubName" + count, clubName);
        // 联盟数据,根据排序sortMap顺序瓶装Excel所需的key值
        for (LMSumInfo lmSumInfo : lmSumInfos) {
            String infoCount = sortMap.get(lmSumInfo.getLmSumName());
            map.put("lmSumInsure_" + count + "_" + infoCount, lmSumInfo.getLmSumInsure());
            map.put("lmSumName_" + count + "_" + infoCount, lmSumInfo.getLmSumName());
            map.put("lmSumPersonCount_" + count + "_" + infoCount, lmSumInfo.getLmSumPersonCount());
            map.put("lmSumZJ_" + count + "_" + infoCount, lmSumInfo.getLmSumZJ());
        }
        count++;
    }
    map.put("total", String.valueOf(sumOfZF));
    log.info("加载联盟总帐Excel数据到Map完成");
    return map;
}
Also used : LMSumInfo(com.kendy.entity.LMSumInfo) HashMap(java.util.HashMap)

Aggregations

LMSumInfo (com.kendy.entity.LMSumInfo)8 ArrayList (java.util.ArrayList)4 ObservableList (javafx.collections.ObservableList)4 Club (com.kendy.entity.Club)3 LMDetailInfo (com.kendy.entity.LMDetailInfo)3 HashMap (java.util.HashMap)3 List (java.util.List)3 Map (java.util.Map)2 ClubZhuofei (com.kendy.entity.ClubZhuofei)1 Record (com.kendy.entity.Record)1 ExportLMExcel (com.kendy.excel.ExportLMExcel)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 Insets (javafx.geometry.Insets)1 TableColumn (javafx.scene.control.TableColumn)1 CellEditEvent (javafx.scene.control.TableColumn.CellEditEvent)1 TableView (javafx.scene.control.TableView)1 Border (javafx.scene.layout.Border)1 BorderStroke (javafx.scene.layout.BorderStroke)1 BorderWidths (javafx.scene.layout.BorderWidths)1