Skip to Content
0

i want to get the price depending upon the quantity

Jan 29 at 06:50 PM

67

avatar image
Former Member

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 left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

6 Answers

Vitaly Izmaylov
Jan 30 at 04:02 PM
0

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

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

hi vitaly,

thanks for your reply.

i have tried your code. but the problem is

effective date and inactive date could be empty.

i have attached the image.

new1.png

the green highlighed is so date (Salesorder Date) SO qty (Sales order quantity)

the red circled is the customer id and list of prices according to the quantity.

so i have to check the so date falls within the range of effective date and inactive date and then i have to check so quantity with customer qty. if so qty falls within the range, then i have pick that price.

once i got the price, i want to exit and display the price the group footer

ie, from the image, i want price : 10.36

i am not sure i have explained properly, if not please let me know.

i am new to the crystal report coding.

thanks in advance.

new1.png (31.2 kB)
0

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}

0
Vitaly Izmaylov
Jan 29 at 11:29 PM
0

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

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 30 at 03:00 PM
0

hi vitaly,

thanks for your reply.

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


new.png (15.4 kB)
Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 02 at 02:23 PM
0

hi vitaly,

thanks for your reply.

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

new1.png

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


new1.png (31.2 kB)
Share
10 |10000 characters needed characters left characters exceeded
Vitaly Izmaylov
Feb 02 at 04:03 PM
0

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}

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Feb 06 at 03:26 AM
0

hi vitaly,

thanks for your reply.


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;

)

);

Share
10 |10000 characters needed characters left characters exceeded