Quantcast
Channel: Microsoft Dynamics GP
Viewing all articles
Browse latest Browse all 59474

Forum Post: RE: Is there a way to assign a Liability to a vendor?

$
0
0

Hi again,

Here's the query I came up with to pull the data if you set it up according to my earlier reply

Kind regards,

Leslie

/* This query returns the sales tax amount on historical SOP Invoices with an invoice

  date between the first day of the previous month and the last date of the

  previous month. Voided documents are excluded.

  It uses the following tables:

  SOP30200 Sales Transaction History

  SOP10105 Sales Taxes Work and History

  GL00100 Account Master

  GL00105 Account Index Master

  PM00200 Vendor Master

  TX00201 Sales/Purchases Tax Master  

*/

SELECT    

 CASE SOP30200.SOPTYPE

    WHEN 1 THEN 'Quote'

    WHEN 2 THEN 'Order'

    WHEN 3 THEN 'Fulfillment Order'

    WHEN 4 THEN 'Invoice'

    WHEN 5 THEN 'Return'

 END AS Doc_Type

, SOP10105.SOPNUMBE AS SOP_Number

, SOP30200.DOCDATE AS Invoice_Date

, SOP30200.CUSTNMBR AS Customer_ID

, SOP30200.CUSTNAME AS Customer_Name

, GL00100.USERDEF1 AS User_Defined1

, PM00200.VENDNAME AS Vendor_Name

, GL00105.ACTNUMST AS GL_Account_Number

, SOP10105.TAXDTLID AS Tax_Detail_ID

, SOP10105.STAXAMNT AS Sales_Tax_Amt

, SOP10105.FRTTXAMT AS Tax_on_Freight

, SOP10105.MSCTXAMT AS Tax_on_Misc

, DATEADD (m,-1, DATEADD(d,1-DATEPART(d,GETDATE()),GETDATE())) as FirstDayPrevMo

, DATEADD (d,-DATEPART(d,GETDATE()),GETDATE()) as LastDayPrevMo

FROM

SOP10105 INNER JOIN

       SOP30200 ON SOP10105.SOPTYPE = SOP30200.SOPTYPE

AND SOP10105.SOPNUMBE = SOP30200.SOPNUMBE

 INNER JOIN GL00100 ON SOP10105.ACTINDX = GL00100.ACTINDX INNER JOIN

                    TX00201 ON SOP10105.TAXDTLID = TX00201.TAXDTLID INNER JOIN

                    PM00200 ON GL00100.USERDEF1 = PM00200.VENDORID INNER JOIN

                    GL00105 ON GL00100.ACTINDX = GL00105.ACTINDX

WHERE    

(SOP30200.SOPTYPE in (3,4)) and  VOIDSTTS = 0 and DOCDATE between

DATEADD (m,-1, DATEADD(d,1-DATEPART(d,GETDATE()),GETDATE())) and

DATEADD(d,-DATEPART(d,GETDATE()),GETDATE())


Viewing all articles
Browse latest Browse all 59474

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>