•  
  • Home page
  • > TECHNICAL SUPPORT
  • > Ready Pro support forum
Author Post
griff 29/10/2015 17:58 griff

reports



Hi Frank

I can I print a report that will show the total sale and the total cost to be able to found out the gross profit  per period or total sale , I can’t seem to get the
Right combination using statistic   

Thank you



Franck 09/11/2015 16:20 Franck

Statistics will not give you the answers you need.

You should use scripting language, in document list views, but it's not easy to explain it on the forum. We usually give this kind of assistance only with remote assistance.

In this case you should:

FIRST STEP


Select a document type list (for example immediate invoice) and click on filters

Franck 09/11/2015 16:22 Franck

STEP TWO

Select all the sales documents you want to process

Franck 09/11/2015 16:25 Franck

STEP THREE

After clicking show (F10), select view menu

Franck 09/11/2015 16:26 Franck

STEP FOUR

add a field that is the result of a script

Franck 09/11/2015 16:27 Franck

STEP FIVE

Paste or create a script like this:

Option Explicit

Dim Quant
Dim sale
Dim purc
Dim saletot
Dim purctot

If Product.Id > 0 Then

    Quant = Rdy.toDouble(DocRow.CustomField(30))
    sale = Rdy.toDouble(DocRow.CustomField(49))
    saletot = Quant * sale

    purc = Rdy.toDouble(DocRow.Product.InventoryValueFIFO(DocRow.Doc.DocDate))
    If purc = 0 Then
        purc = DocRow.Product.CustomField(700)
    End If
    purctot = Quant * purc

End If

Response.Write(Rdy.FormatCurrency(saletot - purctot))

Franck 09/11/2015 16:33 Franck

This script makes the difference between the sales total and the purchases total


Using scripts, you can do a lot of custom statistics, but you need to have programmer's skills

griff 10/11/2015 14:53 griff

Hi Frank

How to you run the script after it is added??

Franck 10/11/2015 14:56 Franck

Once you've inserted it in the view, you just have to run the search again.

griff 10/11/2015 15:09 griff

Frank

the option doesn't show up in the view,
do I copy from Option explicit to end if?

After scrip is copy from step 5 any other step need to be taking?


Franck 10/11/2015 15:13 Franck

You have to copy all the script, the last row is the result:

Option Explicit

Dim Quant
Dim sale
Dim purc
Dim saletot
Dim purctot

If Product.Id > 0 Then

    Quant = Rdy.toDouble(DocRow.CustomField(30))
    sale = Rdy.toDouble(DocRow.CustomField(49))
    saletot = Quant * sale

    purc = Rdy.toDouble(DocRow.Product.InventoryValueFIFO(DocRow.Doc.DocDate))
    If purc = 0 Then
        purc = DocRow.Product.CustomField(700)
    End If
    purctot = Quant * purc

End If

Response.Write(Rdy.FormatCurrency(saletot - purctot))

griff 10/11/2015 15:25 griff

frank
got the scrip in still doesn't show in view box but when I do a search with the scrip in I get this

Error executing script
Row : 9   Column : 0
Source : Microsoft VBScript runtime error
Error detail : Argument not optional: 'Product'


Error executing script
Row : 9   Column : 0
Source : Microsoft VBScript runtime error
Error detail : Argument not optional: 'Product'


Error executing script
Row : 9   Column : 0
Source : Microsoft VBScript runtime error
Error detail : Argument not optional: 'Product'


Error executing script
Row : 9   Column : 0
Source : Microsoft VBScript runtime error
Error detail : Argument not optional: 'Product'

Franck 10/11/2015 15:35 Franck

Are you sure you've inserted the script in the view AFTER clicking on SHOW (F10) like I've told you in step 3?

griff 10/11/2015 16:30 griff

frank

I deleted the script, than added it one step at the time,
don't get the run time error but still can't see it in the view option
I when step by step??

Franck 10/11/2015 16:40 Franck

This is the reason why we usually do this use remote assitance... forum is not suitable for this kind of problem. Wink
Call me on skype and I will have a look, even if I'm not a programmer and I'm not sure to be able to help you.