Period Sales Report

I need to create a report which is basically the customer/item sales report. However, the users would perfer a monthly split over the year to see seasonal information. Seeing what i could do to generate this information, i used the information in the aged debtors as that showed a “period” layout, and then entered this into a new customer/item sales report. The initial problem i had was that for each item / period it copied down down the above value if the value was zero. As the “field” was a variable, I used the “clear” command in order to correct this. The next problem i am faced with is that if there has been a sale over a number of different periods, then only the last value is returned :frowning:


Actual Sales Pd 1 = 10 Pd 2 = 20 Pd 3 = 30 Total Sales = 60 Report Pd 1 Pd 2 Pd 3 00 00 30

I am using the customer and value entry dataitems on the value entry i have added this : OnAfterGetRecord() CLEAR(InvtQty); FOR i := 1 TO 14 DO IF ("Posting Date" >= PeriodStartDate[i]) AND ("Posting Date" < PeriodStartDate[i + 1]) THEN BEGIN CLEAR(InvtCost); InvtQty[i] := "Invoiced Quantity"; IF InvtQty[i] <> 0 THEN PrintLine := TRUE; InvtCost[i] := Amount; //"Adjusted Cost (Expected)"; IF InvtCost[i] <> 0 THEN PrintLine := TRUE; END; Is this something i should be getting the NSC to do, or will i be able to finish it??! (the latter being better, as ive got so far!!)

Firstly I would change a little bit in the code to make it shorter and easier to read: OnAfterGetRecord() CLEAR(InvtQty); CLEAR(InvtCost); PrintLine := FALSE; FOR i := 1 TO 14 DO IF (“Posting Date” IN [PeriodStartDate[i]…PeriodStartDate[i + 1]-1) THEN BEGIN InvtQty[i] := “Invoiced Quantity”; InvtCost[i] := Amount; //“Adjusted Cost (Expected)”; PrintLine := PrintLine OR (InvtCost[i] <> 0) OR (InvtQty[i] <> 0); END; when you call a CLEAR(InvtCost) inside the loop you are clearing out the values you have been entering so far, so I moved it up a little bit. when you make your date comparison you are overlapping one day per period with the next month (PeriodStartDate[I+1]), just reduce by one day. The code you copied is from the Value Entry Table, I guess ? Be careful when setting the PrintLine variable. The way you were doing it just decides on the invtQty[14] <> 0 !!! I have changed the code accordingly. How do you define the start and end date ? Does it always run on a complete year ? So PeriodStart[1] = 0D, PeriodStart[2] = 0101??D, … , PeriodStart[13] = 3112??D, … and so on ?