Skip to Content

get the manufacturer total

Mar 21, 2017 at 08:06 AM


avatar image

Hi sir,

In this query for BP Code BP, Name Item Code, Manufacturer, Qty & Value

along with the latest entry of a particular item code another entry of the same item code for a previous date shows up.

SELECT T0.[CardCode] as 'Supplier Number',

T0.[CardName] as 'Supplier Name', t1.[Itemcode] as 'Item Code',

T3.[FirmName] as 'Manufacturer', T1.[Price] as 'Invoice_Value',

T1.Quantity as 'Invoice_Quantity',

T1.LineTotal as 'InvoiceLineTotal',

T4.[Price] as 'CrediNote_Value',

T4.Quantity as 'CrediNote_Quantity',

T4.LineTotal as 'CreditLineTotal',

((T1.LineTotal) - (T4.LineTotal)) as 'Total' FROM OPCH T0

INNER JOIN PCH1 T1 ON T0.[DocEntry] = T1.[DocEntry]

INNER JOIN OITM T2 ON T1.[ItemCode] = T2.[ItemCode]

INNER JOIN OMRC T3 ON T2.[FirmCode] = T3.[FirmCode]

right JOIN RPC1 T4 ON T2.[ItemCode] = T4.[ItemCode]

INNER JOIN ORPC T5 ON T4.[DocEntry] = T5.[DocEntry]

WHERE T0.[CardCode] between [%0] and [%1]

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers