Skip to content
English
  • There are no suggestions because the search field is empty.

How to locate all checks purchased in a day.

Issue example: If a customer has a payment dispute in the reports in sp_Admin, you can use this query to view all the checks purchased in that day.

To get started, make sure you have your customer’s server and database open. Next, begin a new query—you’ll find a helpful link with step-by-step instructions below.

https://app.hubspot.com/knowledge-article/2371650/editor/201297808252/content?redirectUrl=/knowledge/2371650/177774426885/articles/state/all

Once the instructions above have been followed this is a script Gilbert approved (it doesn't change anything in the database)



DECLARE @ReportDate date = 'input the date you want to search';

SELECT
    p.PayID,
    p.CheckID,
    p.PayDate,
    c.OpenedDate,
    c.ClosedDate,
    p.PayAmount,
    p.PayTax,
    p.TipAmount,
    p.PayType,
    p.VoucherID,
    ISNULL(NULLIF(LTRIM(RTRIM(p.CardType)), ''), '(blank)') AS CardTypeBucket,
    p.PayTerminal,
    c.CheckSourceID,

    CASE 
        WHEN CONVERT(date, p.PayDate) <> CONVERT(date, c.ClosedDate)
            THEN 'Mismatch'
        ELSE 'OK'
    END AS ClosedDateStatus,

    CASE 
        WHEN CONVERT(date, p.PayDate) <> CONVERT(date, c.OpenedDate)
            THEN 'Mismatch'
        ELSE 'OK'
    END AS OpenedDateStatus

FROM [ClubspeedV8].[dbo].[Payment] p
JOIN [ClubspeedV8].[dbo].[Checks]  c
    ON c.CheckID = p.CheckID

WHERE
    p.VoidDate IS NULL
    AND CONVERT(date, p.PayDate) = @ReportDate

ORDER BY
    p.PayDate,
    p.PayID;

then execute the query.