Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Divide value
Message
From
24/07/2006 09:55:38
 
 
To
24/07/2006 09:41:13
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01134849
Message ID:
01139150
Views:
11
hi,

i mean if i start 01/07/2006 or 14/07/2006 and month 1,3,5,7,8,10 and month 12,it works,

but if i start as 01/06/2006 or month 9,4,11 wrong result at first date and last date at the grid.

and big deferrent value if i start with month2,

just try any number ex.. 800.

thanks.

thanks.
>Sorry I don't understand what "not works" mean.
>Cetin
>
>>hi,
>>i try to change this line under but not works for all months include month2
>>
>>
>>lnAmount = m.lnPayment * ((Day(m.ldCurrent)-1)/30)
>>&& to
>>lnAmount = m.lnPayment * ((Day(m.ldCurrent))/30)&& wrong results
>>
>>
>>
>>thanks
>>
>>>Modify the logic to accomodate then.
>>>Cetin
>>>
>>>>hi,
>>>>
>>>>after I run this code ,I see it work very will at months have only 31 days, but not for months have 30 days as case1, and month 2
>>>>February as case2,
>>>>
>>>>thanks
>>>>
>>>>>>hi all,
>>>>>>
>>>>>>i need your help to distribution vlaue between 2 date as
>>>>>>
>>>>>>if my value =$100 and i want to distribution to 12 months start at 10/07/2006 to 10/07/2007 as
>>>>>>from 10/07/2006 to 31/07/2006 value=5.833,
>>>>>>from 01/08/2006 to 31/08/2006=8.333
>>>>>>,month 9=8.333 to month6/2007=8.333,
>>>>>>from 1/07/2007 to 10/07/2007 value=2.5000... this is for 1 year,
>>>>>>
>>>>>>but i need to do that between 2 date ex.. for 6 month , 8 ,10, 4 14,16 months or for 2 years? i need it to distribution as a bove...
>>>>>>
>>>>>>text1=month 7/2006,text2=5.833
>>>>>>text3=month 8/2006,text4=8.333
>>>>>>text5=month 9/2006,text6=8.833
>>>>>>text7=month 10/2006,text8=8.833
>>>>>>text9=month 11/2006,text10=8.833
>>>>>>...
>>>>>>.
>>>>>>.
>>>>>>.
>>>>>>textn=month 7/2007=2.500
>>>>>>
>>>>>>thanks.
>>>>>
>>>>>You can use payment() function to calculate. ie:
>>>>>
>>>>>Public oForm
>>>>>oForm = Createobject('myForm')
>>>>>oForm.Show()
>>>>>
>>>>>Define Class myForm As Form
>>>>>  DataSession = 2
>>>>>  Height = 300
>>>>>  Width = 480
>>>>>
>>>>>  Add Object label1 As Label With ;
>>>>>    Caption = "Principal", Left = 20, Width = 50, Top = 25
>>>>>  Add Object label2 As Label With ;
>>>>>    Caption = "Interest", Left = 20, Width = 50, Top = 55
>>>>>  Add Object label3 As Label With ;
>>>>>    Caption = "Months", Left = 20, Width = 50, Top = 85
>>>>>  Add Object label4 As Label With ;
>>>>>    Caption = "Start", Left = 20, Width = 50, Top = 115
>>>>>  Add Object txtprincipal As TextBox With ;
>>>>>    Value = 100, Left = 80, Top = 25, Width = 100
>>>>>  Add Object txtinterest As TextBox With ;
>>>>>    Value = 0, Left = 80, Top = 55, Width = 100
>>>>>  Add Object txtmonths As TextBox With ;
>>>>>    Value = 12, Left = 80, Top = 85, Width = 100
>>>>>  Add Object txtstart As TextBox With ;
>>>>>    Value = (Date()), Left = 80, Top = 115, Width = 100
>>>>>  Add Object cmdCalculate As CommandButton With ;
>>>>>    Top = 145, Left = 80, Caption = "Go"
>>>>>  Add Object grddistribution As Grid With ;
>>>>>    Height = 280, Left = 190, Top = 5, Visible = .F., Width = 280
>>>>>
>>>>>  Procedure cmdCalculate.Click
>>>>>    With Thisform
>>>>>      lnPayment = Payment( .txtPrincipal.Value,;
>>>>>        .txtInterest.Value,;
>>>>>        .txtMonths.Value)
>>>>>      Create Cursor crsDist (From d, To d, Amount Y)
>>>>>      For ix=0 To .txtMonths.Value
>>>>>        ldCurrent = Gomonth(.txtStart.Value,m.ix)
>>>>>        ldFrom = Iif(m.ix = 0, m.ldCurrent, ;
>>>>>          Date( Year(m.ldCurrent), Month(m.ldCurrent), 1))
>>>>>        ldTo = Iif(m.ix = .txtMonths.Value, m.ldCurrent,;
>>>>>          Gomonth(m.ldCurrent,1)-Day(Gomonth(m.ldCurrent,1)))
>>>>>        Do Case
>>>>>          Case m.ix = 0
>>>>>            lnAmount = m.lnPayment * ((Day(m.ldTo)-Day(m.ldCurrent))/30)
>>>>>          Case m.ix = .txtMonths.Value
>>>>>            lnAmount = m.lnPayment * ((Day(m.ldCurrent)-1)/30)
>>>>>          Otherwise
>>>>>            lnAmount = m.lnPayment
>>>>>        Endcase
>>>>>        Insert Into crsDist (From,To,Amount) ;
>>>>>          values ;
>>>>>          ( m.ldFrom, m.ldTo,m.lnAmount)
>>>>>      Endfor
>>>>>      Locate
>>>>>      .grdDistribution.RecordSource = 'crsDist'
>>>>>      .grdDistribution.Visible = .T.
>>>>>    Endwith
>>>>>  Endproc
>>>>>Enddefine
>>>>>
Cetin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform