Hi,
Can anyone help with the code needed for my barchart?
I have a table called code & the fields I would like to chart are;
Size (these are in a code format & do change, eg might be G4 in one field & S4T in the next field and so on)
These then need to be multiplied times the figure in the drop field, which is also in the code table.
The desired end result wanted would show Total units of G5, G6, S7T, etc each in a different color.
I would be grateful if someone could edit the example code posted below to achieve the desired result. It can be a bar or pie chart.
Regards
Tony
'Date Created: 24-Jun-2005 01:43:48 PM
'Last Updated: 17-Jul-2006 11:38:19 AM
'Created By: Tony
'Updated By : Tony
dim chart_item as c = default "Units"
dim chart_type as c = default "bar"
dim chart_zeroes as c = default "f"
dim chart_var as c
dim chartGen as p
dim s as p
dim total_units as n
dim total_purchase as n
dim total_cost as n
dim total_profit as n
if chart_item = "profit"
chart_var = "total_profit"
elseif chart_item = "cost"
chart_var = "total_cost"
elseif chart_item = "purchase"
chart_var = "total_purchase"
else
chart_var = "total_units"
end if
chartGen = activex1.activex.this
chartGen.DataSeries.AddBarSeries(chart_item, 0) 'scFillModeAutoSolid
s = set.current()
s.fetch_first()
while .not. s.fetch_eof()
total_units = total(Invoice_Items->Quantity,GRP->PRODUCT,GRP->INVOICE_HEADER)
total_purchase = total(Invoice_Items->Extension-(Invoice_Items->Extension*Invoice_Header->Discount/100),GRP->PRODUCT,GRP->INVOICE_HEADER)
total_cost = total(Product->Cost*Invoice_Items->Quantity,GRP->PRODUCT,GRP->INVOICE_HEADER)
total_profit = total_purchase - total_cost
if chart_zeroes = "t" .or. total_units > 0
chartGen.DataSeries(1).SeriesData.Add(alltrim(product->DESCRIPTION),eval(chart_var))
end if
s.fetch_next(1)
end while
Can anyone help with the code needed for my barchart?
I have a table called code & the fields I would like to chart are;
Size (these are in a code format & do change, eg might be G4 in one field & S4T in the next field and so on)
These then need to be multiplied times the figure in the drop field, which is also in the code table.
The desired end result wanted would show Total units of G5, G6, S7T, etc each in a different color.
I would be grateful if someone could edit the example code posted below to achieve the desired result. It can be a bar or pie chart.
Regards
Tony
'Date Created: 24-Jun-2005 01:43:48 PM
'Last Updated: 17-Jul-2006 11:38:19 AM
'Created By: Tony
'Updated By : Tony
dim chart_item as c = default "Units"
dim chart_type as c = default "bar"
dim chart_zeroes as c = default "f"
dim chart_var as c
dim chartGen as p
dim s as p
dim total_units as n
dim total_purchase as n
dim total_cost as n
dim total_profit as n
if chart_item = "profit"
chart_var = "total_profit"
elseif chart_item = "cost"
chart_var = "total_cost"
elseif chart_item = "purchase"
chart_var = "total_purchase"
else
chart_var = "total_units"
end if
chartGen = activex1.activex.this
chartGen.DataSeries.AddBarSeries(chart_item, 0) 'scFillModeAutoSolid
s = set.current()
s.fetch_first()
while .not. s.fetch_eof()
total_units = total(Invoice_Items->Quantity,GRP->PRODUCT,GRP->INVOICE_HEADER)
total_purchase = total(Invoice_Items->Extension-(Invoice_Items->Extension*Invoice_Header->Discount/100),GRP->PRODUCT,GRP->INVOICE_HEADER)
total_cost = total(Product->Cost*Invoice_Items->Quantity,GRP->PRODUCT,GRP->INVOICE_HEADER)
total_profit = total_purchase - total_cost
if chart_zeroes = "t" .or. total_units > 0
chartGen.DataSeries(1).SeriesData.Add(alltrim(product->DESCRIPTION),eval(chart_var))
end if
s.fetch_next(1)
end while
Comment