JavierO |
29-08-2005 19:47:15 |
Bueno este es el código de donde lo mado llamar, pero el que realmente manda el mensaje es el procedimiento PPR0002_VALIDA_REMI_OTRO
Código:
procedure Tsilfpr0002.T_REMIREMI_REMI_NUMERO_APROValidate(Sender: TField);
begin
if (not(T_REMI.FieldByName('remi_remi_serie_apro').IsNull)) and
(not(T_REMI.FieldByName('remi_remi_numero_apro').IsNull)) then
begin
PPR0002_VALIDA_REMI_OTRO();
DBE_Remi_Eqpo_Clave.Enabled := False;
end;
end;
pero le trato de poner la instrucción que me dices pero como mado MessageBox no se puede
Código:
procedure Tsilfpr0002.PPR0002_VALIDA_REMI_OTRO();
var
lw_tipo :string;
lw_cant_facturar :double;
lw_estatus :string;
lw_remi_peci_anio :integer;
lw_remi_peci_numero :integer;
lw_plan_clave :string;
lw_plan_descripcion :string;
lw_peci_anio :integer;
lw_peci_numero :integer;
lw_existe :integer;
lw_error :string;
begin
Q_Consulta.Close;
Q_Consulta.SQL.Clear;
Q_Consulta.SQL.Add(' SELECT remi_tipo AS lw_tipo, remi_cant_facturar AS lw_cant_facturar, remi_estatus AS lw_estatus, ');
Q_Consulta.SQL.Add(' remi_peci_anio_despa AS lw_remi_peci_anio, remi_peci_numero_despa AS lw_remi_peci_numero, ');
Q_Consulta.SQL.Add(' remi_plan_clave AS lw_plan_clave, plan_descripcion AS lw_plan_descripcion ');
Q_Consulta.SQL.Add(' FROM sil_remisiones, sil_plantas ');
Q_Consulta.SQL.Add(' WHERE remi_serie = :pw_lw_remi_serie_otro ');
Q_Consulta.SQL.Add(' AND remi_numero = :pw_lw_remi_numero_otro ');
Q_Consulta.SQL.Add(' AND plan_clave = remi_plan_clave ');
if (not(T_REMI.FieldByName('remi_remi_serie_apro').IsNull)) and (not(T_REMI.FieldByName('remi_remi_numero_apro').IsNull)) then
begin
Q_Consulta.ParamByName('pw_lw_remi_serie_otro').Value := T_REMI.FieldValues['remi_remi_serie_apro'];
Q_Consulta.ParamByName('pw_lw_remi_numero_otro').Value := T_REMI.FieldValues['remi_remi_numero_apro'];
end
else
begin
if (not(T_REMI.FieldByName('remi_remi_serie_reco').IsNull)) and (not(T_REMI.FieldByName('remi_remi_numero_reco').IsNull)) then
begin
Q_Consulta.ParamByName('pw_lw_remi_serie_otro').Value := T_REMI.FieldValues['remi_remi_serie_reco'];
Q_Consulta.ParamByName('pw_lw_remi_numero_otro').Value := T_REMI.FieldValues['remi_remi_numero_reco'];
end
else
begin
//Q_Consulta.ParamByName('pw_lw_remi_serie_otro').Value := T_REMI.FieldValues['lw_remi_serie_otro'];
//Q_Consulta.ParamByName('pw_lw_remi_numero_otro').Value := T_REMI.FieldValues['lw_remi_numero_otro'];
Q_Consulta.ParamByName('pw_lw_remi_serie_otro').Value := NULL;
Q_Consulta.ParamByName('pw_lw_remi_numero_otro').Value := NULL;
end;
end;
Q_Consulta.Open;
if Q_Consulta.RecordCount = 0 then
begin
Application.MessageBox(PChar(Mensaje(153,'','E')), 'SIL Light', mb_ok+mb_iconexclamation));
end
else
begin
lw_tipo := Q_Consulta.FieldValues['lw_tipo'];
lw_cant_facturar := Q_Consulta.FieldValues['lw_cant_facturar'];
lw_estatus := Q_Consulta.FieldValues['lw_estatus'];
lw_remi_peci_anio := Q_Consulta.FieldValues['lw_remi_peci_anio'];
lw_remi_peci_numero := Q_Consulta.FieldValues['lw_remi_peci_numero'];
lw_plan_clave := Q_Consulta.FieldValues['lw_plan_clave'];
lw_plan_descripcion := Q_Consulta.FieldValues['lw_plan_descripcion'];
if lw_plan_clave <> T_REMI.FieldByName('lw_plan_clave').Value then
begin
Q_Consulta2.Close;
Q_Consulta2.SQL.Clear;
Q_Consulta2.SQL.Add(' SELECT COUNT(*) AS lw_existe ');
Q_Consulta2.SQL.Add(' FROM sil_plantas_grupo plgr1, sil_grupos_planta grpl1, sil_plantas_grupo plgr2, sil_grupos_planta grpl2 ');
Q_Consulta2.SQL.Add(' WHERE plgr1.plgr_plan_clave = :pw_lw_plan_clave ');
Q_Consulta2.SQL.Add(' AND grpl1.grpl_clave = plgr1.plgr_grpl_clave ');
Q_Consulta2.SQL.Add(' AND grpl1.grpl_tipo_grupo = ''E'' ');
Q_Consulta2.SQL.Add(' AND plgr2.plgr_plan_clave = :lw_plan_clave ');
Q_Consulta2.SQL.Add(' AND grpl2.grpl_clave = plgr2.plgr_grpl_clave ');
Q_Consulta2.SQL.Add(' AND grpl2.grpl_tipo_grupo = ''E'' ');
Q_Consulta2.SQL.Add(' AND grpl1.grpl_clave = grpl2.grpl_clave ');
Q_Consulta2.ParamByName('pw_lw_plan_clave').Value := T_REMI.FieldValues['lw_plan_clave'];
Q_Consulta2.ParamByName('lw_plan_clave').Value := lw_plan_clave;
Q_Consulta2.Open;
lw_existe := Q_Consulta2.FieldValues['lw_existe'];
Q_Consulta2.Close;
if lw_existe = 0 then
begin
Application.MessageBox(PChar('La remision a utilizar pertenece a la planta '+lw_plan_descripcion+'.'), 'SIL Light', mb_ok+mb_iconexclamation);
Exit;
end;
end;
if lw_tipo <> 'C' then
Application.MessageBox(PChar(Mensaje(154,'','E')), 'SIL Light', mb_ok+mb_iconexclamation);
if (lw_estatus <> 'G') or (lw_estatus <> 'T') then
begin
if lw_estatus = 'C' then
begin
Stores.SIL_P_PERIODO_ACTIVO(T_REMI.FieldValues['lw_plan_clave'],'PRO',lw_peci_anio,lw_peci_numero,lw_error);
if (not(VarIsNull(lw_error))) and (lw_error <> '') then
begin
Application.MessageBox(PChar(Mensaje(186,'','E')), 'SIL Light', mb_ok+mb_iconexclamation);
Exit;
end;
if (lw_remi_peci_anio <> lw_peci_anio) or (lw_remi_peci_numero <> lw_peci_numero) then
begin
Application.MessageBox(PChar(Mensaje(155,'','E')), 'SIL Light', mb_ok+mb_iconexclamation);
Exit;
end;
end
else
begin
Application.MessageBox(PChar(Mensaje(155,'','E')), 'SIL Light', mb_ok+mb_iconexclamation);
Exit;
end;
end;
if NVL(T_REMI.FieldValues['remi_cant_aprovechado'],0) <> 0 then
if lw_cant_facturar < T_REMI.FieldByName('remi_cant_aprovechado').Value then
begin
Application.MessageBox(PChar(Mensaje(156,'','E')), 'SIL Light', mb_ok+mb_iconexclamation);
Exit;
end;
if NVL(T_REMI.FieldValues['remi_cant_recolocado'],0) <> 0 then
if lw_cant_facturar < T_REMI.FieldByName('remi_cant_recolocado').Value then
begin
Application.MessageBox(PChar(Mensaje(157,'','E')), 'SIL Light', mb_ok+mb_iconexclamation);
Exit;
end;
end;
Q_Consulta.Close;
end;
Gracias y saludos
|