Former Member

### i want to get the price depending upon the quantity

i want to get price depending on the SO qty. it is grouped by customer id. each customer has different pricing for specified no. of quantities. how to get the price ?

in some records, there would be effective and inactive date also. i need to check that date also i.e the order date should be in the date range of effective date and inactive date

new.png

how to solve this?

thanks

new.png (15.4 kB)
10|10000 characters needed characters exceeded

• Jan 30, 2018 at 04:02 PM

I propose

1. Reset formula in Group Header:

WhilePrintingrecords;

CurrencyVar APrice:=0; // or it could be set to Group minimum of the Price field

2. Calculation formula in Details Section:

Whileprintingrecords;

CurrencyVar APrice;

If
(
{Order Date} >= {Effective} and
{Order Date} <= {Inactive} and
{SO Qty} >= {Qty}
)
then APrice:={Price}

3. Display formula in the Group Footer:

Whileprintingrecords;

CurrencyVar APrice;

make sure the records within the group sorted by Qty in Ascending Order

10|10000 characters needed characters exceeded
• Try the following modifications:

Whileprintingrecords;

CurrencyVar APrice;

If
(
if isnull ({Effective})then true else {Order Date} >= {Effective} and
if isnull ({Inactive})then true {Order Date} <= {Inactive} and
{SO Qty} >= {Qty}
)
then APrice:={Price}

• Jan 29, 2018 at 11:29 PM

Try to rephrase your question, or tell what number you are expecting in your example

10|10000 characters needed characters exceeded
• Former Member
Jan 30, 2018 at 03:00 PM

hi vitaly,

in the image which i have attached, it is showing SOqty is 8,560,000(highlighted in yellow). so i need to check the records listed in detail section, the qty is which is greater than or equal to SO qty, i want to take that price.

new.png

10|10000 characters needed characters exceeded
• Former Member
Feb 02, 2018 at 02:23 PM

hi vitaly,

i have sent you a mail. i think it is not posted.

i have attached my report result. i need hep to resolve this please.

in my result,

green highlighted is SO Date and SO qty. Depending upon this two, i have to select the record in details section.

red circled one is ID (Customer ID) they have list of prices depending upon the quantity ordered. in this example, so qty is 500, i would like to get the red highlighed result (need to check effective date and inactive date as well). once i have received the price, how to come out of the detais section, or how can store the result and print it in the group footer.

if my question is not clear, please let me know.

thanks

regards,

selvi

10|10000 characters needed characters exceeded
• Feb 02, 2018 at 04:03 PM

Have you tried:

Whileprintingrecords;

CurrencyVar APrice;

If
(
if isnull ({Effective})then true else {Order Date} >= {Effective} and
if isnull ({Inactive})then true {Order Date} <= {Inactive} and
{SO Qty} >= {Qty}
)
then APrice:={Price}

10|10000 characters needed characters exceeded
• Former Member
Feb 06, 2018 at 03:26 AM

hi vitaly,

I have written the following coding, result is coming but not perfect. the problem i face is i want to check next() if it is the same group. if it is a last record of the group, i dont want to execute the next funtion.

Is there any way to check for the last record of each group?

thanks

CurrencyVar uprice;

BooleanVar status;

NumberVar counter;

if (isnull({@effective date}) or ({@effective date} <= {@ord_date})) and (isnull({@deactive date}) or ({@deactive date} > {@ord_date})) and status=false then

(

if {ORD_DETAIL.TOTAL_QTY_ORD} >= {AKA_BREAKS.QUAN} then

(

uprice:={AKA_BREAKS.QPRICE};

if {ORD_DETAIL.TOTAL_QTY_ORD} < next({AKA_BREAKS.QUAN}) then

status:=true;

)

);