|
发表于 2020-5-26 14:23:10
|
显示全部楼层
- SELECT
- MONTH_PAY_DETAIL.VERSION AS version
- ,MONTH_PAY_DETAIL.MASTER AS MASTER
- ,MONTH_PAY_DETAIL.PO_NO AS PO_NO
- ,MONTH_PAY_DETAIL.UP_PLAN AS UP_PLAN
- ,MONTH_PAY_DETAIL.TOTAL3 AS total3
- ,MONTH_PAY_DETAIL.TOTAL4 AS total4
- ,MONTH_PAY_DETAIL.AFFIRM AS AFFIRM
- ,MONTH_PAY_DETAIL.PERIOD_CODE AS PERIOD_CODE
- ,MONTH_PAY_DETAIL.YZDK_TOTAL AS YZDK_TOTAL
- ,(MONTH_PAY_DETAIL.TOTAL4 - MONTH_PAY_DETAIL.UP_PLAN) AS DIFFERENCE
- ,MONTH_PAY_DETAIL.ACCOUNT AS ACCOUNT
- ,(
- DECODE(MONTH_PAY_DETAIL.TOTAL1
- ,NULL, V_SUM_PAY_TOTAL.TOTAL1
- ,MONTH_PAY_DETAIL.TOTAL1
- ) + NVL(MONTH_PAY_DETAIL.TOTAL3, 0)
- ) AS total5
- ,(
- DECODE(MONTH_PAY_DETAIL.TOTAL2
- ,NULL, V_SUM_PAY_TOTAL.TOTAL2
- ,MONTH_PAY_DETAIL.TOTAL2
- ) + NVL(MONTH_PAY_DETAIL.TOTAL4, 0)
- ) AS total6
- ,DECODE(CONTRACT.PO_TOTAL
- ,NULL, NULL
- ,0, NULL
- ,TRUNC((
- (
- (
- NVL(DECODE(MONTH_PAY_DETAIL.TOTAL2
- ,NULL, V_SUM_PAY_TOTAL.TOTAL2
- ,MONTH_PAY_DETAIL.TOTAL2
- ), 0) + NVL(MONTH_PAY_DETAIL.TOTAL4, 0)
- ) / CONTRACT.PO_TOTAL
- ) * 100
- ), 2)
- ) AS ARRIVED_RATE
- ,MONTH_PAY_DETAIL.PROJECT_CODE AS PROJECT_CODE
- ,MONTH_PAY_DETAIL.PROJECT_ID AS PROJECT_ID
- ,NVL(DECODE(MONTH_PAY_DETAIL.TOTAL1
- ,NULL, V_SUM_PAY_TOTAL.TOTAL1
- ,MONTH_PAY_DETAIL.TOTAL1
- ), 0) AS total1
- ,NVL(DECODE(MONTH_PAY_DETAIL.TOTAL2
- ,NULL, V_SUM_PAY_TOTAL.TOTAL2
- ,MONTH_PAY_DETAIL.TOTAL2
- ), 0) AS total2
- ,MONTH_PAY_DETAIL.TOTAL1 AS b_total1
- ,MONTH_PAY_DETAIL.TOTAL2 AS b_total2
- ,MONTH_PAY_DETAIL.MTH_ID AS MTH_ID
- ,V_SUM_PAY_TOTAL.TOTAL1 AS total1_B
- ,V_SUM_PAY_TOTAL.TOTAL2 AS total2_B
- ,CONTRACT.PO_C_NAME AS PO_C_NAME
- ,CONTRACT.CON_U_NAME AS YF_NAME
- ,CONTRACT.PO_TOTAL AS PO_TOTAL
- ,CODE_TABLE_ITEMS.DESCRIPTION AS DEPT_NAME
- ,PROJECT.DESCRIPTION AS PROJECT_NAME
- ,PO_PAY.STATUS AS STATUS
- ,PO_PAY.END_PAY AS TOTAL_SQ
- ,PO_PAY.fID AS PO_PAY_ID
- ,PROJECT_10.DESCRIPTION AS ZJ_PROJECT_NAME
- ,MONTH_PAY_DETAIL.fID
- FROM
- MONTH_PAY_DETAIL MONTH_PAY_DETAIL
- LEFT JOIN V_SUM_PAY_TOTAL V_SUM_PAY_TOTAL
- ON (MONTH_PAY_DETAIL.PROJECT_CODE = V_SUM_PAY_TOTAL.PROJECT_CODE)
- AND (MONTH_PAY_DETAIL.PO_NO = V_SUM_PAY_TOTAL.PO_NO)
- LEFT JOIN CONTRACT CONTRACT
- ON (MONTH_PAY_DETAIL.PROJECT_CODE = CONTRACT.PROJECT_CODE)
- AND (MONTH_PAY_DETAIL.PO_NO = CONTRACT.PO_NO)
- LEFT JOIN CODE_TABLE_ITEMS CODE_TABLE_ITEMS
- ON (CONTRACT.DEPT = CODE_TABLE_ITEMS.CODE_TABLE_ITEM)
- AND (CODE_TABLE_ITEMS.CODE_TABLE = 'DEPT')
- LEFT JOIN PROJECT PROJECT
- ON MONTH_PAY_DETAIL.PROJECT_CODE = PROJECT.PROJECT_CODE
- LEFT JOIN PO_PAY PO_PAY
- ON (MONTH_PAY_DETAIL.PROJECT_CODE = PO_PAY.PROJECT_CODE)
- AND (MONTH_PAY_DETAIL.PO_NO = PO_PAY.PO_NO)
- AND (MONTH_PAY_DETAIL.PERIOD_CODE = PO_PAY.PERIOD_CODE)
- LEFT JOIN PROJECT PROJECT_10
- ON MONTH_PAY_DETAIL.PROJECT_ID = PROJECT_10.PROJECT_CODE
- WHERE
- (p_view_param.set_PERIOD_CODE('202005') = '202005')
- AND (MONTH_PAY_DETAIL.MASTER = '4F1CC53E1E174C6BA1C7023CABE916C7')
- ORDER BY
- DEPT_NAME ASC
- ,MONTH_PAY_DETAIL.PROJECT_CODE ASC
- ,MONTH_PAY_DETAIL.PO_NO ASC;
复制代码
这个到数据库执行没问题? |
|