l_ordered_po_qty NUMBER;
l_cancelled_po_qty NUMBER;
l_received_po_qty NUMBER;
l_corrected_po_qty NUMBER;
l_delivered_po_qty NUMBER;
l_rtv_po_qty NUMBER;
l_billed_po_qty NUMBER;
l_accepted_po_qty NUMBER;
l_rejected_po_qty NUMBER;
l_ordered_txn_qty NUMBER;
l_cancelled_txn_qty NUMBER;
l_received_qty NUMBER;
l_corrected_qty NUMBER;
l_delivered_txn_qty NUMBER;
l_rtv_txn_qty NUMBER;
l_billed_txn_qty NUMBER;
l_accepted_txn_qty NUMBER;
l_rejected_txn_qty NUMBER;
x_po_qty_ordered number;
x_rect_qty_recvd number;
x_rect_qty_billed number;
x_rect_qty_returned number;
x_rect_qty_accepted number;
x_rect_net_qty_recvd number;
x_matching_qty number;
x_caculation number;
--调用API,取得5个数量
RCV_INVOICE_MATCHING_SV.get_quantities ( top_transaction_id => :HEK_AP_INVOICE_LINES_V.transaction_id,--input参数
ordered_po_qty => l_ordered_po_qty,
cancelled_po_qty => l_cancelled_po_qty,
received_po_qty => l_received_po_qty,
corrected_po_qty => l_corrected_po_qty,
delivered_po_qty => l_delivered_po_qty,
rtv_po_qty => l_rtv_po_qty,
billed_po_qty => l_billed_po_qty,
accepted_po_qty => l_accepted_po_qty,
rejected_po_qty => l_rejected_po_qty,
ordered_txn_qty => l_ordered_txn_qty,
cancelled_txn_qty => l_cancelled_txn_qty,
received_txn_qty => l_received_qty,
corrected_txn_qty => l_corrected_qty,
delivered_txn_qty => l_delivered_txn_qty,
rtv_txn_qty => l_rtv_txn_qty,
billed_txn_qty => l_billed_txn_qty,
accepted_txn_qty => l_accepted_txn_qty,
rejected_txn_qty => l_rejected_txn_qty);
--已订购(订单数量)
x_po_qty_ordered := nvl(l_ordered_po_qty,0) - nvl(l_cancelled_po_qty,0);
--已接收(接收数量)
x_rect_qty_recvd := NVL(l_received_qty, 0) + NVL(l_corrected_qty, 0);
--已开单(开票数量)
x_rect_qty_billed := NVL(l_billed_txn_qty, 0);
--已退回(退回数量)
x_rect_qty_returned := NVL(l_rtv_txn_qty, 0);
--已接受
x_rect_qty_accepted := NVL(l_accepted_txn_qty, 0);
--接收净值
x_rect_net_qty_recvd := x_rect_qty_recvd - x_rect_qty_returned;