Ver Mensaje Individual
  #3  
Antiguo 03-06-2015
Avatar de JoAnCa
JoAnCa JoAnCa is offline
Miembro
 
Registrado: jul 2005
Ubicación: Cuba
Posts: 435
Reputación: 19
JoAnCa Va por buen camino
Este es el segmento de codigo del boton calcular

Código Delphi [-]
  with ModBD_Global, ModBD_Global.ztIndicadEfic do
  begin
    First;      //--- Calcular el Plan ---
    while not Eof do
    begin
      Edit;
      case ztIndicadEficFila.Value of
        2:IngPlan:=ztIndicadEficPlan.Value;   //--- Total Ingresos  ---
        3:VNPlan:=ztIndicadEficPlan.Value;    //--- Ventas Netas  ---
        4:GastPlan:=ztIndicadEficPlan.Value;  //--- Total Gastos  ---
        5:if VarIsNull(ztIndicadEficPlan.Value) then SalPlan:=0
          else SalPlan:=ztIndicadEficPlan.Value; //--- Salario ---
        6:CMPlan:=ztIndicadEficPlan.Value;    //--- Costo de Mercancias ---
        7:GMPlan:=ztIndicadEficPlan.Value;    //--- Gasto Material ---
        8:SCPlan:=ztIndicadEficPlan.Value;    //--- Servicios Comprados ---
        9:begin                               //--- VAB ---
            VAPlan:=VNPlan-(GMPlan + CMPlan + SCPlan);
            if VarIsNull(VAPlan) then VAPlan:=0;
            ztIndicadEficPlan.Value:=0.00;//VAPlan;      <--- Aqui da el error de stack overflow
          end;
       10:if (VAPlan = 0) or (VarIsNull(VAPlan)) then ztIndicadEficPlan.Value:=0      <-- y Aqui tambien si el anterior es <> de cero
          else ztIndicadEficPlan.Value:=SalPlan/VAPlan;         //--- IngMon / VAB ---
       17:ztIndicadEficPlan.Value:=(SalPlan*12.5)/100;    //--- 12.5% Seg. Soc. ---
       18:ztIndicadEficPlan.Value:=(SalPlan*12)/100;      //--- 12% Imp. Fza Trab ---
       19:ztIndicadEficPlan.Value:=SalPlan/100;           //--- 1% Imp. Territorial ---
       20:ztIndicadEficPlan.Value:=SalPlan*0.0295;        //--- Financmto OSDE ---
       23:begin                                           //--- Promedio Trabajadores  ---
           PromTrab:=ztIndicadEficPlan.Value;
           if VarIsNull(PromTrab) then PromTrab:=0;
          end;
       26:if PromTrab = 0 then ztIndicadEficPlan.Value:=0
          else ztIndicadEficPlan.Value:=VAPlan/PromTrab;  //--- Productividad ---
       27:if PromTrab = 0 then ztIndicadEficPlan.Value:=0
          else ztIndicadEficPlan.Value:=SalPlan/PromTrab; //--- Salario Medio ---
       28:if VAPlan = 0 then ztIndicadEficPlan.Value:=0
          else ztIndicadEficPlan.Value:=SalPlan/VAPlan;   //--- Salario / VAB ---
      end;
      Post;
      Next;
    end;

  end;

Pero ya les digo, si todos los valores son diferentes de cero, funciona bien
__________________
La hora de acción no es hora de aprender, es necesario haber aprendido antes
Responder Con Cita