Ver Mensaje Individual
  #8  
Antiguo 01-09-2007
Avatar de BuenaOnda
BuenaOnda BuenaOnda is offline
Miembro
 
Registrado: feb 2006
Ubicación: La Serena - Chile
Posts: 347
Reputación: 19
BuenaOnda Va por buen camino
este es el codigo, solo lleno un stringGrid, no utilice un DBStringGrid, por que los datos puedes modificarse en el StringGrid(Osea el StringGrid es editable)..

Código Delphi [-]
     WITH Modulo DO
     BEGIN
          LimpiarGrilla;
          LimpiarMatriz;
          TRY
             fFila:=0;
             Query1.SQL.Clear;
             Query1.SQL.Text:='Select * From Sp_Articulos_de_venta';
             Query1.Open;
             IF Query1.RecordCount > 0 THEN
             BEGIN//1
                    LimpiarGrilla;
                    LimpiarMatriz;
                    Query1.Last;
                    GrillaArticulos.RowCount:=Query1.RecordCount;
                    Query1.First;
                    WHILE NOT Query1.Eof DO
                    BEGIN//2
                           WITH GrillaArticulos DO
                           BEGIN
                                Cells[0,fFila]:=Trim(Query1.FieldByName('DescUsuario').AsString);
                                Cells[1,fFila]:=IntToStr(Query1.FieldByName('CODIGO_FAMILIA').AsInteger);
                                Cells[2,fFila]:=Trim(Query1.FieldByName('DESCFAMILIA').AsString);
                                Cells[3,fFila]:=Trim(Query1.FieldByName('PROVEEDOR').AsString);
                                Cells[4,fFila]:=Trim(Query1.FieldByName('CODIGO_ART_PROVEEDOR').AsString);
                                Cells[5,fFila]:=Trim(Query1.FieldByName('DESCRIPCIONDECOMPRA').AsString);
                                Cells[6,fFila]:=IntToStr(Query1.FieldByName('CODIGO_ARTICULO').AsInteger);
                                Cells[7,fFila]:=Trim(Query1.FieldByName('DESCRIPCION_DE_VENTA').AsString);
                                Cells[8,fFila]:=FormatFloat('#,##',Query1.FieldByName('PRECIO_VENTA').AsFloat);
                                Cells[9,fFila]:=FormatFloat('#,##0.0',Query1.FieldByName('Porcentaje_precio_venta').AsFloat);
                                Cells[10,fFila]:=FormatFloat('#,##0',Query1.FieldByName('PRECIO_OFERTA').AsFloat);
                                Cells[11,fFila]:='0';//FormatFloat('#,##0.0',Query1.FieldByName('PORCENTAJE_PRECIO_VENTA').AsFloat);
                                Cells[12,fFila]:=FormatFloat('#,##',Query1.FieldByName('PRECIO_SOCIA').AsFloat);
                                Cells[13,fFila]:=FormatFloat('#,##0.0',Query1.FieldByName('Porcentaje_precio_Socia').AsFloat);
                                Cells[14,fFila]:=FormatFloat('#,##0',Query1.FieldByName('PRECIO_X_MAYOR').AsFloat);
                                Cells[15,fFila]:=FormatFloat('#,##0.0',Query1.FieldByName('Porcentaje_precio_Mayor').AsFloat);
                                Cells[16,fFila]:=FormatFloat('#,##0',Query1.FieldByName('PRECIO_FINAL').AsFloat);
                                Cells[17,fFila]:=FormatFloat('#,##0.0',(Query1.FieldByName('DESCUENTO1').AsFloat) +
                                                                       (Query1.FieldByName('DESCUENTO2').AsFloat) +
                                                                       (Query1.FieldByName('DESCUENTO3').AsFloat) );
                                Cells[18,fFila]:=FormatFloat('#,##0',Query1.FieldByName('PRECIO_COMPRA').AsFloat);
                                Cells[19,fFila]:=FormatFloat('#,##0',Query1.FieldByName('UNIDADES_DE_VENTAS').AsFloat);
                                Cells[20,fFila]:=FormatFloat('#,##0',Query1.FieldByName('VALOR_UNIDAD_DE_VENTA').AsFloat);
                                Cells[21,fFila]:=FormatFloat('#,##0.0',Query1.FieldByName('DESCUENTO1').AsFloat);
                                Cells[22,fFila]:=FormatFloat('#,##0.0',Query1.FieldByName('DESCUENTO2').AsFloat);
                                Cells[23,fFila]:=FormatFloat('#,##0.0',Query1.FieldByName('DESCUENTO3').AsFloat);
                                Cells[24,fFila]:=FormatDateTime('dd/mm/yyyy',Query1.FieldByName('FECHA_ULT_COMPRA').AsDateTime);
                           END;
                           Inc(fFila);
                           Query1.Next;
                    END; //2
             END  //1
             ELSE AgregarProducto_A_La_Lista; //DamoslaPosibilidad de ingresar un nuevo Artículo..jejej.
          FINALLY
             Query1.Close;
          END;
     END;

lo unico que hace es traer la informacion desde un procedimiento almacenado,no son mas de 3000 registros, la idea es que el StringGrid opere al estilo Excel, lo cual lo realiza super bien..(me gustaria mostrar menos informacion en el StringGrid, pero se necesita mostrar todo)..
Responder Con Cita