177 lines
6.3 KiB
ObjectPascal
177 lines
6.3 KiB
ObjectPascal
|
|
{
|
|||
|
|
===============================================================================
|
|||
|
|
Copyright (<EFBFBD>) 2006. Rodax Software.
|
|||
|
|
===============================================================================
|
|||
|
|
Los contenidos de este fichero son propiedad de Rodax Software titular del
|
|||
|
|
copyright. Este fichero s<EFBFBD>lo podr<EFBFBD> ser copiado, distribuido y utilizado,
|
|||
|
|
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
|
|||
|
|
acuerdo con los t<EFBFBD>rminos y condiciones establecidas en el acuerdo/contrato
|
|||
|
|
bajo el que se suministra.
|
|||
|
|
-----------------------------------------------------------------------------
|
|||
|
|
Web: www.rodax-software.com
|
|||
|
|
===============================================================================
|
|||
|
|
Fecha primera versi<EFBFBD>n: 22-05-2006
|
|||
|
|
Versi<EFBFBD>n actual: 1.0.0
|
|||
|
|
Fecha versi<EFBFBD>n actual: 22-05-2006
|
|||
|
|
===============================================================================
|
|||
|
|
Modificaciones:
|
|||
|
|
|
|||
|
|
Fecha Comentarios
|
|||
|
|
---------------------------------------------------------------------------
|
|||
|
|
===============================================================================
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
unit uViewPresupuestoContacto;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
cxGraphics, DB, uDADataTable, dxLayoutControl, cxLookupEdit, cxDBLookupEdit,
|
|||
|
|
cxDBLookupComboBox, cxMemo, cxDBEdit, cxSpinEdit, cxCalc, cxCheckBox,
|
|||
|
|
cxDropDownEdit, cxContainer, cxEdit, cxTextEdit, cxMaskEdit, cxCalendar,
|
|||
|
|
Classes, Controls, cxControls, uViewBase, uBizObra, ComCtrls, ToolWin,
|
|||
|
|
ImgList, PngImageList, ActnList;
|
|||
|
|
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
IViewPresupuestoContacto = interface(IViewBase)
|
|||
|
|
['{B1E1FA89-25F5-48FF-81ED-A7301D3DCCA5}']
|
|||
|
|
function GetPresupuestoContacto: IBizPresupuestosObra;
|
|||
|
|
procedure SetPresupuestoContacto(const Value: IBizPresupuestosObra);
|
|||
|
|
property PresupuestoContacto: IBizPresupuestosObra read GetPresupuestoContacto write SetPresupuestoContacto;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
TfrViewPresupuestoContacto = class(TfrViewBase, IViewPresupuestoContacto)
|
|||
|
|
dxLayoutControl1Group_Root: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl1: TdxLayoutControl;
|
|||
|
|
dxLayoutControl1Group1: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl1Item1: TdxLayoutItem;
|
|||
|
|
edtFecIni: TcxDBDateEdit;
|
|||
|
|
DADataSource: TDADataSource;
|
|||
|
|
cbTipoPresupuesto: TcxDBComboBox;
|
|||
|
|
dxLayoutControl1Item3: TdxLayoutItem;
|
|||
|
|
edtAceptado: TcxDBCheckBox;
|
|||
|
|
dxLayoutControl1Item2: TdxLayoutItem;
|
|||
|
|
edtPrecioIni: TcxDBCalcEdit;
|
|||
|
|
edtPrecioFin: TcxDBCalcEdit;
|
|||
|
|
edtTiempo: TcxDBSpinEdit;
|
|||
|
|
edtAplicaRetencion: TcxDBCheckBox;
|
|||
|
|
dxLayoutControl1Item5: TdxLayoutItem;
|
|||
|
|
dxLayoutControl1Item7: TdxLayoutItem;
|
|||
|
|
dxLayoutControl1Group3: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl1Group4: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl1Item8: TdxLayoutItem;
|
|||
|
|
dxLayoutControl1Item9: TdxLayoutItem;
|
|||
|
|
dxLayoutControl1Group5: TdxLayoutGroup;
|
|||
|
|
DADataSource2: TDADataSource;
|
|||
|
|
edtDescripcion: TcxDBMemo;
|
|||
|
|
dxLayoutControl1Item10: TdxLayoutItem;
|
|||
|
|
edtRetencion: TcxDBSpinEdit;
|
|||
|
|
dxLayoutControl1Item11: TdxLayoutItem;
|
|||
|
|
edtContacto: TcxDBLookupComboBox;
|
|||
|
|
dxLayoutControl1Item12: TdxLayoutItem;
|
|||
|
|
ToolBar1: TToolBar;
|
|||
|
|
ToolButton1: TToolButton;
|
|||
|
|
dxLayoutControl1Item6: TdxLayoutItem;
|
|||
|
|
dxLayoutControl1Group7: TdxLayoutGroup;
|
|||
|
|
PngImageList: TPngImageList;
|
|||
|
|
ActionList1: TActionList;
|
|||
|
|
actAnadirContacto: TAction;
|
|||
|
|
dxLayoutControl1Item13: TdxLayoutItem;
|
|||
|
|
edtImporteRet: TcxDBTextEdit;
|
|||
|
|
dxLayoutControl1Group8: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl1Group6: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl1Group2: TdxLayoutGroup;
|
|||
|
|
procedure CustomViewCreate(Sender: TObject);
|
|||
|
|
procedure edtRetencionPropertiesChange(Sender: TObject);
|
|||
|
|
procedure edtContactoPropertiesChange(Sender: TObject);
|
|||
|
|
procedure actAnadirContactoExecute(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
FPresupuestoContacto: IBizPresupuestosObra;
|
|||
|
|
function GetPresupuestoContacto: IBizPresupuestosObra;
|
|||
|
|
procedure SetPresupuestoContacto(const Value: IBizPresupuestosObra);
|
|||
|
|
public
|
|||
|
|
property PresupuestoContacto: IBizPresupuestosObra read GetPresupuestoContacto write SetPresupuestoContacto;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frViewPresupuestoContacto: TfrViewPresupuestoContacto;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
uses uDataModuleContactos, uBizContacto;
|
|||
|
|
|
|||
|
|
procedure TfrViewPresupuestoContacto.CustomViewCreate(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
cbTipoPresupuesto.Properties.Items.Add(TIPO_OBRA);
|
|||
|
|
cbTipoPresupuesto.Properties.Items.Add(TIPO_DECORACION);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfrViewPresupuestoContacto.GetPresupuestoContacto: IBizPresupuestosObra;
|
|||
|
|
begin
|
|||
|
|
Result := FPresupuestoContacto;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewPresupuestoContacto.SetPresupuestoContacto(const Value: IBizPresupuestosObra);
|
|||
|
|
begin
|
|||
|
|
FPresupuestoContacto := Value;
|
|||
|
|
|
|||
|
|
if Assigned(FPresupuestoContacto) then
|
|||
|
|
begin
|
|||
|
|
DADataSource.DataTable := FPresupuestoContacto.DataTable;
|
|||
|
|
DADataSource2.DataTable := FPresupuestoContacto.Obra.Contactos.DataTable;
|
|||
|
|
|
|||
|
|
//En caso de no tener contacto asignado se podr<64> modificar
|
|||
|
|
if FPresupuestoCONTACTO.datatable.fieldbyname(edtContacto.DataBinding.DataField).isnull then
|
|||
|
|
begin
|
|||
|
|
edtContacto.Enabled := True;
|
|||
|
|
edtContacto.Properties.OnChange := edtContactoPropertiesChange;
|
|||
|
|
edtContacto.DataBinding.Field.AsVariant := DADataSource2.DataTable.FieldByName(edtContacto.DataBinding.DataField).AsVariant;
|
|||
|
|
actAnadirContacto.Visible := True;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
edtContacto.Enabled := False;
|
|||
|
|
edtContacto.Properties.OnChange := Nil;
|
|||
|
|
actAnadirContacto.Visible := False;
|
|||
|
|
end;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
DADataSource.DataTable := Nil;
|
|||
|
|
DADataSource2.DataTable := Nil;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewPresupuestoContacto.edtRetencionPropertiesChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if edtAplicaRetencion.Checked then
|
|||
|
|
begin
|
|||
|
|
edtRetencion.Enabled := True;
|
|||
|
|
edtTiempo.Enabled := True;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
begin
|
|||
|
|
// edtRetencion.DataBinding.Field.AsInteger := 0;
|
|||
|
|
edtRetencion.Enabled := False;
|
|||
|
|
edtTiempo.Enabled := False;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewPresupuestoContacto.edtContactoPropertiesChange(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if PresupuestoContacto.DataTable.State in dsEditModes then
|
|||
|
|
PresupuestoContacto.NOMBRE := edtContacto.Text;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewPresupuestoContacto.actAnadirContactoExecute(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
PresupuestoContacto.AdjuntarContacto;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|