Hi,
I am using CRXI with SQL server 2005 and am trying to create a Custom's invoice.
I have created a supreport in GH #1a to return product price. I pass the price from the subreport to the main report using a shared variable:
onlastrecord;
Shared numbervar x;
{SALES_PRICE_LINES.VALID_FROM_DATE}=maximum({SALES_PRICE_LINES.VALID_FROM_DATE});
if {SALES_PRICE_LINES.SALES_PRICE_1}=0 then
x:= {SALES_PRICE_LINES.SALES_PRICE} else
x:={SALES_PRICE_LINES.SALES_PRICE_1}
This formula was placed in the footer of the subreport.
I have another shared variable
which passes the pricing unit of measure to the main report. This is declared in the header of the subreport:
Shared stringvar y := {SALES_PRICE_LINES.UNIT_PRICE};
x and y are then used to calculate the line total in GH #1b in the main report:
Shared numbervar x;
shared stringvar y;
if y = 'KG' then
x*sum({DESPATCH_NOTES.WEIGHT},{DESPATCH_NOTES.PART_CODE}) else 0
I then use the following formula to calculate the running total (also placed in GH #1b):
whileprintingrecords;
shared numbervar z;
z := {@Line value};
numbervar v := v + z
And show the final total in the Report Footer:
whileprintingrecords;
numbervar v
My problem is that this works perfectly up until the last group header record, where the total just doesn't add up, the line total is correct, just not the running total. Why might this be? I have checked all background data, and this appears to be OK.
I would also like to ask how you would return only the last record if more than one record is returned by the selection criteris. I tried to do this with the following formula in the subreport, but to no avail:
onlastrecord;
Shared numbervar x;
{SALES_PRICE_LINES.VALID_FROM_DATE}=maximum({SALES_PRICE_LINES.VALID_FROM_DATE});
if {SALES_PRICE_LINES.SALES_PRICE_1}=0 then
x:= {SALES_PRICE_LINES.SALES_PRICE} else
x:={SALES_PRICE_LINES.SALES_PRICE_1}
Thanks for your help!
Penny
I am using CRXI with SQL server 2005 and am trying to create a Custom's invoice.
I have created a supreport in GH #1a to return product price. I pass the price from the subreport to the main report using a shared variable:
onlastrecord;
Shared numbervar x;
{SALES_PRICE_LINES.VALID_FROM_DATE}=maximum({SALES_PRICE_LINES.VALID_FROM_DATE});
if {SALES_PRICE_LINES.SALES_PRICE_1}=0 then
x:= {SALES_PRICE_LINES.SALES_PRICE} else
x:={SALES_PRICE_LINES.SALES_PRICE_1}
This formula was placed in the footer of the subreport.
I have another shared variable
Shared stringvar y := {SALES_PRICE_LINES.UNIT_PRICE};
x and y are then used to calculate the line total in GH #1b in the main report:
Shared numbervar x;
shared stringvar y;
if y = 'KG' then
x*sum({DESPATCH_NOTES.WEIGHT},{DESPATCH_NOTES.PART_CODE}) else 0
I then use the following formula to calculate the running total (also placed in GH #1b):
whileprintingrecords;
shared numbervar z;
z := {@Line value};
numbervar v := v + z
And show the final total in the Report Footer:
whileprintingrecords;
numbervar v
My problem is that this works perfectly up until the last group header record, where the total just doesn't add up, the line total is correct, just not the running total. Why might this be? I have checked all background data, and this appears to be OK.
I would also like to ask how you would return only the last record if more than one record is returned by the selection criteris. I tried to do this with the following formula in the subreport, but to no avail:
onlastrecord;
Shared numbervar x;
{SALES_PRICE_LINES.VALID_FROM_DATE}=maximum({SALES_PRICE_LINES.VALID_FROM_DATE});
if {SALES_PRICE_LINES.SALES_PRICE_1}=0 then
x:= {SALES_PRICE_LINES.SALES_PRICE} else
x:={SALES_PRICE_LINES.SALES_PRICE_1}
Thanks for your help!
Penny