Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Grupo de Teaming del ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 17-06-2017
angelratza angelratza is offline
Registrado
NULL
 
Registrado: jun 2017
Posts: 8
Poder: 0
angelratza Va por buen camino
Error "Grid exceded index" en stringgrid

tengo un problema similar y con sus experiencia de que manera creen que podría lograrlo.

Tengo este código y al utilizar el IndexOf este me manda un error "Grid exceded index"

Código Delphi [-]
texto:=FVenta.EdVenta.Text;

IF GetTokenCount(texto,'%') = 2 then //cuando hay 2 tokens con signo de %
          begin
            if (EsStrunNumero(GetToken(texto,'%',1))) and (EsStrunNumero(GetToken(texto,'%',2)))then
            begin
              idesc:= StrToInt(GetToken(texto,'%',1));//Con esta funcion se obtiene el 1er. token que es el porcentaje de descuento y la colocamos a iDesc
              scve:= GetToken(texto,'%',2);   //Con esta Funcion se obtiene el 2o. token que es la clave de producto y se deposita en scve
              Fventa.SGVenta.Row := Fventa.SGVenta.Cols[1].indexOf(scve); // Con esta funcion nos posicionamos en la fila del producto

                MessageDlg(scve, mtInformation,[mbOk], 0);
                MessageDlg(Fventa.SGVenta.Cells[0,Fventa.SGVenta.Row], mtInformation,[mbOk], 0);

              if scve = Fventa.SGVenta.Cells[0,Fventa.SGVenta.Row] then // Verificamos que sea el producto seleccionado
              begin
                importdesc:=StrToFloat(Fventa.SGVenta.Cells[6,Fventa.SGVenta.Row]); // Obtenemos el valor del importe sin descuento
                if idesc <> 0 then
                begin
                  Desc:=1-idesc/100; //a 1 se resta el porcentaje de descuento para q Desc se multiplique por la cantidad
                  import:=importdesc*Desc;
                  Fventa.SGVenta.Cells[5,Fventa.SGVenta.Row]:= IntToStr(idesc); //Descuento
                end;

                import2:=FormatFloat('#,##0.00',DM1.QDist.FieldByName('Precio').AsFloat);//a Precio se le da formato
                Fventa.SGVenta.Cells[3,Fventa.SGVenta.Row]:= import2; //Precio

                import2:=FormatFloat('#,##0.00',import);
                Fventa.SGVenta.Cells[6,Fventa.SGVenta.Row]:= import2; //Importe

                if Fventa.EdImporte.Text <> '' then
                begin
                  importotal:=StrToFloat(QuitaEn(Fventa.EdImporte.Text, ','));
                  importotal:=importotal+import;
                  import2:=FormatFloat('#,##0.00',importotal);
                  Fventa.EdImporte.Text:=import2;
                  If Fventa.EdCostoEnvio.Text = '' then
                    Fventa.EdTotal.Text:=import2
                  else
                    Fventa.EdTotal.Text:=FormatFloat('#,##0.00',importotal+StrToFloat(Fventa.EdCostoEnvio.Text));
                end
                else
                begin
                  Fventa.EdImporte.Text:=import2;
                  If Fventa.EdCostoEnvio.Text = '' then
                    Fventa.EdTotal.Text:=import2
                  Else
                    Fventa.EdTotal.Text:=FormatFloat('#,##0.00',StrToFloat(import2)+StrToFloat(Fventa.EdCostoEnvio.Text)  );
                end;

                MessageDlg(FVenta.EdVenta.Text, mtInformation,[mbOk], 0);
                Fventa.EdVenta.Clear;

              end
              Else
              begin
                MessageDlg('El PRODUCTO solicitado no ha sido todavia ingresado', mtError,[mbOk], 0);
                FVenta.EdVenta.Clear;
              end;
            end
            Else
            begin
              MessageDlg('Revise su SINTAXIS', mtError,[mbOk], 0);
              FVenta.EdVenta.Clear;
            end;
          end;

Lo que se quiere lograr es encontrar en una columna un string especifico y obtener su indice para realizar las operaciones y sustituir valores.
Saludos.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Mensaje "Index out of date" despues de ajecutar table1.emptytable cvlaso77 Tablas planas 5 19-08-2011 10:40:03
Error "Invalid index descriptor" marconm Conexión con bases de datos 0 16-03-2009 11:24:29
Problema con cliente servidor, error "xsqlda index out of range" Buelos Varios 0 18-07-2008 06:49:57
Error "List index out of bounds(7)" mamen .NET 2 24-01-2006 00:09:38
error al insertar campos "index of bounds(0)" carobahamondes MySQL 1 26-04-2005 01:40:24


La franja horaria es GMT +2. Ahora son las 13:56:59.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi