package com.kingdee.eas.custom.erp.util;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.eas.util.app.DbUtil;
import com.kingdee.jdbc.rowset.IRowSet;

import java.sql.SQLException;

/**
 * description: SynSalaryFromErpUtilsEx <br>
 * date: 2025/3/19 15:24 <br>
 * author: lhbj <br>
 * version: 1.0 <br>
 */
public class SynSalaryFromErpUtilsEx {
    public static void getYearMonth(Context ctx, String cmpschemeid) {
        String sel = "select fid,fperiodyear,fperiodmonth from T_HR_SCalScheme where fid =?";
        try {
            IRowSet rs = DbUtil.executeQuery(ctx,sel,new String[]{cmpschemeid});
            if (rs.next()){
                String year = rs.getString("fperiodyear");
                String month = rs.getString("fperiodmonth");
                String yearMonth = year;
                if("10".compareTo(month)<0){
                    month="0"+month;
                }
                yearMonth=yearMonth+"-"+month;
                SynSalaryFromErpUtils.synSalaryToErp(ctx,yearMonth);
            }
        } catch (BOSException | SQLException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
