2023-03-10 09:32:13 +00:00
|
|
|
|
CREATE OR REPLACE PACKAGE telsale_archievement_pkg IS
|
|
|
|
|
|
2023-12-15 10:22:09 +00:00
|
|
|
|
-- 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-03-10 09:32:13 +00:00
|
|
|
|
|
2023-12-15 10:22:09 +00:00
|
|
|
|
TYPE cur_type IS REF CURSOR;
|
2023-05-18 07:40:04 +00:00
|
|
|
|
|
2023-12-15 10:22:09 +00:00
|
|
|
|
-- <20>쳣
|
|
|
|
|
DEPARTMENTCODE_EXCEPTION_CODE CONSTANT INTEGER := -20000;
|
|
|
|
|
DEPARTMENTCODE_EXCEPTION_MSG CONSTANT VARCHAR2(100) := '<27><><EFBFBD>Ŵ<EFBFBD><C5B4><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>';
|
2023-08-25 12:47:36 +00:00
|
|
|
|
|
2023-12-15 10:22:09 +00:00
|
|
|
|
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-12-15 10:22:09 +00:00
|
|
|
|
PROCEDURE department_archievement
|
|
|
|
|
(
|
|
|
|
|
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
|
|
|
|
|
2023-12-15 10:22:09 +00:00
|
|
|
|
PROCEDURE caller_archievement
|
|
|
|
|
(
|
|
|
|
|
a_caller_code IN VARCHAR2,
|
|
|
|
|
a_attaching_rate OUT VARCHAR2,
|
|
|
|
|
a_renewal_rate OUT VARCHAR2,
|
|
|
|
|
a_total OUT INTEGER,
|
|
|
|
|
a_present_month OUT NUMBER,
|
|
|
|
|
a_mensual_cur OUT cur_type
|
|
|
|
|
);
|
2023-08-25 12:47:36 +00:00
|
|
|
|
|
2023-12-15 10:22:09 +00:00
|
|
|
|
PROCEDURE caller_archievement2
|
|
|
|
|
(
|
|
|
|
|
a_caller_code IN VARCHAR2,
|
|
|
|
|
a_attaching_rate OUT VARCHAR2,
|
|
|
|
|
a_renewal_rate OUT VARCHAR2,
|
|
|
|
|
a_total OUT INTEGER,
|
|
|
|
|
a_present_month OUT NUMBER,
|
|
|
|
|
a_mensual_cur OUT cur_type
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
PROCEDURE caller_arch_ranking_list
|
|
|
|
|
(
|
|
|
|
|
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-12-15 10:22:09 +00:00
|
|
|
|
-- <20><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5>
|
|
|
|
|
PROCEDURE DEPARTMENT_ARCHIEVEMENT
|
|
|
|
|
(
|
|
|
|
|
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
|
|
|
|
|
) IS
|
|
|
|
|
--L_THIS_MONTH VARCHAR2(4);
|
|
|
|
|
--L_THIS_YEAR VARCHAR2(4);
|
|
|
|
|
L_FIRSTDAY DATE;
|
|
|
|
|
L_DEPARTMENT_NAME VARCHAR2(100);
|
2023-03-14 01:47:53 +00:00
|
|
|
|
BEGIN
|
2023-12-15 10:22:09 +00:00
|
|
|
|
/*L_THIS_MONTH := TO_CHAR(SYSDATE,
|
|
|
|
|
'mm');
|
|
|
|
|
L_THIS_YEAR := TO_CHAR(SYSDATE,
|
|
|
|
|
'yyyy');*/
|
|
|
|
|
L_FIRSTDAY := TO_DATE(TO_CHAR(SYSDATE,
|
|
|
|
|
'yyyy') || '-01-01 00:00:00',
|
|
|
|
|
'yyyy-mm-dd hh24:mi:ss');
|
|
|
|
|
-- <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DEPARTMENT_NAME INTO L_DEPARTMENT_NAME FROM IDST0.BM_T BM WHERE BM.DEPARTMENT_CODE = A_DEPARTMENT_CODE;
|
|
|
|
|
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
|
|
|
|
|
RAISE_APPLICATION_ERROR(DEPARTMENTCODE_EXCEPTION_CODE,
|
|
|
|
|
DEPARTMENTCODE_EXCEPTION_MSG);
|
|
|
|
|
END;
|
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT round(dept.<2E><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8>,
|
|
|
|
|
2)
|
|
|
|
|
INTO A_ATTACHING_RATE
|
|
|
|
|
FROM desktop_archievement_admin.BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> dept
|
|
|
|
|
WHERE dept.<2E><><EFBFBD><EFBFBD> = L_DEPARTMENT_NAME;
|
|
|
|
|
EXCEPTION
|
|
|
|
|
WHEN no_data_found THEN
|
|
|
|
|
A_ATTACHING_RATE := 0;
|
|
|
|
|
END;
|
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT round(t."<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>ȫ<EFBFBD>£<EFBFBD>(%)",
|
|
|
|
|
2)
|
|
|
|
|
INTO A_RENEWAL_RATE
|
|
|
|
|
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;
|
|
|
|
|
EXCEPTION
|
|
|
|
|
WHEN no_data_found THEN
|
|
|
|
|
A_RENEWAL_RATE := 0;
|
|
|
|
|
END;
|
|
|
|
|
--<2D><>ҵ<EFBFBD><D2B5>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT ROUND(NVL(SUM(CF.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD> + CF.<2E><><EFBFBD><EFBFBD><EFBFBD>ںϱ<DABA><CFB1><EFBFBD>),
|
|
|
|
|
0),
|
|
|
|
|
0)
|
|
|
|
|
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;
|
|
|
|
|
EXCEPTION
|
|
|
|
|
WHEN no_data_found THEN
|
|
|
|
|
A_TOTAL := 0;
|
|
|
|
|
END;
|
|
|
|
|
--ÿ<><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>;
|
2023-08-25 12:47:36 +00:00
|
|
|
|
END;
|
|
|
|
|
|
2023-12-15 10:22:09 +00:00
|
|
|
|
/*******************************************************/
|
|
|
|
|
-- <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,
|
|
|
|
|
a_present_month OUT NUMBER,
|
|
|
|
|
a_mensual_cur OUT cur_type
|
|
|
|
|
) IS
|
|
|
|
|
l_caller_name VARCHAR2(100);
|
|
|
|
|
l_department_name VARCHAR2(100);
|
|
|
|
|
--l_this_month VARCHAR2(4);
|
|
|
|
|
l_this_year VARCHAR2(4);
|
|
|
|
|
--l_firstday DATE;
|
|
|
|
|
l_rownum INTEGER;
|
2023-08-25 12:47:36 +00:00
|
|
|
|
BEGIN
|
2023-12-15 10:22:09 +00:00
|
|
|
|
--<2D><>ѯ<EFBFBD><D1AF>ϯ<EFBFBD><CFAF><EFBFBD>ƣ<EFBFBD><C6A3>Ͳ<EFBFBD><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>
|
|
|
|
|
BEGIN
|
|
|
|
|
/*SELECT zx.saler_name, bm.department_name
|
|
|
|
|
INTO l_caller_name, l_department_name
|
|
|
|
|
FROM tele_saler zx, tele_saler_team team, idst0.bm_t bm
|
|
|
|
|
WHERE zx.saler_code = a_caller_code
|
|
|
|
|
AND zx.team_code = team.team_code
|
|
|
|
|
AND team.department_code = bm.department_code;
|
|
|
|
|
SELECT saler_name
|
|
|
|
|
INTO l_caller_name
|
|
|
|
|
FROM tele_saler
|
|
|
|
|
WHERE saler_code = a_caller_code;*/
|
|
|
|
|
SELECT zx.<2E><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD>,
|
|
|
|
|
bm.department_name
|
|
|
|
|
INTO l_caller_name,
|
|
|
|
|
l_department_name
|
|
|
|
|
FROM twr_telsaler zx,
|
|
|
|
|
twr_telsaler_team t,
|
|
|
|
|
idst0.bm_t bm
|
|
|
|
|
WHERE zx.<2E><>Ա<EFBFBD><D4B1><EFBFBD><EFBFBD> = a_caller_code
|
|
|
|
|
AND zx.<2E>Ŷ<EFBFBD><C5B6><EFBFBD><EFBFBD><EFBFBD> = t.team_name
|
|
|
|
|
AND t.department_code = bm.department_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>
|
|
|
|
|
SELECT round(nvl(SUM(cf.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD>),
|
|
|
|
|
0),
|
|
|
|
|
2) bf
|
|
|
|
|
INTO a_total
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> cf
|
|
|
|
|
WHERE cf.<2E><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD> = l_caller_name
|
|
|
|
|
AND cf.<2E><><EFBFBD><EFBFBD> = l_department_name
|
|
|
|
|
AND cf.<2E><><EFBFBD><EFBFBD> = l_this_year;
|
|
|
|
|
|
|
|
|
|
--<2D><><EFBFBD><CDB8>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT rownum,
|
|
|
|
|
round(nvl(t.<2E><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8>,
|
|
|
|
|
0),
|
|
|
|
|
2),
|
|
|
|
|
round(nvl(t."<22><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>(<28><>)" * 10000,
|
|
|
|
|
0),
|
|
|
|
|
2)
|
|
|
|
|
INTO l_rownum,
|
|
|
|
|
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
|
|
|
|
|
AND rownum = 1;
|
|
|
|
|
EXCEPTION
|
|
|
|
|
WHEN no_data_found THEN
|
|
|
|
|
l_rownum := 1;
|
|
|
|
|
a_attaching_rate := 0.0;
|
|
|
|
|
a_present_month := 0.0;
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT rownum,
|
|
|
|
|
round(nvl(t."<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>ȫ<EFBFBD>£<EFBFBD>(%)",
|
|
|
|
|
0),
|
|
|
|
|
2)
|
|
|
|
|
INTO l_rownum,
|
|
|
|
|
a_renewal_rate
|
|
|
|
|
FROM BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> t
|
|
|
|
|
WHERE t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = l_caller_name
|
|
|
|
|
AND rownum = 1;
|
|
|
|
|
EXCEPTION
|
|
|
|
|
WHEN no_data_found THEN
|
|
|
|
|
l_rownum := 1;
|
|
|
|
|
a_renewal_rate := 0.0;
|
|
|
|
|
END;
|
|
|
|
|
|
|
|
|
|
--ÿ<><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>),
|
|
|
|
|
0),
|
|
|
|
|
0) BF
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> CF
|
|
|
|
|
WHERE cf.<2E><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD> = l_caller_name
|
|
|
|
|
AND cf.<2E><><EFBFBD><EFBFBD> = l_department_name
|
|
|
|
|
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> <= SYSDATE
|
|
|
|
|
GROUP BY CF.<2E>·<EFBFBD>
|
|
|
|
|
ORDER BY CF.<2E>·<EFBFBD>;
|
2023-04-04 09:58:05 +00:00
|
|
|
|
END;
|
|
|
|
|
|
2023-12-15 10:22:09 +00:00
|
|
|
|
PROCEDURE caller_archievement2
|
|
|
|
|
(
|
|
|
|
|
a_caller_code IN VARCHAR2,
|
|
|
|
|
a_attaching_rate OUT VARCHAR2,
|
|
|
|
|
a_renewal_rate OUT VARCHAR2,
|
|
|
|
|
a_total OUT INTEGER,
|
|
|
|
|
a_present_month OUT NUMBER,
|
|
|
|
|
a_mensual_cur OUT cur_type
|
|
|
|
|
) IS
|
|
|
|
|
l_caller_name VARCHAR2(100);
|
|
|
|
|
l_department_name VARCHAR2(100);
|
|
|
|
|
--l_this_month VARCHAR2(4);
|
|
|
|
|
l_this_year VARCHAR2(4);
|
|
|
|
|
--l_firstday DATE;
|
|
|
|
|
l_rownum INTEGER;
|
2023-06-02 10:04:26 +00:00
|
|
|
|
BEGIN
|
2023-12-15 10:22:09 +00:00
|
|
|
|
--<2D><>ѯ<EFBFBD><D1AF>ϯ<EFBFBD><CFAF><EFBFBD>ƣ<EFBFBD><C6A3>Ͳ<EFBFBD><CDB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>֤<EFBFBD><D6A4><EFBFBD><EFBFBD>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT zx.saler_name,
|
|
|
|
|
bm.department_name
|
|
|
|
|
INTO l_caller_name,
|
|
|
|
|
l_department_name
|
|
|
|
|
FROM tele_saler zx,
|
|
|
|
|
tele_saler_team team,
|
|
|
|
|
idst0.bm_t bm
|
|
|
|
|
WHERE zx.saler_code = a_caller_code
|
|
|
|
|
AND zx.team_code = team.team_code
|
|
|
|
|
AND team.department_code = bm.department_code;
|
|
|
|
|
/* 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>
|
|
|
|
|
SELECT round(nvl(SUM(cf.<2E><><EFBFBD>ո<EFBFBD><D5B8>˿ͻ<CBBF><CDBB><EFBFBD><EFBFBD><EFBFBD>),
|
|
|
|
|
0),
|
|
|
|
|
2) bf
|
|
|
|
|
INTO a_total
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> cf
|
|
|
|
|
WHERE cf.<2E><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD> = l_caller_name
|
|
|
|
|
AND cf.<2E><><EFBFBD><EFBFBD> = l_department_name
|
|
|
|
|
AND cf.<2E><><EFBFBD><EFBFBD> = l_this_year;
|
|
|
|
|
|
|
|
|
|
--<2D><><EFBFBD><CDB8>
|
|
|
|
|
SELECT rownum,
|
|
|
|
|
round(nvl(t.<2E><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8>,
|
|
|
|
|
0),
|
|
|
|
|
2),
|
|
|
|
|
round(nvl(t."<22><><EFBFBD>ձ<EFBFBD><D5B1><EFBFBD>(<28><>)" * 10000,
|
|
|
|
|
0),
|
|
|
|
|
2)
|
|
|
|
|
INTO l_rownum,
|
|
|
|
|
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
|
|
|
|
|
AND rownum = 1;
|
|
|
|
|
--<2D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
SELECT rownum,
|
|
|
|
|
round(nvl(t."<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>ȫ<EFBFBD>£<EFBFBD>(%)",
|
|
|
|
|
0),
|
|
|
|
|
2)
|
|
|
|
|
INTO l_rownum,
|
|
|
|
|
a_renewal_rate
|
|
|
|
|
FROM BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> t
|
|
|
|
|
WHERE t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> = l_caller_name
|
|
|
|
|
AND rownum = 1;
|
|
|
|
|
|
|
|
|
|
--ÿ<><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>),
|
|
|
|
|
0),
|
|
|
|
|
0) BF
|
|
|
|
|
FROM <20><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD>ÿ<EFBFBD>ձ<EFBFBD><D5B1><EFBFBD> CF
|
|
|
|
|
WHERE cf.<2E><>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD> = l_caller_name
|
|
|
|
|
AND cf.<2E><><EFBFBD><EFBFBD> = l_department_name
|
|
|
|
|
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> <= SYSDATE
|
|
|
|
|
GROUP BY CF.<2E>·<EFBFBD>
|
|
|
|
|
ORDER BY CF.<2E>·<EFBFBD>;
|
2023-06-02 10:04:26 +00:00
|
|
|
|
END;
|
2023-12-15 10:22:09 +00:00
|
|
|
|
|
|
|
|
|
/*******************************************************/
|
|
|
|
|
-- <20><>ϯ<EFBFBD><CFAF><EFBFBD>а<EFBFBD>
|
|
|
|
|
PROCEDURE CALLER_ARCH_RANKING_LIST
|
|
|
|
|
(
|
|
|
|
|
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
|
|
|
|
|
) IS
|
|
|
|
|
L_DEPARTMENT_NAME VARCHAR2(100);
|
|
|
|
|
BEGIN
|
|
|
|
|
-- <20><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
BEGIN
|
|
|
|
|
SELECT DEPARTMENT_NAME INTO L_DEPARTMENT_NAME FROM IDST0.BM_T BM WHERE BM.DEPARTMENT_CODE = A_DEPARTMENT_CODE;
|
|
|
|
|
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
|
|
|
|
|
RAISE_APPLICATION_ERROR(DEPARTMENTCODE_EXCEPTION_CODE,
|
|
|
|
|
DEPARTMENTCODE_EXCEPTION_MSG);
|
|
|
|
|
END;
|
|
|
|
|
-- <20><><EFBFBD><EFBFBD><EFBFBD>ں<EFBFBD><DABA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>
|
|
|
|
|
OPEN A_ATTACHING_RANKING_LIST FOR
|
|
|
|
|
SELECT rownum,
|
|
|
|
|
paihang.<2E><><EFBFBD><EFBFBD> AS caller_name,
|
|
|
|
|
paihang.xbl AS attaching_rate
|
|
|
|
|
FROM (SELECT t.<2E><><EFBFBD><EFBFBD>,
|
|
|
|
|
round(t.<2E><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8>,
|
|
|
|
|
2) xbl
|
|
|
|
|
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_DEPARTMENT_NAME
|
|
|
|
|
ORDER BY t.<2E><><EFBFBD>±<EFBFBD><C2B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><CDB8> DESC) paihang;
|
|
|
|
|
|
|
|
|
|
-- <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>а<EFBFBD>
|
|
|
|
|
OPEN A_RENEWAL_RANKING_LIST FOR
|
|
|
|
|
SELECT rownum,
|
|
|
|
|
paihang.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> AS CALLER_NAME,
|
|
|
|
|
paihang.xbl AS RENEWAL_RATE
|
2023-12-14 10:49:53 +00:00
|
|
|
|
FROM (SELECT t.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
|
2023-12-15 10:22:09 +00:00
|
|
|
|
round(t."<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>ȫ<EFBFBD>£<EFBFBD>(%)",
|
|
|
|
|
2) xbl
|
|
|
|
|
FROM BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> t
|
|
|
|
|
WHERE t.<2E><><EFBFBD>β<EFBFBD><CEB2><EFBFBD> = L_DEPARTMENT_NAME
|
|
|
|
|
ORDER BY xbl DESC) paihang;
|
|
|
|
|
/*OPEN A_RENEWAL_RANKING_LIST FOR
|
|
|
|
|
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>,
|
|
|
|
|
round(t."<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʣ<EFBFBD>ȫ<EFBFBD>£<EFBFBD>(%)", 2) xbl,
|
|
|
|
|
zuoxi.department_name
|
|
|
|
|
FROM BI<42><49><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϯ<EFBFBD><CFAF><EFBFBD><EFBFBD><EFBFBD>ʸ<EFBFBD><CAB8>ٱ<EFBFBD> t,
|
|
|
|
|
(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;*/
|
|
|
|
|
END;
|
2023-03-10 09:32:13 +00:00
|
|
|
|
BEGIN
|
2023-12-15 10:22:09 +00:00
|
|
|
|
NULL;
|
2023-08-25 12:47:36 +00:00
|
|
|
|
END TELSALE_ARCHIEVEMENT_PKG;
|
2023-03-10 09:32:13 +00:00
|
|
|
|
/
|