PDA

Ver la Versión Completa : Campos Calculados, y sus variantes


MaMu
22-06-2007, 05:23:56
Resulta que arme una planilla de CAJA, donde en base a los conceptos que se añaden, sean EGRESO o INGRESO, el campo IMPORTE de los mismos, los agrego a sus respectivos campos calculados como DEBE, HABER y SALDO. Hasta aqui todo bien y sin problemas. Pero no se como hacer para lograr visualizar en SALDO (siendo este =DEBE-HABER) el arrastre del importe del campo anterior, para explayarme mejor les pongo el ejemplo:

CONCEPTO DEBE HABER SALDO
=======================================
EGRESO 20 0 -20
EGRESO 10 0 -10
IMGRESO 0 50 50
=======================================
TOTALES 30 50 20

Pero yo quiero mostrarlo como en la vieja escuela, como realmente debe hacerse, asi:

CONCEPTO DEBE HABER SALDO
=======================================
EGRESO 20 0 -20
EGRESO 10 0 -30
IMGRESO 0 50 20
=======================================
TOTALES 30 50 20

Los campos DEBE, HABER y SALDO son calculados, los unicos reales son CONCEPTO e IMPORTE.

Como puedo hacer?? Alguna idea, orientacion, consejo, critica, todo es bienvenido

Saludos y gracias

MaMu
23-06-2007, 18:38:47
Bueno, yo para calcular las columnas DEBE,HABER y SALDO hago lo siguiente:


//DEBE
if QCaja.FieldByName('movimiento').AsString='EGRESO'
then begin
//En True elije DOLAR como moneda, en False elije PESOS como moneda
if dxCheckbox2.Checked=True
then begin
QCajaDebe.Value:=QCaja.FieldByName('importe').AsCurrency/dolar;
QCajaHaber.Value:=0;
QCajaSaldo.Value:=QCajaHaber.Value-QCajaDebe.Value;
end
else begin
QCajaDebe.Value:=QCaja.FieldByName('importe').AsCurrency;
QCajaHaber.Value:=0;
QCajaSaldo.Value:=QCajaHaber.Value-QCajaDebe.Value;
end;
end
else begin
//HABER
if dxCheckbox2.Checked=True
then begin
QCajaHaber.Value:=QCaja.FieldByName('importe').AsCurrency/dolar;
QCajaDebe.Value:=0;
QCajaSaldo.Value:=QCajaHaber.Value-QCajaDebe.Value;
end
else begin
QCajaHaber.Value:=QCaja.FieldByName('importe').AsCurrency;
QCajaDebe.Value:=0;
QCajaSaldo.Value:=QCajaHaber.Value-QCajaDebe.Value;
end;
end;


Lastima que no se como hacer el ARRASTRE de saldo anterior. No se me ocurre la forma.