Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete and sum at grid
Message
De
26/07/2006 08:59:15
 
 
À
26/07/2006 07:52:38
Jay Johengen
Altamahaw-Ossipee, Caroline du Nord, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9
Database:
Visual FoxPro
Divers
Thread ID:
01140106
Message ID:
01140125
Vues:
19
hi,
thank you for reply,

i try to find another way to solve this code as what i need,

but i think it is very defficult or maybe no way????
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 = 000000000.000, 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)
        *? ldCurrent
        *wait
        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
            lnLeft = 30 - (Day(m.ldTo)-Day(m.ldCurrent))
            lnAmount = m.lnPayment * ((Day(m.ldTo)-Day(m.ldCurrent))/30)
                  
            Case m.ix = .txtmonths.Value
            lnAmount = m.lnPayment * (m.lnLeft/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
>>hi,
>>
>>i need help to make sum and delete at grid as
>>
>>
>>
>>        Insert Into crsDist (From,To,Amount) ;
>>          values ;
>>          ( m.ldFrom, m.ldTo,m.lnAmount)
>>      Endfor
>>
>> IF month(txtstart)=2 or month(txtstart)=4 or month(txtstart)=6 or month    (txtstart)=9 or month(txtstart)=11 and day(txtstart)=1
>>
>>use crsDist
>>go bottom
>>m.val=amount
>>delet the last record
>>
>>go top first record
>>amount=amount+m.val
>>
>>thanks
>
>Can you show what the grid would look like for one of those non 30-day months? I'm a little familiar with what you're working on, and I'm not sure that deleting/adding days is really what you should be doing in your calculations. Can't you change your formulas to handle whether it is 28, 29, 30 or 31 days?
>
>But, regardless, all you need to do to delete the last records is:
>
>use crsDist
>go bottom
>m.val=amount
>DELETE
>
>Make sure that you have SET DELETED OFF somewhere in the INIT of your form and you should see the grid display appropriately on REFRESH.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform