|
@@ -4,12 +4,15 @@ import java.awt.BorderLayout;
|
|
|
import java.awt.Dimension;
|
|
|
import java.awt.event.ActionEvent;
|
|
|
import java.awt.event.ActionListener;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
|
|
|
import nc.bs.framework.common.NCLocator;
|
|
|
import nc.desktop.ui.WorkbenchEnvironment;
|
|
|
import nc.itf.hr.SocialInsuranceAllMaintain;
|
|
|
import nc.itf.uap.IUAPQueryBS;
|
|
|
import nc.jdbc.framework.processor.ColumnProcessor;
|
|
|
+import nc.jdbc.framework.processor.MapListProcessor;
|
|
|
import nc.ui.pub.beans.MessageDialog;
|
|
|
import nc.ui.pub.beans.UIButton;
|
|
|
import nc.ui.pub.beans.UIDialog;
|
|
@@ -19,10 +22,11 @@ import nc.ui.pub.bill.BillCardPanel;
|
|
|
import nc.ui.pub.bill.BillEditEvent;
|
|
|
import nc.ui.pub.bill.BillEditListener;
|
|
|
import nc.vo.ecpubapp.pattern.data.ValueUtils;
|
|
|
+import nc.vo.pubapp.pattern.pub.PubAppTool;
|
|
|
import nc.vo.uap.rbac.profile.FunctionPermProfileManager;
|
|
|
|
|
|
/**
|
|
|
- * 表八:实际集团内其他公司已缴当月工资个人部分已扣新增页面
|
|
|
+ * 公积金分摊表新增界面
|
|
|
* @author YaoYu
|
|
|
*
|
|
|
*/
|
|
@@ -141,7 +145,7 @@ public class AccumulationFundAllInsertDiaLog extends UIDialog implements ActionL
|
|
|
//循环表单行数
|
|
|
for (int i = 0; i < cp.getRowCount(); i++) {
|
|
|
String tableName = ValueUtils.getString(cp.getBodyValueAt(i, "tablename"));//表
|
|
|
- String orgCode = QueyrOrgCode(ValueUtils.getString(cp.getBodyValueAt(i, "orgcode")));//公司
|
|
|
+ String orgCode = queyrOrgCode(ValueUtils.getString(cp.getBodyValueAt(i, "orgcode")));//公司
|
|
|
String contributoryOrgName = ValueUtils.getString(cp.getBodyValueAt(i, "contributoryorg"));//成本归属公司
|
|
|
String period = ValueUtils.getString(cp.getBodyValueAt(i, "period"));//年月
|
|
|
String clerkCode = ValueUtils.getString(cp.getBodyValueAt(i, "clerkcode"));//员工编号
|
|
@@ -154,9 +158,30 @@ public class AccumulationFundAllInsertDiaLog extends UIDialog implements ActionL
|
|
|
contributoryOrgName = contributoryOrgName == null ? "" : contributoryOrgName;
|
|
|
String combinedField = tableName + contributoryOrgName + clerkCode + clerkName;
|
|
|
if(queryTable(orgCode, period, combinedField)) {
|
|
|
- MessageDialog.showHintDlg(this, "提示", "成本归属公司:" +contributoryOrgName+ ",员工编号:" + clerkCode + "当月数据已存在不允许重新新增");
|
|
|
+ MessageDialog.showHintDlg(this, "提示", "成本归属公司:" +contributoryOrgName+ ",员工编号:" + clerkCode + ",员工姓名:"+clerkName+",当月数据已存在不允许重复新增");
|
|
|
return;
|
|
|
}
|
|
|
+ if(tableName.equals("表一:由个人承担")) {
|
|
|
+ queryTableOne(orgCode, period, contributoryOrgName, clerkCode, clerkName);
|
|
|
+ }
|
|
|
+ if(tableName.equals("表二:由外部公司承担")) {
|
|
|
+ queryTableTwo(orgCode, period, contributoryOrgName, clerkCode, clerkName);
|
|
|
+ }
|
|
|
+ if(tableName.equals("表三:由部门承担或全额公司承担")) {
|
|
|
+ queryTableThree(orgCode, period, contributoryOrgName, clerkCode, clerkName);
|
|
|
+ }
|
|
|
+ if(tableName.equals("表四:个人部分已在集团内其他公司扣除")) {
|
|
|
+ queryTableFour(orgCode, period, contributoryOrgName, clerkCode, clerkName);
|
|
|
+ }
|
|
|
+ if(tableName.equals("表五:月薪工资表中当月扣当月缴纳")) {
|
|
|
+ queryTableFive(orgCode, period, contributoryOrgName, clerkCode, clerkName);
|
|
|
+ }
|
|
|
+ if(tableName.equals("表六:实际已缴当月工资个人部分未扣")) {
|
|
|
+ queryTableSix(orgCode, period, contributoryOrgName, clerkCode, clerkName);
|
|
|
+ }
|
|
|
+ if(tableName.equals("表七:实际未缴当月工资个人部分已扣")) {
|
|
|
+ queryTableSeven(orgCode, period, contributoryOrgName, clerkCode, clerkName);
|
|
|
+ }
|
|
|
StringBuilder insertSQL = new StringBuilder("INSERT INTO accumulation_fund VALUES (");
|
|
|
insertSQL.append("'").append("公积金分摊表").append("', ");
|
|
|
insertSQL.append("'").append(orgCode).append("', ");
|
|
@@ -197,8 +222,30 @@ public class AccumulationFundAllInsertDiaLog extends UIDialog implements ActionL
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public void afterEdit(BillEditEvent arg0) {
|
|
|
-
|
|
|
+ public void afterEdit(BillEditEvent e) {
|
|
|
+ try {
|
|
|
+ if("orgcode".equals(e.getKey())) {
|
|
|
+ String pk_org = String.valueOf(e.getValue());
|
|
|
+ UIRefPane clerkCodeRef = (UIRefPane) this.jlcardPanel.getBodyItem("clerkcode").getComponent();
|
|
|
+ // 设置当前组织
|
|
|
+ clerkCodeRef.setPk_org(pk_org);
|
|
|
+ }
|
|
|
+ if("clerkcode".equals(e.getKey())) {
|
|
|
+ String clerkcode = String.valueOf(e.getValue());
|
|
|
+ if(clerkcode != null) {
|
|
|
+ String sql = "SELECT name FROM bd_psndoc WHERE pk_psndoc = '"+clerkcode+"'";
|
|
|
+ String clerkname = (String) iuap.executeQuery(sql, new ColumnProcessor());
|
|
|
+ //赋值姓名
|
|
|
+ this.jlcardPanel.setBodyValueAt(clerkname, 0, "clerkname");
|
|
|
+ }else {
|
|
|
+ //清空姓名
|
|
|
+ this.jlcardPanel.setBodyValueAt(null, 0, "clerkname");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ } catch (Exception e1) {
|
|
|
+ MessageDialog.showHintDlg(this, "提示", e1.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -233,6 +280,375 @@ public class AccumulationFundAllInsertDiaLog extends UIDialog implements ActionL
|
|
|
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 查询个人承担是否存在数据
|
|
|
+ * @param orgCode 财务组织
|
|
|
+ * @param period 年月
|
|
|
+ * @param contributoryOrgName 成本归属公司
|
|
|
+ * @param clerkCode 员工号
|
|
|
+ * @param clerkName 姓名
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ private void queryTableOne(String orgCode, String period, String contributoryOrgName, String clerkCode, String clerkName) throws Exception {
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
+ sql.append("SELECT clerkcode");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT ");
|
|
|
+ sql.append(" NULL AS orgname,");
|
|
|
+ sql.append(" t.CLERKCODE AS clerkcode,");
|
|
|
+ sql.append(" T1.CLERKNAME AS clerkname,");
|
|
|
+ sql.append(" t1.housing_fund_base AS basicssum,");
|
|
|
+ sql.append(" NULL AS staffsum,");
|
|
|
+ sql.append(" SUM( NVL( t.VALUE, 0 ) ) AS orgsum,");
|
|
|
+ sql.append(" t1.mark AS mark");
|
|
|
+ sql.append(" from NC6337.v_data_xz_gjjshare t");
|
|
|
+ sql.append(" LEFT JOIN NC6337.V_SUM_TB_HR_SOCIAL_SECURITY t1 ON t1.CLERKCODE = t.CLERKCODE AND t1.PAY_MONTH || '-01' = t.ym");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t.key = '公积金公司税后扣款' and t.VALUE <> 0 and t.ym='"+period+"'||'-01' and t1.ORGCODE_HOUSE='"+orgCode+"' and t1.ENDOWMENT_BASE is not null");
|
|
|
+ sql.append(" GROUP BY t.CLERKCODE,T1.CLERKNAME,t1.housing_fund_base,t1.mark");
|
|
|
+ sql.append(" ) where clerkcode ='"+clerkCode+"' AND clerkname = '"+clerkName+"'");
|
|
|
+ if(!PubAppTool.isNull(contributoryOrgName)) {
|
|
|
+ sql.append(" AND orgname = '"+contributoryOrgName+"'");
|
|
|
+ }
|
|
|
+ if (iuap.executeQuery(sql.toString(), new ColumnProcessor()) != null) {
|
|
|
+ throw new Exception("成本归属公司:" +contributoryOrgName+ ",员工编号:" + clerkCode + ",员工姓名:"+clerkName+",当月数据已存在不允许重复新增");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询外部公司承担是否存在数据
|
|
|
+ * @param orgCode 财务组织
|
|
|
+ * @param period 年月
|
|
|
+ * @param contributoryOrgName 成本归属公司
|
|
|
+ * @param clerkCode 员工号
|
|
|
+ * @param clerkName 姓名
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ private void queryTableTwo(String orgCode, String period, String contributoryOrgName, String clerkCode, String clerkName) throws Exception {
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
+ sql.append("SELECT clerkcode");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" NULL AS orgname,");
|
|
|
+ sql.append(" clerkcode as clerkcode,");
|
|
|
+ sql.append(" clerkname as clerkname,");
|
|
|
+ sql.append(" endowment_base AS basicssum,");
|
|
|
+ sql.append(" so_staff_sum AS staffsum,");
|
|
|
+ sql.append(" so_org_sum AS orgsum,");
|
|
|
+ sql.append(" mark AS mark");
|
|
|
+ sql.append(" FROM nc6337.V_SUM_TB_HR_SOCIAL_SECURITY t");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t.out_org IS NOT NULL AND t.PAY_MONTH = '"+period+"' AND t.ORGCODE = '"+orgCode+"'");
|
|
|
+ sql.append(" ) where clerkcode ='"+clerkCode+"' AND clerkname = '"+clerkName+"'");
|
|
|
+ if(!PubAppTool.isNull(contributoryOrgName)) {
|
|
|
+ sql.append(" AND orgname = '"+contributoryOrgName+"'");
|
|
|
+ }
|
|
|
+ if (iuap.executeQuery(sql.toString(), new ColumnProcessor()) != null) {
|
|
|
+ throw new Exception("成本归属公司:" +contributoryOrgName+ ",员工编号:" + clerkCode + ",员工姓名:"+clerkName+",当月数据已存在不允许重复新增");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询由部门承担或全额公司承担是否存在数据
|
|
|
+ * @param orgCode 财务组织
|
|
|
+ * @param period 年月
|
|
|
+ * @param contributoryOrgName 成本归属公司
|
|
|
+ * @param clerkCode 员工号
|
|
|
+ * @param clerkName 姓名
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ private void queryTableThree(String orgCode, String period, String contributoryOrgName, String clerkCode, String clerkName) throws Exception {
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
+ sql.append(" SELECT clerkcode");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" NULL AS orgname,");
|
|
|
+ sql.append(" clerkcode AS clerkcode,");
|
|
|
+ sql.append(" clerkname AS clerkname,");
|
|
|
+ sql.append(" housing_fund_base AS basicssum,");
|
|
|
+ sql.append(" HOUSING_FUND_STAFF AS staffsum,");
|
|
|
+ sql.append(" HOUSING_FUND_ORG AS orgsum,");
|
|
|
+ sql.append(" NULL AS mark");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" T.housing_fund_base,T.CLERKCODE,T.CLERKNAME,T.HOUSING_FUND_ORG,T.HOUSING_FUND_STAFF,T.ORGCODE_HOUSE,T.PAY_MONTH,T.MARK");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" NC6337.V_SUM_TB_HR_SOCIAL_SECURITY T");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" T.PK_POST IN ( SELECT T3.PK_POST FROM NC6337.om_post t3 WHERE T3.postname = '残保金人员' ) AND T.HOUSING_FUND_ORG <> 0");
|
|
|
+ sql.append(" UNION ALL");
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" t1.housing_fund_base,t1.CLERKCODE,t1.CLERKNAME,t1.HOUSING_FUND_ORG,t1.HOUSING_FUND_STAFF,T1.ORGCODE_HOUSE,t1.PAY_MONTH,T1.MARK");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" NC6337.V_SUM_TB_HR_SOCIAL_SECURITY_D t1 ");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t1.MARK = '表三') t2");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t2.PAY_MONTH = '"+period+"' AND t2.ORGCODE_HOUSE = '"+orgCode+"'");
|
|
|
+ sql.append(" ) where clerkcode ='"+clerkCode+"' AND clerkname = '"+clerkName+"'");
|
|
|
+ if(!PubAppTool.isNull(contributoryOrgName)) {
|
|
|
+ sql.append(" AND orgname = '"+contributoryOrgName+"'");
|
|
|
+ }
|
|
|
+ if (iuap.executeQuery(sql.toString(), new ColumnProcessor()) != null) {
|
|
|
+ throw new Exception("成本归属公司:" +contributoryOrgName+ ",员工编号:" + clerkCode + ",员工姓名:"+clerkName+",当月数据已存在不允许重复新增");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询个人部分已在集团内其他公司扣除是否存在数据
|
|
|
+ * @param orgCode 财务组织
|
|
|
+ * @param period 年月
|
|
|
+ * @param contributoryOrgName 成本归属公司
|
|
|
+ * @param clerkCode 员工号
|
|
|
+ * @param clerkName 姓名
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ private void queryTableFour(String orgCode, String period, String contributoryOrgName, String clerkCode, String clerkName) throws Exception {
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
+ sql.append(" SELECT clerkcode");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" salocation AS orgname,");
|
|
|
+ sql.append(" clerkcode,");
|
|
|
+ sql.append(" clerkname,");
|
|
|
+ sql.append(" housing_fund_base AS basicssum,");
|
|
|
+ sql.append(" HOUSING_FUND_STAFF AS staffsum,");
|
|
|
+ sql.append(" HOUSING_FUND_ORG AS orgsum,");
|
|
|
+ sql.append(" mark");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" t.CLERKCODE,T1.CLERKNAME,t.ym,sum( nvl( t.VALUE, 0 ) ) AS sum_per_cost,t.c_23 AS salocation,t1.HOUSING_FUND_ORG,t1.HOUSING_FUND_STAFF,t1.housing_fund_base,t1.mark");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" NC6337.v_data_xz_gjjshare t");
|
|
|
+ sql.append(" LEFT JOIN NC6337.V_SUM_TB_HR_SOCIAL_SECURITY t1 ON t1.CLERKCODE = t.CLERKCODE");
|
|
|
+ sql.append(" AND t1.PAY_MONTH || '-01' = t.ym");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t.key = '社保个人合计' AND t.VALUE <> 0 AND t.ym = '"+period+"' || '-01' AND t1.ORGCODE_HOUSE = '"+orgCode+"' AND t1.HOUSING_FUND_PAY_ORG <> t.c_23");
|
|
|
+ sql.append(" GROUP BY ROWNUM,t.CLERKCODE,T1.CLERKNAME,t.ym,t1.housing_fund_base,t1.HOUSING_FUND_ORG,t1.HOUSING_FUND_STAFF,t.c_23,t1.mark");
|
|
|
+ sql.append(" ORDER BY t.c_23)");
|
|
|
+ sql.append(" ) where clerkcode ='"+clerkCode+"' AND clerkname = '"+clerkName+"'");
|
|
|
+ if(!PubAppTool.isNull(contributoryOrgName)) {
|
|
|
+ sql.append(" AND orgname = '"+contributoryOrgName+"'");
|
|
|
+ }
|
|
|
+ if (iuap.executeQuery(sql.toString(), new ColumnProcessor()) != null) {
|
|
|
+ throw new Exception("成本归属公司:" +contributoryOrgName+ ",员工编号:" + clerkCode + ",员工姓名:"+clerkName+",当月数据已存在不允许重复新增");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询月薪工资表中当月扣当月缴纳是否存在数据
|
|
|
+ * @param orgCode 财务组织
|
|
|
+ * @param period 年月
|
|
|
+ * @param contributoryOrgName 成本归属公司
|
|
|
+ * @param clerkCode 员工号
|
|
|
+ * @param clerkName 姓名
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ private void queryTableFive(String orgCode, String period, String contributoryOrgName, String clerkCode, String clerkName) throws Exception {
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
+ sql.append(" SELECT clerkcode");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" costorgname AS orgname,");
|
|
|
+ sql.append(" clerkcode,");
|
|
|
+ sql.append(" clerkname,");
|
|
|
+ sql.append(" housing_fund_base AS basicssum,");
|
|
|
+ sql.append(" HOUSING_FUND_STAFF AS staffsum,");
|
|
|
+ sql.append(" HOUSING_FUND_ORG AS orgsum,");
|
|
|
+ sql.append(" mark");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" t.CLERKCODE,T1.CLERKNAME,t.ym,sum( nvl( t.VALUE, 0 ) ) AS sum_per_cost,T13.Name AS costorgname,t.c_23 AS salocation,t1.HOUSING_FUND_ORG - nvl( t15.sum_per_cost, 0 ) - nvl( t16.HOUSING_FUND_ORG, 0 ) AS HOUSING_FUND_ORG,t1.HOUSING_FUND_STAFF,t1.housing_fund_base,t1.mark ");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" NC6337.v_data_xz_gjjshare t");
|
|
|
+ sql.append(" LEFT JOIN NC6337.V_SUM_TB_HR_SOCIAL_SECURITY t1 ON t1.CLERKCODE = t.CLERKCODE");
|
|
|
+ sql.append(" AND t1.PAY_MONTH || '-01' = t.ym");
|
|
|
+ sql.append(" LEFT JOIN (");
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" t12.CLERK_CODE,");
|
|
|
+ sql.append(" t12.NC_PK_POST");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" nc6337.monthly_position_gjj t12");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t12.month = to_char( last_day( to_date( '"+period+"', 'yyyy-mm' ) ), 'yyyy-mm-dd' )");
|
|
|
+ sql.append(" ) T12 ON t12.CLERK_CODE = t.CLERKCODE");
|
|
|
+ sql.append(" LEFT JOIN nc6337.om_post t14 ON t14.pk_post = t12.NC_PK_POST");
|
|
|
+ sql.append(" LEFT JOIN nc6337.org_corp T13 ON T13.Pk_Corp = t14.pk_org");
|
|
|
+ sql.append(" LEFT JOIN nc6337.person_afford_sbgjj_g t15 ON t15.CLERKCODE = t.CLERKCODE AND t.YM = t15.ym");
|
|
|
+ sql.append(" LEFT JOIN nc6337.DEPT_AFFORD_SBGJJ t16 ON t16.CLERKCODE = t.CLERKCODE AND t.YM = t16.PAY_MONTH");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t.key IN ( '公积金个人合计', '费用调整公积金', '公积金个人扣款', '费用调整公积金t' )AND t.VALUE <> 0 AND t.ym = '"+period+"' || '-01' AND t1.ORGCODE_HOUSE = '"+orgCode+"' AND t1.Housing_Fund_Pay_Org = t.c_23");
|
|
|
+ sql.append(" AND t.CLERKCODE NOT IN ( SELECT t11.WORKERCODE FROM nc6337.v_hr_allocationratio_gjjshareF t11 WHERE t11.WA_PERIOD = '"+period+"' || '-01' )");
|
|
|
+ sql.append(" GROUP BY t.CLERKCODE,t.CLERKCODE,T1.CLERKNAME,t.ym,t1.housing_fund_base,t1.HOUSING_FUND_ORG - nvl( t15.sum_per_cost, 0 ) - nvl( t16.HOUSING_FUND_ORG, 0 ),t1.HOUSING_FUND_STAFF,T13.Name,t.c_23,t1.mark");
|
|
|
+ sql.append(" UNION ALL");
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" t.WORKERCODE AS CLERKCODE,t1.CLERKNAME,t.WA_PERIOD AS ym,0 AS sum_per_cost,T6.NAME AS costorgname,'上海天华' AS salocation,round( nvl( t1.HOUSING_FUND_ORG, 0 ) * nvl( t.perc, 0 ), 2 ) AS HOUSING_FUND_ORG,");
|
|
|
+ sql.append(" round( nvl( t1.HOUSING_FUND_STAFF, 0 ) * nvl( t.perc, 0 ), 2 ) AS HOUSING_FUND_STAFF,t1.housing_fund_base,t1.mark");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" nc6337.v_hr_allocationratio_gjjshareF t");
|
|
|
+ sql.append(" LEFT JOIN nc6337.V_SUM_TB_HR_SOCIAL_SECURITY t1 ON t1.CLERKCODE = t.WORKERCODE AND t1.PAY_MONTH || '-01' = t.WA_PERIOD");
|
|
|
+ sql.append(" LEFT JOIN ( SELECT DISTINCT T5.CODE, T5.NAME, t5.pk_corp FROM nc6337.ORG_CORP T5 ) T6 ON T6.pk_corp = T.COST_ORG");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t.WA_PERIOD = '"+period+"' || '-01'AND t1.CLERKNAME IS NOT NULL AND t1.ORGCODE_HOUSE = '"+orgCode+"' UNION ALL");
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" t1.CLERKCODE,t1.CLERKNAME,t1.PAY_MONTH || '-01' AS ym,0 AS sum_per_cost,T1.Housing_Fund_Pay_Org AS costorgname,'上海天华' AS salocation,t1.HOUSING_FUND_ORG,0 AS HOUSING_FUND_STAFF,t1.housing_fund_base,t1.mark");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" NC6337.V_SUM_TB_HR_SOCIAL_SECURITY_D t1");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t1.MARK IN ( '资质人员', '上海公司承担' )AND t1.PAY_MONTH = '"+period+"'AND t1.ORGCODE_HOUSE = '"+orgCode+"')");
|
|
|
+ sql.append(" ) where clerkcode ='"+clerkCode+"' AND clerkname = '"+clerkName+"'");
|
|
|
+ if(!PubAppTool.isNull(contributoryOrgName)) {
|
|
|
+ sql.append(" AND orgname = '"+contributoryOrgName+"'");
|
|
|
+ }
|
|
|
+ if (iuap.executeQuery(sql.toString(), new ColumnProcessor()) != null) {
|
|
|
+ throw new Exception("成本归属公司:" +contributoryOrgName+ ",员工编号:" + clerkCode + ",员工姓名:"+clerkName+",当月数据已存在不允许重复新增");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询实际已缴纳当月工资个人部分未扣是否存在数据
|
|
|
+ * @param orgCode 财务组织
|
|
|
+ * @param period 年月
|
|
|
+ * @param contributoryOrgName 成本归属公司
|
|
|
+ * @param clerkCode 员工号
|
|
|
+ * @param clerkName 姓名
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ private void queryTableSix(String orgCode, String period, String contributoryOrgName, String clerkCode, String clerkName) throws Exception {
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" clerkcode");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" T13.Name AS orgname,");
|
|
|
+ sql.append(" clerkcode,");
|
|
|
+ sql.append(" clerkname,");
|
|
|
+ sql.append(" endowment_base AS basicssum,");
|
|
|
+ sql.append(" housing_fund_staff AS staffsum,");
|
|
|
+ sql.append(" housing_fund_org AS orgsum,");
|
|
|
+ sql.append(" mark");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" nc6337.V_SUM_TB_HR_SOCIAL_SECURITY t1");
|
|
|
+ sql.append(" LEFT JOIN (");
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" t12.CLERK_CODE,");
|
|
|
+ sql.append(" t12.NC_PK_POST");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" nc6337.monthly_position_gjj t12");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t12.month = to_char( last_day( to_date( '"+period+"', 'yyyy-mm' ) ), 'yyyy-mm-dd' )");
|
|
|
+ sql.append(" ) T12 ON t12.CLERK_CODE = t1.CLERKCODE");
|
|
|
+ sql.append(" LEFT JOIN nc6337.om_post t14 ON t14.pk_post = t12.NC_PK_POST");
|
|
|
+ sql.append(" LEFT JOIN nc6337.org_corp T13 ON T13.Pk_Corp = t14.pk_org");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t1.CLERKCODE NOT IN (");
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" t2.CLERKCODE");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" t.CLERKCODE,sum( nvl( t.VALUE, 0 ) ) AS sumVALUE");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" NC6337.v_data_xz_gjjshare t");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t.key IN ( '公积金个人合计', '公积金个人扣款' )AND t.ym = '"+period+"' || '-01'");
|
|
|
+ sql.append(" GROUP BY t.CLERKCODE) t2");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t2.sumVALUE > 0)");
|
|
|
+ sql.append(" AND T1.PK_POST NOT IN ( SELECT T3.PK_POST FROM NC6337.om_post t3 WHERE T3.postname IN ( '残保金人员', '资质人员' ) ) AND t1.out_org IS NULL");
|
|
|
+ sql.append(" AND t1.housing_fund_base <> 0 AND t1.PAY_MONTH = '"+period+"'AND t1.ORGCODE_HOUSE = '"+orgCode+"'");
|
|
|
+ sql.append(" ) where clerkcode ='"+clerkCode+"'");
|
|
|
+ if(!PubAppTool.isNull(contributoryOrgName)) {
|
|
|
+ sql.append(" AND orgname = '"+contributoryOrgName+"' AND clerkname = '"+clerkName+"'");
|
|
|
+ }
|
|
|
+ if (iuap.executeQuery(sql.toString(), new ColumnProcessor()) != null) {
|
|
|
+ throw new Exception("成本归属公司:" +contributoryOrgName+ ",员工编号:" + clerkCode + ",员工姓名:"+clerkName+",当月数据已存在不允许重复新增");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询实际未缴当月工资个人部分已扣是否存在数据
|
|
|
+ * @param orgCode 财务组织
|
|
|
+ * @param period 年月
|
|
|
+ * @param contributoryOrgName 成本归属公司
|
|
|
+ * @param clerkCode 员工号
|
|
|
+ * @param clerkName 姓名
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ private void queryTableSeven(String orgCode, String period, String contributoryOrgName, String clerkCode, String clerkName) throws Exception {
|
|
|
+ StringBuffer sql = new StringBuffer();
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" clerkcode");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" orgname,");
|
|
|
+ sql.append(" clerkcode,");
|
|
|
+ sql.append(" clerkname,");
|
|
|
+ sql.append(" housing_fund_base AS basicssum,");
|
|
|
+ sql.append(" housing_fund_staff AS staffsum,");
|
|
|
+ sql.append(" so_org_sum AS orgsum,");
|
|
|
+ sql.append(" mark");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" t1.CLERKCODE,t1.CLERKNAME,t1.housing_fund_base,( t16.sumvalue - t1.HOUSING_FUND_STAFF ) AS HOUSING_FUND_STAFF,0 AS so_org_sum,T13.Name AS orgname,t1.mark ");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" nc6337.V_SUM_TB_HR_SOCIAL_SECURITY t1");
|
|
|
+ sql.append(" LEFT JOIN (");
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" t12.CLERK_CODE,t12.NC_PK_POST");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" nc6337.monthly_position_gjj t12 ");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t12.month = to_char( last_day( to_date( '"+period+"', 'yyyy-mm' ) ), 'yyyy-mm-dd' )");
|
|
|
+ sql.append(" ) T12 ON t12.CLERK_CODE = t1.CLERKCODE");
|
|
|
+ sql.append(" LEFT JOIN nc6337.om_post t14 ON t14.pk_post = t12.NC_PK_POST");
|
|
|
+ sql.append(" LEFT JOIN nc6337.org_corp T13 ON T13.Pk_Corp = t14.pk_org");
|
|
|
+ sql.append(" LEFT JOIN nc6337.person_deduction_sbgjj_g t16 ON t16.CLERKCODE = t1.CLERKCODE ");
|
|
|
+ sql.append(" AND t1.pay_month || '-01' = t16.ym");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t1.CLERKCODE IN (");
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" t2.CLERKCODE");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" (SELECT");
|
|
|
+ sql.append(" t.CLERKCODE,sum( nvl( t.VALUE, 0 ) ) AS sumVALUE");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" NC6337.v_data_xz_gjjshare t ");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t.key IN ( '公积金个人合计', '公积金个人扣款' ) AND t.ym = '"+period+"' || '-01'");
|
|
|
+ sql.append(" GROUP BY t.CLERKCODE) t2");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t2.sumVALUE > 0) ");
|
|
|
+ sql.append(" AND T12.NC_PK_POST NOT IN ( SELECT T3.PK_POST FROM NC6337.om_post t3 WHERE T3.postname IN ( '残保金人员', '资质人员' ) )");
|
|
|
+ sql.append(" AND t1.out_org IS NULL AND t1.housing_fund_base <> 0 AND ( t16.sumvalue - t1.HOUSING_FUND_STAFF ) <> 0");
|
|
|
+ sql.append(" AND t1.PAY_MONTH = '"+period+"' AND t1.ORGCODE_HOUSE = '"+orgCode+"'");
|
|
|
+ sql.append(" UNION ALL");
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" t1.CLERKCODE,t1.CLERKNAME,t1.housing_fund_base,t1.HOUSING_FUND_STAFF,t1.HOUSING_FUND_ORG,T13.Name AS orgname,t1.mark");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" nc6337.V_SUM_TB_HR_SOCIAL_SECURITY_D t1");
|
|
|
+ sql.append(" LEFT JOIN (");
|
|
|
+ sql.append(" SELECT");
|
|
|
+ sql.append(" t12.CLERK_CODE,t12.NC_PK_POST");
|
|
|
+ sql.append(" FROM");
|
|
|
+ sql.append(" nc6337.monthly_position_gjj t12");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t12.month = to_char( last_day( to_date( '"+period+"', 'yyyy-mm' ) ), 'yyyy-mm-dd' )");
|
|
|
+ sql.append(" ) T12 ON t12.CLERK_CODE = t1.CLERKCODE");
|
|
|
+ sql.append(" LEFT JOIN nc6337.om_post t14 ON t14.pk_post = t12.NC_PK_POST");
|
|
|
+ sql.append(" LEFT JOIN nc6337.org_corp T13 ON T13.Pk_Corp = t14.pk_org");
|
|
|
+ sql.append(" WHERE");
|
|
|
+ sql.append(" t1.mark LIKE '%表七%' AND t1.PAY_MONTH = '"+period+"'AND t1.ORGCODE_HOUSE = '"+orgCode+"')");
|
|
|
+ sql.append(" ) where clerkcode ='"+clerkCode+"' AND clerkname = '"+clerkName+"'");
|
|
|
+ if(!PubAppTool.isNull(contributoryOrgName)) {
|
|
|
+ sql.append(" AND orgname = '"+contributoryOrgName+"'");
|
|
|
+ }
|
|
|
+ if (iuap.executeQuery(sql.toString(), new ColumnProcessor()) != null) {
|
|
|
+ throw new Exception("成本归属公司:" +contributoryOrgName+ ",员工编号:" + clerkCode + ",员工姓名:"+clerkName+",当月数据已存在不允许重复新增");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 查询中间表是否存在数据
|
|
|
* @param orgCode 查询组织
|
|
@@ -261,7 +677,7 @@ public class AccumulationFundAllInsertDiaLog extends UIDialog implements ActionL
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
- public String QueyrOrgCode(String orgName) throws Exception {
|
|
|
+ public String queyrOrgCode(String orgName) throws Exception {
|
|
|
String sql = "select code from org_financeorg where name ='"+orgName+"' and enablestate = '2' and dr = 0";
|
|
|
return (String) iuap.executeQuery(sql.toString(), new ColumnProcessor());
|
|
|
}
|