|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
/*===========================================================
---- Procedure Name: xxxMain()
---- The Main Procedure Of This pkg.
=============================================================*/
Procedure xxxMain(P_Suc_Flag Out Varchar2,
P_Suc_Log Out Varchar2,
P_Org_ID in Number,
P_TPName in varchar2,
P_PMT_Mode in varchar2,
P_FULLPMT_Flag in varchar2 Default P_FULLPMT_DFlag) is
L_Suc_Log varchar2(32000);
L_Suc_Flag varchar2(2);
x_Request_ID Number;
L_Org_ID Number := P_Org_ID;
L_TPName varchar2(7) := P_TPName;
L_Period_Opening Number;
L_Start_Date Date;
L_End_Date Date;
L_Batch_ID Number;
L_PMT_Mode varchar2(4) := P_PMT_Mode;
L_FULLPMT_Flag varchar2(4) := P_FULLPMT_Flag;
Cursor xx_AccountingDate(P_Org_ID in Number) is
select *
from xxx_ap_AutoPMTs_iFace xxx
where xxx.imported_status = 'I'
and xxx.org_id = P_Org_ID
For Update Of xxx.pmt_date;
Begin
---- ---- ---- ---- Get the Org_ID
if L_Org_ID is Null Or L_Org_ID <> fnd_global.Org_ID Then
L_Org_ID := fnd_global.Org_ID;
End If;
if L_Org_ID is Null Then
Print_Output('PLS Set the OU Of the Profile!');
End if;
Print_Logs('L_Org_ID:xxxxxx' || L_Org_ID);
if L_FULLPMT_Flag is null Then
L_FULLPMT_Flag := P_FULLPMT_DFlag;
End if;
Print_Logs('xxx_vFullPMTs_Flag:' || L_FULLPMT_Flag);
---- ---- ---- ---- To Check the Period and gl Accounting Date.
select Sum(1)
into L_Period_Opening
from gl_period_statuses gps
where gps.set_of_books_id = fnd_profile.value('GL_SET_OF_BKS_ID')
and gps.application_id = fnd_global.resp_appl_id
and gps.period_name = L_TPName
and gps.adjustment_period_flag = 'N'
and gps.closing_status = 'O';
---- ---- ---- ---- To Build The PMTs Data Info.
if L_Period_Opening < 0 Then
dbms_output.put_line('Then Periodx U Selected is Not Openning');
Print_Logs('Then Periodx U Selected is Not Openning');
Print_Output('Then Periodx U Selected is Not Openning');
End if;
if L_Period_Opening > 0 then
select min(gdd.accounting_date), max(gdd.accounting_date)
into L_Start_Date, L_End_Date
from gl_ledgers gll, gl_date_period_map gdd
where gll.ledger_id = fnd_profile.value('GL_SET_OF_BKS_ID')
and gdd.period_set_name = gll.period_set_name
and gdd.period_name = L_TPName;
For xoo in xx_AccountingDate(L_Org_ID) Loop
if xoo.pmt_date < L_Start_Date Or xoo.pmt_date > L_End_Date Then
Update xxx_ap_AutoPMTs_iFace iii
Set iii.pmt_date = L_End_Date
Where Current Of xx_AccountingDate;
End if;
End Loop;
Commit;
if L_PMT_Mode = 'IS' Then
Build_PMTISs(L_Batch_ID, L_Org_ID, L_TPName, L_PMT_Mode);
Build_InvISs(L_Batch_ID, L_Org_ID, L_TPName, L_PMT_Mode);
End if;
if L_PMT_Mode = 'AS' Then
Build_PMTASs(L_Batch_ID, L_Org_ID, L_TPName, L_PMT_Mode);
Build_InvASs(L_Batch_ID, L_Org_ID, L_TPName, L_PMT_Mode);
End if;
----P For Partial PMTs
if L_FULLPMT_Flag = 'P' Then
Auto_PPMTs(L_Suc_Flag,
L_Suc_Log,
L_Batch_ID,
L_Org_ID,
L_TPName,
L_PMT_Mode);
End if;
----FM For Full PMTs
if L_FULLPMT_Flag = 'FM' Then
Auto_FMPMTs(L_Suc_Flag,
L_Suc_Log,
L_Batch_ID,
L_Org_ID,
L_TPName,
L_PMT_Mode);
End if;
if L_FULLPMT_Flag = 'FO' Then
Auto_FOPMTs(L_Suc_Flag,
L_Suc_Log,
L_Batch_ID,
L_Org_ID,
L_TPName,
L_PMT_Mode);
End if;
End if;
---- ---- ---- ----
/*Submit_Request(P_TPName => L_TPName,
P_Rturn_Status => x_Rturn_Status,
P_msg_Data => x_msg_Data,
P_Request_ID => x_Request_ID);*/
Print_Logs('L_Suc_Flag:' || L_Suc_Flag);
Print_Logs('L_Suc_Log:' || L_Suc_Log);
End xxxMain;
|
|