Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why am I getting a logical instead of a number
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Why am I getting a logical instead of a number
Divers
Thread ID:
00761511
Message ID:
00761511
Vues:
70
I'm sure it is just because I have been working on this tooooo long. Yesterday I got the results I wanted, today I am getting a logical output instead of the number I am trying to calculate. What is the error of my ways? Using VFP6 sp5 on Win2K sp2.
LOCAL dSchedDate, dRcvDate, nItemCuft, nItemRate, nNumberOfDays, nFreeDays, nDaysInMonth, nStorageDue, amt_due

dSchedDate = ctod('03/16/2003')
dRcvDate = ctod('02/25/2003')
nItemCuft = 90
nItemRate = .50
nNumberOfDays = 0
nStorageDue = 0
amt_due = 0.00
nFreeDays = 14
nDaysInMonth = 31

IF MONTH(dRcvDate) = MONTH(dSchedDate)
	dStartCalcDate = dRcvDate + nFreeDays
	IF dStartCalcDate >= dSchedDate
		nNumberOfDays = 0
	ELSE
		nNumberOfDays = DAY(dSchedDate) - DAY(dStartCalcDate) + 1
	ENDIF
ENDIF
*** received date was in a previous month
*** determine if we use the first of the month or find how many freedays in last month
IF MONTH(dRcvDate + nFreeDays) < MONTH(dSchedDate)
	dStartCalcDate = 1
ELSE
	dStartCalcDate = dRcvDate + nFreedays
ENDIF
nNumberOfDays = DAY(dSchedDate) - DAY(dStartCalcDate) + 1
*** do the calculation
? nStorageDue = (nItemRate/nDaysInMonth) * nItemCuft * nNumberOfDays
? amt_due = ROUND(nStorageDue, 2)
*** no negative amounts allowed
IF amt_due < 0
	amt_due = 0
ENDIF
TIA
Opportunity is missed by most people beacuse it is dressed in overalls, and looks like work --- Thomas Edison
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform