This repository has been archived on 2024-12-02. You can view files and clone it, but cannot push or open issues or pull requests.
AlonsoYSal_FactuGES/Modulos/Pedidos a proveedor/Cliente/uViewObraPedido.pas
2007-06-21 16:02:50 +00:00

109 lines
3.0 KiB
ObjectPascal
Raw Blame History

unit uViewObraPedido;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uViewBase, ExtCtrls, StdCtrls, cxControls, cxContainer, cxEdit,
cxTextEdit, cxDBEdit, ComCtrls, ToolWin, ImgList, PngImageList, ActnList,
DB, uDADataTable, uBizPedidosProveedor, uBizPresupuestosCliente;
type
IViewObraPedido = interface(IViewBase)
['{127631C5-DDC6-44D4-B96F-70795357B2CF}']
function GetPedido: IBizPedidosProveedor;
procedure SetPedido(const Value: IBizPedidosProveedor);
property Pedido: IBizPedidosProveedor read GetPedido
write SetPedido;
end;
TfrViewObraPedido = class(TfrViewBase, IViewObraPedido)
Label5: TLabel;
Bevel1: TBevel;
ActionList1: TActionList;
actElegirObra: TAction;
actVerObra: TAction;
PngImageList: TPngImageList;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton3: TToolButton;
ToolButton2: TToolButton;
lblNombre: TLabel;
edtlReferencia: TcxTextEdit;
procedure actElegirObraExecute(Sender: TObject);
procedure actVerObraExecute(Sender: TObject);
procedure actVerObraUpdate(Sender: TObject);
private
FPedido: IBizPedidosProveedor;
function GetPedido: IBizPedidosProveedor;
procedure SetPedido(const Value: IBizPedidosProveedor);
public
property Pedido: IBizPedidosProveedor read GetPedido
write SetPedido;
end;
var
frViewObraPedido: TfrViewObraPedido;
implementation
uses uDataModulePresupuestos, schPresupuestosClient_Intf;
{$R *.dfm}
{ TfrViewPresupuestoAlbaran }
function TfrViewObraPedido.GetPedido: IBizPedidosProveedor;
begin
Result := FPedido;
end;
procedure TfrViewObraPedido.SetPedido(const Value: IBizPedidosProveedor);
begin
FPedido := Value;
if Assigned(FPedido) and (IntToStr(FPedido.CODIGOOBRA) <> '') then
edtlReferencia.Text := dmPresupuestos.GetReferencia(FPedido.CODIGOOBRA);
end;
procedure TfrViewObraPedido.actElegirObraExecute(Sender: TObject);
var
AObra : IBizPresupuestos;
begin
inherited;
if Length(edtlReferencia.Text) > 0 then
if (MessageBox(0, 'Este pedido ya tiene asociado una obra. '+#13+#10+
'<27>Desea continuar?', 'Confirmaci<63>n', MB_ICONQUESTION or MB_YESNO) = idNo) then
Exit;
AObra := dmPresupuestos.GetPresupuestosSinAlbaran;
try
if AObra.ShowForSelect = mrOK then
begin
if not (FPedido.DataTable.State in dsEditModes) then
FPedido.Edit;
// FObra.CopyFrom(APresupuesto);
FPedido.CODIGOOBRA := AObra.CODIGO;
edtlReferencia.Text := AObra.REFERENCIA;
end;
finally
AObra := NIL;
end;
end;
procedure TfrViewObraPedido.actVerObraExecute(Sender: TObject);
var
AObra : IBizPresupuestos;
begin
AObra := dmPresupuestos.GetPresupuesto(FPedido.CODIGOOBRA);
AObra.Show;
end;
procedure TfrViewObraPedido.actVerObraUpdate(Sender: TObject);
begin
inherited;
(Sender as TAction).Enabled := (Length(edtlReferencia.Text) > 0)
end;
end.