Librería

Clase

Metodo

AhoraConta

ContaProcesos

GeneraApunte


Implementación:


 Public Function GeneraApunte(
     aAsiento As Long,
     aFecha As Date,
     aCuenta As String,
     aValor As Double,
     aConcepto As String,
     Optional aIdCentrocoste As String = "")              As Long 


Descripción:


Inserta un apunte contable con los parámetros indicados. Si aAsiento es 0 entonces lo calcula automáticamente. Devuelve el índice del apunte creado, para el asiento.


Ejemplo de uso:


 lSql = "Select sum(Alb.Total) Tot from vAlbaran_Cli_Lineas  A " + _
        "Inner join Pedidos_Cli_Cabecera P On A.IdPedido=P.IdPedido " + _
        "Where (A.IdEstadoLinea=5) Group by P.IdCentroCoste"
 Set lCursor = gCn.OpenResultset(lSql)
 If Not lCursor.EOF Then
   ' Apuntes al Haber por C.C.
   lInsertar = True
   Do While Not lCursor.EOF
     lTotalEuros = DRound(VGetNumber(lCursor!Tot.Value), 2)
     gCn.AhoraProceso "GeneraApunte", False, lAsiento, lFecha,
         pCuentaCli_H, lTotalEuros,
         "Contab.Alb.Actualiz.: " & Format(lFecha, cFmt_Date))
     lTotal = lTotal + lTotalEuros
     lCursor.MoveNext
   Loop
   lCursor.Cerrar
   End If
 Set lCursor = Nothing
 ' Apuntes al Debe agrupado
 If lInsertar Then
   gCn.AhoraProceso "GeneraApunte", False, lAsiento, lFecha, pCuentaCli_D,
   (-1) * lTotal, "Contab.Alb.Actualiz.:" & Format(lFecha, cFmt_Date)
 End If