Aging report GP Dynamics

  • Comments posted to this topic are about the item Aging report GP Dynamics

  • This script appears to make short work of a problem we experience. However, I can not be sure since it calls '[dbo].[uf_AR_EndPrd_Date]())' which I do not have to make use of.

  • The User Function is nothing more than a date function. It can be commented out and the program will run fine. You could subsititute select cast(getdate() as date) as 'User Date'

    USE [XX]

    GO

    /****** Object: UserDefinedFunction [dbo].[uf_AR_EndPrd_Date] Script Date: 10/14/2014 7:27:36 AM ******/

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    --IF OBJECT_ID (N'dbo.ISOweek', N'FN') IS NOT NULL

    -- DROP FUNCTION dbo.ISOweek;

    --GO

    ALTER FUNCTION [dbo].[uf_AR_EndPrd_Date] ()

    RETURNS date

    AS

    BEGIN

    declare @cyr as int

    declare @cprd as int

    declare @pyr as int

    declare @pmth as int

    declare @Begdate as date

    declare @EndDate as date

    set @pmth = (select month(getdate())-1)

    set @pyr = (Select year(getdate())-1)

    if @pmth = 0

    begin

    set @pmth = 12

    end

    if @pmth >=1 and @pmth <12

    begin

    set @pyr = (select year(getdate()))

    end

    set @EndDate = (select Perdendt

    from servername.DB.dbo.SY40100

    where periodID = @pmth

    and year1 = @pyr

    and series = 3

    and odesctn = 'Receivables Cash Receipts')

    return(@Enddate)

    END

  • The User Function is nothing more than a date function. It can be commented out and the program will run fine.

  • Thanks for the tip.

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply