返利是指公司间应收款项按一定比率的返还给客户。返利开发实质就是实现对应收发票的更改和新增(暂时我的理解)
一.对发票行更改
PACKAGE AP_INVOICE_LINES_ALL_PRIVATE IS
PROCEDURE INSERT_ROW (X_LINE_NUM OUT NUMBER,P_FLAG VARCHAR2,P_AMOUNT NUMBER);
PROCEDURE UPDATE_ROW (P_LINE_NUM IN NUMBER,P_INVOICE_ID IN NUMBER,P_ORG_ID IN NUMBER);
END;
PACKAGE BODY AP_INVOICE_LINES_ALL_PRIVATE IS
PROCEDURE INSERT_ROW (X_LINE_NUM OUT NUMBER,P_FLAG VARCHAR2,P_AMOUNT NUMBER)IS
v_row_id VARCHAR2(1000);
v_line_number number;
g_user_id CONSTANT NUMBER := fnd_global.user_id;
g_login_id CONSTANT NUMBER := fnd_global.conc_login_id;
g_request_id CONSTANT NUMBER := fnd_global.conc_request_id;
g_prog_appl_id CONSTANT NUMBER := fnd_global.prog_appl_id;
g_conc_program_id CONSTANT NUMBER := fnd_global.conc_program_id;
x_ccid number;
V_AMOUNT NUMBER;
BEGIN
select max(NVL(line_number,0))
into v_line_number
from AP_INVOICE_LINES_ALL
where invoice_id = :parameter.G_INVOICE_ID;
X_LINE_NUM := v_line_number + 1;
cux_cuxaprebate_utl.create_account(p_org_id =>:parameter.g_org_id,
p_ccid =>:parameter.G_CCID,
x_ccid =>x_ccid);
IF P_FLAG = 'CANCEL' THEN
V_AMOUNT := P_AMOUNT;
ELSIF P_FLAG = 'APPLY' THEN
V_AMOUNT := - P_AMOUNT;
END IF;
/*mo_global.init('AP');
mo_global.set_policy_context(p_access_mode => 'S',
p_org_id => :parameter.g_org_id);--mo_global.get_current_org_id*/
ap_ail_table_handler_pkg.insert_row(p_rowid => v_row_id,
p_invoice_id => :parameter.G_INVOICE_ID,
p_line_number => X_LINE_NUM,
p_line_type_lookup_code => 'MISCELLANEOUS',--杂项
p_line_group_number => NULL,
p_requester_id => NULL,
p_description => NULL,
p_line_source => NULL,
p_org_id => NULL,
p_inventory_item_id => NULL,
p_item_description => NULL,
p_serial_number => NULL,
p_manufacturer => NULL,
p_model_number => NULL,
p_warranty_number => NULL,
p_generate_dists => NULL,
p_match_type => NULL,
p_distribution_set_id => NULL,
p_account_segment => NULL,
p_balancing_segment => NULL,
p_cost_center_segment => NULL,
p_overlay_dist_code_concat => NULL,
p_default_dist_ccid => x_ccid,--ccid
p_prorate_across_all_items => NULL,
p_accounting_date => :parameter.G_GL_DATE,--gl_date
p_period_name => NULL,
p_deferred_acctg_flag => NULL,
p_def_acctg_start_date => NULL,
p_def_acctg_end_date => NULL,
p_def_acctg_number_of_periods => NULL,
p_def_acctg_period_type => NULL,
p_set_of_books_id => :parameter.G_SET_OF_BOOKS_ID,--
p_amount => V_AMOUNT,--金额
p_base_amount => NULL,
p_rounding_amt => NULL,
p_quantity_invoiced => NULL,
p_unit_meas_lookup_code => NULL,
p_unit_price => NULL,
p_wfapproval_status => 'NOT REQUIRED',--
p_discarded_flag => NULL,
p_original_amount => NULL,
p_original_base_amount => NULL,
p_original_rounding_amt => NULL,
p_cancelled_flag => NULL,
p_income_tax_region => NULL,
p_type_1099 => NULL,
p_stat_amount => NULL,
p_prepay_invoice_id => NULL,
p_prepay_line_number => NULL,
p_invoice_includes_prepay_flag => NULL,
p_corrected_inv_id => NULL,
p_corrected_line_number => NULL,
p_po_header_id => NULL,
p_po_line_id