Current position:  Home > Default > Calculation Of invoice amount

Calculation Of invoice amount

Time:October 11
Advertisement
I got Invoice_Amount two ways By Joining Some tables
First way
Tables:
wsh_delivery_details
wsh_delivery_assignments
wsh_new_deliveries
The Query :
select max(wnd.STATUS_CODE) Status, wnd. DELIVERY_ID INV_NO,
Max(wdd.DATE_SCHEDULED) Inv_Date, Max(wdd.CUSTOMER_ID) CUSTOMER_ID, sum(nvl(wdd.SHIPPED_QUANTITY,0) * nvl(wdd.UNIT_PRICE,0)) Inv_Amt
from wsh_delivery_details wdd, wsh_new_deliveries wnd ,wsh_delivery_assignments wda
where wdd.DELIVERY_DETAIL_ID= wda.DELIVERY_DETAIL_ID
and wda.DELIVERY_ID=wnd.DELIVERY_ID
group by wnd. DELIVERY_ID
Second way
Tables:
ra_customer_trx_lines_all
ra_customer_trx_all ct
Query:
select max(cl.CUSTOMER_TRX_ID) Cust_trx_no ,max(ct.TRX_NUMBER) ct_trx
,cl.INTERFACE_LINE_ATTRIBUTE3 INV_No,max(cl.CREATION_DATE) Inv_date,
sum(cl.QUANTITY_INVOICED* cl.UNIT_SELLING_PRICE) inv_amt ,
Max(cl.SALES_ORDER) Ord_No ,Max(cl.SALES_ORDER_DATE) Order_date ,max(ct.TRX_DATE)
ct_TRX_DATE,Max(ct.SOLD_TO_CUSTOMER_ID) ct_SLDtoCust
from ra_customer_trx_lines_all cl,ra_customer_trx_all ct
where cl.CUSTOMER_TRX_ID=ct.CUSTOMER_TRX_ID
group by cl.INTERFACE_LINE_ATTRIBUTE3
Note:cl.INTERFACE_LINE_ATTRIBUTE3 is INV number.
But invoice Amounts are different. Why it is so? Shall i apply any more
conditions? Why same Data(ie selling price and Quantity) storing in two tables(ra_customer_trx_lines_all,wsh_delivery_details)?
Advertisement
Hi Mike,
U r using transaction types to generate your distributions, right?
Try to insert distribution info for each of your invoices in the table ra_interface_distributions_all, specifying REC, REV and TAX (tax where applicable) lines.
Hope this will solve your prob.
Vik