Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Divide value
Message
From
24/07/2006 09:28:31
 
 
To
10/07/2006 07:11:58
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:
01139129
Views:
14
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