Query, dicount on invoice report

Hello,
We have some items that are not discountable, so I created on item properties"discountable =yes/no".
On the invoice report I'd like to have the following:
Payable until xx.yy.zzzz: EUR XXXXX <sum of amount of discountable items & based upon BP payment terms discount rate and last date>, until xx.yy.zzzz: EUR <total amount and last date without discount>.
Example:
Payable until 14.02.2012 EUR 1960,00 (14 days 2%, 30 days Net.), until 28.02.2012 EUR 2000,00.
I know this is only for the report(paper and screen) and some tables will showup wrong data as the customer pays the discount amount.
Coresuite installed.
Thank you
Marc

Hi Jitin,
Thanks for you code sniplet, as you can see I played a bit with the SQL query:
SELECT
T0.DocNum AS 'Belegnummer',
SUM(T1.LineTotal) AS 'Betrag Zeilensumme', T0.DocTotal AS 'Gesamt', T5.Discount AS 'Skontowert',
(CAST (T0.DocTotal AS money)-(CAST (T0.DocTotal AS money)-(((SUM(CAST (T1.LineTotal AS money)1.1900)/(T5.Discount/100 + 1))+((CAST (T0.DocTotal AS money)/1.1900)-(SUM(CAST (T1.LineTotal AS money))))1.1900)))) AS 'Skontobereinigt'
FROM
dbo.OINV T0 FULL OUTER JOIN dbo.INV1 T1
ON T1.DocEntry = T0.DocEntry
FULL OUTER JOIN dbo.OITM T2
ON T2.ItemCode = T1.ItemCode
FULL OUTER JOIN dbo.OCRD T3
ON T1.BaseCard = T3.CardCode
FULL OUTER JOIN dbo.OCTG T4
ON T3.GroupNum = T4.GroupNum
FULL OUTER JOIN dbo.CDC1 T5
ON T4.DiscCode = T5.CdcCode
WHERE T2.QryGroup1 = (N'Y' )
GROUP BY T0.DocNum, T5.Discount , T0.DocTotal, T2.QryGroup1
so how can I get this into my invoice to be Shown like:
Zahlungskonditionen: 10 Tage abzüglich "T5.Discount/SkontoimGP" EUR "RN Betrag Skontoabzug", 30 Tage Netto
Thanks Marc

Similar Messages

  • A/r Invoice report query based on posting date selection criteria

    Hi experts,
    I am trying to write a query to get the A/r invoice report including Docnum, Docdate, cardname, project, linetotal, taxcode, taxtotal.
    and i tried the below query
    SELECT T0.[DocNum], T0.[DocDate], T0.[CardCode], T0.[CardName],T1.[LineTotal] FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry WHERE T0.[DocDate] >=[%0] AND  T0.[DocDate] <=[%1]
    In this query ,
    1) i am unable to sum up the linetotal( total before tax) 
    2) also unable to fetch the sum of taxamount.
    3) its more important , the above query will  me docnum , when i try to open that doc, it opens the 2007 docments. whereas the other details are correct like docdate, amount and all.
    example:   from date: 1/04/2011    to date: 28/07/2011
    Docnum    Docdate  cardname   linetotal.... etc
        2              1/04/11   XYZ              5000
    when i click the 2 (docnum)  it opens me the 04/04/2007  documents.
    how to limit the doc within the periods given?
    thanks in advance
    Dwarak

    Hi Rahul/Gordon,
    thanks for your query's .
    additionally,   i want this query without the A/r invoices whichever having credit memo as target doc. 
    and
    i have selection criteria as  T0.[U_Sec_Category] = '[%2]'  and this has 3 values like  1)CIM 2)BIN 3)DMP
    among these  CIM should be seen only only user1  and BIN & DMP only by user2.
    can u plz get me this
    thanks,
    Dwarak

  • A/R invoice Report Query selection by Items.

    Dear All,
    I need a A/R invoice  Report Query selection by Items.
    Thanx in advance!!!!!!!!

    Hi,
            Try this......
    Declare @Itemcode nvarchar(50)
    set @Itemcode = (select (T1.iTEMCODE) FROM INV1 T1 WHERE T1.ITEMCODE='[%0]')
    SELECT T0.DocNum, T0.DocStatus, T0.DocDate as 'Posting date',
    T0.TaxDate as 'Document Date', T0.CardCode as 'Customer Code',
    T0.CardName as 'Customer Name', T1.ItemCode, T1.Dscription as 'Item Name',
    T1.Quantity,T1.Price,T1.VatSum AS TAX,T1.LineTotal as Total
    FROM OINV T0
    INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
    where T1.ItemCode =@Itemcode 

  • Error when attempting to run auto invoice report

    Hi,
    We are currently using Oracle E-Business Suite 11.2.  One of our users was attempting to run an Auto Invoice Report this morning and got an error occur.  The log file shows the following:
    SELECT INTERFACE_LINE_ID
    FROM   RA_INTERFACE_LINES L2
    WHERE  L2.REQUEST_ID = :b5
    AND    L2.INTERFACE_LINE_CONTEXT = 'UPLS INVOICES'
    AND    L1.LINK_TO_LINE_CONTEXT = L2.INTERFACE_LINE_CONTEXT
    AND    L1.LINK_TO_LINE_ATTRIBUTE10 = L2.INTERFACE_LINE_ATTRIBUTE10
    AND    L1.LINK_TO_LINE_ATTRIBUTE11 = L2.INTERFACE_LINE_ATTRIBUTE11
    AND    L1.LINK_TO_LINE_ATTRIBUTE12 = L2.INTERFACE_LINE_ATTRIBUTE12
    WHERE NVL(INTERFACE_STATUS, '~') != 'P'
    AND (REQUEST_ID IS NULL OR REQUEST_ID IN (:b6)
    AND EXISTS
    SELECT 'x'
    FROM   RA_INTERFACE_LINES L2
    WHERE  L2.REQUEST_ID = :b7
    AND    L2.INTERFACE_LINE_CONTEXT = 'UPLS INVOICES'
    AND    L1.LINK_TO_LINE_CONTEXT = L2.INTERFACE_LINE_CONTEXT
    AND    L1.LINK_TO_LINE_ATTRIBUTE10 = L2.INTERFACE_LINE_ATTRIBUTE10
    AND    L1.LINK_TO_LINE_ATTRIBUTE11 = L2.INTERFACE_LINE_ATTRIBUTE11
    AND    L1.LINK_TO_LINE_ATTRIBUTE12 = L2.INTERFACE_LINE_ATTRIBUTE12
    len = 1171
    Current system time is 09-OCT-2013 07:33:50
    APP-AR-11526: ORA-01427: single-row subquery returns more than one row
    UPDATE RA_INTERFACE_LINES L1
    SET REQUEST_ID = :b1,
    LAST_UPDATE_DATE =
    APP-AR-11526: 2913367/ar/src/autoinv/raamil.lpc 1333
    UPDATE RA_INTERFACE_LINES L1
    SET REQUEST_ID = :b1,
    LAST_UPDATE_DATE = sysdate,
    LAST_UPDATED_BY = :b2,
    LAST_UPDATE_LOGIN = :b3,
    CUSTOMER_TRX_ID = NULL,
    INTERFACE_LINE_ID = NVL(INTERFACE_LINE_ID,
    RA_CUSTOMER_TRX_LINES_S.NEXTVAL),
    SET_OF_BOOKS_ID = NVL(SET_OF_BOOKS_ID, :b4),
    LINK_TO_LINE_ID =
    Would someone be able to help me with this as my knowledge on Oracle is quite basic and the person who usually deals with these queries is out of the office.
    Regards,
    Jon Ditchfield

    The error is
    APP-AR-11526: ORA-01427: single-row subquery returns more than one row
    A subquery that is supposed to return only one row is returning more than one. Most likely it is this query
    SELECT 'x'
    FROM   RA_INTERFACE_LINES L2
    WHERE  L2.REQUEST_ID = :b7
    AND    L2.INTERFACE_LINE_CONTEXT = 'UPLS INVOICES'
    AND    L1.LINK_TO_LINE_CONTEXT = L2.INTERFACE_LINE_CONTEXT
    AND    L1.LINK_TO_LINE_ATTRIBUTE10 = L2.INTERFACE_LINE_ATTRIBUTE10
    AND    L1.LINK_TO_LINE_ATTRIBUTE11 = L2.INTERFACE_LINE_ATTRIBUTE11
    AND    L1.LINK_TO_LINE_ATTRIBUTE12 = L2.INTERFACE_LINE_ATTRIBUTE12

  • Add PA_NON_LABOR_RESOURCES.DESCRIPTION in Invoice Report

    I need to modify the Invoice Report by adding the PA_NON_LABOR_RESOURCES.DESCRIPTION for each line in the invoice (q_lines query).
    I'm not sure how to tie a record in ra_customer_trx_lines back to pa_expenditure_items (also ensuring a one-to-one mapping) so I can use the NON_LABOR_RESOURCE column to lookup the description. I don't see any direct or indirect foreign keys between the two tables (customer trx lines and expenditure items). Any help will be greatly appreciated.
    Thanks,
    Ahsun Jilani

    Don't think there is a direct link back. You can use CUSTOMER_TRX_ID to tie back to SYSTEM_REFERENCE in PA_DRAFT_INVOICES_ALL but the PA invoice will not contain a one-to-one relationship with the expenditure items as you can't generate PA invoices to that level of detail. From PA_DRAFT_INVOICES you can get down to PA_DRAFT_INVOICE_ITEMS and then to PA_CUST_REV_DIST_LINES_ALL where you can then get to PA_EXPENDITURE_ITEMS. How the PA invoice is created depends on the invoice format you have used, the lowest level I can see is by expenditure type so you'll find that the invoice lines contain grouped items based on the type - well, as far as I can see anyway!!
    Graham

  • Query to generate a report for incoming pending payments as per Item Group!

    Dear All,
    I need a Query to generate a report for incoming pending payments through Item Group.
    Please provide me the same.
    Thanks in advance..........................
    Edited by: Param Deshwal on Nov 22, 2011 7:11 AM

    Hi
         try this
    SELECT T0.[DocNum] as 'Invoice Number', T0.[DocDate] as 'Invoice Date', T0.[CardName], T0.[DocTotal] as 'Invoice Amount', T0.[PaidToDate] as 'Paid Amount',(T0.[DocTotal]-T0.[PaidToDate]) as 'Pending Amount',T3.[ItmsGrpnam] FROM OINV T0 Inner join inv1 t1 on t0.docentry=t1.docentry inner join oitm t2 on t2.itemcode=t1.itemcode inner join oitb t3 on t3.[ItmsGrpcod]=t2.[ItmsGrpcod] where T3.[ItmsGrpnam]=[%0] 
    Regards,
    sudhir B.
    Edited by: B.sudhir on Nov 22, 2011 7:28 AM

  • How to make query base delivery monthly report  link with delivery return

    Hi,
    I have facing some problem in Sales delivery report monthly. Problem is:
    1) When i make Monthly query delivery report without any delivery return and AR Credit memo, it is Fine.
    2) When i make Monthly query delivery report with any delivery return and AR Credit memo, it is not showing proper. Its showing in report including return quantity or AR Credit memo quantity.
    So, How to make query base delivery monthly report  link with delivery return and AR Credit Memo?
    Please help me regarding this.
    Mizan
    Edited by: mizan700 on Dec 18, 2010 2:50 PM
    Edited by: mizan700 on Dec 18, 2010 2:50 PM

    Hi,
    try this.
    SELECT DISTINCt T1.CARDCODE, T1.CARDNAME , T1.DOCNUM DELIVERY#,T1.DocStatus 'DELIVERY STATUS', T1.DOCDATE 'DELIVERY Date', T1.DocTotal 'DELIVERY Total', T3.DOCNUM Return#,T3.DocStatus 'Return Status', T3.DOCDATE 'Return Date', T3.DocTotal 'Return Total',T5.DOCNUM Invoice#,T5.DocStatus 'Invoice Status', T5.DOCDATE 'Invoice Date', (T5.DocTotal-T5.VatSum-T5.TotalExpns-T5.DiscSum) 'Total Before Discount', T5.VatSum 'Tax', T5.TotalExpns 'Freight', (T5.DocTotal - T5.PaidToDate) 'Total Payment Due', T7.DOCNUM AS 'CREDIT MEMO#', T7.DOCDATE
    FROM DBO.DLN1 T0
    INNER JOIN DBO.ODLN T1 ON T1.DOCENTRY = T0.DOCENTRY
    LEFT JOIN DBO.RDN1 T2 ON T2.BASEENTRY = T1.DOCENTRY
    LEFT JOIN DBO.ORDN T3 ON T2.DOCENTRY = T3.DOCENTRY
    LEFT JOIN DBO.INV1 T4 ON T4.BASEENTRY = T1.DOCENTRY
    LEFT JOIN DBO.OINV T5 ON T5.DOCENTRY = T4.DOCENTRY
    LEFT JOIN DBO.RIN1 T6 ON T6.BASEENTRY = T5.DOCENTRY
    LEFT JOIN DBO.ORIN T7 ON T7.DOCENTRY = T6.DOCENTRY
    WHERE  T1.DOCDATE >= [%0] AND  T1.DOCDATE <= [%1]
    Thanks,
    Joseph

  • Make my A/R invoice report consider A/R credit

    Hello Xperts
    I would like to make my AR INVOICE report to consider also the DBO.ORIN A/R Credit
    How can i make it show also the ORIN documents?
    This is the  A/R invoice report that i've made: 
    SELECT
    T1.DocNum , T1.CardCode,T1.CardName ,T1.BPCHCODE,T4.CARDNAME
    FROM OINV T1
      INNER JOIN OCRD T2 ON T1.CardCode = T2.CardCode
      INNER JOIN OCRY T3 ON T2.Country = T3.Code
    LEFT JOIN OCRD T4 ON T4.CARDCODE = T1.BPCHCODE
    WHERE ((T3.Name = '[%0]')  or ( [%0] =''))
    Thank you !
    D.Medalion

    Are you creating the reporting using SAP Business one Crystal or .Net Crystal?
    if you are using .Net crystal and bringing result in report by querying the OINV table (not directly keeping OINV as the data source) then you can defineltly add union clause in your query and bring data from ORIN table.
    SELECT
    T1.DocNum , T1.CardCode,T1.CardName ,T1.BPCHCODE,T4.CARDNAME
    FROM OINV T1
      INNER JOIN OCRD T2 ON T1.CardCode = T2.CardCode
      INNER JOIN OCRY T3 ON T2.Country = T3.Code
    LEFT JOIN OCRD T4 ON T4.CARDCODE = T1.BPCHCODE
    WHERE ((T3.Name = '[%0]')  or ( [%0] =''))
    UNION
    SELECT
    T1.DocNum , T1.CardCode,T1.CardName ,T1.BPCHCODE,T4.CARDNAME
    FROM ORIN T1
      INNER JOIN OCRD T2 ON T1.CardCode = T2.CardCode
      INNER JOIN OCRY T3 ON T2.Country = T3.Code
    LEFT JOIN OCRD T4 ON T4.CARDCODE = T1.BPCHCODE
    WHERE ((T3.Name = '[%0]')  or ( [%0] =''))

  • How to improve the query performance in to report level and designer level

    How to improve the query performance in to report level and designer level......?
    Plz let me know the detail view......

    first its all based on the design of the database, universe and the report.
    at the universe Level, you have to check your Contexts very well to get the optimal performance of the universe and also your joins, keep your joins with key fields, will give you the best performance.
    at the report level, try to make the reports dynamic as much as you can, (Parameters) and so on.
    and when you create a paremeter try to get it match with the key fields in the database.
    good luck
    Amr

  • How to find the name of query for a given report

    Hi All,
    I am having the name of a report and i need to find out the name of query for that report . Plz tell me how to find out the name of the query for a given report.
    Thanks.
    Regards,
    Pooja Joshi.

    Use this FM
    RSAQ_DECODE_REPORT_NAME
    This FM takes program name as I/P and gives Query Name as O/P.
    This FM uses the structure AQADEF to fetch the data.
    Hope this helps.
    Regards
    Vinayak

  • How to pass parameter value as "where [fieldname] = [fieldvalue]" in sql query under query type in SSRS report?

    I am having trouble with passing dynamic string to sql query for executing SSRS reports.
    I am using oracle database and I want to pass where clause parameter as "where LAND_NR = 6" to my select query.
    For example: I want to execute Select * from employee :p_where.
    where p_where parameter holds value "where LAND_NR = 6"
    So it will treat as "Select * from employee where LAND_NR = 6" statement which will give me the list of records to display in my reports.
    But it's not taking correct sql command throwing an error as "SQLcommand not properly ended."
    How can I achieve this?

    You need to use dynamic sql
    But please keep in mind that since you're using Oracle you may be better off posting this in some Oracle forums
    This forum is specifically for SQL Server
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to create dynamic Invoice report based on Tax calculations

    Hi Ppl,
    I have an invoice report requirement. There are multiple line items in invoice and each line item will have a tax % and discount associated with it. Discount has to be applied at line item level. Tax will be applicable on resultant amount which respect to tax share on total amount. Below is example
    Part# Tax     Qty     UnitPrice Amount     Discount     Net Value
    1     12.5%     40     10          400          100          300
    2     12.5%     50     20          1000          200          800
    3     4%     10     30          300          50          250
                             SubTotal                    1350
                             VAT 12.5% on 1100(300+800)     137.50
                             VAT 4% on 250               10
                             Total Amount               1497.5
    I have created a static rtf which does all calculations correctly. I have hardcoded 12.5 and 4 % tax values for calculations. But issue is that taxes are changeable in future so I want to create dynamic template which takes care for tax calculations. I thought of to create an array to store distinct tax values from XML data and then to perform calculation but don’t know how to do that.
    Can some body help me out as this is very critical and urgent?
    Note: Tax calculation can be done at line item level itself but there are some scenarios where additional discounts are there so tax calculation can not be done at line item level.
    Below is the sample XML data
    <?xml version="1.0" encoding="UTF-8" ?>
    - <ListOfBipActionTest>
    - <Action>
    <AccountId>1</AccountId>
    <PartName>17211KCC900LS</PartName>
    <TAX>12.5</TAX>
    <QTY>40</QTY>
    <UNITPRICE>47.06</UNITPRICE>
    <DIS>15.00</DIS>
    <TaxType>CST</TaxType>
    </Action>
    - <Action>
    <AccountId>2</AccountId>
    <PartName>17213KCC900LS</PartName>
    <TAX>12.5</TAX>
    <QTY>50</QTY>
    <UNITPRICE>19.53</UNITPRICE>
    <DIS>8.00</DIS>
    <TaxType>CST</TaxType>
    </Action>
    - <Action>
    <AccountId>3</AccountId>
    <PartName>28302KAG900S</PartName>
    <TAX>12.5</TAX>
    <QTY>50</QTY>
    <UNITPRICE>59.49</UNITPRICE>
    <DIS>15.00</DIS>
    <TaxType>CST</TaxType>
    </Action>
    - <Action>
    <AccountId>4</AccountId>
    <PartName>2830AKAG900S</PartName>
    <TAX>12.5</TAX>
    <QTY>10</QTY>
    <UNITPRICE>168.7</UNITPRICE>
    <DIS>15.00</DIS>
    <TaxType>CST</TaxType>
    </Action>
    - <Action>
    <AccountId>4</AccountId>
    <PartName>91001GF6000S</PartName>
    <TAX>4.00</TAX>
    <QTY>60</QTY>
    <UNITPRICE>115.34</UNITPRICE>
    <DIS>17.00</DIS>
    <TaxType>CST</TaxType>
    </Action>
    </ListOfBipActionTest>
    Thanks
    Ashish

    Dear Efstratios Kara,
    I installed SAP Integration Kit 3.1. Yes I installed the integration kit after installing CR.
    I have uninstalled the earlier version and i have reinstalled CR with (12.3.0.601) version.
    But still i cant view the SAP connectivity. can u tell me from which version they have included this connectivity option in CR.
    If CR going to support SAP Table connectivity on specific version, what is that version.
    Waiting for your reply.
    Regards,
    Suman

  • In DBI , how to find out the Source Query used for the Report

    Hi All,
    How to find out the Source Query used to display the data in the DBI Reports or Dashboards. We can get it in Apps Front end by Going to Help and Record Histroty. But DBI Runs in Internet Explorer so i dont know how to get the source query ( SELECT Query ) Used.
    In IE we have View --> Source . But that does not help since it gives the HTML Coding and not the SELECT Query used.
    If anyone has ever worked on it...Please help me in finding it.
    Thanks,
    Neeraj Shrivastava

    Hi neeraj,
    You can see the query used to display reports.Follow these steps to get the query.
    1)Login to oracle apps
    2)Select "Daily Business Intelligence Administrator" responsiblity.
    3)Now click on "Enable/Disable Debugging" (Now u enabled debugging)
    4)now open the report which you want to see the query of
    5)In view source it displays query along with the bind varilables.
    Feel free to ping me if you have any doubts
    thanks
    kittu

  • Extracting the Logical sql query for the specified report  in OBIEE 11g

    Hi ,
    I want to extract the logical SQL Query for the Particular report in OBIEE 11.1.1.5.
    Any pointers related to this will be very helpful.
    Thanks,
    Sonali

    for a try please add Logical sql view to ur report it will dispaly the Logical sql for that Report..
    Hope it will helps you.

  • AR Invoice Report for Certain Vendor.

    Hi Experts,
           I was needing to have a .txt file created monthly to send to one of the vendors that has the following columns of information (in this order) for an AR Invoice:
    Customer city
    Customer State
    Customer Zip
    Part #
    Quantity
    Invoice #
    Invoice Date
    Unit cost
    Unit Price
    Customer ID
    Customer Name
    Customer PO
    Ship Date
    Thanks in advance,
    Jeff Haldeman
    Support One

    Please check if this query meets your need:
    Select T2.City 'Customer City', T2.State1 'Customer State',
    T2.ZipCode 'Customer ZIP', T0.ItemCode 'Part#', T0.Quantity,
    T1.DocNum 'Invoice#', T1.DocDate 'Invoice Date',
    T0.GrossBuyPr 'Unit Cost',T0.Price 'Unit Price', T1.CardCode 'Customer Code', T1.CardName 'Customer
    Name', T1.NumAtCard 'Customer PO', T0.ShipDate 'Ship Date'
    From INV1 T0 INNER JOIN OINV T1 ON T1.DocEntry =
    T0.DocEntry
    LEFT JOIN OCRD T2 ON T2.CardCode = T1.CardCode
    LEFT JOIN OITM T3 On T3.ItemCode = T0.ItemCode
    Where T1.DocType = 'I' and DateDiff(MM,T1.DocDate,
    GetDate()) = 1
    In this query, only the invoices are showed.  If you need Credit Memo too, use Union All to add those tables.
    Thanks,
    Gordon

Maybe you are looking for

  • How do i get music videos to play like the music does on my ipad, for example one right after another and shuffle

    I need to know how I can get the music videos on my IPad to play like the music does.  What I mean id setting up a playlist, shuffle, and have them play one right after another instead of going back to the main screen.

  • AS is down and failing to connect:  Getting the error below

    I'm new to the Oracle AS environment. I'm also new to the Oracle technical support environment. I just encountered the error below and I'm researching the cause this problem. I was informed to come to this board to seek valuable knowlege, solutions a

  • Threads updating Swing

    Hi. I noticed that when trying to add text to a textbox: myJTextArea.append("abc");From a Thread: loop 100 times{call append() }> My application hangs. But when I add an sleep: loop 100 times{call append() Thread.Sleep(10); }> It all works fine. Is t

  • Button not doing what it should

    I have two buttons on my page, button 1 and button 2. They have different appearences once tapped, under "click" applied to them, just to add a little extra to my app. The "event" is "on release". The actions I have set are "go to state", i have thre

  • Schedule for Maintenance and Support

    When do you expect to be at a point where you set product price and maintenance cost? Also, I assume that you will give existing MATRIXx customers a 'grace period' during which we can secure funds to resume paying for maintenance and support, right?