git-svn-id: https://192.168.0.254/svn/Proyectos.AbetoDesign_FactuGES/trunk@58 93f398dd-4eb6-7a46-baf6-13f46f578da2
176 lines
4.7 KiB
ObjectPascal
176 lines
4.7 KiB
ObjectPascal
unit uBizDetallesPresupuestoCliente;
|
|
|
|
interface
|
|
|
|
uses
|
|
uDADataTable, schPresupuestosClienteClient_Intf;
|
|
|
|
const
|
|
BIZ_CLIENT_PROPIEDADES = 'Client.Propiedades';
|
|
BIZ_CLIENT_VALORES = 'Client.Valores';
|
|
BIZ_CLIENT_CAPITULOS = 'Client.Capitulos';
|
|
BIZ_CLIENT_DETALLES_PRESUPUESTO_CLIENTE = 'Client.PresupuestoCliente.Detalles';
|
|
|
|
TIPO_CAPITULO_AF = 'AF'; //FRENTE DE ARMARIO
|
|
TIPO_CAPITULO_AI = 'AI'; //INTERIOR DE ARMARIO
|
|
TIPO_CAPITULO_B = 'B'; //BAÑO
|
|
TIPO_CAPITULO_C = 'C'; //COCINA
|
|
TIPO_CAPITULO_E = 'E'; //ELECTRODOMÉSTICOS
|
|
TIPO_CAPITULO_V = 'V'; //VARIOS
|
|
TIPO_CAPITULO_C_VACIO = 'CV'; //COCINAVACIO
|
|
TIPO_CAPITULO_O = 'O'; //OBRA
|
|
|
|
type
|
|
IBizValores = interface(IValores)
|
|
['{24C5CEDF-9A20-447B-9291-C42967D52748}']
|
|
end;
|
|
|
|
IBizPropiedades = interface(IPropiedades)
|
|
['{A3EAE8BB-A19C-45B4-AB62-6C40962D2E80}']
|
|
function GetValores: IBizValores;
|
|
procedure SetValores(Value: IBizValores);
|
|
property Valores: IBizValores read GetValores write SetValores;
|
|
end;
|
|
|
|
IBizCapitulo = interface(ICapitulosPresupuesto)
|
|
['{FE35D755-7781-441F-960C-98F847A5039E}']
|
|
function GetTipo: String;
|
|
procedure SetTipo(Value: String);
|
|
property Tipo: String read GetTipo write SetTipo;
|
|
end;
|
|
|
|
IBizDetallesPresupuestoCliente = interface(IPresupuestosCliente_Detalles)
|
|
['{2D7781DC-AD16-4857-9567-5C1620319781}']
|
|
end;
|
|
|
|
TBizValores = class(TValoresDataTableRules, IBizValores)
|
|
end;
|
|
|
|
TBizPropiedades = class(TPropiedadesDataTableRules, IBizPropiedades)
|
|
protected
|
|
FValores : IBizValores;
|
|
FValoresLink : TDADataSource;
|
|
|
|
function GetValores: IBizValores;
|
|
procedure SetValores(Value: IBizValores);
|
|
|
|
public
|
|
property Valores: IBizValores read GetValores write SetValores;
|
|
|
|
constructor Create(aDataTable: TDADataTable); override;
|
|
destructor Destroy; override;
|
|
end;
|
|
|
|
TBizCapitulo = class(TCapitulosPresupuestoDataTableRules, IBizCapitulo)
|
|
protected
|
|
FTipo : String;
|
|
function GetTipo: String;
|
|
procedure SetTipo(Value: String);
|
|
procedure OnNewRecord(Sender: TDADataTable); override;
|
|
public
|
|
property Tipo: String read GetTipo write SetTipo;
|
|
constructor Create(aDataTable: TDADataTable); override;
|
|
end;
|
|
|
|
TBizDetallesPresupuestoCliente = class(TPresupuestosCliente_DetallesDataTableRules, IBizDetallesPresupuestoCliente)
|
|
protected
|
|
procedure OnNewRecord(Sender: TDADataTable); override;
|
|
procedure BeforeInsert(Sender: TDADataTable); override;
|
|
end;
|
|
|
|
|
|
implementation
|
|
|
|
{ TBizDetallesPresupuestoCliente }
|
|
|
|
uses
|
|
Dialogs, DB, uDataTableUtils, SysUtils, JclStrings,
|
|
uBizPresupuestosCliente, uControllerDetallesBase;
|
|
|
|
procedure TBizDetallesPresupuestoCliente.BeforeInsert(Sender: TDADataTable);
|
|
var
|
|
AMasterTable : TDADataTable;
|
|
begin
|
|
inherited;
|
|
AMasterTable := DataTable.GetMasterDataTable;
|
|
if Assigned(AMasterTable) and (AMasterTable.State = dsInsert) then
|
|
AMasterTable.Post;
|
|
end;
|
|
|
|
procedure TBizDetallesPresupuestoCliente.OnNewRecord(Sender: TDADataTable);
|
|
var
|
|
AMasterTable : TDADataTable;
|
|
|
|
begin
|
|
inherited;
|
|
VISIBLE := 1;
|
|
|
|
AMasterTable := DataTable.GetMasterDataTable;
|
|
// if (TIPO_DETALLE = TIPO_DETALLE_CONCEPTO)
|
|
if Assigned(AMasterTable)
|
|
and Assigned((AMasterTable as IBizPresupuestoCliente).Cliente)
|
|
and ((AMasterTable as IBizPresupuestoCliente).Cliente.DESCUENTO_LINEA > 0) then
|
|
DESCUENTO := (AMasterTable as IBizPresupuestoCliente).Cliente.DESCUENTO_LINEA;
|
|
end;
|
|
|
|
{ TBizPropiedades }
|
|
|
|
constructor TBizPropiedades.Create(aDataTable: TDADataTable);
|
|
begin
|
|
inherited;
|
|
|
|
FValoresLink := TDADataSource.Create(NIL);
|
|
FValoresLink.DataTable := aDataTable;
|
|
end;
|
|
|
|
destructor TBizPropiedades.Destroy;
|
|
begin
|
|
FValores := NIL;
|
|
FValoresLink.Free;
|
|
|
|
inherited;
|
|
end;
|
|
|
|
function TBizPropiedades.GetValores: IBizValores;
|
|
begin
|
|
Result := FValores;
|
|
end;
|
|
|
|
procedure TBizPropiedades.SetValores(Value: IBizValores);
|
|
begin
|
|
FValores := Value;
|
|
EnlazarMaestroDetalle(FValoresLink, FValores);
|
|
end;
|
|
|
|
{ TBizCapitulo }
|
|
|
|
constructor TBizCapitulo.Create(aDataTable: TDADataTable);
|
|
begin
|
|
inherited;
|
|
FTipo := TIPO_CAPITULO_V;
|
|
end;
|
|
|
|
function TBizCapitulo.GetTipo: String;
|
|
begin
|
|
Result := FTipo;
|
|
end;
|
|
|
|
procedure TBizCapitulo.OnNewRecord(Sender: TDADataTable);
|
|
begin
|
|
inherited;
|
|
TIPO_ARTICULO := FTipo;
|
|
end;
|
|
|
|
procedure TBizCapitulo.SetTipo(Value: String);
|
|
begin
|
|
FTipo := Value;
|
|
end;
|
|
|
|
initialization
|
|
RegisterDataTableRules(BIZ_CLIENT_DETALLES_PRESUPUESTO_CLIENTE, TBizDetallesPresupuestoCliente);
|
|
RegisterDataTableRules(BIZ_CLIENT_PROPIEDADES, TBizPropiedades);
|
|
RegisterDataTableRules(BIZ_CLIENT_VALORES, TBizValores);
|
|
RegisterDataTableRules(BIZ_CLIENT_CAPITULOS, TBizCapitulo);
|
|
|
|
end.
|