Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > OOP
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 12-03-2012
gianfranco_tont gianfranco_tont is offline
Miembro
NULL
 
Registrado: ene 2012
Posts: 96
Poder: 13
gianfranco_tont Va por buen camino
Cita:
Empezado por gianfranco_tont Ver Mensaje
Alguien tiene alguna idea como ayudar con esto?
Código Delphi [-]
unit Unitcotizacion;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DB, ADODB, ExtCtrls, StdCtrls, DBCGrids, Mask, JPEG, DBCtrls, Buttons,
  Grids, DBGrids;

type
    TControlActual = Class(TControl);
  TFormcotizacion = class(TForm)
    ADOQuery1: TADOQuery;
    DataSource1: TDataSource;
    Edit1: TEdit;
    DBCtrlGrid1: TDBCtrlGrid;
    DBMemo1: TDBMemo;
    DBText3: TDBText;
    DBGrid1: TDBGrid;
    Button1: TButton;
    ADOQuery1co_art: TStringField;
    ADOQuery1art_des: TStringField;
    ADOQuery1fecha_reg: TDateTimeField;
    ADOQuery1manj_ser: TBooleanField;
    ADOQuery1co_lin: TStringField;
    ADOQuery1co_cat: TStringField;
    ADOQuery1co_subl: TStringField;
    ADOQuery1co_color: TStringField;
    ADOQuery1item: TStringField;
    ADOQuery1ref: TStringField;
    ADOQuery1modelo: TStringField;
    ADOQuery1procedenci: TStringField;
    ADOQuery1comentario: TMemoField;
    ADOQuery1co_prov: TStringField;
    ADOQuery1ubicacion: TStringField;
    ADOQuery1uni_venta: TStringField;
    ADOQuery1uni_compra: TStringField;
    ADOQuery1uni_relac: TFMTBCDField;
    ADOQuery1relac_aut: TIntegerField;
    ADOQuery1stock_act: TFMTBCDField;
    ADOQuery1stock_com: TFMTBCDField;
    ADOQuery1sstock_com: TFMTBCDField;
    ADOQuery1stock_lle: TFMTBCDField;
    ADOQuery1sstock_lle: TFMTBCDField;
    ADOQuery1stock_des: TFMTBCDField;
    ADOQuery1sstock_des: TFMTBCDField;
    ADOQuery1suni_venta: TStringField;
    ADOQuery1suni_compr: TStringField;
    ADOQuery1suni_relac: TBCDField;
    ADOQuery1sstock_act: TFMTBCDField;
    ADOQuery1relac_comp: TFMTBCDField;
    ADOQuery1relac_vent: TFMTBCDField;
    ADOQuery1pto_pedido: TFMTBCDField;
    ADOQuery1stock_max: TFMTBCDField;
    ADOQuery1stock_min: TFMTBCDField;
    ADOQuery1prec_om: TBooleanField;
    ADOQuery1prec_vta1: TFMTBCDField;
    ADOQuery1fec_prec_v: TDateTimeField;
    ADOQuery1fec_prec_2: TDateTimeField;
    ADOQuery1prec_vta2: TFMTBCDField;
    ADOQuery1fec_prec_3: TDateTimeField;
    ADOQuery1prec_vta3: TFMTBCDField;
    ADOQuery1fec_prec_4: TDateTimeField;
    ADOQuery1prec_vta4: TFMTBCDField;
    ADOQuery1fec_prec_5: TDateTimeField;
    ADOQuery1prec_vta5: TFMTBCDField;
    ADOQuery1prec_agr1: TFMTBCDField;
    ADOQuery1prec_agr2: TFMTBCDField;
    ADOQuery1prec_agr3: TFMTBCDField;
    ADOQuery1prec_agr4: TFMTBCDField;
    ADOQuery1prec_agr5: TFMTBCDField;
    ADOQuery1can_agr: TFMTBCDField;
    ADOQuery1fec_des_p5: TDateTimeField;
    ADOQuery1fec_has_p5: TDateTimeField;
    ADOQuery1co_imp: TStringField;
    ADOQuery1margen_max: TBCDField;
    ADOQuery1ult_cos_un: TFMTBCDField;
    ADOQuery1fec_ult_co: TDateTimeField;
    ADOQuery1cos_pro_un: TFMTBCDField;
    ADOQuery1fec_cos_pr: TDateTimeField;
    ADOQuery1cos_merc: TFMTBCDField;
    ADOQuery1fec_cos_me: TDateTimeField;
    ADOQuery1cos_prov: TFMTBCDField;
    ADOQuery1fec_cos_p2: TDateTimeField;
    ADOQuery1ult_cos_do: TFMTBCDField;
    ADOQuery1fec_cos_do: TDateTimeField;
    ADOQuery1cos_un_an: TFMTBCDField;
    ADOQuery1fec_cos_an: TDateTimeField;
    ADOQuery1ult_cos_om: TFMTBCDField;
    ADOQuery1fec_ult_om: TDateTimeField;
    ADOQuery1cos_pro_om: TFMTBCDField;
    ADOQuery1fec_pro_om: TDateTimeField;
    ADOQuery1tipo_cos: TStringField;
    ADOQuery1mont_comi: TBCDField;
    ADOQuery1porc_cos: TBCDField;
    ADOQuery1mont_cos: TBCDField;
    ADOQuery1porc_gas: TBCDField;
    ADOQuery1mont_gas: TBCDField;
    ADOQuery1f_cost: TDateTimeField;
    ADOQuery1fisico: TBooleanField;
    ADOQuery1punt_cli: TBCDField;
    ADOQuery1punt_pro: TBCDField;
    ADOQuery1dias_repos: TIntegerField;
    ADOQuery1tipo: TStringField;
    ADOQuery1alm_prin: TStringField;
    ADOQuery1anulado: TBooleanField;
    ADOQuery1tipo_imp: TStringField;
    ADOQuery1dis_cen: TMemoField;
    ADOQuery1mon_ilc: TFMTBCDField;
    ADOQuery1capacidad: TBCDField;
    ADOQuery1grado_al: TBCDField;
    ADOQuery1tipo_licor: TStringField;
    ADOQuery1compuesto: TBooleanField;
    ADOQuery1imagen: TBlobField;
    ADOQuery1picture: TBlobField;
    ADOQuery1codigo1: TStringField;
    ADOQuery1codigo2: TStringField;
    ADOQuery1codigo3: TStringField;
    ADOQuery1codigo4: TStringField;
    ADOQuery1codigo5: TStringField;
    ADOQuery1codigo6: TStringField;
    ADOQuery1codigo7: TStringField;
    ADOQuery1codigo8: TStringField;
    ADOQuery1co_us_in: TStringField;
    ADOQuery1fe_us_in: TDateTimeField;
    ADOQuery1co_us_mo: TStringField;
    ADOQuery1fe_us_mo: TDateTimeField;
    ADOQuery1co_us_el: TStringField;
    ADOQuery1fe_us_el: TDateTimeField;
    ADOQuery1revisado: TStringField;
    ADOQuery1trasnfe: TStringField;
    ADOQuery1co_sucu: TStringField;
    ADOQuery1rowguid: TGuidField;
    ADOQuery1tuni_venta: TStringField;
    ADOQuery1equi_uni1: TFMTBCDField;
    ADOQuery1equi_uni2: TFMTBCDField;
    ADOQuery1equi_uni3: TFMTBCDField;
    ADOQuery1lote: TBooleanField;
    ADOQuery1serialp: TStringField;
    ADOQuery1valido: TBooleanField;
    ADOQuery1atributo1: TBooleanField;
    ADOQuery1vatributo1: TStringField;
    ADOQuery1atributo2: TBooleanField;
    ADOQuery1vatributo2: TStringField;
    ADOQuery1atributo3: TBooleanField;
    ADOQuery1vatributo3: TStringField;
    ADOQuery1atributo4: TBooleanField;
    ADOQuery1vatributo4: TStringField;
    ADOQuery1atributo5: TBooleanField;
    ADOQuery1vatributo5: TStringField;
    ADOQuery1atributo6: TBooleanField;
    ADOQuery1vatributo6: TStringField;
    ADOQuery1garantia: TStringField;
    ADOQuery1peso: TFMTBCDField;
    ADOQuery1pie: TFMTBCDField;
    ADOQuery1margen1: TBCDField;
    ADOQuery1margen2: TBCDField;
    ADOQuery1margen3: TBCDField;
    ADOQuery1margen4: TBCDField;
    ADOQuery1margen5: TBCDField;
    ADOQuery1row_id: TBytesField;
    ADOQuery1imagen1: TStringField;
    ADOQuery1imagen2: TStringField;
    ADOQuery1i_art_des: TStringField;
    ADOQuery1uni_emp: TStringField;
    ADOQuery1rel_emp: TFMTBCDField;
    ADOQuery1movil: TBooleanField;
    ADOQuery1tot_costo: TFMTBCDField;
    DBImage1: TDBImage;
    DBText1: TDBText;
    DataSource2: TDataSource;
    ADOQuery2: TADOQuery;
    ADOQuery2fact_num: TIntegerField;
    ADOQuery2contrib: TBooleanField;
    ADOQuery2nombre: TStringField;
    ADOQuery2rif: TStringField;
    ADOQuery2nit: TStringField;
    ADOQuery2status: TStringField;
    ADOQuery2comentario: TMemoField;
    ADOQuery2descrip: TStringField;
    ADOQuery2saldo: TBCDField;
    ADOQuery2fec_emis: TDateTimeField;
    ADOQuery2fec_venc: TDateTimeField;
    ADOQuery2co_cli: TStringField;
    ADOQuery2co_ven: TStringField;
    ADOQuery2co_tran: TStringField;
    ADOQuery2dir_ent: TMemoField;
    ADOQuery2forma_pag: TStringField;
    ADOQuery2tot_bruto: TFMTBCDField;
    ADOQuery2tot_neto: TFMTBCDField;
    ADOQuery2glob_desc: TBCDField;
    ADOQuery2tot_reca: TBCDField;
    ADOQuery2porc_gdesc: TStringField;
    ADOQuery2porc_reca: TStringField;
    ADOQuery2total_uc: TBCDField;
    ADOQuery2total_cp: TBCDField;
    ADOQuery2tot_flete: TBCDField;
    ADOQuery2monto_dev: TBCDField;
    ADOQuery2totklu: TBCDField;
    ADOQuery2anulada: TBooleanField;
    ADOQuery2impresa: TBooleanField;
    ADOQuery2iva: TBCDField;
    ADOQuery2iva_dev: TBCDField;
    ADOQuery2feccom: TDateTimeField;
    ADOQuery2numcom: TIntegerField;
    ADOQuery2tasa: TFMTBCDField;
    ADOQuery2moneda: TStringField;
    ADOQuery2cta_contab: TStringField;
    ADOQuery2seriales: TIntegerField;
    ADOQuery2tasag: TFMTBCDField;
    ADOQuery2tasag10: TFMTBCDField;
    ADOQuery2tasag20: TFMTBCDField;
    ADOQuery2campo1: TStringField;
    ADOQuery2campo2: TStringField;
    ADOQuery2campo3: TStringField;
    ADOQuery2campo4: TStringField;
    ADOQuery2campo5: TStringField;
    ADOQuery2campo6: TStringField;
    ADOQuery2campo7: TStringField;
    ADOQuery2campo8: TStringField;
    ADOQuery2co_us_in: TStringField;
    ADOQuery2fe_us_in: TDateTimeField;
    ADOQuery2co_us_mo: TStringField;
    ADOQuery2fe_us_mo: TDateTimeField;
    ADOQuery2co_us_el: TStringField;
    ADOQuery2fe_us_el: TDateTimeField;
    ADOQuery2revisado: TStringField;
    ADOQuery2trasnfe: TStringField;
    ADOQuery2co_sucu: TStringField;
    ADOQuery2rowguid: TGuidField;
    ADOQuery2mon_ilc: TFMTBCDField;
    ADOQuery2otros1: TFMTBCDField;
    ADOQuery2otros2: TFMTBCDField;
    ADOQuery2otros3: TFMTBCDField;
    ADOQuery2aux01: TFMTBCDField;
    ADOQuery2aux02: TStringField;
    ADOQuery2salestax: TStringField;
    ADOQuery2origen: TStringField;
    ADOQuery2origen_d: TStringField;
    ADOQuery2sta_prod: TStringField;
    ADOQuery2telefono: TStringField;
    procedure LimitaMovimiento(Control:TControl);
    procedure Edit1Change(Sender: TObject);
    procedure MoveControl(Sender: TObject; Button: TMouseButton;
    Shift: TShiftState; X, Y: Integer);
    procedure FormCreate(Sender: TObject);
    procedure DBGrid1DragOver(Sender, Source: TObject; X, Y: Integer;
      State: TDragState; var Accept: Boolean);
    procedure DBImage1MouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);


  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Formcotizacion: TFormcotizacion;
  Const
   coma = #39;
   MARGEN = 8;  //8 Pixels

implementation
uses unit1;

{$R *.dfm}

procedure TFormcotizacion.LimitaMovimiento(Control:TControl);
//procedure de Radikal modificada
begin
  //Que no se salga horizontalmente:
  //if Control.Left < MARGEN then Control.Left:=MARGEN-7;
  //if Control.Left+Control.Width+MARGEN > Control.Parent.Width then
    //Control.Left:=(Control.Parent.Width-Control.Width)-MARGEN;
  //Ni Verticalmente
  //if Control.Top < MARGEN then Control.Top:=MARGEN;
  //if Control.Top > Control.Parent.Height-Control.Height-(MARGEN+19) then
  //  Control.Top:=(Control.Parent.Height-Control.Height)-(MARGEN+19);
  //if Control.Top > 140 then
  //Begin
  //if Control.Name = 'DBImage1' then
  //begin
  //DBImage1.Top:= 17;
  //DBImage1.Left:= 56;
  //end;
  //End;
end;


procedure TFormcotizacion.DBGrid1DragOver(Sender, Source: TObject; X,
  Y: Integer; State: TDragState; var Accept: Boolean);
begin
    Accept := Source is tImage;
end;

procedure TFormcotizacion.DBImage1MouseDown(Sender: TObject;
  Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
      DbImage1.BeginDrag(true);
end;

procedure TFormcotizacion.Edit1Change(Sender: TObject);
begin
    if Edit1.Text <> '' then
      with ADOQuery1 do
      begin
      adoQuery1.Close;
      adoQuery1.Sql.Clear;
      adoQuery1.Sql.Add('Select * From art');
      adoQuery1.Sql.Add('where art_des like'+coma+'%'+Edit1.text+'%'+coma);
      adoquery1.Open;
      if adoQuery1.RecordCount  > 0 then
      begin
      try
      //Image1.Picture.LoadFromFile(ExtractFilePath(Application.ExeName)+'\IMAGEN\BOLSAS BLANCAS.JPEG');
      //Image1.Stretch:= True;
      except
      end;
      ADOQuery1.Close;
      adoQuery1.Sql.Clear;
      adoQuery1.Sql.Add('SELECT  TOP (200) imagen.art_des AS Expr149, imagen.foto, imagen.cod_art, art.co_art, art.art_des, art.uni_venta art ON imagen.cod_art = art.co_art');
      adoquery1.Open;
      //DBImage1.LoadPicture;
      LockWindowUpdate(0);

 end;
end;
end;

procedure TFormcotizacion.MoveControl(Sender:TObject; Button:TMouseButton;
          Shift:TShiftState; X,Y:Integer);
//procedure de Peter Morris modificada
var
  TempPanel: TPanel;
  Control: TControl;
begin
  //Aqui controlamos si debemos mover o no (ALT+Raton.BotonIzquierdo)
  //Pon la condición que quieras.
  //If (Not(ssAlt in Shift)) Then
  //Exit;
  // Releases the mouse capture from a window
  // Liberamos la captura de los eventos de raton de nuestra ventana
  ReleaseCapture;
  // If the component is a TWinControl, move it directly
  // Si el Control es del Tipo TWINCONTROL lo movemos directamente
  if Sender is TWinControl then
    Begin
      TWinControl(Sender).Perform(WM_SYSCOMMAND,$F012,0);
      LimitaMovimiento(TWinControl(Sender));
    End
   else//No es de tipo TWinControl
    try
      Control := TControl(Sender);
      TempPanel := TPanel.Create(Self);
      with TempPanel do
        begin
        //Replace the component with TempPanel
        //Incorporamos Un TPanel a la posicion donde esta el control
        Caption := '';
        BevelOuter := bvNone;
        SetBounds(Control.Left, Control.Top, Control.Width, Control.Height);
        Parent := Control.Parent;
        //Put our control in TempPanel
        //Metemos ese control en el panel temporal creado para la circunstancia
        Control.Parent := TempPanel;
        //Move TempPanel with control inside it
        //Ala, ya podemos mover el panel, ya que este si es de tipo TWinControl
        Perform(WM_SYSCOMMAND, $F012, 0);
        //Put the component where the panel was dropped
        //Una vez sabemos la posicion final del panel, la utilizamos para poner alli nuestro
        //control no-TWinControl
        Control.Parent := Parent;
        Control.Left := Left;
        Control.Top := Top;
        //LimitaMovimiento(Control);//controlamos que no se salga de la ventana.
      end;
    finally
      TempPanel.Free;
    end;
end;

procedure TFormcotizacion.FormCreate(Sender: TObject);
Var
  I : Integer;
  BaseDeDatos, ConStr : String;
begin
  For I:=0 To (ComponentCount-1) Do
    Begin
      If Components[i] Is TControl Then//Todos los controles, sean o no TWincontrol
        Begin
          TControlActual(Components[i]).OnMouseDown:=Movecontrol;
      End;
    End;
  //Esta instruccion hace que las ventanas muestren su contenido
  //cuando las movemos por el escritorio, y como los TWincontrol
  //no son más que "ventanitas", pues nos vale para poder mostrar
  //el contenido de los controles al moverlos.
  SystemParametersInfo(SPI_SETDRAGFULLWINDOWS, 1, nil, 0);
  //Create.AutoScroll:=FALSE;//para mejorar la "visibilidad"
  // conectamos con la BD
  // Obtiene la ruta y el nombre de la base de datos

end;

end.

Talvez esto pueda darle una idea del problema que tengo.
Responder Con Cita
Respuesta



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
Arrastrar y Soltar Panasys OOP 7 11-08-2011 00:03:26
Arrastrar de objetos Cheswar Gráficos 1 30-09-2007 23:03:45
arrastrar y muliseleccion palets Gráficos 2 06-06-2006 23:35:31
Arrastrar Registro vtdeleon SQL 8 13-08-2005 00:51:17
Arrastrar y Soltar!!! chechu Varios 6 21-10-2004 20:26:35


La franja horaria es GMT +2. Ahora son las 15:12:18.


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