with ModBD_Global, ModBD_Global.ztCertifSalario do
begin
ztResumIndEfic.Filtered:=False;
ztResumIndEfic.Filter:='CodUnid = '+ QuotedStr(ztUnidCostoCodUnid.Value) +' AND Mes = '+ IntToStr(cbbMes.ItemIndex+1) +' AND Anno = '+ FloatToStr(spAnno.Value);
ztResumIndEfic.Filtered:=True;
First;
while not Eof do
begin
Edit;
case RecNo of
1:begin //--- Utilidades ---
if ztUnidCostoOC.Value = -1 then ztCertifSalarioReal.Value:=ztIndFundUtilAcum.Value
else ztCertifSalarioReal.Value:=(ztResumIndEficTotIngAcum.Value - ztResumIndEficTotGastAcum.Value);
end;
2:begin //--- Total Ingresos ---
if ztUnidCostoOC.Value = -1 then ztCertifSalarioReal.Value:=ztIndFundIngTotAcum.Value
else ztCertifSalarioReal.Value:=ztResumIndEficTotIngAcum.Value;
end;
3:begin //--- Ventas Netas ---
if ztUnidCostoOC.Value = -1 then ztCertifSalarioReal.Value:=ztIndFundVNetasAcum.Value
else ztCertifSalarioReal.Value:=ztResumIndEficVentasNetAcum.Value;
VNPlan:=ztCertifSalarioPlan.Value;
end;
4:begin //--- Total de Gastos ---
if ztUnidCostoOC.Value = -1 then ztCertifSalarioReal.Value:=ztIndFundGastoTotAcum.Value
else ztCertifSalarioReal.Value:=ztResumIndEficTotGastAcum.Value;
end;
5:begin //--- Salario ---
if ztUnidCostoOC.Value = -1 then SalarioR:=ztIndFundSalario.Value
else SalarioR:=ztResumIndEficFSalarioAcum.Value;
SalPlan:=ztCertifSalarioPlan.Value;
ztCertifSalarioReal.Value:=SalarioR;
end;
6:begin //--- Costo de Mercancias ---
if ztUnidCostoOC.Value = -1 then ztCertifSalarioReal.Value:=ztIndFundCostoMerc.Value
else ztCertifSalarioReal.Value:=ztResumIndEficCostoMercAcum.Value;
CMPlan:=ztCertifSalarioPlan.Value;
end;
7:begin //--- Gasto Material ---
if ztUnidCostoOC.Value = -1 then ztCertifSalarioReal.Value:=ztIndFundGastMat.Value
else ztCertifSalarioReal.Value:=ztResumIndEficGastoMatAcum.Value;
GMPlan:=ztCertifSalarioPlan.Value;
end;
8:begin //--- Servicios Comprados ---
if ztUnidCostoOC.Value = -1 then ztCertifSalarioReal.Value:=ztIndFundServComp.Value
else ztCertifSalarioReal.Value:=ztResumIndEficServCompAcum.Value;
SCPlan:=ztCertifSalarioPlan.Value;
end;
9:begin //--- VAB ---
VAPlan:=VNPlan - (GMPlan + CMPlan + SCPlan);
ztCertifSalarioPlan.Value:=VAPlan;
if ztUnidCostoOC.Value = -1 then ztCertifSalarioReal.Value:=ztIndFundVAB.Value
else ztCertifSalarioReal.Value:=ztResumIndEficVABAcum.Value;
end;
10: begin //--- IngMon / VAB ---
IMPlan:=SalPlan / VAPlan;
if ztUnidCostoOC.Value = -1 then ztCertifSalarioReal.Value:=ztIndFundIngVAB.Value
else ztCertifSalarioReal.Value:=ztResumIndEficIngMonVABAcum.Value;
end;
11:begin //--- Salario Creado ---
if ztUnidCostoOC.Value = -1 then SalCreado:=ztIndFundVAB.Value * IMPlan
else SalCreado:=ztResumIndEficVABAcum.Value * IMPlan;
ztCertifSalarioReal.Value:=SalCreado;
end;
12:begin //--- Salario Disponible ---
ztCertifSalarioReal.Value:=SalCreado - SalarioR;
end;
13:begin //--- Porciento ---
Pcto:=StrToFloatDef(edtPcto.Text, 0);
ztCertifSalarioReal.Value:=Pcto;
end;
14:begin //--- Salario a Pagar ---
ztCertifSalarioReal.Value:=((SalCreado - SalarioR) * Pcto)/100;
end;
end;
Post;
Next;
end;
ztResumIndEfic.Filtered:=False;
end;