56 lines
1.2 KiB
ObjectPascal
56 lines
1.2 KiB
ObjectPascal
|
|
unit uBizDetallesPresupuesto;
|
||
|
|
|
||
|
|
interface
|
||
|
|
|
||
|
|
uses
|
||
|
|
uDAInterfaces, uDADataTable, schPresupuestosClient_Intf;
|
||
|
|
|
||
|
|
const
|
||
|
|
BIZ_CLIENT_DETALLES_PRESUPUESTO = 'Client.DetallesPresupuesto';
|
||
|
|
|
||
|
|
type
|
||
|
|
IBizDetallesPresupuesto = interface(IPresupuestos_Detalles)
|
||
|
|
['{46C2F77A-0D5A-4872-B37A-260FC5E52CC5}']
|
||
|
|
function EsNuevo: Boolean;
|
||
|
|
end;
|
||
|
|
|
||
|
|
TBizDetallesPresupuesto = class(TPresupuestos_DetallesDataTableRules, IBizDetallesPresupuesto)
|
||
|
|
private
|
||
|
|
FContadorID: Integer;
|
||
|
|
protected
|
||
|
|
procedure OnNewRecord(Sender: TDADataTable); override;
|
||
|
|
public
|
||
|
|
function EsNuevo: Boolean;
|
||
|
|
constructor Create(aDataTable: TDADataTable); override;
|
||
|
|
end;
|
||
|
|
|
||
|
|
implementation
|
||
|
|
|
||
|
|
{ TBizDetallesPresupuesto }
|
||
|
|
|
||
|
|
uses uDataTableUtils;
|
||
|
|
|
||
|
|
constructor TBizDetallesPresupuesto.Create(aDataTable: TDADataTable);
|
||
|
|
begin
|
||
|
|
inherited Create(aDataTable);
|
||
|
|
FContadorID := -1;
|
||
|
|
end;
|
||
|
|
|
||
|
|
function TBizDetallesPresupuesto.EsNuevo: Boolean;
|
||
|
|
begin
|
||
|
|
Result := (ID < 0);
|
||
|
|
end;
|
||
|
|
|
||
|
|
procedure TBizDetallesPresupuesto.OnNewRecord(Sender: TDADataTable);
|
||
|
|
begin
|
||
|
|
inherited;
|
||
|
|
ID := FContadorID; // -1, -2, -3...
|
||
|
|
Dec(FContadorID);
|
||
|
|
end;
|
||
|
|
|
||
|
|
initialization
|
||
|
|
RegisterDataTableRules(BIZ_CLIENT_DETALLES_PRESUPUESTO, TBizDetallesPresupuesto);
|
||
|
|
|
||
|
|
|
||
|
|
end.
|