[Home] [Help]
80: CREATION_DATE, CREATED_BY, REQUEST_ID, WARNING_MESSAGE
81: )
82: SELECT Project_ID, Draft_Invoice_Num, sysdate, P_User_ID,
83: sysdate, P_User_ID, P_Request_ID, l_error_message
84: FROM PA_Draft_Invoices_ALL
85: WHERE Invoice_Set_ID = P_Invoice_Set_ID
86: AND project_id = p_project_id ; /* Fix for Performance bug 4942339 */
87:
88: END IF;
119: dii.line_num line_num,
120: dii.amount amount,
121: NVL(di.retention_invoice_flag,'N') retention_invoice_flag
122: from pa_draft_invoice_items dii,
123: pa_draft_invoices_all di
124: where dii.project_id = P_Project_Id
125: and dii.draft_invoice_num = P_Draft_Inv_Num
126: and dii.invoice_line_type in ('STANDARD','INVOICE REDUCTION')
127: and dii.project_id = di.project_id
132: dii.line_num line_num,
133: dii.amount amount,
134: NVL(di.retention_invoice_flag,'N') retention_invoice_flag
135: from pa_draft_invoice_items dii,
136: pa_draft_invoices_all di
137: where dii.project_id = P_Project_Id
138: and dii.draft_invoice_num = P_Draft_Inv_Num
139: and dii.invoice_line_type = 'RETENTION'
140: and dii.project_id = di.project_id
149: dii.amount amt,
150: dii.line_num line,
151: dii.projfunc_bill_amount,
152: NVL(di.retention_invoice_flag,'N') retention_invoice_flag
153: from pa_draft_invoices di,
154: pa_draft_invoice_items dii
155: where di.project_id = dii.project_id
156: and di.draft_invoice_num = dii.draft_invoice_num
157: and di.project_id = P_Project_Id
327: PA_MCB_INVOICE_PKG.log_message('recalculATE: ' || ' If (l_invproc_currency_code = l_inv_currency_code) AND (l_inv_currency_code = l_func_curr)' );
328: END IF;
329: X_Status := NULL;
330:
331: Update pa_draft_invoices_all
332: set inv_currency_code = l_invproc_currency_code
333: ,inv_rate_type = NULL
334: ,inv_rate_date = NULL
335: ,inv_exchange_rate = NULL
353: IF g1_debug_mode = 'Y' THEN
354: PA_MCB_INVOICE_PKG.log_message('recalculATE: ' || ' If (l_invproc_currency_code = l_inv_currency_code) ');
355: END IF;
356:
357: Update pa_draft_invoices_all
358: set inv_currency_code = l_invproc_currency_code
359: ,inv_rate_type = NULL
360: ,inv_rate_date = NULL
361: ,inv_exchange_rate = NULL
380:
381: /* The following commented and rewritten for bug#2355135
382: invoice currency = projfunc currency <> invproc currency
383: copy projfunc amount and null out other attributes as AR expects the amounts to be same
384: Update pa_draft_invoices_all
385: set projfunc_invtrans_rate_type = NULL
386: ,projfunc_invtrans_rate_date = NULL
387: ,projfunc_invtrans_ex_rate = NULL
388: where project_id = P_Project_Id
387: ,projfunc_invtrans_ex_rate = NULL
388: where project_id = P_Project_Id
389: and draft_invoice_num = P_Draft_Inv_Num;
390: */
391: Update pa_draft_invoices_all
392: set projfunc_invtrans_rate_type = NULL
393: ,projfunc_invtrans_rate_date = NULL
394: ,projfunc_invtrans_ex_rate = NULL
395: ,inv_currency_code = l_inv_currency_code
460: conversion attribute */
461: IF g1_debug_mode = 'Y' THEN
462: PA_MCB_INVOICE_PKG.log_message('recalculATE: ' || ' Update DI ');
463: END IF;
464: Update pa_draft_invoices_all
465: set inv_currency_code = l_inv_currency_code
466: ,inv_rate_type = l_inv_rate_type
467: ,inv_rate_date = l_inv_rate_date
468: ,inv_exchange_rate = l_rate
644: AND rownum=1;
645: END IF;
646:
647: /****End of code added for 3436063****/
648: Update pa_draft_invoices_all
649: set projfunc_invtrans_rate_type = 'User'
650: /* ,projfunc_invtrans_rate_date = sysdate commented for bug 3485407 and modified as follows ..*/
651: ,projfunc_invtrans_rate_date = invoice_date /* for bug 3485407 */
652: ,projfunc_invtrans_ex_rate = NVL(l_projfunc_invtrans_rate,0)
690: PA_MCB_INVOICE_PKG.log_message('recalculATE: l_projfunc_Exchg_Rate_type ' || l_projfunc_Exchg_Rate_type);
691: PA_MCB_INVOICE_PKG.log_message('recalculATE: l_Rate ' || l_Rate);
692: PA_MCB_INVOICE_PKG.log_message('recalculATE: l_Projfunc_Exchange_Rate ' || l_Projfunc_Exchange_Rate);
693:
694: Update pa_draft_invoices_all
695: set projfunc_invtrans_rate_type = l_projfunc_Exchg_Rate_type
696: ,projfunc_invtrans_rate_date = DECODE(l_PFC_Exchg_Rate_Date_Code,
697: 'PA_INVOICE_DATE', l_invoice_date, -- Fix for bug 3836514
698: l_projfunc_Exchg_Rate_Date)
745:
746: );
747:
748: --================================
749: Update pa_draft_invoices_all
750: set projfunc_invtrans_rate_type = l_projfunc_Exchg_Rate_type
751: ,projfunc_invtrans_rate_date = DECODE(l_PFC_Exchg_Rate_Date_Code,
752: 'PA_INVOICE_DATE', l_invoice_date, -- Fix for Bug 3836514
753: l_projfunc_Exchg_Rate_Date)
755: l_Projfunc_Exchange_Rate)
756: where project_id = P_Project_Id
757: and draft_invoice_num = P_Draft_Inv_Num;
758: Else */
759: Update pa_draft_invoices_all
760: set projfunc_invtrans_rate_type = inv_rate_type
761: ,projfunc_invtrans_rate_date = inv_rate_date
762: ,projfunc_invtrans_ex_rate = inv_exchange_rate
763: where project_id = P_Project_Id
794: select Inv_Currency_code,
795: Inv_rate_date,
796: Inv_rate_type,
797: Inv_exchange_rate
798: from pa_draft_invoices
799: where project_id = P_Project_Id
800: and draft_invoice_num = P_Draft_Inv_Num;
801:
802: l_inv_curr_code varchar2(15);
835: is
836: select Projfunc_invtrans_rate_date,
837: Projfunc_invtrans_rate_type,
838: Projfunc_invtrans_ex_rate
839: from pa_draft_invoices
840: where project_id = P_Project_Id
841: and draft_invoice_num = P_Draft_Inv_Num;
842:
843: l_inv_rate_date date;
905: select sum(dii.amount),
906: sum(dii.inv_amount),
907: nvl(di.canceled_flag,'N'),max(dii.line_num) /*Added max line for bug 6501526*/
908: from pa_draft_invoice_items dii,
909: pa_draft_invoices di
910: where di.project_id = P_Project_Id
911: and di.draft_invoice_num = P_Draft_Inv_Num_Credited
912: and di.project_id = dii.project_id
913: and di.draft_invoice_num = dii.draft_invoice_num
922: *cmdii.amount),cmdi.inv_currency_code) line_amt,
923: cmdi.retention_percentage retper,
924: cmdi.inv_currency_code curcode,
925: cmdii.line_num line_num
926: from pa_draft_invoices cmdi,
927: pa_draft_invoice_items cmdii
928: where cmdi.project_id = P_Project_Id
929: and cmdi.draft_invoice_num = P_Draft_Inv_Num
930: and cmdi.project_id = cmdii.project_id
938: pa_currency.round_trans_currency_amt((cmdii.amount* cmdii1.inv_amount/cmdii1.amount ),cmdi.inv_currency_code) line_amt,
939: cmdi.retention_percentage retper,
940: cmdi.inv_currency_code curcode,
941: cmdii.line_num line_num
942: from pa_draft_invoices cmdi,
943: pa_draft_invoice_items cmdii,
944: pa_draft_invoice_items cmdii1
945: where cmdi.project_id = P_Project_Id
946: and cmdi.draft_invoice_num = P_Draft_Inv_Num
972: Cursor get_mult_ret_amt is
973: select cmdii.amount amt,
974: pa_currency.round_trans_currency_amt((cmdii.amount* cmdii1.inv_amount/cmdii1.amount ),cmdi.inv_currency_code) line_amt,
975: cmdii.line_num line_num
976: from pa_draft_invoices cmdi,
977: pa_draft_invoice_items cmdii,
978: pa_draft_invoice_items cmdii1
979: where cmdi.project_id = P_Project_Id
980: and cmdi.draft_invoice_num = P_Draft_Inv_Num
1109: END IF;
1110:
1111: -- X_Status := NULL;
1112:
1113: Update pa_draft_invoices_all
1114: set inv_currency_code = l_invproc_currency_code
1115: ,inv_rate_type = NULL
1116: ,inv_rate_date = NULL
1117: ,inv_exchange_rate = NULL
1136: IF g1_debug_mode = 'Y' THEN
1137: PA_MCB_INVOICE_PKG.log_message('recalculATE: ' || ' If (l_invproc_currency_code = l_inv_currency_code) ');
1138: END IF;
1139:
1140: Update pa_draft_invoices_all
1141: set inv_currency_code = l_invproc_currency_code
1142: ,inv_rate_type = NULL
1143: ,inv_rate_date = NULL
1144: ,inv_exchange_rate = NULL
1158: IF g1_debug_mode = 'Y' THEN
1159: PA_MCB_INVOICE_PKG.log_message('recalculATE: ' || ' If (l_inv_currency_code = l_func_curr) ');
1160: END IF;
1161:
1162: Update pa_draft_invoices_all
1163: set projfunc_invtrans_rate_type = NULL
1164: ,projfunc_invtrans_rate_date = NULL
1165: ,projfunc_invtrans_ex_rate = NULL
1166: ,inv_currency_code = l_inv_currency_code
1345:
1346: /* commented for bug 6501526
1347: SELECT di.inv_rate_type,di.inv_rate_date
1348: INTO l_inv_rate_type,l_inv_rate_date
1349: FROM pa_draft_invoices_all di,pa_draft_invoices_all cmdi
1350: WHERE cmdi.draft_invoice_num_credited= di.draft_invoice_num
1351: AND cmdi.project_id=di.project_id
1352: AND cmdi.draft_invoice_num=P_Draft_Inv_Num
1353: AND cmdi.project_id=P_Project_Id;
1353: AND cmdi.project_id=P_Project_Id;
1354:
1355: -- Update the conversion rate for ITC to IC
1356:
1357: Update pa_draft_invoices_all
1358: set inv_currency_code = l_inv_currency_code
1359: -- ,inv_rate_type = 'User'
1360: --,inv_rate_date = sysdate Should be picked from main invoice: Bug 2689348
1361: -- code changed for bug 2689348
1432: /****End of code added for 3436063****/
1433:
1434: -- Update the conversion rate for ITC to PFC
1435:
1436: Update pa_draft_invoices_all
1437: set projfunc_invtrans_rate_type = 'User'
1438: /* ,projfunc_invtrans_rate_date = sysdate commented for bug 3485407 and modified as follows ..*/
1439: ,projfunc_invtrans_rate_date = invoice_date /* for bug 3485407 */
1440: ,projfunc_invtrans_ex_rate = NVL(l_projfunc_invtrans_rate,0)
1446: IF g1_debug_mode = 'Y' THEN
1447: PA_MCB_INVOICE_PKG.log_message('recalculATE: ' || ' l_func_curr <> l_inv_currency_code and l_invproc_currency_code = l_func_curr ');
1448: END IF;
1449:
1450: Update pa_draft_invoices_all
1451: set projfunc_invtrans_rate_type = inv_rate_type
1452: ,projfunc_invtrans_rate_date = inv_rate_date
1453: ,projfunc_invtrans_ex_rate = inv_exchange_rate
1454: -- DECODE(NVL(inv_exchange_rate,0),0,0, 1/NVL(inv_exchange_rate,0))
1494: 'CREDIT_MEMO') invoice_class,
1495: agr.customer_id,
1496: i.bill_through_date,
1497: i.draft_invoice_num_credited
1498: FROM pa_draft_invoices i,
1499: pa_agreements_all agr
1500: WHERE i.request_id = P_Request_ID
1501: AND nvl(i.generation_error_flag, 'N') = 'N'
1502: AND i.project_id+0 = P_Project_ID
1512: 'CREDIT_MEMO') invoice_class,
1513: agr.customer_id,
1514: i.bill_through_date,
1515: i.draft_invoice_num_credited
1516: FROM pa_draft_invoices i,
1517: pa_agreements_all agr
1518: WHERE i.request_id = P_Request_ID
1519: AND nvl(i.generation_error_flag, 'N') = 'N'
1520: AND i.project_id+0 = P_Project_ID
1587: THEN
1588: IF g1_debug_mode = 'Y' THEN
1589: PA_MCB_INVOICE_PKG.log_message ('recalculATE: ' || 'Invoice Generation Error is set....'||l_out_status);
1590: END IF;
1591: UPDATE pa_draft_invoices_all
1592: SET generation_error_flag='Y',
1593: transfer_rejection_reason= (SELECT meaning FROM pa_lookups
1594: WHERE lookup_type='INVOICE_CURRENCY'
1595: AND lookup_code=l_out_status)