Scripting

  • 1.  For something that seems simple, I'm hitting a bri

    Posted 08-27-2014 14:11
    For something that seems simple, I'm hitting a brick wall here. Does anyone have a way to pull the current year's sales $ from either the history or summary tabs in customer maintenance (or obtain the information from some other source) so that it can be used in a script? I essentially want to compare YTD sales with a UDF and figure out the difference. Possible?


  • 2.  RE: For something that seems simple, I'm hitting a bri

    Posted 08-27-2014 14:43
    I think the YTD amount on the summary tab is calculated on the fly when the the customer is retrieved or periods are changed. These totals reside in memory and are not accessible by a script.


  • 3.  RE: For something that seems simple, I'm hitting a bri

    Posted 08-27-2014 14:47
    You could use a SQL query against AR_OpenInvoice for the total if one has the option set to hold paid invoices for 366 days.


  • 4.  RE: For something that seems simple, I'm hitting a bri

    Posted 08-27-2014 15:36
    The data on the screen in the Summary tab for sure is calc'd when the tab itself is clicked and most of it coming from AR_CustomerSalesHistory. I researched this doing a non-scripting project awhile back where they wanted the Sales, Cogs, Profit % for PTD, YTD, PYD (all 9 calculated every X minutes and stored into 9 Customer UDFs which was then added to a Customer lookup) With scripting presumably you could grab AR_CustomerSalesHistory_bus, do the SetKeyValue's for the 4 key columns, then do a Find() with nothing in the parentheses. If the retVal on your Find is 1 you're in business. For YTD Sales the trick is to increment the DollarsSold while looping the FiscalPeriod from the Period 01 to the current period.