Ver Mensaje Individual
  #1 (permalink)  
Antiguo 02/08/2010, 17:36
Avatar de a83
a83
 
Fecha de Ingreso: noviembre-2005
Ubicación: Santiago de chile
Mensajes: 637
Antigüedad: 18 años, 5 meses
Puntos: 1
consulta como puedo sumar en una MSHFlexGrid

estimados tengo esta MSHFlexGrid y neesito sumar el valor que esntrega el campo (prima_us_acu) pero el total de todos los reguistros
y enviar el total a un Label es pocible hacer esto


gracias por la ayuda


Código PHP:
'Llama a la  base  de  cador  y muestra  en  la Grilla
Sub mLlenarGrilla(mfgRet As MSHFlexGrid)
Dim strSql As String
Dim adoRs As New ADODB.Recordset
Dim strAux As String
Dim lngFila As Long
Abre_Base
    strSql = vbNullString
    strAux = vbNullString
    strSql = "Select * from produ_comercial where "
    strSql = "Select sum(prima_us_acu) as prima_us_acu,mes, year from produ_comercial where "
    '
strAux " Where RE_Id <> -1 "
    
If cmblinea.ListIndex <> -1 Then
        strAux 
strAux "linea = '" cmblinea.Text "' "
    
End If
    
    If 
cmbperiodo.ListIndex <> -1 Then
        
If cmbperiodo.ListIndex 0 Then
           strAux 
strAux " and mes in ('1','2','3')"
        
End If
        If 
cmbperiodo.ListIndex 1 Then
           strAux 
strAux " and mes in ('4','5','6')"
        
End If
        If 
cmbperiodo.ListIndex 2 Then
           strAux 
strAux " and mes in ('7','8','9')"
        
End If
        If 
cmbperiodo.ListIndex 3 Then
           strAux 
strAux " and mes in ('10','11','12')"
        
End If
        
        
        
    
End If
    
    If 
cmbfecha1.ListIndex <> -1 Then
        strAux 
strAux " and year between " cmbfecha1.Text ""
    
End If
    
     If 
cmbfecha2.ListIndex <> -1 Then
        strAux 
strAux " and " cmbfecha2.Text ""
    
End If
         
      
    
strSql strSql strAux
    
    strSql 
strSql " group by mes,year order by mes asc"
    
lngFila 0
    Call FormatoGrilla
    
If dbCreaConsultaRapida(strSqladoRsThen
        
Do While Not adoRs.EOF
            mfgRet
.Col 1
            mfgRet
.Row mfgRet.Rows 1
            
If mfgRet.Text <> "" Then
                mfgRet
.Rows mfgRet.Rows 1
            End 
If
            
mfgRet.Row mfgRet.Rows 1
            
            lngFila 
lngFila 1
                           
            
If Not IsNull(adoRs![mes]) Then
                
If (adoRs!mes) = Or (adoRs!mes) = Or (adoRs!mes) = 3 Then
                     mfgRet
.TextMatrix(lngFilamcintColperiodo) = "1st Quarter"
                
End If
                If (
adoRs!mes) = Or (adoRs!mes) = Or (adoRs!mes) = 6 Then
                     mfgRet
.TextMatrix(lngFilamcintColperiodo) = "2nd Quarter"
                
End If
                If (
adoRs!mes) = Or (adoRs!mes) = Or (adoRs!mes) = 9 Then
                     mfgRet
.TextMatrix(lngFilamcintColperiodo) = "3rd Quarter"
                
End If
                If (
adoRs!mes) = 10 Or (adoRs!mes) = 11 Or (adoRs!mes) = 12 Then
                     mfgRet
.TextMatrix(lngFilamcintColperiodo) = "4th Quarter"
                
End If
            
End If
            If 
Not IsNull(adoRs![Year]) Then
                mfgRet
.TextMatrix(lngFilamcintColfecha) = adoRs!Year
            End 
If
            If 
Not IsNull(adoRs![prima_us_acu]) Then
                mfgRet
.TextMatrix(lngFilamcintprima) = adoRs!prima_us_acu
            End 
If
            
adoRs.MoveNext
        Loop
    End 
If
    
Set adoRs Nothing
End Sub