Customer Inquiry - Age as of date

SOLVED

When looking up Customer Credit history within CUSTOMER INQUIRY, why does the "Age as of" and "Cut off Date" default to a date that is several years in the past instead of todays date?  Sage 300 ERP V6.0

Parents Reply
  • 0 in reply to SageDS

    Yes, but anybody can do it, it's not complicated.  Just select Macro/Edit, and change the hard-coded date value into the VBA system variable "Date".  Like this:

    ARAGING1Fields("RUNDATE").PutWithoutVerification (DateSerial(2021, 1, 31)) ' Age as-of Date
    ARAGING1Fields("CUTOFFDATE").PutWithoutVerification (DateSerial(2021, 1, 31)) ' Cutoff Date

    becomes:

    ARAGING1Fields("RUNDATE").PutWithoutVerification Date ' Age as-of Date
    ARAGING1Fields("CUTOFFDATE").PutWithoutVerification Date ' Cutoff Date

Children
  • 0 in reply to Jay Converse Acumen

    Hey Jay - the text isn't exactly like that - here it is:

    Option Explicit

    Sub MainSub()
    '
    ' Sage 300 Macro file: C:\Accpac\Macros\Aged trial balance ecity.AVB
    ' Recorded at: Sun Jan 9 09:23:13 2022
    '

    On Error GoTo ACCPACErrorHandler

    ' TODO: To increase efficiency, comment out any unused DB links.
    Dim mDBLinkCmpRW As AccpacCOMAPI.AccpacDBLink
    Set mDBLinkCmpRW = OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)

    Dim mDBLinkSysRW As AccpacCOMAPI.AccpacDBLink
    Set mDBLinkSysRW = OpenDBLink(DBLINK_SYSTEM, DBLINK_FLG_READWRITE)

    Dim temp As Boolean
    Dim ARAGING1 As AccpacCOMAPI.AccpacView
    Dim ARAGING1Fields As AccpacCOMAPI.AccpacViewFields
    mDBLinkCmpRW.OpenView "AR0055", ARAGING1
    Set ARAGING1Fields = ARAGING1.Fields


    Dim rpt As AccpacCOMAPI.AccpacReport
    Set rpt = ReportSelect("ARTBAL01", " ", " ")
    Dim rptPrintSetup As AccpacCOMAPI.AccpacPrintSetup
    Set rptPrintSetup = GetPrintSetup(" ", " ")
    rptPrintSetup.DeviceName = "Canon LBP612C/613C UFR II (redi"
    rptPrintSetup.OutputName = "TS001"
    rptPrintSetup.Orientation = 10
    rptPrintSetup.PaperSize = 300
    rptPrintSetup.PaperSource = 7
    rpt.PrinterSetup rptPrintSetup
    rpt.SetParam "PRTTYPE", "2" ' Report parameter: 27
    rpt.SetParam "MCURCUST?", "N" ' Report parameter: 16
    rpt.SetParam "FROMDATE", "00000000" ' Report parameter: 58
    rpt.SetParam "CUTOFFBY", "0" ' Report parameter: 17
    rpt.SetParam "CUTOFFDT", "20220109" ' Report parameter: 22
    rpt.SetParam "SELECT1", " " ' Report parameter: 2
    rpt.SetParam "FROM1", " " ' Report parameter: 3
    rpt.SetParam "TO1", " " ' Report parameter: 4
    rpt.SetParam "TYPE1", " " ' Report parameter: 37
    rpt.SetParam "SELECT2", " " ' Report parameter: 5
    rpt.SetParam "FROM2", " " ' Report parameter: 6
    rpt.SetParam "TO2", " " ' Report parameter: 7
    rpt.SetParam "TYPE2", " " ' Report parameter: 38
    rpt.SetParam "SELECT3", " " ' Report parameter: 8
    rpt.SetParam "FROM3", " " ' Report parameter: 9
    rpt.SetParam "TO3", " " ' Report parameter: 10
    rpt.SetParam "TYPE3", " " ' Report parameter: 39
    rpt.SetParam "SELECT4", " " ' Report parameter: 11
    rpt.SetParam "FROM4", " " ' Report parameter: 12
    rpt.SetParam "TO4", " " ' Report parameter: 13
    rpt.SetParam "TYPE4", " " ' Report parameter: 40
    rpt.SetParam "PHNFMT?", "Y" ' Report parameter: 14
    rpt.SetParam "SORT1", "Salesperson" ' Report parameter: 33
    rpt.SetParam "SORT2", " " ' Report parameter: 34
    rpt.SetParam "SORT3", " " ' Report parameter: 35
    rpt.SetParam "SORT4", " " ' Report parameter: 36
    rpt.SetParam "SORTORDER", "Salesperson" ' Report parameter: 15
    rpt.SetParam "GRP1TITLE?", "Y" ' Report parameter: 65
    rpt.SetParam "GRP2TITLE?", "N" ' Report parameter: 66
    rpt.SetParam "GRP3TITLE?", "N" ' Report parameter: 67
    rpt.SetParam "GRP4TITLE?", "N" ' Report parameter: 68
    rpt.SetParam "GRP1TOTAL?", "N" ' Report parameter: 47
    rpt.SetParam "GRP2TOTAL?", "N" ' Report parameter: 48
    rpt.SetParam "GRP3TOTAL?", "N" ' Report parameter: 49
    rpt.SetParam "GRP4TOTAL?", "N" ' Report parameter: 50
    rpt.SetParam "ACCTTYPE", "All Customers" ' Report parameter: 19
    rpt.SetParam "ASOFDATE", "20220109" ' Report parameter: 21
    rpt.SetParam "AMTTYPE", "F" ' Report parameter: 26
    rpt.SetParam "CONTACT?", "N" ' Report parameter: 23
    rpt.SetParam "OVERCRLM?", "N" ' Report parameter: 24
    rpt.SetParam "ZEROBAL?", "N" ' Report parameter: 28
    rpt.SetParam "COMMENT?", "N" ' Report parameter: 29
    rpt.SetParam "APPLDETL?", "N" ' Report parameter: 30
    rpt.SetParam "INCLPAID?", "N" ' Report parameter: 31
    rpt.SetParam "INCLPREPAY?", "Y" ' Report parameter: 45
    rpt.SetParam "INVOICE?", "Y" ' Report parameter: 51
    rpt.SetParam "DEBIT?", "Y" ' Report parameter: 52
    rpt.SetParam "CREDIT?", "Y" ' Report parameter: 53
    rpt.SetParam "INTEREST?", "Y" ' Report parameter: 55
    rpt.SetParam "UCASH?", "Y" ' Report parameter: 54
    rpt.SetParam "RECEIPT?", "Y" ' Report parameter: 56
    rpt.SetParam "REFUND?", "Y" ' Report parameter: 57
    rpt.SetParam "ADJUSTMENT?", "Y" ' Report parameter: 61
    rpt.SetParam "SORTBYTRANSTYPE?", "N" ' Report parameter: 62
    rpt.SetParam "AGERTG?", "N" ' Report parameter: 64
    rpt.SetParam "HASRTG?", "N" ' Report parameter: 63
    rpt.SetParam "RPTTITLE", "Aged Trial Balance by Due Date" ' Report parameter: 32
    rpt.SetParam "FCURNDEC", "2" ' Report parameter: 46
    rpt.SetParam "PERIOD1", "0" ' Report parameter: 41
    rpt.SetParam "PERIOD2", "30" ' Report parameter: 42
    rpt.SetParam "PERIOD3", "60" ' Report parameter: 43
    rpt.SetParam "PERIOD4", "90" ' Report parameter: 44
    ARAGING1.RecordClear

    ARAGING1Fields("CMNDCODE").PutWithoutVerification ("52") ' Command Code
    ARAGING1Fields("AGEINVDTSW").PutWithoutVerification ("0") ' Age by
    ARAGING1Fields("AGEPERIOD2").PutWithoutVerification ("30") ' First Period
    ARAGING1Fields("AGEPERIOD3").PutWithoutVerification ("60") ' Second Period
    ARAGING1Fields("AGEPERIOD4").PutWithoutVerification ("90") ' Third Period
    ARAGING1Fields("SWOPTMETER").PutWithoutVerification ("1") ' Display Meter
    ARAGING1Fields("SORTINDEX1").PutWithoutVerification ("106") ' Sort Field Index 1
    ARAGING1Fields("SORTNAME1").PutWithoutVerification ("ARCUS.CODESLSP1") ' Sort Field Name 1

    ARAGING1.Process
    rpt.SetParam "AGESEQ", "1" ' Report parameter: 20
    rpt.NumOfCopies = 1
    rpt.Destination = PD_PREVIEW
    rpt.PrintDir = ""
    rpt.PrintReport


    Exit Sub

    ACCPACErrorHandler:
    Dim lCount As Long
    Dim lIndex As Long

    If Errors Is Nothing Then
    MsgBox Err.Description
    Else
    lCount = Errors.Count

    If lCount = 0 Then
    MsgBox Err.Description
    Else
    For lIndex = 0 To lCount - 1
    MsgBox Errors.Item(lIndex)
    Next
    Errors.Clear
    End If
    Resume Next

    End If

    End Sub

  • 0 in reply to SageDS

    That's because you didn't change anything on the screen when you recorded it.  Record another one, and this time make changes to different fields on the screen so that they get into the recorder.  It's just like recording Excel macros, you have to type things.

  • 0 in reply to Jay Converse Acumen

    Aha - that makes sense. Thanks Jay!

  • 0 in reply to SageDS

    Hi Jay -

    So I re-recorded and then made the changes to this but it is still finishing with an old date in the report.

    Here is new code and screen shot below.

    ARAGING1Fields("CMNDCODE").PutWithoutVerification ("52") ' Command Code
    ARAGING1Fields("RUNDATE").PutWithoutVerification Date ' Age as-of Date
    ARAGING1Fields("CUTOFFDATE").PutWithoutVerification Date ' Cutoff Date
    ARAGING1Fields("AGEINVDTSW").PutWithoutVerification ("0") ' Age by
    ARAGING1Fields("AGEPERIOD2").PutWithoutVerification ("30") ' First Period
    ARAGING1Fields("AGEPERIOD3").PutWithoutVerification ("60") ' Second Period
    ARAGING1Fields("AGEPERIOD4").PutWithoutVerification ("90") ' Third Period
    ARAGING1Fields("SWOPTMETER").PutWithoutVerification ("1") ' Display Meter
    ARAGING1Fields("SORTINDEX1").PutWithoutVerification ("106") ' Sort Field Index 1
    ARAGING1Fields("SORTNAME1").PutWithoutVerification ("ARCUS.CODESLSP1") ' Sort Field Name 1

  • 0 in reply to SageDS

    Keep trying, you need to do some debugging.  FWIW, I have done Sage programming for 20 years and none of my clients has ever asked for a custom aging macro like this.  All they do is just make their changes on the aging screen, then select "Settings/Save as Default".