Ver Mensaje Individual
  #3  
Antiguo 18-06-2008
CharlesWar CharlesWar is offline
Registrado
 
Registrado: may 2008
Posts: 5
Reputación: 0
CharlesWar Va por buen camino
q_detallefac.First;
while not q_detallefac.Eof do
begin
if (copy(q_detallefac['CVE_ART'],1,2)<>'00') AND (q_detallefac['PREC']>0) and (importe>0) then
begin q_ParFac.sql.Clear;
q_ParFac.SQL.Add ('Select * from PARTIDAS_FAC');
q_parfac.sql.add (' where sucursal=' + QuotedStr(trim(inttostr(num_sucursal))));
q_parfac.sql.add (' and trim(FACTURA)=' + QuotedStr(TRIM(q_cobranza['refer'])));
q_parfac.SQL.add (' and trim(CVE_CONC)=' + QuotedStr(TRIM(q_detallefac['cve_art'])));
q_parfac.SQL.add (' and CANTIDAD=' + QuotedStr(TRIM(inttostr(q_detallefac['cant']))));
q_ParFac.Active:=true;
anticipo:=0;
hay_partida:=0;
if q_parfac.RecordCount>0 then
begin
hay_partida:=1;
if q_parfac['Pagado']<q_parfac['subtotal'] then
anticipo:=q_parfac['pagado'];
end; if (hay_partida=0) or ((hay_partida=1) and (anticipo>0)) then
begin
dias:=q_cobranza['FECHA_APLI']-q_facturas['FECHA_DOC'];
nom_agente:=' '; q_agentes.sql.clear;
q_agentes.sql.add('select * from Vendedores');
q_agentes.sql.add(' where numero=' + quotedstr(trim(num_agente)));
q_agentes.SQL.add(' and sucursal=' + quotedstr(trim(inttostr(num_sucursal))));
q_agentes.Active:=true;
if q_agentes.RecordCount>0 then
nom_agente:=q_agentes['nombre']
else
nom_agente:='NULL'; por lo regular num_agente me dice q valor indefinido cuando al inicio siempre la inicializo al menos con 0
Responder Con Cita