Ver Mensaje Individual
  #5  
Antiguo 06-05-2021
Avatar de mRoman
mRoman mRoman is offline
Miembro
 
Registrado: nov 2003
Posts: 599
Reputación: 21
mRoman Va por buen camino
Una solución no muy optima

Bueno hasta el momento funciona asi: (UNA SOLUCION NO MUY OPTIMA Y MUCHO MENOS PROFESIONAL!!)

Código Delphi [-]
                       if qryValidaInv.fieldByName('KAR_M_EXISTENCIAS').AsInteger<=qryValidaInv.FieldByName('KAR_M_STOCK_MINIM  O').AsInteger then
                       begin
                           Application.MessageBox('Este producto esta por acabarse, favor de realizar pedido','Advertencia',mb_Ok+mb_IconExclamation);
                           Application.MessageBox('Este producto esta por acabarse, favor de realizar pedido','Advertencia',mb_Ok+mb_IconExclamation);
                       end;

Repitiendo 2 veces la linea de código....solo asi me muestra el mensaje...pero cuando se usa el teclado lo muestra -obvio- 2 VECES!!!...q joda!

(Código completo)
Código Delphi [-]
procedure TfrmVentas.mskCodProdExit(Sender: TObject);
begin
    if NOT(mskCodProd.Text='') then
    begin
        qryProductos.Close;
        qryProductos.ParamByName('COD_BAR').AsString:=mskCodProd.Text;
        qryProductos.Open;
        if qryProductos.IsEmpty then
        begin
             Application.MessageBox('Este código de producto no existe en el catálogo, o bien, aún no ha sido activado','Error',MB_OK+MB_ICONERROR);
             Application.MessageBox('Este código de producto no existe en el catálogo, o bien, aún no ha sido activado','Error',MB_OK+MB_ICONERROR);
//             mskCodProd.SetFocus;
             FormShow(Sender);
        end Else
        begin
            qryValidaInv.Close;
            qryValidaInv.ParamByName('PROD_ID').AsString:=mskCodProd.Text;
            qryValidaInv.Open;
            if qryValidaInv.IsEmpty then
            begin
                 Application.MessageBox('Este PRODUCTO no tiene KARDEX creado','Aviso',mb_Ok+mb_IconInformation);
                 Application.MessageBox('Este PRODUCTO no tiene KARDEX creado','Aviso',mb_Ok+mb_IconInformation);
                 FormShow(Sender);
            end Else
            begin
               if not(qryValidaInv.FieldByName('KAR_M_EXISTENCIAS').IsNull) then
               begin
                   if qryValidaInv.fieldByName('KAR_M_EXISTENCIAS').AsInteger=0 then
                   begin
                       Panel8.Visible:=True;
                       Application.MessageBox('Este producto esta AGOTADO, no tiene existencias','Aviso',mb_Ok+mb_IconWarning);
                       Application.MessageBox('Este producto esta AGOTADO, no tiene existencias','Aviso',mb_Ok+mb_IconWarning);
                       Limpiar();
                   end Else
                   begin
                       if qryValidaInv.fieldByName('KAR_M_EXISTENCIAS').AsInteger<=qryValidaInv.FieldByName('KAR_M_STOCK_MINIM  O').AsInteger then
                       begin
                           Application.MessageBox('Este producto esta por acabarse, favor de realizar pedido','Advertencia',mb_Ok+mb_IconExclamation);
                           Application.MessageBox('Este producto esta por acabarse, favor de realizar pedido','Advertencia',mb_Ok+mb_IconExclamation);
                       end;
                       sBtnAdd.Enabled:=True;
                       mskCant.Text:=IntToStr(1);
                   end;
               end Else
               begin
                   Application.MessageBox('Este producto aún NO TIENE EXISTENCIAS registradas','Aviso',mb_Ok+mb_IconInformation);
                   Application.MessageBox('Este producto aún NO TIENE EXISTENCIAS registradas','Aviso',mb_Ok+mb_IconInformation);
                   FormShow(Sender);
               end;
            end;
        end;
    end;
end;

Lo q hace FormShow:
Código Delphi [-]
procedure TfrmVentas.FormShow(Sender: TObject);
begin
    BD.trsBDWine.Active:=false;
    bd.trsBDWine.StartTransaction;
    Limpiar();
    IniciaRegNvo();
end;

Lo q hace Limpiar():
Código Delphi [-]
procedure TfrmVentas.Limpiar;
begin
    mskCodProd.Text:='';
    mskCant.Text:='';
    mskCodProd.SetFocus;
    sBtnAdd.Enabled:=False;
    qryProductos.Close;
    Panel8.Visible:=False;
//    btnImprimir.Enabled:=False;
end;

Lo q hace IniciaRegNvo():
Código Delphi [-]
procedure TfrmVentas.IniciaRegNvo;
begin
    nRegNvo:=0;
    qryUltimoTCK.Close;
    qryUltimoTCK.Open;
    nTicket:=qryUltimoTCK.fieldByName('ULTIMO_TCK').AsInteger;
//*************************************************************************
    dsVentaM.Open;
    dsVentaM.Append;
    dsVentaM.FieldByName('VENTA_NUM_TICKET').AsInteger:=nTicket+1;
    dsVentaM.FieldByName('ESTATUS_VENTA_ID').AsInteger:=1;
    dsVentaM.Post;

    dsVentaD.Open;
//*************************************************************************
    sbtnBorrar.Enabled:=False;
    qryVentaID.Close;
    qryVentaID.Open;
    nVentaID:=qryVentaID.fieldByName('ID').AsInteger;
    nConsec:=0;
    nTotImporte:=0;
    Label8.Caption:='';
end;
__________________
Miguel Román

Afectuoso saludo desde tierras mexicanas....un aguachile?, con unas "cetaseas" bien "muertas"?, VENTE PUES !!

Última edición por mRoman fecha: 06-05-2021 a las 02:28:55.
Responder Con Cita