Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Kulwant Singh
  Where is Kulwant Singh?
 Shimla
 India
 Kulwant Singh
 To: naveed ahmad
  Where is naveed ahmad?
 peshawar
 Pakistan
 naveed ahmad
 Tags
Subject: RE: need help for discount protection
Thread ID: 393840 Message ID: 393890 # Views: 32 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Wednesday, December 25, 2013 10:38:15 AM         
   


> >
> > If the operator is entering the Discount figure in a Text Box For example, in the valid of the text box you can enter
> >
> >
MaxDisc = YOUR_MAX_DISCOUNT_LIMIT &&& you can set it in the Menu / Rate list etc
> > If this.value > MaxDisc
> > mAns = MESSAGEBOX( "Sure You want to allow this?", 4 + 32 + 256, "Ah! Discount is greater than " + str(MaxDisc)) 
> > IF mAns = 6
> > ** Code for Yes...Go Ahead
> > ELSE
> > *** Code for No...Permission Not Granted
> > ENDIF
> > endif
> > 

> >
> >
> >
> > kulwant
> > (Help Save the TIGER. Save Wildlife. Live & let Live)
>
> Dear i am facing one problem on yes code it works proper but when gives less then given range then discount values not shows. what wrong with this?
>
> Local lndisrng, lntot, lndisval, lndis
>
> lndisrng = Thisform.txt_disrnge.Value
> lndis = This.Value
> If This.Value > lndisrng
> mAns = Messagebox("Do you want to allow this ?",4 +32 + 256, " Discount is greater then" + Str(lndisrng))
> If mAns = 6
> lntot = Thisform.txt_total.Value
> lndisval = lntot*lndis/100
> Thisform.txt_disval.Value = lndisval
> Thisform.txt_net.Value = lntot - lndisval
> Else
> Messagebox("Permission not Granted")
>
>
> Return 0
>
> Endif
> Endi
>
> please guide me.
> thanks
> regards.

you have put the "Calculation Code" in the IF block where it executes only if a Higher figure is entered...you need to place the samecode within an ELSE block ..




 Local  lndisrng, lntot, lndisval, lndis
 
 lndisrng = Thisform.txt_disrnge.Value
 lndis = This.Value
 If This.Value > lndisrng
 	mAns = Messagebox("Do you want to allow this ?",4 +32 + 256, " Discount is greater then" + Str(lndisrng))
 	If mAns = 6
 	thisform.disc_within_range()
 	Else
 		Messagebox("Permission not Granted")
  		Return 0
  	Endif
 ELSE
 	thisform.disc_within_range()
 ENDIF




**add this new method "disc_within_range" to the form
  		lntot = Thisform.txt_total.Value
 		lndisval = lntot*lndis/100
 		Thisform.txt_disval.Value = lndisval
 		Thisform.txt_net.Value = lntot - lndisval





kulwant
(Help Save the TIGER. Save Wildlife. Live & let Live)

ENTIRE THREAD

need help for discount protection Posted by naveed ahmad @ 12/24/2013 1:40:12 PM
RE: need help for discount protection Posted by Kulwant Singh @ 12/24/2013 4:37:24 PM
RE: need help for discount protection Posted by naveed ahmad @ 12/25/2013 8:15:02 AM
RE: need help for discount protection Posted by naveed ahmad @ 12/25/2013 8:41:24 AM
RE: need help for discount protection Posted by Kulwant Singh @ 12/25/2013 10:38:15 AM
RE: need help for discount protection Posted by naveed ahmad @ 12/25/2013 11:11:07 AM
RE: need help for discount protection Posted by naveed ahmad @ 12/25/2013 12:12:21 PM
RE: need help for discount protection Posted by Kulwant Singh @ 12/25/2013 3:47:40 PM
RE: need help for discount protection Posted by Ayaz Ahmad @ 12/25/2013 3:54:32 PM