2023-03-10 09:32:13 +00:00
|
|
|
|
CREATE OR REPLACE PACKAGE telsale_archievement_pkg IS
|
|
|
|
|
|
|
|
|
|
-- Author : WANGWEI-202
|
|
|
|
|
-- Created : 2023/3/10 15:13:34
|
|
|
|
|
-- Purpose : <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɰ<EFBFBD>
|
|
|
|
|
|
2023-05-18 07:40:04 +00:00
|
|
|
|
TYPE cur_type IS REF CURSOR;
|
|
|
|
|
|
2023-06-05 10:09:40 +00:00
|
|
|
|
-- <20>쳣
|
|
|
|
|
DEPARTMENTCODE_EXCEPTION_CODE CONSTANT INTEGER := -20000;
|
2023-08-25 12:47:36 +00:00
|
|
|
|
DEPARTMENTCODE_EXCEPTION_MSG CONSTANT VARCHAR2(100) := '<27><><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>';
|
|
|
|
|
|
|
|
|
|
CALLERCODE_EXCEPTION_CODE CONSTANT INTEGER := -20001;
|
|
|
|
|
CALLERCODE_EXCEPTION_MSG CONSTANT VARCHAR2(100) := '<27><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>';
|
2023-06-05 10:09:40 +00:00
|
|
|
|
|
2023-05-15 12:06:17 +00:00
|
|
|
|
PROCEDURE department_archievement
|
2023-03-14 01:47:53 +00:00
|
|
|
|
(
|
2023-05-15 12:06:17 +00:00
|
|
|
|
a_department_code IN VARCHAR2,
|
|
|
|
|
a_attaching_rate OUT VARCHAR2,
|
2023-05-18 07:40:04 +00:00
|
|
|
|
a_renewal_rate OUT VARCHAR2,
|
2023-05-18 10:22:05 +00:00
|
|
|
|
a_total OUT INTEGER,
|
2023-05-18 07:40:04 +00:00
|
|
|
|
a_mensual_cur OUT cur_type
|
2023-03-14 01:47:53 +00:00
|
|
|
|
);
|
|
|
|
|
|
2023-08-25 12:47:36 +00:00
|
|
|
|
PROCEDURE caller_archievement
|
|
|
|
|
(
|
|
|
|
|
a_caller_code IN VARCHAR2,
|
|
|
|
|
a_attaching_rate OUT VARCHAR2,
|
|
|
|
|
a_renewal_rate OUT VARCHAR2,
|
|
|
|
|
a_total OUT INTEGER,
|
2023-10-26 10:46:32 +00:00
|
|
|
|
a_present_month OUT NUMBER,
|
2023-08-25 12:47:36 +00:00
|
|
|
|
a_mensual_cur OUT cur_type
|
|
|
|
|
);
|
|
|
|
|
|
2023-06-02 10:04:26 +00:00
|
|
|
|
PROCEDURE caller_arch_ranking_list
|
|
|
|
|
(
|
2023-06-05 10:09:40 +00:00
|
|
|
|
a_department_code IN VARCHAR2,
|
|
|
|
|
a_year IN VARCHAR2,
|
|
|
|
|
a_month IN VARCHAR2,
|
|
|
|
|
a_attaching_ranking_list OUT cur_type,
|
|
|
|
|
a_renewal_ranking_list OUT cur_type
|
2023-06-02 10:04:26 +00:00
|
|
|
|
);
|
|
|
|
|
|
2023-03-10 09:32:13 +00:00
|
|
|
|
END telsale_archievement_pkg;
|
|
|
|
|
/
|
2023-08-25 12:47:36 +00:00
|
|
|
|
CREATE OR REPLACE PACKAGE BODY TELSALE_ARCHIEVEMENT_PKG IS
|
2023-07-27 13:43:56 +00:00
|
|
|
|
-- <20><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>
|
2023-08-25 12:47:36 +00:00
|
|
|
|
PROCEDURE DEPARTMENT_ARCHIEVEMENT
|
2023-03-14 01:47:53 +00:00
|
|
|
|
(
|
2023-08-25 12:47:36 +00:00
|
|
|
|
A_DEPARTMENT_CODE IN VARCHAR2,
|
|
|
|
|
A_ATTACHING_RATE OUT VARCHAR2,
|
|
|
|
|
A_RENEWAL_RATE OUT VARCHAR2,
|
|
|
|
|
A_TOTAL OUT INTEGER,
|
|
|
|
|
A_MENSUAL_CUR OUT CUR_TYPE
|
2023-03-14 01:47:53 +00:00
|
|
|
|
) IS
|
2023-10-25 10:11:56 +00:00
|
|
|
|
--L_THIS_MONTH VARCHAR2(4);
|
|
|
|
|
--L_THIS_YEAR VARCHAR2(4);
|
2023-08-25 12:47:36 +00:00
|
|
|
|
L_FIRSTDAY DATE;
|
|
|
|
|
L_DEPARTMENT_NAME VARCHAR2(100);
|
2023-03-14 01:47:53 +00:00
|
|
|
|
BEGIN
|
2023-10-25 10:11:56 +00:00
|
|
|
|
/*L_THIS_MONTH := TO_CHAR(SYSDATE,
|
2023-06-04 11:11:44 +00:00
|
|
|
|
'mm');
|
2023-08-25 12:47:36 +00:00
|
|
|
|
L_THIS_YEAR := TO_CHAR(SYSDATE,
|
2023-10-25 10:11:56 +00:00
|
|
|
|
'yyyy');*/
|
|
|
|
|
L_FIRSTDAY := TO_DATE(TO_CHAR(SYSDATE,
|
|
|
|
|
'yyyy') || '-01-01 00:00:00',
|
|
|
|
|
'yyyy-mm-dd hh24:mi:ss');
|
2023-06-05 10:09:40 +00:00
|
|
|
|
-- <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BEGIN
|
2023-08-25 12:47:36 +00:00
|
|
|
|
SELECT DEPARTMENT_NAME
|
|
|
|
|
INTO L_DEPARTMENT_NAME
|
|
|
|
|
FROM IDST0.BM_T BM
|
|
|
|
|
WHERE BM.DEPARTMENT_CODE = A_DEPARTMENT_CODE;
|
2023-06-05 10:09:40 +00:00
|
|
|
|
EXCEPTION
|
|
|
|
|
-- <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׳<EFBFBD><D7B3>쳣
|
|
|
|
|
WHEN NO_DATA_FOUND THEN
|
2023-08-25 12:47:36 +00:00
|
|
|
|
RAISE_APPLICATION_ERROR(DEPARTMENTCODE_EXCEPTION_CODE,
|
2023-06-05 10:09:40 +00:00
|
|
|
|
DEPARTMENTCODE_EXCEPTION_MSG);
|
|
|
|
|
END;
|
2023-05-18 07:40:04 +00:00
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8>
|
2023-10-23 15:48:07 +00:00
|
|
|
|
/*SELECT DECODE(SUM(CF.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD>),
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
ROUND((SUM(CF.<2E><><EFBFBD><EFBFBD><EFBFBD>ںϱ<DABA><CFB1><EFBFBD>) / SUM(CF.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD>) * 100),
|
|
|
|
|
2))
|
|
|
|
|
INTO A_ATTACHING_RATE
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> CF
|
|
|
|
|
WHERE CF.<2E>·<EFBFBD> = L_THIS_MONTH
|
|
|
|
|
AND CF.<2E><><EFBFBD><EFBFBD> = L_THIS_YEAR
|
|
|
|
|
AND <20><><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD> = A_DEPARTMENT_CODE;*/
|
2023-10-25 10:11:56 +00:00
|
|
|
|
SELECT round(dept.<2E><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8>,
|
|
|
|
|
2)
|
2023-08-25 12:47:36 +00:00
|
|
|
|
INTO A_ATTACHING_RATE
|
2023-10-26 10:46:32 +00:00
|
|
|
|
FROM desktop_archievement_admin.BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> dept
|
2023-10-23 15:48:07 +00:00
|
|
|
|
WHERE dept.<2E><><EFBFBD><EFBFBD> = L_DEPARTMENT_NAME;
|
2023-05-18 07:40:04 +00:00
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2023-10-25 10:11:56 +00:00
|
|
|
|
/*SELECT DECODE(SUM(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>),
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
ROUND(SUM(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD>) / SUM(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) * 100,
|
|
|
|
|
2))
|
|
|
|
|
INTO A_RENEWAL_RATE
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3>
|
|
|
|
|
WHERE <20><><EFBFBD><EFBFBD> = L_DEPARTMENT_NAME;*/
|
|
|
|
|
SELECT round(t."<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>ȫ<EFBFBD>£<EFBFBD>(%)",
|
|
|
|
|
2)
|
2023-08-25 12:47:36 +00:00
|
|
|
|
INTO A_RENEWAL_RATE
|
2023-10-25 10:11:56 +00:00
|
|
|
|
FROM BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¸<EFBFBD><C2B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> t
|
|
|
|
|
WHERE t.<2E><><EFBFBD>β<EFBFBD><CEB2><EFBFBD> = L_DEPARTMENT_NAME;
|
2023-05-18 07:40:04 +00:00
|
|
|
|
--<2D><>ҵ<EFBFBD><D2B5>
|
2023-08-25 12:47:36 +00:00
|
|
|
|
SELECT ROUND(NVL(SUM(CF.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD> + CF.<2E><><EFBFBD><EFBFBD><EFBFBD>ںϱ<DABA><CFB1><EFBFBD>),
|
2023-05-18 07:40:04 +00:00
|
|
|
|
0),
|
|
|
|
|
0)
|
2023-08-25 12:47:36 +00:00
|
|
|
|
INTO A_TOTAL
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> CF
|
|
|
|
|
WHERE <20><><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD> = A_DEPARTMENT_CODE
|
|
|
|
|
AND ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> >= L_FIRSTDAY
|
|
|
|
|
AND ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <= SYSDATE;
|
|
|
|
|
--ÿ<><C3BF>ҵ<EFBFBD><D2B5>
|
|
|
|
|
OPEN A_MENSUAL_CUR FOR
|
|
|
|
|
SELECT CF.<2E>·<EFBFBD> MM,
|
|
|
|
|
ROUND(NVL(SUM(CF.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD> + CF.<2E><><EFBFBD><EFBFBD><EFBFBD>ںϱ<DABA><CFB1><EFBFBD>) / 10000,
|
|
|
|
|
0),
|
|
|
|
|
0) BF
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> CF
|
|
|
|
|
WHERE <20><><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD> = A_DEPARTMENT_CODE
|
|
|
|
|
AND ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> >= TO_DATE(TO_CHAR(SYSDATE,
|
|
|
|
|
'yyyy') || '-01-01 00:00:00',
|
|
|
|
|
'yyyy-mm-dd hh24:mi:ss')
|
|
|
|
|
AND ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> < TO_DATE(TO_CHAR(SYSDATE,
|
|
|
|
|
'yyyy-mm') || '-01 00:00:00',
|
|
|
|
|
'yyyy-mm-dd hh24:mi:ss')
|
|
|
|
|
GROUP BY CF.<2E>·<EFBFBD>
|
|
|
|
|
ORDER BY CF.<2E>·<EFBFBD>;
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
|
|
/*******************************************************/
|
|
|
|
|
-- <20><>ϯҵ<CFAF><D2B5>
|
|
|
|
|
PROCEDURE caller_archievement
|
|
|
|
|
(
|
|
|
|
|
a_caller_code IN VARCHAR2,
|
|
|
|
|
a_attaching_rate OUT VARCHAR2,
|
|
|
|
|
a_renewal_rate OUT VARCHAR2,
|
|
|
|
|
a_total OUT INTEGER,
|
2023-10-26 10:46:32 +00:00
|
|
|
|
a_present_month OUT NUMBER,
|
2023-08-25 12:47:36 +00:00
|
|
|
|
a_mensual_cur OUT cur_type
|
|
|
|
|
) IS
|
|
|
|
|
l_caller_name VARCHAR2(100);
|
|
|
|
|
l_this_month VARCHAR2(4);
|
|
|
|
|
l_this_year VARCHAR2(4);
|
|
|
|
|
l_firstday DATE;
|
2023-10-25 10:11:56 +00:00
|
|
|
|
l_rownum INTEGER;
|
2023-08-25 12:47:36 +00:00
|
|
|
|
BEGIN
|
|
|
|
|
--<2D><>ѯ<EFBFBD><D1AF>ϯ<EFBFBD><CFAF><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT saler_name
|
|
|
|
|
INTO l_caller_name
|
|
|
|
|
FROM tele_saler
|
|
|
|
|
WHERE saler_code = a_caller_code;
|
|
|
|
|
EXCEPTION
|
|
|
|
|
-- <20><><EFBFBD><EFBFBD>û<EFBFBD>в<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD>ϯ<EFBFBD><CFAF><EFBFBD>ƣ<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׳<EFBFBD><D7B3>쳣
|
|
|
|
|
WHEN no_data_found THEN
|
|
|
|
|
raise_application_error(CALLERCODE_EXCEPTION_CODE,
|
|
|
|
|
CALLERCODE_EXCEPTION_MSG);
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
|
|
l_this_month := to_char(SYSDATE,
|
|
|
|
|
'mm');
|
|
|
|
|
l_this_year := to_char(SYSDATE,
|
|
|
|
|
'yyyy');
|
|
|
|
|
l_firstday := to_date(l_this_year || '-01-01 00:00:00',
|
|
|
|
|
'yyyy-mm-dd hh24:mi:ss');
|
|
|
|
|
|
|
|
|
|
--<2D>ܳ<EFBFBD><DCB3>ձ<EFBFBD><D5B1><EFBFBD>
|
2023-08-25 14:47:25 +00:00
|
|
|
|
SELECT round(nvl(SUM(cf.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD>),
|
|
|
|
|
0),
|
2023-08-25 12:47:36 +00:00
|
|
|
|
2) bf
|
2023-05-18 07:40:04 +00:00
|
|
|
|
INTO a_total
|
2023-06-04 11:11:44 +00:00
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> cf
|
2023-08-25 12:47:36 +00:00
|
|
|
|
WHERE cf.<2E><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD> = a_caller_code
|
|
|
|
|
AND cf.<2E><><EFBFBD><EFBFBD> = l_this_year;
|
|
|
|
|
|
|
|
|
|
--<2D><><EFBFBD><CDB8>
|
2023-10-25 10:11:56 +00:00
|
|
|
|
SELECT rownum,
|
|
|
|
|
round(nvl(t.<2E><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8>,
|
|
|
|
|
0),
|
2023-10-26 10:46:32 +00:00
|
|
|
|
2),
|
|
|
|
|
round(nvl(t."<22><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>(<28><>)" * 10000,
|
|
|
|
|
0),
|
2023-10-25 10:11:56 +00:00
|
|
|
|
2)
|
|
|
|
|
INTO l_rownum,
|
2023-10-26 10:46:32 +00:00
|
|
|
|
a_attaching_rate,
|
|
|
|
|
a_present_month
|
|
|
|
|
FROM BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> t
|
|
|
|
|
WHERE t.<2E><><EFBFBD><EFBFBD> = l_caller_name
|
2023-10-25 10:11:56 +00:00
|
|
|
|
AND rownum = 1;
|
|
|
|
|
/*SELECT decode(nvl(SUM(cf.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD>),
|
|
|
|
|
0),
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
round(SUM(cf.<2E><><EFBFBD><EFBFBD><EFBFBD>ںϱ<DABA><CFB1><EFBFBD>) / SUM(cf.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD>) * 100,
|
|
|
|
|
2))
|
|
|
|
|
INTO a_attaching_rate
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> cf
|
|
|
|
|
WHERE cf.<2E><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD> = a_caller_code
|
|
|
|
|
AND cf.<2E><><EFBFBD><EFBFBD> = l_this_year
|
|
|
|
|
AND cf.<2E>·<EFBFBD> = l_this_month;*/
|
2023-08-25 12:47:36 +00:00
|
|
|
|
|
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2023-10-25 10:11:56 +00:00
|
|
|
|
/*SELECT decode(nvl(SUM(xb.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>),
|
|
|
|
|
0),
|
|
|
|
|
0,
|
|
|
|
|
0,
|
|
|
|
|
round(SUM(xb.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ۼ<EFBFBD>) / SUM(xb.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) * 100,
|
|
|
|
|
2)) xbl
|
|
|
|
|
INTO a_renewal_rate
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ͳ<EFBFBD><CDB3> xb
|
|
|
|
|
WHERE xb.<2E><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD> = a_caller_code;*/
|
|
|
|
|
SELECT rownum,
|
2023-10-26 10:46:32 +00:00
|
|
|
|
round(nvl(t."<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>ȫ<EFBFBD>£<EFBFBD>(%)",
|
2023-10-25 10:11:56 +00:00
|
|
|
|
0),
|
|
|
|
|
2)
|
|
|
|
|
INTO l_rownum,
|
|
|
|
|
a_renewal_rate
|
2023-10-26 10:46:32 +00:00
|
|
|
|
FROM BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> t
|
2023-10-25 10:11:56 +00:00
|
|
|
|
WHERE t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = l_caller_name
|
|
|
|
|
AND rownum = 1;
|
2023-05-18 07:40:04 +00:00
|
|
|
|
|
|
|
|
|
--ÿ<><C3BF>ҵ<EFBFBD><D2B5>
|
2023-08-25 12:47:36 +00:00
|
|
|
|
OPEN A_MENSUAL_CUR FOR
|
|
|
|
|
SELECT CF.<2E>·<EFBFBD> MM,
|
2023-08-26 11:26:13 +00:00
|
|
|
|
ROUND(NVL(SUM(CF.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD> + CF.<2E><><EFBFBD><EFBFBD><EFBFBD>ںϱ<DABA><CFB1><EFBFBD>),
|
2023-05-18 07:40:04 +00:00
|
|
|
|
0),
|
2023-08-25 12:47:36 +00:00
|
|
|
|
0) BF
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> CF
|
|
|
|
|
WHERE cf.<2E><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD> = a_caller_code
|
|
|
|
|
AND ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> >= TO_DATE(TO_CHAR(SYSDATE,
|
2023-05-18 07:40:04 +00:00
|
|
|
|
'yyyy') || '-01-01 00:00:00',
|
|
|
|
|
'yyyy-mm-dd hh24:mi:ss')
|
2023-09-05 10:37:41 +00:00
|
|
|
|
AND ǩ<><C7A9><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <= SYSDATE
|
2023-08-25 12:47:36 +00:00
|
|
|
|
GROUP BY CF.<2E>·<EFBFBD>
|
|
|
|
|
ORDER BY CF.<2E>·<EFBFBD>;
|
2023-04-04 09:58:05 +00:00
|
|
|
|
END;
|
|
|
|
|
|
2023-06-05 10:09:40 +00:00
|
|
|
|
/*******************************************************/
|
|
|
|
|
-- <20><>ϯ<EFBFBD><CFAF><EFBFBD>а<EFBFBD>
|
2023-08-25 12:47:36 +00:00
|
|
|
|
PROCEDURE CALLER_ARCH_RANKING_LIST
|
2023-06-02 10:04:26 +00:00
|
|
|
|
(
|
2023-08-25 12:47:36 +00:00
|
|
|
|
A_DEPARTMENT_CODE IN VARCHAR2,
|
|
|
|
|
A_YEAR IN VARCHAR2,
|
|
|
|
|
A_MONTH IN VARCHAR2,
|
|
|
|
|
A_ATTACHING_RANKING_LIST OUT CUR_TYPE,
|
|
|
|
|
A_RENEWAL_RANKING_LIST OUT CUR_TYPE
|
2023-06-02 10:04:26 +00:00
|
|
|
|
) IS
|
2023-08-25 12:47:36 +00:00
|
|
|
|
L_DEPARTMENT_NAME VARCHAR2(100);
|
2023-06-02 10:04:26 +00:00
|
|
|
|
BEGIN
|
2023-06-05 10:09:40 +00:00
|
|
|
|
-- <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BEGIN
|
2023-08-25 12:47:36 +00:00
|
|
|
|
SELECT DEPARTMENT_NAME
|
|
|
|
|
INTO L_DEPARTMENT_NAME
|
|
|
|
|
FROM IDST0.BM_T BM
|
|
|
|
|
WHERE BM.DEPARTMENT_CODE = A_DEPARTMENT_CODE;
|
2023-06-05 10:09:40 +00:00
|
|
|
|
EXCEPTION
|
|
|
|
|
-- <20><><EFBFBD><EFBFBD>û<EFBFBD><C3BB><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>˵<EFBFBD><CBB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>׳<EFBFBD><D7B3>쳣
|
|
|
|
|
WHEN NO_DATA_FOUND THEN
|
2023-08-25 12:47:36 +00:00
|
|
|
|
RAISE_APPLICATION_ERROR(DEPARTMENTCODE_EXCEPTION_CODE,
|
2023-06-05 10:09:40 +00:00
|
|
|
|
DEPARTMENTCODE_EXCEPTION_MSG);
|
|
|
|
|
END;
|
2023-08-25 12:47:36 +00:00
|
|
|
|
-- <20><><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD><DABA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>
|
|
|
|
|
OPEN A_ATTACHING_RANKING_LIST FOR
|
2023-10-25 10:11:56 +00:00
|
|
|
|
SELECT rownum,
|
2023-10-26 10:46:32 +00:00
|
|
|
|
paihang.<2E><><EFBFBD><EFBFBD> AS caller_name,
|
2023-10-25 10:11:56 +00:00
|
|
|
|
paihang.attaching_rate
|
|
|
|
|
FROM (SELECT DISTINCT *
|
2023-10-26 10:46:32 +00:00
|
|
|
|
FROM (SELECT t.<2E><><EFBFBD><EFBFBD>,
|
2023-10-25 10:11:56 +00:00
|
|
|
|
round(t.<2E><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8>,
|
|
|
|
|
2) attaching_rate,
|
|
|
|
|
zuoxi.department_name
|
2023-10-26 10:46:32 +00:00
|
|
|
|
FROM BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> t,
|
2023-10-25 10:11:56 +00:00
|
|
|
|
(SELECT DISTINCT t.saler_code,
|
|
|
|
|
t.saler_name,
|
|
|
|
|
t.team_code,
|
|
|
|
|
team.team,
|
|
|
|
|
bm.department_name
|
|
|
|
|
FROM tele_saler t,
|
|
|
|
|
tele_saler_team team,
|
|
|
|
|
idst0.bm_t bm
|
|
|
|
|
WHERE t.team_code = team.team_code
|
|
|
|
|
AND team.department_code = bm.department_code
|
|
|
|
|
AND bm.department_name = L_DEPARTMENT_NAME) zuoxi
|
2023-10-26 10:46:32 +00:00
|
|
|
|
WHERE t.<2E><><EFBFBD><EFBFBD> = zuoxi.saler_name) st
|
2023-10-25 10:11:56 +00:00
|
|
|
|
ORDER BY st.department_name,
|
|
|
|
|
st.attaching_rate DESC) paihang;
|
2023-06-05 10:09:40 +00:00
|
|
|
|
-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>
|
2023-08-25 12:47:36 +00:00
|
|
|
|
OPEN A_RENEWAL_RANKING_LIST FOR
|
2023-10-25 10:11:56 +00:00
|
|
|
|
SELECT rownum,
|
|
|
|
|
paihang.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS CALLER_NAME,
|
|
|
|
|
paihang.xbl AS RENEWAL_RATE
|
|
|
|
|
FROM (SELECT DISTINCT *
|
|
|
|
|
FROM (SELECT t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
2023-10-26 10:46:32 +00:00
|
|
|
|
round(t."<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>ȫ<EFBFBD>£<EFBFBD>(%)",
|
2023-10-25 10:11:56 +00:00
|
|
|
|
2) xbl,
|
|
|
|
|
zuoxi.department_name
|
2023-10-26 10:46:32 +00:00
|
|
|
|
FROM BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> t,
|
2023-10-25 10:11:56 +00:00
|
|
|
|
(SELECT DISTINCT t.saler_code,
|
|
|
|
|
t.saler_name,
|
|
|
|
|
t.team_code,
|
|
|
|
|
team.team,
|
|
|
|
|
bm.department_name
|
|
|
|
|
FROM tele_saler t,
|
|
|
|
|
tele_saler_team team,
|
|
|
|
|
idst0.bm_t bm
|
|
|
|
|
WHERE t.team_code = team.team_code
|
|
|
|
|
AND team.department_code = bm.department_code
|
|
|
|
|
AND bm.department_name = L_DEPARTMENT_NAME) zuoxi
|
|
|
|
|
WHERE t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = zuoxi.saler_name) xb
|
|
|
|
|
ORDER BY xb.department_name,
|
|
|
|
|
xb.xbl DESC) paihang;
|
2023-06-02 10:04:26 +00:00
|
|
|
|
END;
|
2023-03-10 09:32:13 +00:00
|
|
|
|
BEGIN
|
|
|
|
|
NULL;
|
2023-08-25 12:47:36 +00:00
|
|
|
|
END TELSALE_ARCHIEVEMENT_PKG;
|
2023-03-10 09:32:13 +00:00
|
|
|
|
/
|