Pedidos a proveedor: mejorada la reserva para obras y dirección de entrega.

git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@741 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
David Arranz 2008-11-06 19:53:42 +00:00
parent 100a6a501e
commit 562ad3812d
7 changed files with 269 additions and 200 deletions

View File

@ -98,47 +98,11 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv
object RadioButton1: TRadioButton object RadioButton1: TRadioButton
Left = 10 Left = 10
Top = 39 Top = 39
Width = 383 Width = 231
Height = 17 Height = 17
Action = actListaObras Action = actListaObras
TabOrder = 2 TabOrder = 2
end end
object cbListaObras: TcxDBLookupComboBox
Left = 414
Top = 37
Anchors = [akLeft, akTop, akRight]
DataBinding.DataField = 'ID_ALMACEN'
DataBinding.DataSource = dsPedido
Properties.DropDownListStyle = lsFixedList
Properties.ImmediatePost = True
Properties.KeyFieldNames = 'ID'
Properties.ListColumns = <
item
FieldName = 'NOMBRE'
end>
Properties.ListOptions.AnsiSort = True
Properties.ListOptions.GridLines = glNone
Properties.ListOptions.ShowHeader = False
Properties.ListOptions.SyncMode = True
Properties.ListSource = dsObras
Properties.PostPopupValueOnTab = True
Properties.OnValidate = cbListaObrasPropertiesValidate
Style.BorderColor = clWindowFrame
Style.BorderStyle = ebs3D
Style.HotTrack = False
Style.LookAndFeel.NativeStyle = True
Style.LookAndFeel.SkinName = ''
Style.ButtonStyle = bts3D
Style.PopupBorderStyle = epbsFrame3D
StyleDisabled.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.SkinName = ''
TabOrder = 3
Width = 128
end
object edtEntregarA: TcxDBButtonEdit object edtEntregarA: TcxDBButtonEdit
Left = 10 Left = 10
Top = 209 Top = 209
@ -170,6 +134,19 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv
TabOrder = 7 TabOrder = 7
Width = 334 Width = 334
end end
object lblNombreObra: TcxDBLabel
Left = 247
Top = 37
DataBinding.DataField = 'NOMBRE_OBRA'
DataBinding.DataSource = dsPedido
Style.HotTrack = False
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
Height = 21
Width = 121
end
object dxLayoutGroup1: TdxLayoutGroup object dxLayoutGroup1: TdxLayoutGroup
ShowCaption = False ShowCaption = False
Hidden = True Hidden = True
@ -215,13 +192,12 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv
ControlOptions.AutoColor = True ControlOptions.AutoColor = True
ControlOptions.ShowBorder = False ControlOptions.ShowBorder = False
end end
object dxLayoutControl1Item6: TdxLayoutItem object dxLayoutControl1Item9: TdxLayoutItem
AutoAligns = [aaVertical] AutoAligns = []
AlignHorz = ahClient AlignHorz = ahClient
Offsets.Left = 15 AlignVert = avCenter
ShowCaption = False ShowCaption = False
Visible = False Control = lblNombreObra
Control = cbListaObras
ControlOptions.ShowBorder = False ControlOptions.ShowBorder = False
end end
end end
@ -290,6 +266,7 @@ inherited frViewDireccionEntregaPedidoProv: TfrViewDireccionEntregaPedidoProv
end end
end end
object dsPedido: TDADataSource object dsPedido: TDADataSource
OnDataChange = dsPedidoDataChange
Left = 352 Left = 352
Top = 8 Top = 8
end end

View File

@ -9,7 +9,7 @@ uses
cxDBLookupEdit, cxDBLookupComboBox, StdCtrls, cxControls, DB, uDADataTable, cxDBLookupEdit, cxDBLookupComboBox, StdCtrls, cxControls, DB, uDADataTable,
ActnList, uBizAlmacenes, uAlmacenesController, uPedidosProveedorController, ActnList, uBizAlmacenes, uAlmacenesController, uPedidosProveedorController,
Buttons, uDAInterfaces, uBizObras, uObrasController, cxButtonEdit, cxDBEdit, Buttons, uDAInterfaces, uBizObras, uObrasController, cxButtonEdit, cxDBEdit,
ExtCtrls; ExtCtrls, cxLabel, cxDBLabel;
type type
IViewDireccionEntregaPedidoProv = interface(IViewBase) IViewDireccionEntregaPedidoProv = interface(IViewBase)
@ -39,8 +39,6 @@ type
dxLayoutControl1Item5: TdxLayoutItem; dxLayoutControl1Item5: TdxLayoutItem;
dxLayoutControl1Item4: TdxLayoutItem; dxLayoutControl1Item4: TdxLayoutItem;
RadioButton1: TRadioButton; RadioButton1: TRadioButton;
dxLayoutControl1Item6: TdxLayoutItem;
cbListaObras: TcxDBLookupComboBox;
dsObras: TDADataSource; dsObras: TDADataSource;
actListaObras: TAction; actListaObras: TAction;
Bevel1: TBevel; Bevel1: TBevel;
@ -50,34 +48,36 @@ type
dxLayoutControl1Group1: TdxLayoutGroup; dxLayoutControl1Group1: TdxLayoutGroup;
dxLayoutControl1Group2: TdxLayoutGroup; dxLayoutControl1Group2: TdxLayoutGroup;
dxLayoutControl1Group3: TdxLayoutGroup; dxLayoutControl1Group3: TdxLayoutGroup;
lblNombreObra: TcxDBLabel;
dxLayoutControl1Item9: TdxLayoutItem;
procedure actListaAlmacenesExecute(Sender: TObject); procedure actListaAlmacenesExecute(Sender: TObject);
procedure actOtroExecute(Sender: TObject); procedure actOtroExecute(Sender: TObject);
procedure cbListaAlmacenesPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean); procedure cbListaAlmacenesPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
procedure cbListaObrasPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
procedure bModificarClick(Sender: TObject); procedure bModificarClick(Sender: TObject);
procedure txtDireccionDblClick(Sender: TObject); procedure txtDireccionDblClick(Sender: TObject);
procedure actListaObrasExecute(Sender: TObject); procedure actListaObrasExecute(Sender: TObject);
procedure edtEntregarAPropertiesButtonClick(Sender: TObject; procedure edtEntregarAPropertiesButtonClick(Sender: TObject;
AButtonIndex: Integer); AButtonIndex: Integer);
procedure dsPedidoDataChange(Sender: TObject; Field: TField);
protected protected
FAlmacenesController : IAlmacenesController; FAlmacenesController : IAlmacenesController;
FAlmacenes: IBizAlmacen; FAlmacenes: IBizAlmacen;
FObrasController : IObrasController; FObrasController : IObrasController;
FObras: IBizObra; FObra: IBizObra;
FPedido : IBizPedidoProveedor; FPedido : IBizPedidoProveedor;
FController : IPedidosProveedorController; FController : IPedidosProveedorController;
function GetPedidoProveedor: IBizPedidoProveedor; function GetPedidoProveedor: IBizPedidoProveedor;
procedure SetPedidoProveedor(const Value: IBizPedidoProveedor); procedure SetPedidoProveedor(const Value: IBizPedidoProveedor);
procedure CambioDireccionAlmacen; procedure CambioDireccionAlmacen;
procedure CambioDireccionObra; procedure RefrescarControles;
procedure RefrescarDireccion;
procedure PrepararObra;
procedure SetReadOnly(Value: Boolean); override; procedure SetReadOnly(Value: Boolean); override;
procedure ID_OBRAOnChange(Sender: TDACustomField); procedure RecuperarObra;
public public
property PedidoProveedor: IBizPedidoProveedor read GetPedidoProveedor write SetPedidoProveedor; property PedidoProveedor: IBizPedidoProveedor read GetPedidoProveedor write SetPedidoProveedor;
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
destructor Destroy; override; destructor Destroy; override;
procedure PrepararObra;
procedure CambioDireccionObra;
end; end;
implementation implementation
@ -90,21 +90,20 @@ uses
procedure TfrViewDireccionEntregaPedidoProv.actListaAlmacenesExecute(Sender: TObject); procedure TfrViewDireccionEntregaPedidoProv.actListaAlmacenesExecute(Sender: TObject);
begin begin
actListaAlmacenes.Checked := True; actListaAlmacenes.Checked := True;
RefrescarDireccion; RefrescarControles;
end; end;
procedure TfrViewDireccionEntregaPedidoProv.actListaObrasExecute( procedure TfrViewDireccionEntregaPedidoProv.actListaObrasExecute(
Sender: TObject); Sender: TObject);
begin begin
actListaObras.Checked := True; actListaObras.Checked := True;
RefrescarDireccion; RefrescarControles;
CambioDireccionObra; CambioDireccionObra;
end; end;
procedure TfrViewDireccionEntregaPedidoProv.actOtroExecute(Sender: TObject); procedure TfrViewDireccionEntregaPedidoProv.actOtroExecute(Sender: TObject);
begin begin
actOtro.Checked := True; actOtro.Checked := True;
// txtDireccion.Enabled := True;
if Assigned(FPedido) then if Assigned(FPedido) then
begin begin
@ -116,7 +115,7 @@ begin
FPedido.ID_ALMACEN := 0; FPedido.ID_ALMACEN := 0;
end; end;
end; end;
RefrescarDireccion; RefrescarControles;
end; end;
procedure TfrViewDireccionEntregaPedidoProv.bModificarClick(Sender: TObject); procedure TfrViewDireccionEntregaPedidoProv.bModificarClick(Sender: TObject);
@ -135,32 +134,24 @@ begin
FPedido.POBLACION := FAlmacenes.POBLACION; FPedido.POBLACION := FAlmacenes.POBLACION;
FPedido.PROVINCIA := FAlmacenes.PROVINCIA; FPedido.PROVINCIA := FAlmacenes.PROVINCIA;
FPedido.CODIGO_POSTAL := FAlmacenes.CODIGO_POSTAL; FPedido.CODIGO_POSTAL := FAlmacenes.CODIGO_POSTAL;
RefrescarDireccion; RefrescarControles;
end; end;
end; end;
procedure TfrViewDireccionEntregaPedidoProv.CambioDireccionObra; procedure TfrViewDireccionEntregaPedidoProv.CambioDireccionObra;
begin begin
if Assigned(FPedido) and Assigned(FObras) then if Assigned(FPedido) and Assigned(FObra) then
begin begin
FPedido.Edit; FPedido.Edit;
FPedido.CALLE := FObras.CALLE; FPedido.CALLE := FObra.CALLE;
FPedido.POBLACION := FObras.POBLACION; FPedido.POBLACION := FObra.POBLACION;
FPedido.POBLACION := FObras.POBLACION; FPedido.POBLACION := FObra.POBLACION;
FPedido.PROVINCIA := FObras.PROVINCIA; FPedido.PROVINCIA := FObra.PROVINCIA;
FPedido.CODIGO_POSTAL := FObras.CODIGO_POSTAL; FPedido.CODIGO_POSTAL := FObra.CODIGO_POSTAL;
RefrescarDireccion; RefrescarControles;
end; end;
end; end;
procedure TfrViewDireccionEntregaPedidoProv.cbListaObrasPropertiesValidate(
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
var Error: Boolean);
begin
if Assigned(FPedido) and Assigned(FObras) and (FPedido.ID_ALMACEN <> FObras.ID) then
CambioDireccionObra;
end;
procedure TfrViewDireccionEntregaPedidoProv.cbListaAlmacenesPropertiesValidate( procedure TfrViewDireccionEntregaPedidoProv.cbListaAlmacenesPropertiesValidate(
Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption; Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
var Error: Boolean); var Error: Boolean);
@ -179,27 +170,43 @@ begin
dsAlmacenes.DataTable := FAlmacenes.DataTable; dsAlmacenes.DataTable := FAlmacenes.DataTable;
FObrasController := TObrasController.Create; FObrasController := TObrasController.Create;
FObras := FObrasController.BuscarTodos; FObra := NIL;
FObras.DataTable.Active := True;
dsObras.DataTable := FObras.DataTable;
end; end;
destructor TfrViewDireccionEntregaPedidoProv.Destroy; destructor TfrViewDireccionEntregaPedidoProv.Destroy;
begin begin
cbListaObras.Properties.OnValidate := Nil; //cbListaObras.Properties.OnValidate := Nil;
cbListaAlmacenes.Properties.OnValidate := Nil; cbListaAlmacenes.Properties.OnValidate := Nil;
FAlmacenesController := Nil; FAlmacenesController := Nil;
FAlmacenes := Nil; FAlmacenes := Nil;
FObrasController := Nil; FObrasController := Nil;
FObras := Nil; FObra := NIL;
FController := NIL; FController := NIL;
inherited; inherited;
end; end;
procedure TfrViewDireccionEntregaPedidoProv.dsPedidoDataChange(Sender: TObject;
Field: TField);
begin
inherited;
if Assigned(Field) and (Field.FieldName = 'ID_OBRA') then
begin
PrepararObra;
if actListaObras.Enabled then
begin
if not Assigned(FObra) then
RecuperarObra;
CambioDireccionObra
end
else
FObra := NIL;
end;
end;
procedure TfrViewDireccionEntregaPedidoProv.edtEntregarAPropertiesButtonClick( procedure TfrViewDireccionEntregaPedidoProv.edtEntregarAPropertiesButtonClick(
Sender: TObject; AButtonIndex: Integer); Sender: TObject; AButtonIndex: Integer);
var var
@ -209,9 +216,15 @@ begin
inherited; inherited;
AID_Subcontrata := -1; AID_Subcontrata := -1;
{ ********************************************************* REPASAR if not FPedido.ID_OBRAIsNull then
if actListaObras.Checked then begin
AID_Subcontrata := FObras.ID_SUBCONTRATA;} RecuperarObra;
if FObrasController.LocalizarEjecucionActiva(FObra.Ejecuciones) then
begin
if not FObra.Ejecuciones.ID_SUBCONTRATAIsNull then
AID_Subcontrata := FObra.Ejecuciones.ID_SUBCONTRATA;
end;
end;
APersonaContacto := FPedido.PERSONA_CONTACTO; APersonaContacto := FPedido.PERSONA_CONTACTO;
@ -227,14 +240,16 @@ begin
Result := FPedido; Result := FPedido;
end; end;
procedure TfrViewDireccionEntregaPedidoProv.ID_OBRAOnChange( procedure TfrViewDireccionEntregaPedidoProv.RecuperarObra;
Sender: TDACustomField);
begin begin
PrepararObra; if Assigned(FObra) and (FObra.ID = FPedido.ID_OBRA) then
CambioDireccionObra; Exit; // No hace falta volver a recuperarla
FObra := FObrasController.Buscar(FPedido.ID_OBRA);
FObra.Open;
end; end;
procedure TfrViewDireccionEntregaPedidoProv.RefrescarDireccion; procedure TfrViewDireccionEntregaPedidoProv.RefrescarControles;
begin begin
txtDireccion.Caption := ''; txtDireccion.Caption := '';
if Assigned(FPedido) then if Assigned(FPedido) then
@ -243,8 +258,6 @@ begin
begin begin
cbListaAlmacenes.Enabled := False; cbListaAlmacenes.Enabled := False;
cbListaAlmacenes.Text := ''; cbListaAlmacenes.Text := '';
cbListaObras.Enabled := False;
cbListaObras.Text := '';
txtDireccion.Enabled := True; txtDireccion.Enabled := True;
txtDireccion.Caption := FPedido.CALLE; txtDireccion.Caption := FPedido.CALLE;
@ -255,8 +268,6 @@ begin
else if (actListaAlmacenes.Checked) then else if (actListaAlmacenes.Checked) then
begin begin
txtDireccion.Enabled := False; txtDireccion.Enabled := False;
cbListaObras.Enabled := False;
cbListaObras.Text := '';
cbListaAlmacenes.Enabled := True; cbListaAlmacenes.Enabled := True;
cbListaAlmacenes.DroppedDown := True; cbListaAlmacenes.DroppedDown := True;
@ -268,9 +279,6 @@ begin
txtDireccion.Enabled := False; txtDireccion.Enabled := False;
cbListaAlmacenes.Enabled := False; cbListaAlmacenes.Enabled := False;
cbListaAlmacenes.Text := ''; cbListaAlmacenes.Text := '';
cbListaObras.Enabled := True;
cbListaObras.DroppedDown := True;
end; end;
end; end;
end; end;
@ -281,34 +289,24 @@ begin
if FPedido.ID_OBRAIsNull then if FPedido.ID_OBRAIsNull then
begin begin
actListaObras.Enabled := False; actListaObras.Enabled := False;
actListaObras.Caption := 'Recibir el pedido en la dirección de la obra.';
if actListaObras.Checked then if actListaObras.Checked then
actListaAlmacenes.Execute; actListaAlmacenes.Execute;
end end
else begin else
actListaObras.Enabled := True; actListaObras.Enabled := True;
FObras.DataTable.First;
FObras.DataTable.Locate('ID', FPedido.ID_OBRA, []);
actListaObras.Caption := 'Recibir el pedido en la dirección de la obra (' + FObras.NOMBRE + ')';
end;
end; end;
procedure TfrViewDireccionEntregaPedidoProv.SetPedidoProveedor( procedure TfrViewDireccionEntregaPedidoProv.SetPedidoProveedor(
const Value: IBizPedidoProveedor); const Value: IBizPedidoProveedor);
begin begin
cbListaAlmacenes.Properties.OnValidate := NIL; cbListaAlmacenes.Properties.OnValidate := NIL;
cbListaObras.Properties.OnValidate := NIL;
dsPedido.DataTable := nil; dsPedido.DataTable := nil;
FPedido := Value; FPedido := Value;
dsPedido.DataTable := FPedido.DataTable; dsPedido.DataTable := FPedido.DataTable;
FPedido.DataTable.FieldByName('ID_OBRA').OnChange := ID_OBRAOnChange;
cbListaAlmacenes.Properties.OnValidate := cbListaAlmacenesPropertiesValidate; cbListaAlmacenes.Properties.OnValidate := cbListaAlmacenesPropertiesValidate;
cbListaObras.Properties.OnValidate := cbListaObrasPropertiesValidate;
if (FPedido.EsNuevo) then if (FPedido.EsNuevo) then
CambioDireccionAlmacen CambioDireccionAlmacen
@ -323,7 +321,7 @@ begin
actOtro.Checked := True; actOtro.Checked := True;
end; end;
PrepararObra; PrepararObra;
RefrescarDireccion; RefrescarControles;
end; end;
procedure TfrViewDireccionEntregaPedidoProv.SetReadOnly(Value: Boolean); procedure TfrViewDireccionEntregaPedidoProv.SetReadOnly(Value: Boolean);

View File

@ -1,22 +1,19 @@
inherited frViewObraReserva: TfrViewObraReserva inherited frViewObraReserva: TfrViewObraReserva
Width = 586 Width = 586
Height = 73 Height = 68
OnShow = CustomViewShow
ExplicitWidth = 586 ExplicitWidth = 586
ExplicitHeight = 73 ExplicitHeight = 68
object dxLayoutControl1: TdxLayoutControl object dxLayoutControl1: TdxLayoutControl
Left = 0 Left = 0
Top = 0 Top = 0
Width = 586 Width = 586
Height = 73 Height = 68
Align = alClient Align = alClient
ParentBackground = True ParentBackground = True
TabOrder = 0 TabOrder = 0
TabStop = False TabStop = False
AutoContentSizes = [acsWidth, acsHeight] AutoContentSizes = [acsWidth, acsHeight]
ExplicitHeight = 66
DesignSize = (
586
73)
object Label1: TLabel object Label1: TLabel
Left = 10 Left = 10
Top = 10 Top = 10
@ -24,43 +21,6 @@ inherited frViewObraReserva: TfrViewObraReserva
Height = 13 Height = 13
Caption = 'Reservar el material de este pedido para la obra:' Caption = 'Reservar el material de este pedido para la obra:'
end end
object cbListaObrasReserva: TcxDBLookupComboBox
Left = 25
Top = 31
Anchors = [akLeft, akTop, akRight]
DataBinding.DataField = 'ID_OBRA'
DataBinding.DataSource = dsPedido
Properties.DropDownListStyle = lsFixedList
Properties.ImmediatePost = True
Properties.KeyFieldNames = 'ID'
Properties.ListColumns = <
item
SortOrder = soAscending
FieldName = 'NOMBRE'
end>
Properties.ListOptions.AnsiSort = True
Properties.ListOptions.GridLines = glNone
Properties.ListOptions.ShowHeader = False
Properties.ListOptions.SyncMode = True
Properties.ListSource = dsObras
Properties.PostPopupValueOnTab = True
Properties.OnEditValueChanged = cbListaObrasReservaPropertiesEditValueChanged
Style.BorderColor = clWindowFrame
Style.BorderStyle = ebs3D
Style.HotTrack = False
Style.LookAndFeel.NativeStyle = True
Style.LookAndFeel.SkinName = ''
Style.ButtonStyle = bts3D
Style.PopupBorderStyle = epbsFrame3D
StyleDisabled.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.SkinName = ''
TabOrder = 0
Width = 168
end
object Button3: TBitBtn object Button3: TBitBtn
Left = 432 Left = 432
Top = 29 Top = 29
@ -105,6 +65,18 @@ inherited frViewObraReserva: TfrViewObraReserva
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00 FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00
FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00} FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00FF00}
end end
object cbObraReserva: TComboBox
Left = 10
Top = 31
Width = 475
Height = 21
AutoDropDown = True
AutoCloseUp = True
Style = csDropDownList
ItemHeight = 13
TabOrder = 0
OnChange = cbObraReservaChange
end
object dxLayoutGroup1: TdxLayoutGroup object dxLayoutGroup1: TdxLayoutGroup
ShowCaption = False ShowCaption = False
Hidden = True Hidden = True
@ -121,13 +93,12 @@ inherited frViewObraReserva: TfrViewObraReserva
Hidden = True Hidden = True
LayoutDirection = ldHorizontal LayoutDirection = ldHorizontal
ShowBorder = False ShowBorder = False
object dxLayoutControl1Item6: TdxLayoutItem object dxLayoutControl1Item5: TdxLayoutItem
AutoAligns = [] AutoAligns = []
AlignHorz = ahClient AlignHorz = ahClient
AlignVert = avCenter AlignVert = avCenter
Offsets.Left = 15
ShowCaption = False ShowCaption = False
Control = cbListaObrasReserva Control = cbObraReserva
ControlOptions.ShowBorder = False ControlOptions.ShowBorder = False
end end
object dxLayoutControl1Item2: TdxLayoutItem object dxLayoutControl1Item2: TdxLayoutItem
@ -144,10 +115,6 @@ inherited frViewObraReserva: TfrViewObraReserva
Left = 200 Left = 200
Top = 8 Top = 8
end end
object dsObras: TDADataSource
Left = 160
Top = 8
end
object PngImageList: TPngImageList object PngImageList: TPngImageList
PngImages = < PngImages = <
item item

View File

@ -23,27 +23,31 @@ type
dxLayoutControl1: TdxLayoutControl; dxLayoutControl1: TdxLayoutControl;
dxLayoutGroup1: TdxLayoutGroup; dxLayoutGroup1: TdxLayoutGroup;
dsPedido: TDADataSource; dsPedido: TDADataSource;
dxLayoutControl1Item6: TdxLayoutItem;
cbListaObrasReserva: TcxDBLookupComboBox;
dsObras: TDADataSource;
Label1: TLabel; Label1: TLabel;
dxLayoutControl1Item1: TdxLayoutItem; dxLayoutControl1Item1: TdxLayoutItem;
dxLayoutControl1Item2: TdxLayoutItem; dxLayoutControl1Item2: TdxLayoutItem;
Button3: TBitBtn; Button3: TBitBtn;
dxLayoutControl1Group1: TdxLayoutGroup;
PngImageList: TPngImageList; PngImageList: TPngImageList;
ActionList1: TActionList; ActionList1: TActionList;
actVerObra: TAction; actVerObra: TAction;
cbObraReserva: TComboBox;
dxLayoutControl1Item5: TdxLayoutItem;
dxLayoutControl1Group1: TdxLayoutGroup;
procedure actVerObraExecute(Sender: TObject); procedure actVerObraExecute(Sender: TObject);
procedure actVerObraUpdate(Sender: TObject); procedure actVerObraUpdate(Sender: TObject);
procedure cbListaObrasReservaPropertiesEditValueChanged(Sender: TObject); procedure cbObraReservaChange(Sender: TObject);
procedure CustomViewShow(Sender: TObject);
protected protected
FObrasController : IObrasController; FObrasController : IObrasController;
FObras: IBizObra; FListaObras : TStringList;
//FObras: IBizObra;
FPedido : IBizPedidoProveedor; FPedido : IBizPedidoProveedor;
FController : IPedidosProveedorController; FController : IPedidosProveedorController;
function GetPedidoProveedor: IBizPedidoProveedor; function GetPedidoProveedor: IBizPedidoProveedor;
procedure SetPedidoProveedor(const Value: IBizPedidoProveedor); procedure SetPedidoProveedor(const Value: IBizPedidoProveedor);
procedure CargarObra;
procedure SalvarObra;
procedure SetReadOnly(Value: Boolean); override;
public public
property PedidoProveedor: IBizPedidoProveedor read GetPedidoProveedor write SetPedidoProveedor; property PedidoProveedor: IBizPedidoProveedor read GetPedidoProveedor write SetPedidoProveedor;
constructor Create(AOwner: TComponent); override; constructor Create(AOwner: TComponent); override;
@ -59,50 +63,87 @@ uses
uStringsUtils; uStringsUtils;
procedure TfrViewObraReserva.actVerObraExecute(Sender: TObject); procedure TfrViewObraReserva.actVerObraExecute(Sender: TObject);
var
AObra : IBizObra;
AID : Integer;
begin begin
inherited; inherited;
FObrasController.Ver(FObras); AID := StrToInt(FListaObras.Values[FListaObras.Names[cbObraReserva.ItemIndex-1]]);
AObra := FObrasController.Buscar(AID);
if Assigned(AObra) then
try
FObrasController.Ver(AObra);
finally
AObra := NIL;
end;
end; end;
procedure TfrViewObraReserva.actVerObraUpdate(Sender: TObject); procedure TfrViewObraReserva.actVerObraUpdate(Sender: TObject);
begin begin
inherited; inherited;
(Sender as TAction).Enabled := Assigned(FObras) and (Sender as TAction).Enabled := Assigned(FListaObras) and
(not EsCadenaVacia(cbListaObrasReserva.Text)); (not EsCadenaVacia(cbObraReserva.Text));
end; end;
procedure TfrViewObraReserva.cbListaObrasReservaPropertiesEditValueChanged( procedure TfrViewObraReserva.CargarObra;
Sender: TObject); var
i : integer;
begin
cbObraReserva.ItemIndex := 0;
if not FPedido.Active then
FPedido.Open;
if not FPedido.ID_OBRAIsNull then
begin
for i := 0 to FListaObras.Count - 1 do
begin
if IntToStr(FPedido.ID_OBRA) = FListaObras.Values[FListaObras.Names[i]] then
begin
cbObraReserva.ItemIndex := i + 1;
Exit;
end;
end;
end;
end;
procedure TfrViewObraReserva.cbObraReservaChange(Sender: TObject);
begin begin
inherited; inherited;
{ if Assigned(FPedido) and (FPedido.Active) then SalvarObra;
begin
if not (FPedido.ID_OBRAIsNull) and (FPedido.NOMBRE_OBRA <> cbListaObrasReserva.Text) then
begin
FPedido.Edit;
FPedido.NOMBRE_OBRA := cbListaObrasReserva.Text;
end;
end;}
end; end;
constructor TfrViewObraReserva.Create(AOwner: TComponent); constructor TfrViewObraReserva.Create(AOwner: TComponent);
var
i: Integer;
begin begin
inherited; inherited;
FController := TPedidosProveedorController.Create; FController := TPedidosProveedorController.Create;
FObrasController := TObrasController.Create; FObrasController := TObrasController.Create;
FObras := FObrasController.BuscarTodos; FListaObras := FObrasController.DarListaObras;
FObras.DataTable.Active := True;
dsObras.DataTable := FObras.DataTable; cbObraReserva.Items.BeginUpdate;
try
cbObraReserva.Items.Add(''); // Para poder indicar sin obra
for i := 0 to FListaObras.Count - 1 do
cbObraReserva.Items.Add(FListaObras.Names[i]);
finally
cbObraReserva.Items.EndUpdate;
end;
end;
procedure TfrViewObraReserva.CustomViewShow(Sender: TObject);
begin
inherited;
cbObraReserva.Enabled := not Self.ReadOnly;
end; end;
destructor TfrViewObraReserva.Destroy; destructor TfrViewObraReserva.Destroy;
begin begin
cbListaObrasReserva.Properties.OnEditValueChanged := NIL;
FObrasController := Nil; FObrasController := Nil;
FObras := Nil;
FController := NIL; FController := NIL;
FreeANDNIL(FListaObras);
inherited; inherited;
end; end;
@ -111,16 +152,42 @@ begin
Result := FPedido; Result := FPedido;
end; end;
procedure TfrViewObraReserva.SalvarObra;
var
AID : String;
begin
// En el item 0 no hay nada
if (cbObraReserva.ItemIndex > 0) then
begin
AID := FListaObras.Values[FListaObras.Names[cbObraReserva.ItemIndex-1]];
FPedido.Edit;
FPedido.ID_OBRA := StrToInt(AID);
FPedido.NOMBRE_OBRA := FListaObras.Names[cbObraReserva.ItemIndex-1];
end
else begin
FPedido.Edit;
FPedido.ClearField('ID_OBRA');
FPedido.ClearField('NOMBRE_OBRA');
end;
end;
procedure TfrViewObraReserva.SetPedidoProveedor( procedure TfrViewObraReserva.SetPedidoProveedor(
const Value: IBizPedidoProveedor); const Value: IBizPedidoProveedor);
begin begin
dsPedido.DataTable := nil; dsPedido.DataTable := nil;
cbListaObrasReserva.Properties.OnEditValueChanged := NIL;
FPedido := Value; FPedido := Value;
dsPedido.DataTable := FPedido.DataTable; dsPedido.DataTable := FPedido.DataTable;
cbListaObrasReserva.Properties.OnEditValueChanged := cbListaObrasReservaPropertiesEditValueChanged; CargarObra;
end; end;
procedure TfrViewObraReserva.SetReadOnly(Value: Boolean);
begin
inherited;
if (csLoading in Self.ComponentState) then
Exit;
cbObraReserva.Enabled := not Self.ReadOnly;
end;
end. end.

View File

@ -15,7 +15,6 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
TabOrder = 0 TabOrder = 0
TabStop = False TabStop = False
AutoContentSizes = [acsWidth, acsHeight] AutoContentSizes = [acsWidth, acsHeight]
ExplicitHeight = 546
DesignSize = ( DesignSize = (
965 965
560) 560)
@ -171,6 +170,10 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
ExplicitTop = 200 ExplicitTop = 200
end end
inherited cbListaAlmacenes: TcxDBLookupComboBox inherited cbListaAlmacenes: TcxDBLookupComboBox
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
end end
inherited bModificar: TBitBtn inherited bModificar: TBitBtn
Left = 294 Left = 294
@ -179,23 +182,39 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
ExplicitTop = 164 ExplicitTop = 164
end end
inherited txtDireccion: TStaticText inherited txtDireccion: TStaticText
Height = 37 Height = 68
ExplicitHeight = 37 ExplicitHeight = 68
end end
inherited RadioButton1: TRadioButton inherited RadioButton1: TRadioButton
Width = 342 Width = 223
ExplicitWidth = 342 ExplicitWidth = 223
end end
inherited cbListaObras: TcxDBLookupComboBox inherited cbListaObras: TcxDBLookupComboBox
Left = 373 Left = 364
ExplicitLeft = 373 Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 364
ExplicitWidth = 82 ExplicitWidth = 82
Width = 82 Width = 82
end end
inherited edtEntregarA: TcxDBButtonEdit inherited edtEntregarA: TcxDBButtonEdit
Top = 231 Top = 231
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitTop = 231 ExplicitTop = 231
end end
inherited lblNombreObra: TcxDBLabel
Left = 239
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 239
end
end end
inherited ActionList1: TActionList inherited ActionList1: TActionList
Left = 72 Left = 72
@ -433,29 +452,23 @@ inherited frViewPedidoProveedor: TfrViewPedidoProveedor
Height = 72 Height = 72
ExplicitWidth = 432 ExplicitWidth = 432
ExplicitHeight = 72 ExplicitHeight = 72
DesignSize = (
432
72)
inherited Label1: TLabel inherited Label1: TLabel
Width = 235 Width = 235
ExplicitWidth = 235 ExplicitWidth = 235
end end
inherited cbListaObrasReserva: TcxDBLookupComboBox
ExplicitWidth = 397
Width = 397
end
inherited Button3: TBitBtn inherited Button3: TBitBtn
Left = 278 Left = 278
ExplicitLeft = 278 ExplicitLeft = 278
end end
inherited cbObraReserva: TComboBox
Width = 475
ExplicitWidth = 475
end
end end
inherited dsPedido: TDADataSource inherited dsPedido: TDADataSource
Left = 192 Left = 192
Top = 24 Top = 24
end end
inherited dsObras: TDADataSource
Top = 24
end
inherited PngImageList: TPngImageList inherited PngImageList: TPngImageList
Left = 224 Left = 224
Top = 24 Top = 24

View File

@ -78,6 +78,8 @@ type
procedure actVerPedidoCliUpdate(Sender: TObject); procedure actVerPedidoCliUpdate(Sender: TObject);
procedure frViewProveedorPedidoButton1Click(Sender: TObject); procedure frViewProveedorPedidoButton1Click(Sender: TObject);
procedure frViewProveedorPedidoButton2Click(Sender: TObject); procedure frViewProveedorPedidoButton2Click(Sender: TObject);
procedure frViewObraReserva1cbListaObrasReservaPropertiesEditValueChanged(
Sender: TObject);
protected protected
FPedido : IBizPedidoProveedor; FPedido : IBizPedidoProveedor;
FViewProveedorPedido : TfrViewDatosYSeleccionProveedor; FViewProveedorPedido : TfrViewDatosYSeleccionProveedor;
@ -144,6 +146,15 @@ begin
inherited; inherited;
end; end;
procedure TfrViewPedidoProveedor.frViewObraReserva1cbListaObrasReservaPropertiesEditValueChanged(
Sender: TObject);
begin
inherited;
ShowMessage('Hola');
frViewDireccionEntregaPedidoProv1.PrepararObra;
frViewDireccionEntregaPedidoProv1.CambioDireccionObra;
end;
procedure TfrViewPedidoProveedor.frViewProveedorPedidoButton1Click(Sender: TObject); procedure TfrViewPedidoProveedor.frViewProveedorPedidoButton1Click(Sender: TObject);
begin begin
if Assigned(Pedido) and Assigned(Pedido.Proveedor) and if Assigned(Pedido) and Assigned(Pedido.Proveedor) and

View File

@ -13,11 +13,19 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
273) 273)
inherited edtlNombre: TcxDBTextEdit inherited edtlNombre: TcxDBTextEdit
Left = 118 Left = 118
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
ExplicitLeft = 118 ExplicitLeft = 118
end end
inherited edtNIFCIF: TcxDBTextEdit inherited edtNIFCIF: TcxDBTextEdit
Left = 118 Left = 118
Top = 153 Top = 153
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
TabOrder = 7 TabOrder = 7
ExplicitLeft = 118 ExplicitLeft = 118
ExplicitTop = 153 ExplicitTop = 153
@ -25,6 +33,10 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
inherited edtCalle: TcxDBTextEdit inherited edtCalle: TcxDBTextEdit
Left = 118 Left = 118
Top = 180 Top = 180
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
TabOrder = 8 TabOrder = 8
ExplicitLeft = 118 ExplicitLeft = 118
ExplicitTop = 180 ExplicitTop = 180
@ -32,6 +44,10 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
inherited edtPoblacion: TcxDBTextEdit inherited edtPoblacion: TcxDBTextEdit
Left = 118 Left = 118
Top = 207 Top = 207
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
TabOrder = 9 TabOrder = 9
ExplicitLeft = 118 ExplicitLeft = 118
ExplicitTop = 207 ExplicitTop = 207
@ -39,6 +55,10 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
inherited edtProvincia: TcxDBTextEdit inherited edtProvincia: TcxDBTextEdit
Left = 118 Left = 118
Top = 234 Top = 234
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
TabOrder = 11 TabOrder = 11
ExplicitLeft = 118 ExplicitLeft = 118
ExplicitTop = 234 ExplicitTop = 234
@ -46,6 +66,10 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
inherited edtCodigoPostal: TcxDBTextEdit inherited edtCodigoPostal: TcxDBTextEdit
Left = 381 Left = 381
Top = 207 Top = 207
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.SkinName = ''
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.SkinName = ''
TabOrder = 10 TabOrder = 10
ExplicitLeft = 381 ExplicitLeft = 381
ExplicitTop = 207 ExplicitTop = 207
@ -72,10 +96,14 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
Style.BorderStyle = ebs3D Style.BorderStyle = ebs3D
Style.HotTrack = False Style.HotTrack = False
Style.LookAndFeel.NativeStyle = True Style.LookAndFeel.NativeStyle = True
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.NativeStyle = True StyleDisabled.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleDisabled.TextColor = clWindowText StyleDisabled.TextColor = clWindowText
StyleFocused.LookAndFeel.NativeStyle = True StyleFocused.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.NativeStyle = True StyleHot.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.SkinName = ''
TabOrder = 5 TabOrder = 5
Height = 21 Height = 21
Width = 585 Width = 585
@ -95,10 +123,14 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
Style.BorderStyle = ebs3D Style.BorderStyle = ebs3D
Style.HotTrack = False Style.HotTrack = False
Style.LookAndFeel.NativeStyle = True Style.LookAndFeel.NativeStyle = True
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.NativeStyle = True StyleDisabled.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleDisabled.TextColor = clWindowText StyleDisabled.TextColor = clWindowText
StyleFocused.LookAndFeel.NativeStyle = True StyleFocused.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.NativeStyle = True StyleHot.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.SkinName = ''
TabOrder = 4 TabOrder = 4
Height = 21 Height = 21
Width = 121 Width = 121
@ -118,10 +150,14 @@ inherited frViewProveedorPedido: TfrViewProveedorPedido
Style.BorderStyle = ebs3D Style.BorderStyle = ebs3D
Style.HotTrack = False Style.HotTrack = False
Style.LookAndFeel.NativeStyle = True Style.LookAndFeel.NativeStyle = True
Style.LookAndFeel.SkinName = ''
StyleDisabled.LookAndFeel.NativeStyle = True StyleDisabled.LookAndFeel.NativeStyle = True
StyleDisabled.LookAndFeel.SkinName = ''
StyleDisabled.TextColor = clWindowText StyleDisabled.TextColor = clWindowText
StyleFocused.LookAndFeel.NativeStyle = True StyleFocused.LookAndFeel.NativeStyle = True
StyleFocused.LookAndFeel.SkinName = ''
StyleHot.LookAndFeel.NativeStyle = True StyleHot.LookAndFeel.NativeStyle = True
StyleHot.LookAndFeel.SkinName = ''
TabOrder = 3 TabOrder = 3
Height = 21 Height = 21
Width = 169 Width = 169