- Usar el nuevo servicio de gestión de referencias en los módulos de la aplicación
- En la BD, añadir clave primario ID y generador para la table REFERENCIAS git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@69 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
08891f5662
commit
9a8b866380
2623
Build/Build.fbp5
2623
Build/Build.fbp5
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -9,21 +9,13 @@ const
|
||||
{ Data table rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferencia = '{A693E269-BAF7-46A1-84E5-DBC746856BE3}';
|
||||
RID_AlbaranesCliente = '{1D19F302-9D09-4E86-9602-98B88C9FF5E7}';
|
||||
RID_AlbaranesCliente_Detalles = '{DFBF54C4-E8F9-47BA-9920-89709FB21148}';
|
||||
RID_AlbaranesCliente = '{075163FA-70D9-40DC-999D-5CAB8882B53C}';
|
||||
RID_AlbaranesCliente_Detalles = '{40889198-AE9A-45C6-A6DE-31DE39AF5323}';
|
||||
|
||||
{ Data table names }
|
||||
nme_DarReferencia = 'DarReferencia';
|
||||
nme_AlbaranesCliente = 'AlbaranesCliente';
|
||||
nme_AlbaranesCliente_Detalles = 'AlbaranesCliente_Detalles';
|
||||
|
||||
{ DarReferencia fields }
|
||||
fld_DarReferenciaVALOR = 'VALOR';
|
||||
|
||||
{ DarReferencia field indexes }
|
||||
idx_DarReferenciaVALOR = 0;
|
||||
|
||||
{ AlbaranesCliente fields }
|
||||
fld_AlbaranesClienteID = 'ID';
|
||||
fld_AlbaranesClienteID_EMPRESA = 'ID_EMPRESA';
|
||||
@ -139,44 +131,9 @@ const
|
||||
idx_AlbaranesCliente_DetallesREFERENCIA_PROVEEDOR = 13;
|
||||
|
||||
type
|
||||
{ IDarReferencia }
|
||||
IDarReferencia = interface(IDAStronglyTypedDataTable)
|
||||
['{15B4231D-DD94-42A2-9AC2-4C32AFB4B267}']
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String;
|
||||
procedure SetVALORValue(const aValue: String);
|
||||
function GetVALORIsNull: Boolean;
|
||||
procedure SetVALORIsNull(const aValue: Boolean);
|
||||
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
TDarReferenciaDataTableRules = class(TIntfObjectDADataTableRules, IDarReferencia)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aDataTable: TDADataTable); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IAlbaranesCliente }
|
||||
IAlbaranesCliente = interface(IDAStronglyTypedDataTable)
|
||||
['{26F46D95-DBBE-40FD-BB99-EEC4B6EE75CD}']
|
||||
['{9E47C30E-71A9-4677-978C-7E91AF2A9ABE}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -667,7 +624,7 @@ type
|
||||
|
||||
{ IAlbaranesCliente_Detalles }
|
||||
IAlbaranesCliente_Detalles = interface(IDAStronglyTypedDataTable)
|
||||
['{C442C7DF-32BE-4A00-8446-3DA2F08508AC}']
|
||||
['{75F4E552-56D6-47A3-9D76-77310590BF15}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -860,39 +817,6 @@ implementation
|
||||
|
||||
uses Variants, uROBinaryHelpers;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
constructor TDarReferenciaDataTableRules.Create(aDataTable: TDADataTable);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaDataTableRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORValue: String;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].AsString;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsString := aValue;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORIsNull: boolean;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].IsNull;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsVariant := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TAlbaranesClienteDataTableRules }
|
||||
constructor TAlbaranesClienteDataTableRules.Create(aDataTable: TDADataTable);
|
||||
var
|
||||
@ -2043,7 +1967,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterDataTableRules(RID_DarReferencia, TDarReferenciaDataTableRules);
|
||||
RegisterDataTableRules(RID_AlbaranesCliente, TAlbaranesClienteDataTableRules);
|
||||
RegisterDataTableRules(RID_AlbaranesCliente_Detalles, TAlbaranesCliente_DetallesDataTableRules);
|
||||
|
||||
|
||||
@ -9,48 +9,13 @@ const
|
||||
{ Delta rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferenciaDelta = '{95530CA0-F6C5-439B-ACE3-8DD1B50D65AC}';
|
||||
RID_AlbaranesClienteDelta = '{9E1A105B-7BE6-4100-BED9-9EB5E4517371}';
|
||||
RID_AlbaranesCliente_DetallesDelta = '{4FD893A0-294F-4ACF-8656-9DC37A524688}';
|
||||
RID_AlbaranesClienteDelta = '{9D0691A8-4F4E-4F30-84A1-BCBA842729F3}';
|
||||
RID_AlbaranesCliente_DetallesDelta = '{424240C2-D81F-4084-B7A9-510E394C566F}';
|
||||
|
||||
type
|
||||
{ IDarReferenciaDelta }
|
||||
IDarReferenciaDelta = interface(IDarReferencia)
|
||||
['{95530CA0-F6C5-439B-ACE3-8DD1B50D65AC}']
|
||||
{ Property getters and setters }
|
||||
function GetOldVALORValue : String;
|
||||
|
||||
{ Properties }
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
TDarReferenciaBusinessProcessorRules = class(TDABusinessProcessorRules, IDarReferencia, IDarReferenciaDelta)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
function GetOldVALORValue: String; virtual;
|
||||
function GetOldVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR : String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull : Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
property OldVALORIsNull : Boolean read GetOldVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IAlbaranesClienteDelta }
|
||||
IAlbaranesClienteDelta = interface(IAlbaranesCliente)
|
||||
['{9E1A105B-7BE6-4100-BED9-9EB5E4517371}']
|
||||
['{9D0691A8-4F4E-4F30-84A1-BCBA842729F3}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_EMPRESAValue : Integer;
|
||||
@ -542,7 +507,7 @@ type
|
||||
|
||||
{ IAlbaranesCliente_DetallesDelta }
|
||||
IAlbaranesCliente_DetallesDelta = interface(IAlbaranesCliente_Detalles)
|
||||
['{4FD893A0-294F-4ACF-8656-9DC37A524688}']
|
||||
['{424240C2-D81F-4084-B7A9-510E394C566F}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_ALBARANValue : Integer;
|
||||
@ -735,49 +700,6 @@ implementation
|
||||
uses
|
||||
Variants, uROBinaryHelpers, uDAInterfaces;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
constructor TDarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaBusinessProcessorRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := aValue;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TAlbaranesClienteBusinessProcessorRules }
|
||||
constructor TAlbaranesClienteBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
var
|
||||
@ -2460,7 +2382,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(RID_DarReferenciaDelta, TDarReferenciaBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_AlbaranesClienteDelta, TAlbaranesClienteBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_AlbaranesCliente_DetallesDelta, TAlbaranesCliente_DetallesBusinessProcessorRules);
|
||||
|
||||
|
||||
@ -8,73 +8,107 @@ uses
|
||||
|
||||
const
|
||||
BIZ_SERVER_ALBARAN_CLIENTE = 'Server.AlbaranCliente';
|
||||
REF_ALBARANES_CLIENTE = 'REF_ALBARANES_CLIENTE';
|
||||
REF_ALBARANES_DEV_CLIENTE = 'REF_ALBARANES_DEV_CLIENTE';
|
||||
|
||||
type
|
||||
TBizAlbaranClienteServer = class(TAlbaranesClienteBusinessProcessorRules)
|
||||
private
|
||||
FReferenciaAutomatica : Boolean;
|
||||
function DarReferencia : String;
|
||||
function IncrementarReferencia : Boolean;
|
||||
protected
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta); override;
|
||||
procedure AfterProcessChange(Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Variants, uDAClasses, uReferenciasUtils, uBusinessUtils, uROClasses, uDataModuleServer,
|
||||
schAlbaranesClienteClient_Intf;
|
||||
schAlbaranesClienteClient_Intf, srvReferencias_Impl;
|
||||
|
||||
const
|
||||
REF_ALBARANES_CLIENTE = 'REF_ALBARANES_CLIENTE';
|
||||
REF_ALBARANES_DEV_CLIENTE = 'REF_ALBARANES_DEV_CLIENTE';
|
||||
|
||||
{ TBizAlbaranClienteServer }
|
||||
|
||||
procedure TBizAlbaranClienteServer.BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
Empresa : Variant;
|
||||
CodigoReferencia: String;
|
||||
|
||||
procedure TBizAlbaranClienteServer.AfterProcessChange(
|
||||
Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
{ Por defecto, mantenemos los deltas por si alguna tabla hija los necesita }
|
||||
CanRemoveFromDelta := False;
|
||||
|
||||
case aChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
if FReferenciaAutomatica then
|
||||
begin
|
||||
IncrementarReferencia;
|
||||
FReferenciaAutomatica := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
procedure TBizAlbaranClienteServer.BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
FReferenciaAutomatica := False;
|
||||
|
||||
case Sender.CurrentChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
//Si la referencia no ha sido asignada le asignamos una nosotros
|
||||
if (VarIsNull(Sender.CurrentChange.NewValueByName[fld_AlbaranesClienteREFERENCIA]))
|
||||
or (VarToStr(Sender.CurrentChange.NewValueByName[fld_AlbaranesClienteREFERENCIA]) = '') then
|
||||
if REFERENCIAIsNull or (Length(REFERENCIA) = 0) then
|
||||
begin
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
try
|
||||
//Siempre va a estar rellena
|
||||
Empresa := Sender.CurrentChange.NewValueByName[fld_AlbaranesClienteID_EMPRESA];
|
||||
if (Sender.CurrentChange.NewValueByName[fld_AlbaranesClienteIMPORTE_TOTAL] < 0) then
|
||||
CodigoReferencia := REF_ALBARANES_DEV_CLIENTE
|
||||
else
|
||||
CodigoReferencia := REF_ALBARANES_CLIENTE;
|
||||
|
||||
dsData := ASchema.NewDataset(ACurrentConn, 'DarReferencia', ['CODIGO', 'EMPRESA'], [CodigoReferencia, Empresa]);
|
||||
except
|
||||
RaiseError('No existe la tabla REFERENCIAS');
|
||||
end;
|
||||
|
||||
dsData.Active := True;
|
||||
|
||||
if dsData.IsEmpty then
|
||||
RaiseError('NO HAY REFERENCIA ' + CodigoReferencia + ' DECLARADA EN TABLA REFERENCIAS');
|
||||
|
||||
REFERENCIA := dsData.FieldByName(fld_DarReferenciaVALOR).AsString;
|
||||
|
||||
try
|
||||
ASchema.NewCommand(ACurrentConn, 'ModificarReferencia', ['CODIGO', 'VALOR', 'EMPRESA'], [CodigoReferencia, DarReferenciaSiguiente(REFERENCIA), Empresa]);
|
||||
except
|
||||
RaiseError('Error al asignar la nueva ' + REFERENCIA + ' referencia en tabla');
|
||||
end;
|
||||
|
||||
FReferenciaAutomatica := True;
|
||||
REFERENCIA := DarReferencia;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function TBizAlbaranClienteServer.DarReferencia: String;
|
||||
var
|
||||
ACodigoReferencia : String;
|
||||
begin
|
||||
if (IMPORTE_TOTAL < 0) then
|
||||
ACodigoReferencia := REF_ALBARANES_DEV_CLIENTE
|
||||
else
|
||||
ACodigoReferencia := REF_ALBARANES_CLIENTE;
|
||||
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := DarNuevaReferencia(ACodigoReferencia, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function TBizAlbaranClienteServer.IncrementarReferencia: Boolean;
|
||||
var
|
||||
ACodigoReferencia : String;
|
||||
begin
|
||||
if (IMPORTE_TOTAL < 0) then
|
||||
ACodigoReferencia := REF_ALBARANES_DEV_CLIENTE
|
||||
else
|
||||
ACodigoReferencia := REF_ALBARANES_CLIENTE;
|
||||
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := IncrementarValorReferencia(ACodigoReferencia,
|
||||
Self.REFERENCIA, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(BIZ_SERVER_ALBARAN_CLIENTE, TBizAlbaranClienteServer);
|
||||
|
||||
|
||||
@ -14,40 +14,6 @@ object srvAlbaranesCliente: TsrvAlbaranesCliente
|
||||
ConnectionManager = dmServer.ConnectionManager
|
||||
DataDictionary = DADataDictionary
|
||||
Datasets = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'SELECT'#10' VALOR'#10'FROM'#10' REFERENCIAS'#10'WHERE'#10' CODIGO = :COD' +
|
||||
'IGO'#10'AND ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'VALOR'
|
||||
TableField = 'VALOR'
|
||||
end>
|
||||
end>
|
||||
Name = 'DarReferencia'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <>
|
||||
Statements = <
|
||||
@ -591,32 +557,6 @@ object srvAlbaranesCliente: TsrvAlbaranesCliente
|
||||
JoinDataTables = <>
|
||||
UnionDataTables = <>
|
||||
Commands = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'UPDATE REFERENCIAS SET'#10' VALOR = :VALOR'#10'WHERE CODIGO = :COD' +
|
||||
'IGO AND'#10' ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'ModificarReferencia'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
|
||||
@ -30,7 +30,6 @@ type
|
||||
procedure DataAbstractServiceBeforeAcquireConnection(aSender: TObject; var aConnectionName: string);
|
||||
procedure DARemoteServiceBeforeGetDatasetData(const Dataset: IDADataset; const IncludeSchema: Boolean; const MaxRecords: Integer);
|
||||
procedure DARemoteServiceCreate(Sender: TObject);
|
||||
private
|
||||
protected
|
||||
{ IsrvAlbaranesCliente methods }
|
||||
function GenerateReport(const ID: String): Binary;
|
||||
@ -46,6 +45,12 @@ uses
|
||||
// uRptAlbaranesCliente_Server,
|
||||
uBizAlbaranClienteServer;
|
||||
|
||||
const
|
||||
REF_ALBARANES_CLIENTE = 'REF_ALBARANES_CLIENTE';
|
||||
REF_ALBARANES_DEV_CLIENTE = 'REF_ALBARANES_DEV_CLIENTE';
|
||||
|
||||
|
||||
|
||||
procedure Create_srvAlbaranesCliente(out anInstance : IUnknown);
|
||||
begin
|
||||
anInstance := TsrvAlbaranesCliente.Create(NIL);
|
||||
|
||||
@ -9,21 +9,13 @@ const
|
||||
{ Data table rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferencia = '{E264DAAA-A65A-4F97-8399-054CD6715754}';
|
||||
RID_AlbaranesProveedor = '{8070DE55-5BC2-4DCA-B26F-B6E77353CD13}';
|
||||
RID_AlbaranesProveedor_Detalles = '{B5916447-B176-439A-8E99-A6CDA1527B86}';
|
||||
RID_AlbaranesProveedor = '{5D89B51C-1BBF-4965-9ACB-E1001B5BB710}';
|
||||
RID_AlbaranesProveedor_Detalles = '{F59ECE23-B806-40E7-B93E-B6544F6AF9EF}';
|
||||
|
||||
{ Data table names }
|
||||
nme_DarReferencia = 'DarReferencia';
|
||||
nme_AlbaranesProveedor = 'AlbaranesProveedor';
|
||||
nme_AlbaranesProveedor_Detalles = 'AlbaranesProveedor_Detalles';
|
||||
|
||||
{ DarReferencia fields }
|
||||
fld_DarReferenciaVALOR = 'VALOR';
|
||||
|
||||
{ DarReferencia field indexes }
|
||||
idx_DarReferenciaVALOR = 0;
|
||||
|
||||
{ AlbaranesProveedor fields }
|
||||
fld_AlbaranesProveedorID = 'ID';
|
||||
fld_AlbaranesProveedorID_EMPRESA = 'ID_EMPRESA';
|
||||
@ -133,44 +125,9 @@ const
|
||||
idx_AlbaranesProveedor_DetallesREFERENCIA_PROVEEDOR = 13;
|
||||
|
||||
type
|
||||
{ IDarReferencia }
|
||||
IDarReferencia = interface(IDAStronglyTypedDataTable)
|
||||
['{87BCEB3E-3FAF-44FF-A992-70B549FF79CE}']
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String;
|
||||
procedure SetVALORValue(const aValue: String);
|
||||
function GetVALORIsNull: Boolean;
|
||||
procedure SetVALORIsNull(const aValue: Boolean);
|
||||
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
TDarReferenciaDataTableRules = class(TIntfObjectDADataTableRules, IDarReferencia)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aDataTable: TDADataTable); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IAlbaranesProveedor }
|
||||
IAlbaranesProveedor = interface(IDAStronglyTypedDataTable)
|
||||
['{91E3DC89-DDB4-4727-88A3-1931B49B7F08}']
|
||||
['{3AAA0A9E-4414-45B7-B5CB-A7A2B174ABD0}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -625,7 +582,7 @@ type
|
||||
|
||||
{ IAlbaranesProveedor_Detalles }
|
||||
IAlbaranesProveedor_Detalles = interface(IDAStronglyTypedDataTable)
|
||||
['{A644C742-27E7-449C-9A6B-ED24143E13CD}']
|
||||
['{7D0DD573-4F12-44EB-9355-C334C92E18C0}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -818,39 +775,6 @@ implementation
|
||||
|
||||
uses Variants, uROBinaryHelpers;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
constructor TDarReferenciaDataTableRules.Create(aDataTable: TDADataTable);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaDataTableRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORValue: String;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].AsString;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsString := aValue;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORIsNull: boolean;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].IsNull;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsVariant := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TAlbaranesProveedorDataTableRules }
|
||||
constructor TAlbaranesProveedorDataTableRules.Create(aDataTable: TDADataTable);
|
||||
var
|
||||
@ -1938,7 +1862,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterDataTableRules(RID_DarReferencia, TDarReferenciaDataTableRules);
|
||||
RegisterDataTableRules(RID_AlbaranesProveedor, TAlbaranesProveedorDataTableRules);
|
||||
RegisterDataTableRules(RID_AlbaranesProveedor_Detalles, TAlbaranesProveedor_DetallesDataTableRules);
|
||||
|
||||
|
||||
@ -9,48 +9,13 @@ const
|
||||
{ Delta rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferenciaDelta = '{AD9EC61F-92A8-4757-A729-430A9C0F1014}';
|
||||
RID_AlbaranesProveedorDelta = '{6120285E-A519-4B85-96C3-9568FD81A17F}';
|
||||
RID_AlbaranesProveedor_DetallesDelta = '{CEDDEB44-9AE4-468F-A241-3235B7D100D6}';
|
||||
RID_AlbaranesProveedorDelta = '{54AAD20A-09DB-4C98-B452-D36229C7A4F3}';
|
||||
RID_AlbaranesProveedor_DetallesDelta = '{903174F0-DB0A-491D-9C1E-222E145262F6}';
|
||||
|
||||
type
|
||||
{ IDarReferenciaDelta }
|
||||
IDarReferenciaDelta = interface(IDarReferencia)
|
||||
['{AD9EC61F-92A8-4757-A729-430A9C0F1014}']
|
||||
{ Property getters and setters }
|
||||
function GetOldVALORValue : String;
|
||||
|
||||
{ Properties }
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
TDarReferenciaBusinessProcessorRules = class(TDABusinessProcessorRules, IDarReferencia, IDarReferenciaDelta)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
function GetOldVALORValue: String; virtual;
|
||||
function GetOldVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR : String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull : Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
property OldVALORIsNull : Boolean read GetOldVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IAlbaranesProveedorDelta }
|
||||
IAlbaranesProveedorDelta = interface(IAlbaranesProveedor)
|
||||
['{6120285E-A519-4B85-96C3-9568FD81A17F}']
|
||||
['{54AAD20A-09DB-4C98-B452-D36229C7A4F3}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_EMPRESAValue : Integer;
|
||||
@ -506,7 +471,7 @@ type
|
||||
|
||||
{ IAlbaranesProveedor_DetallesDelta }
|
||||
IAlbaranesProveedor_DetallesDelta = interface(IAlbaranesProveedor_Detalles)
|
||||
['{CEDDEB44-9AE4-468F-A241-3235B7D100D6}']
|
||||
['{903174F0-DB0A-491D-9C1E-222E145262F6}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_ALBARANValue : Integer;
|
||||
@ -699,49 +664,6 @@ implementation
|
||||
uses
|
||||
Variants, uROBinaryHelpers, uDAInterfaces;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
constructor TDarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaBusinessProcessorRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := aValue;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TAlbaranesProveedorBusinessProcessorRules }
|
||||
constructor TAlbaranesProveedorBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
var
|
||||
@ -2331,7 +2253,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(RID_DarReferenciaDelta, TDarReferenciaBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_AlbaranesProveedorDelta, TAlbaranesProveedorBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_AlbaranesProveedor_DetallesDelta, TAlbaranesProveedor_DetallesBusinessProcessorRules);
|
||||
|
||||
|
||||
@ -8,74 +8,106 @@ uses
|
||||
|
||||
const
|
||||
BIZ_SERVER_ALBARAN_PROVEEDOR = 'Server.AlbaranProveedor';
|
||||
REF_ALBARANES_PROVEEDOR = 'REF_ALBARANES_PROVEEDOR';
|
||||
REF_ALBARANES_DEV_PROVEEDOR = 'REF_ALBARANES_DEV_PROVEEDOR';
|
||||
|
||||
type
|
||||
TBizAlbaranProveedorServer = class(TFacturasClienteBusinessProcessorRules)
|
||||
private
|
||||
FReferenciaAutomatica : Boolean;
|
||||
function DarReferencia : String;
|
||||
function IncrementarReferencia : Boolean;
|
||||
protected
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta); override;
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor;
|
||||
const aDelta: IDADelta); override;
|
||||
procedure AfterProcessChange(Sender: TDABusinessProcessor;
|
||||
aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Dialogs, SysUtils, Variants, uDataModuleServer, uDAClasses, DARemoteService_Impl,
|
||||
schAlbaranesProveedorClient_Intf, uBusinessUtils, uReferenciasUtils, uROClasses;
|
||||
Dialogs, SysUtils, Variants, uDataModuleServer, uDAClasses,
|
||||
schAlbaranesProveedorClient_Intf, uBusinessUtils, uReferenciasUtils, uROClasses,
|
||||
srvReferencias_Impl;
|
||||
|
||||
const
|
||||
REF_ALBARANES_PROVEEDOR = 'REF_ALBARANES_PROVEEDOR';
|
||||
REF_ALBARANES_DEV_PROVEEDOR = 'REF_ALBARANES_DEV_PROVEEDOR';
|
||||
|
||||
{ TBizFacturasClienteServer }
|
||||
|
||||
procedure TBizAlbaranProveedorServer.BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
Empresa : Variant;
|
||||
CodigoReferencia: String;
|
||||
|
||||
procedure TBizAlbaranProveedorServer.AfterProcessChange(
|
||||
Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
{ Por defecto, mantenemos los deltas por si alguna tabla hija los necesita }
|
||||
CanRemoveFromDelta := False;
|
||||
|
||||
case aChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
if FReferenciaAutomatica then
|
||||
begin
|
||||
IncrementarReferencia;
|
||||
FReferenciaAutomatica := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizAlbaranProveedorServer.BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
begin
|
||||
FReferenciaAutomatica := False;
|
||||
|
||||
case Sender.CurrentChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
//Si la referencia no ha sido asignada le asignamos una nosotros
|
||||
if (VarIsNull(Sender.CurrentChange.NewValueByName[fld_AlbaranesProveedorREFERENCIA]))
|
||||
or (VarToStr(Sender.CurrentChange.NewValueByName[fld_AlbaranesProveedorREFERENCIA]) = '') then
|
||||
if REFERENCIAIsNull or (Length(REFERENCIA) = 0) then
|
||||
begin
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
try
|
||||
//Siempre va a estar rellena
|
||||
Empresa := Sender.CurrentChange.NewValueByName[fld_AlbaranesProveedorID_EMPRESA];
|
||||
if Sender.CurrentChange.NewValueByName[fld_AlbaranesProveedorIMPORTE_TOTAL] < 0 then
|
||||
CodigoReferencia := REF_ALBARANES_DEV_PROVEEDOR
|
||||
else
|
||||
CodigoReferencia := REF_ALBARANES_PROVEEDOR;
|
||||
|
||||
dsData := ASchema.NewDataset(ACurrentConn, 'DarReferencia', ['CODIGO', 'EMPRESA'], [CodigoReferencia, Empresa]);
|
||||
except
|
||||
RaiseError('No existe la tabla REFERENCIAS');
|
||||
end;
|
||||
|
||||
dsData.Active := True;
|
||||
|
||||
if dsData.IsEmpty then
|
||||
RaiseError('NO HAY REFERENCIA ' + CodigoReferencia + ' DECLARADA EN TABLA REFERENCIAS');
|
||||
|
||||
REFERENCIA := dsData.FieldByName(fld_DarReferenciaVALOR).AsString;
|
||||
|
||||
try
|
||||
ASchema.NewCommand(ACurrentConn, 'ModificarReferencia', ['CODIGO', 'VALOR', 'EMPRESA'], [CodigoReferencia, DarReferenciaSiguiente(REFERENCIA), Empresa]);
|
||||
except
|
||||
RaiseError('Error al asignar la nueva ' + REFERENCIA + ' referencia en tabla');
|
||||
end;
|
||||
|
||||
FReferenciaAutomatica := True;
|
||||
REFERENCIA := DarReferencia;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizAlbaranProveedorServer.DarReferencia: String;
|
||||
var
|
||||
ACodigoReferencia : String;
|
||||
begin
|
||||
if (IMPORTE_TOTAL < 0) then
|
||||
ACodigoReferencia := REF_ALBARANES_DEV_PROVEEDOR
|
||||
else
|
||||
ACodigoReferencia := REF_ALBARANES_PROVEEDOR;
|
||||
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := DarNuevaReferencia(ACodigoReferencia, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizAlbaranProveedorServer.IncrementarReferencia: Boolean;
|
||||
var
|
||||
ACodigoReferencia : String;
|
||||
begin
|
||||
if (IMPORTE_TOTAL < 0) then
|
||||
ACodigoReferencia := REF_ALBARANES_DEV_PROVEEDOR
|
||||
else
|
||||
ACodigoReferencia := REF_ALBARANES_PROVEEDOR;
|
||||
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := IncrementarValorReferencia(ACodigoReferencia,
|
||||
Self.REFERENCIA, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(BIZ_SERVER_ALBARAN_PROVEEDOR, TBizAlbaranProveedorServer);
|
||||
|
||||
end.
|
||||
|
||||
|
||||
@ -14,40 +14,6 @@ object srvAlbaranesProveedor: TsrvAlbaranesProveedor
|
||||
ConnectionManager = dmServer.ConnectionManager
|
||||
DataDictionary = DADataDictionary
|
||||
Datasets = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'SELECT'#10' VALOR'#10'FROM'#10' REFERENCIAS'#10'WHERE'#10' CODIGO = :COD' +
|
||||
'IGO'#10'AND ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'VALOR'
|
||||
TableField = 'VALOR'
|
||||
end>
|
||||
end>
|
||||
Name = 'DarReferencia'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <>
|
||||
Statements = <
|
||||
@ -565,32 +531,6 @@ object srvAlbaranesProveedor: TsrvAlbaranesProveedor
|
||||
JoinDataTables = <>
|
||||
UnionDataTables = <>
|
||||
Commands = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'UPDATE REFERENCIAS SET'#10' VALOR = :VALOR'#10'WHERE CODIGO = :COD' +
|
||||
'IGO AND'#10' ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'ModificarReferencia'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
|
||||
@ -3,27 +3,19 @@ unit schFacturasClienteClient_Intf;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, DB, SysUtils, uROClasses, uDADataTable, FmtBCD, uROXMLIntf;
|
||||
Classes, DB, schBase_Intf, SysUtils, uROClasses, uDADataTable, FmtBCD, uROXMLIntf;
|
||||
|
||||
const
|
||||
{ Data table rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferencia = '{BFD0BE4F-A013-4368-AAB1-D78832815453}';
|
||||
RID_FacturasCliente = '{F251FC90-F8DB-4542-BB27-1D9D1C38B5C2}';
|
||||
RID_FacturasCliente_Detalles = '{21F1B1B1-A23D-4DE8-A7A9-91B042AA33C4}';
|
||||
RID_FacturasCliente = '{F2391B37-1CFC-4278-9886-10B58EB16F64}';
|
||||
RID_FacturasCliente_Detalles = '{85136507-38CB-4985-B1C4-DFBDB0D69903}';
|
||||
|
||||
{ Data table names }
|
||||
nme_DarReferencia = 'DarReferencia';
|
||||
nme_FacturasCliente = 'FacturasCliente';
|
||||
nme_FacturasCliente_Detalles = 'FacturasCliente_Detalles';
|
||||
|
||||
{ DarReferencia fields }
|
||||
fld_DarReferenciaVALOR = 'VALOR';
|
||||
|
||||
{ DarReferencia field indexes }
|
||||
idx_DarReferenciaVALOR = 0;
|
||||
|
||||
{ FacturasCliente fields }
|
||||
fld_FacturasClienteID = 'ID';
|
||||
fld_FacturasClienteID_EMPRESA = 'ID_EMPRESA';
|
||||
@ -129,44 +121,9 @@ const
|
||||
idx_FacturasCliente_DetallesREFERENCIA_PROVEEDOR = 13;
|
||||
|
||||
type
|
||||
{ IDarReferencia }
|
||||
IDarReferencia = interface(IDAStronglyTypedDataTable)
|
||||
['{2F985A85-CE21-459E-9476-83CB04A2F9AC}']
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String;
|
||||
procedure SetVALORValue(const aValue: String);
|
||||
function GetVALORIsNull: Boolean;
|
||||
procedure SetVALORIsNull(const aValue: Boolean);
|
||||
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
TDarReferenciaDataTableRules = class(TDADataTableRules, IDarReferencia)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aDataTable: TDADataTable); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IFacturasCliente }
|
||||
IFacturasCliente = interface(IDAStronglyTypedDataTable)
|
||||
['{153F474D-B1D3-4EC7-A4AE-B83884F61A16}']
|
||||
['{EE310893-B940-40AD-B0F3-7BBF9128C629}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -377,7 +334,7 @@ type
|
||||
end;
|
||||
|
||||
{ TFacturasClienteDataTableRules }
|
||||
TFacturasClienteDataTableRules = class(TDADataTableRules, IFacturasCliente)
|
||||
TFacturasClienteDataTableRules = class(TIntfObjectDADataTableRules, IFacturasCliente)
|
||||
private
|
||||
f_OBSERVACIONES: IROStrings;
|
||||
procedure OBSERVACIONES_OnChange(Sender: TObject);
|
||||
@ -597,7 +554,7 @@ type
|
||||
|
||||
{ IFacturasCliente_Detalles }
|
||||
IFacturasCliente_Detalles = interface(IDAStronglyTypedDataTable)
|
||||
['{CC81CA29-10BA-4644-B6C0-86EB1BB27BBD}']
|
||||
['{69194180-6BEA-41D0-8DD9-21E562F1B351}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -689,7 +646,7 @@ type
|
||||
end;
|
||||
|
||||
{ TFacturasCliente_DetallesDataTableRules }
|
||||
TFacturasCliente_DetallesDataTableRules = class(TDADataTableRules, IFacturasCliente_Detalles)
|
||||
TFacturasCliente_DetallesDataTableRules = class(TIntfObjectDADataTableRules, IFacturasCliente_Detalles)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
@ -790,39 +747,6 @@ implementation
|
||||
|
||||
uses Variants, uROBinaryHelpers;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
constructor TDarReferenciaDataTableRules.Create(aDataTable: TDADataTable);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaDataTableRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORValue: String;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].AsString;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsString := aValue;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORIsNull: boolean;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].IsNull;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsVariant := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TFacturasClienteDataTableRules }
|
||||
constructor TFacturasClienteDataTableRules.Create(aDataTable: TDADataTable);
|
||||
var
|
||||
@ -1863,7 +1787,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterDataTableRules(RID_DarReferencia, TDarReferenciaDataTableRules);
|
||||
RegisterDataTableRules(RID_FacturasCliente, TFacturasClienteDataTableRules);
|
||||
RegisterDataTableRules(RID_FacturasCliente_Detalles, TFacturasCliente_DetallesDataTableRules);
|
||||
|
||||
|
||||
@ -9,48 +9,13 @@ const
|
||||
{ Delta rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferenciaDelta = '{96BD45A4-7433-4AE5-B411-7B16AB88936D}';
|
||||
RID_FacturasClienteDelta = '{4EBF93DA-5847-45E1-960B-069B5239374F}';
|
||||
RID_FacturasCliente_DetallesDelta = '{1CB4A035-683D-412C-A365-6CF3A4E86ACD}';
|
||||
RID_FacturasClienteDelta = '{156A6AD0-D912-4FCF-AC71-2BB455BBC0AB}';
|
||||
RID_FacturasCliente_DetallesDelta = '{F4802AAF-93A6-40A6-8DC8-8BF1B5E4B06A}';
|
||||
|
||||
type
|
||||
{ IDarReferenciaDelta }
|
||||
IDarReferenciaDelta = interface(IDarReferencia)
|
||||
['{96BD45A4-7433-4AE5-B411-7B16AB88936D}']
|
||||
{ Property getters and setters }
|
||||
function GetOldVALORValue : String;
|
||||
|
||||
{ Properties }
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
TDarReferenciaBusinessProcessorRules = class(TDABusinessProcessorRules, IDarReferencia, IDarReferenciaDelta)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
function GetOldVALORValue: String; virtual;
|
||||
function GetOldVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR : String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull : Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
property OldVALORIsNull : Boolean read GetOldVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IFacturasClienteDelta }
|
||||
IFacturasClienteDelta = interface(IFacturasCliente)
|
||||
['{4EBF93DA-5847-45E1-960B-069B5239374F}']
|
||||
['{156A6AD0-D912-4FCF-AC71-2BB455BBC0AB}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_EMPRESAValue : Integer;
|
||||
@ -481,7 +446,7 @@ type
|
||||
|
||||
{ IFacturasCliente_DetallesDelta }
|
||||
IFacturasCliente_DetallesDelta = interface(IFacturasCliente_Detalles)
|
||||
['{1CB4A035-683D-412C-A365-6CF3A4E86ACD}']
|
||||
['{F4802AAF-93A6-40A6-8DC8-8BF1B5E4B06A}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_FACTURAValue : Integer;
|
||||
@ -674,49 +639,6 @@ implementation
|
||||
uses
|
||||
Variants, uROBinaryHelpers, uDAInterfaces;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
constructor TDarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaBusinessProcessorRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := aValue;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TFacturasClienteBusinessProcessorRules }
|
||||
constructor TFacturasClienteBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
var
|
||||
@ -2238,7 +2160,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(RID_DarReferenciaDelta, TDarReferenciaBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_FacturasClienteDelta, TFacturasClienteBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_FacturasCliente_DetallesDelta, TFacturasCliente_DetallesBusinessProcessorRules);
|
||||
|
||||
|
||||
@ -8,13 +8,13 @@ uses
|
||||
|
||||
const
|
||||
BIZ_SERVER_FACTURAS_CLIENTE = 'Server.FacturasCliente';
|
||||
REF_FACTURAS_CLIENTE = 'REF_FACTURAS_CLIENTE';
|
||||
REF_ABONOS_CLIENTE = 'REF_ABONOS_CLIENTE';
|
||||
CTE_TIPO_ABONO = 'A';
|
||||
CTE_TIPO_FACTURA = 'F';
|
||||
|
||||
type
|
||||
TBizFacturasClienteServer = class(TFacturasClienteBusinessProcessorRules)
|
||||
private
|
||||
FReferenciaAutomatica : Boolean;
|
||||
function DarReferencia : String;
|
||||
function IncrementarReferencia : Boolean;
|
||||
protected
|
||||
procedure Insert_Asiento_Factura(aChange: TDADeltaChange); virtual;
|
||||
procedure Update_Asiento_Factura(aChange: TDADeltaChange); virtual;
|
||||
@ -28,7 +28,13 @@ implementation
|
||||
|
||||
uses
|
||||
Variants, uDAClasses, uReferenciasUtils, uBusinessUtils, uROClasses, uDataModuleServer,
|
||||
schFacturasClienteClient_Intf;
|
||||
schFacturasClienteClient_Intf, srvReferencias_Impl;
|
||||
|
||||
const
|
||||
REF_FACTURAS_CLIENTE = 'REF_FACTURAS_CLIENTE';
|
||||
REF_ABONOS_CLIENTE = 'REF_ABONOS_CLIENTE';
|
||||
CTE_TIPO_ABONO = 'A';
|
||||
CTE_TIPO_FACTURA = 'F';
|
||||
|
||||
{ TBizFacturasClienteServer }
|
||||
|
||||
@ -51,59 +57,31 @@ begin
|
||||
// mantengan por si alguna tabla detalle lo necesita
|
||||
// (por ejemplo, DireccionesContacto)
|
||||
CanRemoveFromDelta := False;
|
||||
|
||||
// Actualizamos el contador de referencias.
|
||||
case aChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
if FReferenciaAutomatica then
|
||||
begin
|
||||
IncrementarReferencia;
|
||||
FReferenciaAutomatica := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizFacturasClienteServer.BeforeProcessDelta(
|
||||
Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
Empresa : Variant;
|
||||
Tipo : Variant;
|
||||
|
||||
begin
|
||||
inherited;
|
||||
FReferenciaAutomatica := False;
|
||||
|
||||
case Sender.CurrentChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
//Si la referencia no ha sido asignada le asignamos una nosotros
|
||||
if (VarIsNull(Sender.CurrentChange.NewValueByName[fld_FacturasClienteREFERENCIA]))
|
||||
or (VarToStr(Sender.CurrentChange.NewValueByName[fld_FacturasClienteREFERENCIA]) = '') then
|
||||
if REFERENCIAIsNull or (Length(REFERENCIA) = 0) then
|
||||
begin
|
||||
try
|
||||
//Siempre va a estar rellena
|
||||
Empresa := Sender.CurrentChange.NewValueByName[fld_FacturasClienteID_EMPRESA];
|
||||
Tipo := Sender.CurrentChange.NewValueByName[fld_FacturasClienteTIPO];
|
||||
|
||||
if Tipo = CTE_TIPO_FACTURA then
|
||||
dsData := ASchema.NewDataset(ACurrentConn, 'DarReferencia', ['CODIGO', 'EMPRESA'], [REF_FACTURAS_CLIENTE, Empresa])
|
||||
else
|
||||
dsData := ASchema.NewDataset(ACurrentConn, 'DarReferencia', ['CODIGO', 'EMPRESA'], [REF_ABONOS_CLIENTE, Empresa]);
|
||||
|
||||
except
|
||||
RaiseError('No existe la tabla REFERENCIAS');
|
||||
end;
|
||||
|
||||
dsData.Active := True;
|
||||
|
||||
if dsData.IsEmpty then
|
||||
RaiseError('NO HAY REFERENCIA ' + REF_FACTURAS_CLIENTE + ' / ' + REF_ABONOS_CLIENTE + ' DECLARADA EN TABLA REFERENCIAS');
|
||||
|
||||
REFERENCIA := dsData.FieldByName('VALOR').AsString;
|
||||
|
||||
try
|
||||
if Tipo = CTE_TIPO_FACTURA then
|
||||
ASchema.NewCommand(ACurrentConn, 'ModificarReferencia', ['CODIGO', 'VALOR', 'EMPRESA'], [REF_FACTURAS_CLIENTE, DarReferenciaSiguiente(REFERENCIA), Empresa])
|
||||
else
|
||||
ASchema.NewCommand(ACurrentConn, 'ModificarReferencia', ['CODIGO', 'VALOR', 'EMPRESA'], [REF_ABONOS_CLIENTE, DarReferenciaSiguiente(REFERENCIA), Empresa]);
|
||||
|
||||
except
|
||||
RaiseError('Error al asignar la nueva ' + REFERENCIA + ' referencia en tabla');
|
||||
end;
|
||||
FReferenciaAutomatica := True;
|
||||
REFERENCIA := DarReferencia;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
@ -130,6 +108,41 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizFacturasClienteServer.DarReferencia: String;
|
||||
var
|
||||
ATipo : String;
|
||||
begin
|
||||
if TIPO = CTE_TIPO_FACTURA then
|
||||
ATipo := REF_FACTURAS_CLIENTE
|
||||
else
|
||||
ATipo := REF_ABONOS_CLIENTE;
|
||||
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := DarNuevaReferencia(ATipo, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizFacturasClienteServer.IncrementarReferencia: Boolean;
|
||||
var
|
||||
ATipo : String;
|
||||
begin
|
||||
if TIPO = CTE_TIPO_FACTURA then
|
||||
ATipo := REF_FACTURAS_CLIENTE
|
||||
else
|
||||
ATipo := REF_ABONOS_CLIENTE;
|
||||
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := IncrementarValorReferencia(ATipo,
|
||||
Self.REFERENCIA, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizFacturasClienteServer.Insert_Asiento_Factura(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
|
||||
@ -15,42 +15,6 @@ object srvFacturasCliente: TsrvFacturasCliente
|
||||
DataDictionary = DataDictionary
|
||||
Diagrams = Diagrams
|
||||
Datasets = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
DataType = datString
|
||||
Size = 50
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'SELECT VALOR'#10'FROM REFERENCIAS'#10'WHERE CODIGO = :CODIGO'#10'AND ID_EMPR' +
|
||||
'ESA = :EMPRESA'
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'VALOR'
|
||||
TableField = 'VALOR'
|
||||
end>
|
||||
end>
|
||||
Name = 'DarReferencia'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <>
|
||||
Statements = <
|
||||
@ -579,31 +543,6 @@ object srvFacturasCliente: TsrvFacturasCliente
|
||||
end>
|
||||
Name = 'Insert_AsientoFactura'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
SQL =
|
||||
'UPDATE REFERENCIAS SET'#10' VALOR = :VALOR'#10'WHERE CODIGO = :COD' +
|
||||
'IGO AND'#10' ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'ModificarReferencia'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
|
||||
@ -9,21 +9,13 @@ const
|
||||
{ Data table rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferencia = '{5C2671F2-30A9-40DF-85EB-DAC3E5798C81}';
|
||||
RID_FacturasProveedor = '{EB88CFA6-A4F3-44A5-99AC-CEEF636BBC0F}';
|
||||
RID_FacturasProveedor_Detalles = '{794BFE28-FCFA-451E-809D-4B3204729DB8}';
|
||||
RID_FacturasProveedor = '{136699FF-423F-4F03-8EF2-2177BB023D1D}';
|
||||
RID_FacturasProveedor_Detalles = '{DEFE9C53-4E75-4151-97EB-0B915C6D0FA3}';
|
||||
|
||||
{ Data table names }
|
||||
nme_DarReferencia = 'DarReferencia';
|
||||
nme_FacturasProveedor = 'FacturasProveedor';
|
||||
nme_FacturasProveedor_Detalles = 'FacturasProveedor_Detalles';
|
||||
|
||||
{ DarReferencia fields }
|
||||
fld_DarReferenciaVALOR = 'VALOR';
|
||||
|
||||
{ DarReferencia field indexes }
|
||||
idx_DarReferenciaVALOR = 0;
|
||||
|
||||
{ FacturasProveedor fields }
|
||||
fld_FacturasProveedorID = 'ID';
|
||||
fld_FacturasProveedorID_EMPRESA = 'ID_EMPRESA';
|
||||
@ -123,44 +115,9 @@ const
|
||||
idx_FacturasProveedor_DetallesREFERENCIA_PROVEEDOR = 13;
|
||||
|
||||
type
|
||||
{ IDarReferencia }
|
||||
IDarReferencia = interface(IDAStronglyTypedDataTable)
|
||||
['{2CD8615C-AC9E-463D-A28B-9DF7EA71C261}']
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String;
|
||||
procedure SetVALORValue(const aValue: String);
|
||||
function GetVALORIsNull: Boolean;
|
||||
procedure SetVALORIsNull(const aValue: Boolean);
|
||||
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
TDarReferenciaDataTableRules = class(TIntfObjectDADataTableRules, IDarReferencia)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aDataTable: TDADataTable); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IFacturasProveedor }
|
||||
IFacturasProveedor = interface(IDAStronglyTypedDataTable)
|
||||
['{19ADA8D8-BA53-426F-9AFA-700B29166843}']
|
||||
['{C77E17AB-983D-4BA0-9307-753EEACE24CA}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -555,7 +512,7 @@ type
|
||||
|
||||
{ IFacturasProveedor_Detalles }
|
||||
IFacturasProveedor_Detalles = interface(IDAStronglyTypedDataTable)
|
||||
['{8C420A12-5489-4872-A3A6-9DE83225D778}']
|
||||
['{A0C91003-B79C-400B-815C-9CC93FBAB289}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -748,39 +705,6 @@ implementation
|
||||
|
||||
uses Variants, uROBinaryHelpers;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
constructor TDarReferenciaDataTableRules.Create(aDataTable: TDADataTable);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaDataTableRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORValue: String;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].AsString;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsString := aValue;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORIsNull: boolean;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].IsNull;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsVariant := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TFacturasProveedorDataTableRules }
|
||||
constructor TFacturasProveedorDataTableRules.Create(aDataTable: TDADataTable);
|
||||
var
|
||||
@ -1758,7 +1682,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterDataTableRules(RID_DarReferencia, TDarReferenciaDataTableRules);
|
||||
RegisterDataTableRules(RID_FacturasProveedor, TFacturasProveedorDataTableRules);
|
||||
RegisterDataTableRules(RID_FacturasProveedor_Detalles, TFacturasProveedor_DetallesDataTableRules);
|
||||
|
||||
|
||||
@ -9,48 +9,13 @@ const
|
||||
{ Delta rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferenciaDelta = '{29799EE8-6169-4A26-9C4C-02C33D658D97}';
|
||||
RID_FacturasProveedorDelta = '{90E2FE05-93D9-4478-B54E-73618BD635BF}';
|
||||
RID_FacturasProveedor_DetallesDelta = '{9215693E-0AA6-46A8-AD7B-3EAE75F51EFE}';
|
||||
RID_FacturasProveedorDelta = '{49DEF80E-CE30-451C-9F9F-ACC792AF58B2}';
|
||||
RID_FacturasProveedor_DetallesDelta = '{2373FE62-65FF-43FC-86C0-82138300CDA1}';
|
||||
|
||||
type
|
||||
{ IDarReferenciaDelta }
|
||||
IDarReferenciaDelta = interface(IDarReferencia)
|
||||
['{29799EE8-6169-4A26-9C4C-02C33D658D97}']
|
||||
{ Property getters and setters }
|
||||
function GetOldVALORValue : String;
|
||||
|
||||
{ Properties }
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
TDarReferenciaBusinessProcessorRules = class(TDABusinessProcessorRules, IDarReferencia, IDarReferenciaDelta)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
function GetOldVALORValue: String; virtual;
|
||||
function GetOldVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR : String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull : Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
property OldVALORIsNull : Boolean read GetOldVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IFacturasProveedorDelta }
|
||||
IFacturasProveedorDelta = interface(IFacturasProveedor)
|
||||
['{90E2FE05-93D9-4478-B54E-73618BD635BF}']
|
||||
['{49DEF80E-CE30-451C-9F9F-ACC792AF58B2}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_EMPRESAValue : Integer;
|
||||
@ -445,7 +410,7 @@ type
|
||||
|
||||
{ IFacturasProveedor_DetallesDelta }
|
||||
IFacturasProveedor_DetallesDelta = interface(IFacturasProveedor_Detalles)
|
||||
['{9215693E-0AA6-46A8-AD7B-3EAE75F51EFE}']
|
||||
['{2373FE62-65FF-43FC-86C0-82138300CDA1}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_FACTURAValue : Integer;
|
||||
@ -638,49 +603,6 @@ implementation
|
||||
uses
|
||||
Variants, uROBinaryHelpers, uDAInterfaces;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
constructor TDarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaBusinessProcessorRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := aValue;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TFacturasProveedorBusinessProcessorRules }
|
||||
constructor TFacturasProveedorBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
var
|
||||
@ -2109,7 +2031,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(RID_DarReferenciaDelta, TDarReferenciaBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_FacturasProveedorDelta, TFacturasProveedorBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_FacturasProveedor_DetallesDelta, TFacturasProveedor_DetallesBusinessProcessorRules);
|
||||
|
||||
|
||||
@ -8,80 +8,105 @@ uses
|
||||
|
||||
const
|
||||
BIZ_SERVER_FACTURAS_PROVEEDOR = 'Server.FacturasProveedor';
|
||||
REF_FACTURAS_PROVEEDOR = 'REF_FACTURAS_PROVEEDOR';
|
||||
REF_ABONOS_PROVEEDOR = 'REF_ABONOS_PROVEEDOR';
|
||||
CTE_TIPO_ABONO = 'A';
|
||||
CTE_TIPO_FACTURA = 'F';
|
||||
|
||||
|
||||
type
|
||||
TBizFacturasProveedorServer = class(TFacturasProveedorBusinessProcessorRules)
|
||||
FReferenciaAutomatica : Boolean;
|
||||
function DarReferencia : String;
|
||||
function IncrementarReferencia : Boolean;
|
||||
protected
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta); override;
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor;
|
||||
const aDelta: IDADelta); override;
|
||||
procedure AfterProcessChange(Sender: TDABusinessProcessor;
|
||||
aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Variants, uDAClasses, uReferenciasUtils, uBusinessUtils, uROClasses, uDataModuleServer,
|
||||
schFacturasProveedorClient_Intf;
|
||||
schFacturasProveedorClient_Intf, srvReferencias_Impl;
|
||||
|
||||
const
|
||||
REF_FACTURAS_PROVEEDOR = 'REF_FACTURAS_PROVEEDOR';
|
||||
REF_ABONOS_PROVEEDOR = 'REF_ABONOS_PROVEEDOR';
|
||||
CTE_TIPO_ABONO = 'A';
|
||||
CTE_TIPO_FACTURA = 'F';
|
||||
|
||||
{ TBizFacturasProveedorServer }
|
||||
|
||||
procedure TBizFacturasProveedorServer.BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
Empresa : Variant;
|
||||
Tipo : Variant;
|
||||
|
||||
procedure TBizFacturasProveedorServer.AfterProcessChange(
|
||||
Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
{ Por defecto, mantenemos los deltas por si alguna tabla hija los necesita }
|
||||
CanRemoveFromDelta := False;
|
||||
|
||||
case aChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
if FReferenciaAutomatica then
|
||||
begin
|
||||
IncrementarReferencia;
|
||||
FReferenciaAutomatica := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizFacturasProveedorServer.BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
begin
|
||||
FReferenciaAutomatica := False;
|
||||
|
||||
case Sender.CurrentChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
//Si la referencia no ha sido asignada le asignamos una nosotros
|
||||
if (VarIsNull(Sender.CurrentChange.NewValueByName[fld_FacturasProveedorREFERENCIA]))
|
||||
or (VarToStr(Sender.CurrentChange.NewValueByName[fld_FacturasProveedorREFERENCIA]) = '') then
|
||||
if REFERENCIAIsNull or (Length(REFERENCIA) = 0) then
|
||||
begin
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
try
|
||||
//Siempre va a estar rellena
|
||||
Empresa := Sender.CurrentChange.NewValueByName[fld_FacturasProveedorID_EMPRESA];
|
||||
Tipo := Sender.CurrentChange.NewValueByName[fld_FacturasProveedorTIPO];
|
||||
|
||||
if Tipo = CTE_TIPO_FACTURA then
|
||||
dsData := ASchema.NewDataset(ACurrentConn, 'DarReferencia', ['CODIGO', 'EMPRESA'], [REF_FACTURAS_PROVEEDOR, Empresa])
|
||||
else
|
||||
dsData := ASchema.NewDataset(ACurrentConn, 'DarReferencia', ['CODIGO', 'EMPRESA'], [REF_ABONOS_PROVEEDOR, Empresa]);
|
||||
|
||||
except
|
||||
RaiseError('No existe la tabla REFERENCIAS');
|
||||
end;
|
||||
|
||||
dsData.Active := True;
|
||||
|
||||
if dsData.IsEmpty then
|
||||
RaiseError('NO HAY REFERENCIA ' + REF_FACTURAS_PROVEEDOR + ' / ' + REF_ABONOS_PROVEEDOR + ' DECLARADA EN TABLA REFERENCIAS');
|
||||
|
||||
REFERENCIA := dsData.FieldByName('VALOR').AsString;
|
||||
|
||||
try
|
||||
if Tipo = CTE_TIPO_FACTURA then
|
||||
ASchema.NewCommand(ACurrentConn, 'ModificarReferencia', ['CODIGO', 'VALOR', 'EMPRESA'], [REF_FACTURAS_PROVEEDOR, DarReferenciaSiguiente(REFERENCIA), Empresa])
|
||||
else
|
||||
ASchema.NewCommand(ACurrentConn, 'ModificarReferencia', ['CODIGO', 'VALOR', 'EMPRESA'], [REF_ABONOS_PROVEEDOR, DarReferenciaSiguiente(REFERENCIA), Empresa]);
|
||||
|
||||
except
|
||||
RaiseError('Error al asignar la nueva ' + REFERENCIA + ' referencia en tabla');
|
||||
end;
|
||||
FReferenciaAutomatica := True;
|
||||
REFERENCIA := DarReferencia;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizFacturasProveedorServer.DarReferencia: String;
|
||||
var
|
||||
ATipo : String;
|
||||
begin
|
||||
if TIPO = CTE_TIPO_FACTURA then
|
||||
ATipo := REF_FACTURAS_PROVEEDOR
|
||||
else
|
||||
ATipo := REF_ABONOS_PROVEEDOR;
|
||||
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := DarNuevaReferencia(ATipo, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizFacturasProveedorServer.IncrementarReferencia: Boolean;
|
||||
var
|
||||
ATipo : String;
|
||||
begin
|
||||
if TIPO = CTE_TIPO_FACTURA then
|
||||
ATipo := REF_FACTURAS_PROVEEDOR
|
||||
else
|
||||
ATipo := REF_ABONOS_PROVEEDOR;
|
||||
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := IncrementarValorReferencia(ATipo,
|
||||
Self.REFERENCIA, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(BIZ_SERVER_FACTURAS_PROVEEDOR, TBizFacturasProveedorServer);
|
||||
|
||||
|
||||
@ -15,42 +15,6 @@ object srvFacturasProveedor: TsrvFacturasProveedor
|
||||
DataDictionary = DataDictionary
|
||||
Diagrams = Diagrams
|
||||
Datasets = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
DataType = datString
|
||||
Size = 50
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'SELECT VALOR'#10'FROM REFERENCIAS'#10'WHERE CODIGO = :CODIGO'#10'AND ID_EMPR' +
|
||||
'ESA = :EMPRESA'
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'VALOR'
|
||||
TableField = 'VALOR'
|
||||
end>
|
||||
end>
|
||||
Name = 'DarReferencia'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <>
|
||||
Statements = <
|
||||
@ -519,31 +483,6 @@ object srvFacturasProveedor: TsrvFacturasProveedor
|
||||
JoinDataTables = <>
|
||||
UnionDataTables = <>
|
||||
Commands = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
SQL =
|
||||
'UPDATE REFERENCIAS SET'#10' VALOR = :VALOR'#10'WHERE CODIGO = :COD' +
|
||||
'IGO AND'#10' ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'ModificarReferencia'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
|
||||
@ -9,23 +9,15 @@ const
|
||||
{ Data table rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferencia = '{CA7994DB-6CC3-4494-8CDA-4D8411DB5D2D}';
|
||||
RID_PedidosProveedor = '{684C5776-911B-490A-9C71-D4EDCCAD631E}';
|
||||
RID_PedidosProveedor_Detalles = '{FCF3DE95-4073-4679-92C0-87B7E7C46108}';
|
||||
RID_PedidosProveedor_Articulos_Pendientes = '{EA978B2E-441A-49F8-AF4D-76517D74CF10}';
|
||||
RID_PedidosProveedor = '{74E7C143-965A-4B32-80F9-D2C42B5B1287}';
|
||||
RID_PedidosProveedor_Detalles = '{F254F368-78C1-4219-B5A5-3716C3A52772}';
|
||||
RID_PedidosProveedor_Articulos_Pendientes = '{5AE8E5D9-5CC5-48B5-986F-F8C8A20284A8}';
|
||||
|
||||
{ Data table names }
|
||||
nme_DarReferencia = 'DarReferencia';
|
||||
nme_PedidosProveedor = 'PedidosProveedor';
|
||||
nme_PedidosProveedor_Detalles = 'PedidosProveedor_Detalles';
|
||||
nme_PedidosProveedor_Articulos_Pendientes = 'PedidosProveedor_Articulos_Pendientes';
|
||||
|
||||
{ DarReferencia fields }
|
||||
fld_DarReferenciaVALOR = 'VALOR';
|
||||
|
||||
{ DarReferencia field indexes }
|
||||
idx_DarReferenciaVALOR = 0;
|
||||
|
||||
{ PedidosProveedor fields }
|
||||
fld_PedidosProveedorID = 'ID';
|
||||
fld_PedidosProveedorID_EMPRESA = 'ID_EMPRESA';
|
||||
@ -149,44 +141,9 @@ const
|
||||
idx_PedidosProveedor_Articulos_PendientesREFERENCIA_PROVEEDOR = 5;
|
||||
|
||||
type
|
||||
{ IDarReferencia }
|
||||
IDarReferencia = interface(IDAStronglyTypedDataTable)
|
||||
['{04456888-5D38-48BB-8CED-95617D1F2BB9}']
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String;
|
||||
procedure SetVALORValue(const aValue: String);
|
||||
function GetVALORIsNull: Boolean;
|
||||
procedure SetVALORIsNull(const aValue: Boolean);
|
||||
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
TDarReferenciaDataTableRules = class(TIntfObjectDADataTableRules, IDarReferencia)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aDataTable: TDADataTable); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IPedidosProveedor }
|
||||
IPedidosProveedor = interface(IDAStronglyTypedDataTable)
|
||||
['{4E3D9B42-CF76-460B-8136-2D0C2B3417D4}']
|
||||
['{659AE890-EF50-4D5D-A340-A46C0FE2C5E3}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -629,7 +586,7 @@ type
|
||||
|
||||
{ IPedidosProveedor_Detalles }
|
||||
IPedidosProveedor_Detalles = interface(IDAStronglyTypedDataTable)
|
||||
['{127BE3FD-DEF4-4C58-ABC5-5A54DCE0608D}']
|
||||
['{858490D5-7CC4-4293-A34B-B2843B15A102}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -820,7 +777,7 @@ type
|
||||
|
||||
{ IPedidosProveedor_Articulos_Pendientes }
|
||||
IPedidosProveedor_Articulos_Pendientes = interface(IDAStronglyTypedDataTable)
|
||||
['{34BDDF31-970F-4F58-923B-1C0E66F27A5F}']
|
||||
['{7D012016-CF55-4F5A-9726-B19B2CF79733}']
|
||||
{ Property getters and setters }
|
||||
function GetID_PEDIDOValue: Integer;
|
||||
procedure SetID_PEDIDOValue(const aValue: Integer);
|
||||
@ -917,39 +874,6 @@ implementation
|
||||
|
||||
uses Variants, uROBinaryHelpers;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
constructor TDarReferenciaDataTableRules.Create(aDataTable: TDADataTable);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaDataTableRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORValue: String;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].AsString;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsString := aValue;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORIsNull: boolean;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].IsNull;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsVariant := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TPedidosProveedorDataTableRules }
|
||||
constructor TPedidosProveedorDataTableRules.Create(aDataTable: TDADataTable);
|
||||
var
|
||||
@ -2154,7 +2078,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterDataTableRules(RID_DarReferencia, TDarReferenciaDataTableRules);
|
||||
RegisterDataTableRules(RID_PedidosProveedor, TPedidosProveedorDataTableRules);
|
||||
RegisterDataTableRules(RID_PedidosProveedor_Detalles, TPedidosProveedor_DetallesDataTableRules);
|
||||
RegisterDataTableRules(RID_PedidosProveedor_Articulos_Pendientes, TPedidosProveedor_Articulos_PendientesDataTableRules);
|
||||
|
||||
@ -9,49 +9,14 @@ const
|
||||
{ Delta rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferenciaDelta = '{A1F1C534-FD91-42C1-856B-0CAE9DE48B68}';
|
||||
RID_PedidosProveedorDelta = '{349D50BE-57FD-468A-8751-0374A571AAA4}';
|
||||
RID_PedidosProveedor_DetallesDelta = '{E924668B-8D1B-44C3-9DA2-D033F8C44E06}';
|
||||
RID_PedidosProveedor_Articulos_PendientesDelta = '{0B859C3A-9F82-4451-A206-24CEF18A61E9}';
|
||||
RID_PedidosProveedorDelta = '{1F3B2168-C09F-472F-8722-9DA783EF59A9}';
|
||||
RID_PedidosProveedor_DetallesDelta = '{7716AB41-604A-4367-904A-82479CDE2DA1}';
|
||||
RID_PedidosProveedor_Articulos_PendientesDelta = '{8E47806D-955F-4154-97C8-B4543A8837D7}';
|
||||
|
||||
type
|
||||
{ IDarReferenciaDelta }
|
||||
IDarReferenciaDelta = interface(IDarReferencia)
|
||||
['{A1F1C534-FD91-42C1-856B-0CAE9DE48B68}']
|
||||
{ Property getters and setters }
|
||||
function GetOldVALORValue : String;
|
||||
|
||||
{ Properties }
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
TDarReferenciaBusinessProcessorRules = class(TDABusinessProcessorRules, IDarReferencia, IDarReferenciaDelta)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
function GetOldVALORValue: String; virtual;
|
||||
function GetOldVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR : String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull : Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
property OldVALORIsNull : Boolean read GetOldVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IPedidosProveedorDelta }
|
||||
IPedidosProveedorDelta = interface(IPedidosProveedor)
|
||||
['{349D50BE-57FD-468A-8751-0374A571AAA4}']
|
||||
['{1F3B2168-C09F-472F-8722-9DA783EF59A9}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_EMPRESAValue : Integer;
|
||||
@ -495,7 +460,7 @@ type
|
||||
|
||||
{ IPedidosProveedor_DetallesDelta }
|
||||
IPedidosProveedor_DetallesDelta = interface(IPedidosProveedor_Detalles)
|
||||
['{E924668B-8D1B-44C3-9DA2-D033F8C44E06}']
|
||||
['{7716AB41-604A-4367-904A-82479CDE2DA1}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_PEDIDOValue : Integer;
|
||||
@ -685,7 +650,7 @@ type
|
||||
|
||||
{ IPedidosProveedor_Articulos_PendientesDelta }
|
||||
IPedidosProveedor_Articulos_PendientesDelta = interface(IPedidosProveedor_Articulos_Pendientes)
|
||||
['{0B859C3A-9F82-4451-A206-24CEF18A61E9}']
|
||||
['{8E47806D-955F-4154-97C8-B4543A8837D7}']
|
||||
{ Property getters and setters }
|
||||
function GetOldID_PEDIDOValue : Integer;
|
||||
function GetOldREFERENCIAValue : String;
|
||||
@ -782,49 +747,6 @@ implementation
|
||||
uses
|
||||
Variants, uROBinaryHelpers, uDAInterfaces;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
constructor TDarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaBusinessProcessorRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := aValue;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TPedidosProveedorBusinessProcessorRules }
|
||||
constructor TPedidosProveedorBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
var
|
||||
@ -2581,7 +2503,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(RID_DarReferenciaDelta, TDarReferenciaBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_PedidosProveedorDelta, TPedidosProveedorBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_PedidosProveedor_DetallesDelta, TPedidosProveedor_DetallesBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_PedidosProveedor_Articulos_PendientesDelta, TPedidosProveedor_Articulos_PendientesBusinessProcessorRules);
|
||||
|
||||
@ -8,68 +8,91 @@ uses
|
||||
|
||||
const
|
||||
BIZ_SERVER_PEDIDOS_PROVEEDOR = 'Server.PedidosProveedor';
|
||||
REF_PEDIDOS_PROVEEDOR = 'REF_PEDIDOS_PROVEEDOR';
|
||||
|
||||
type
|
||||
TBizPedidosProveedorServer = class(TPedidosProveedorBusinessProcessorRules)
|
||||
private
|
||||
FReferenciaAutomatica : Boolean;
|
||||
function DarReferencia : String;
|
||||
function IncrementarReferencia : Boolean;
|
||||
protected
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta); override;
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor;
|
||||
const aDelta: IDADelta); override;
|
||||
procedure AfterProcessChange(Sender: TDABusinessProcessor;
|
||||
aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Variants, uDAClasses, uReferenciasUtils, uBusinessUtils, uROClasses, uDataModuleServer,
|
||||
schPedidosProveedorClient_Intf;
|
||||
schPedidosProveedorClient_Intf, srvReferencias_Impl;
|
||||
|
||||
const
|
||||
REF_PEDIDOS_PROVEEDOR = 'REF_PEDIDOS_PROVEEDOR';
|
||||
|
||||
{ TBizPedidosProveedorServer }
|
||||
|
||||
procedure TBizPedidosProveedorServer.BeforeProcessDelta(
|
||||
Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
Empresa : Variant;
|
||||
|
||||
procedure TBizPedidosProveedorServer.AfterProcessChange(
|
||||
Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
{ Por defecto, mantenemos los deltas por si alguna tabla hija los necesita }
|
||||
CanRemoveFromDelta := False;
|
||||
|
||||
case aChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
if FReferenciaAutomatica then
|
||||
begin
|
||||
IncrementarReferencia;
|
||||
FReferenciaAutomatica := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizPedidosProveedorServer.BeforeProcessDelta(
|
||||
Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
begin
|
||||
FReferenciaAutomatica := False;
|
||||
|
||||
case Sender.CurrentChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
//Si la referencia no ha sido asignada le asignamos una nosotros
|
||||
if (VarIsNull(Sender.CurrentChange.NewValueByName[fld_PedidosProveedorREFERENCIA]))
|
||||
or (VarToStr(Sender.CurrentChange.NewValueByName[fld_PedidosProveedorREFERENCIA]) = '') then
|
||||
if REFERENCIAIsNull or (Length(REFERENCIA) = 0) then
|
||||
begin
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
try
|
||||
//Siempre va a estar rellena
|
||||
Empresa := Sender.CurrentChange.NewValueByName[fld_PedidosProveedorID_EMPRESA];
|
||||
dsData := ASchema.NewDataset(ACurrentConn, 'DarReferencia', ['CODIGO', 'EMPRESA'], [REF_PEDIDOS_PROVEEDOR, Empresa]);
|
||||
except
|
||||
RaiseError('No existe la tabla REFERENCIAS');
|
||||
end;
|
||||
|
||||
dsData.Active := True;
|
||||
|
||||
if dsData.IsEmpty then
|
||||
RaiseError('NO HAY REFERENCIA ' + REF_PEDIDOS_PROVEEDOR + ' DECLARADA EN TABLA REFERENCIAS');
|
||||
|
||||
REFERENCIA := dsData.FieldByName(fld_DarReferenciaVALOR).AsString;
|
||||
|
||||
try
|
||||
ASchema.NewCommand(ACurrentConn, 'ModificarReferencia', ['CODIGO', 'VALOR', 'EMPRESA'], [REF_PEDIDOS_PROVEEDOR, DarReferenciaSiguiente(REFERENCIA), Empresa]);
|
||||
except
|
||||
RaiseError('Error al asignar la nueva ' + REFERENCIA + ' referencia en tabla');
|
||||
end;
|
||||
|
||||
FReferenciaAutomatica := True;
|
||||
REFERENCIA := DarReferencia;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizPedidosProveedorServer.DarReferencia: String;
|
||||
begin
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := DarNuevaReferencia(REF_PEDIDOS_PROVEEDOR, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizPedidosProveedorServer.IncrementarReferencia: Boolean;
|
||||
begin
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := IncrementarValorReferencia(REF_PEDIDOS_PROVEEDOR,
|
||||
Self.REFERENCIA, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(BIZ_SERVER_PEDIDOS_PROVEEDOR, TBizPedidosProveedorServer);
|
||||
|
||||
end.
|
||||
|
||||
|
||||
@ -14,40 +14,6 @@ object srvPedidosProveedor: TsrvPedidosProveedor
|
||||
ConnectionManager = dmServer.ConnectionManager
|
||||
DataDictionary = DADataDictionary
|
||||
Datasets = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'SELECT'#10' VALOR'#10'FROM'#10' REFERENCIAS'#10'WHERE'#10' CODIGO = :COD' +
|
||||
'IGO'#10'AND ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'VALOR'
|
||||
TableField = 'VALOR'
|
||||
end>
|
||||
end>
|
||||
Name = 'DarReferencia'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <>
|
||||
Statements = <
|
||||
@ -619,32 +585,6 @@ object srvPedidosProveedor: TsrvPedidosProveedor
|
||||
JoinDataTables = <>
|
||||
UnionDataTables = <>
|
||||
Commands = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'UPDATE REFERENCIAS SET'#10' VALOR = :VALOR'#10'WHERE CODIGO = :COD' +
|
||||
'IGO AND'#10' ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'ModificarReferencia'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
|
||||
@ -9,21 +9,13 @@ const
|
||||
{ Data table rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferencia = '{6594B31A-A292-486E-A784-AF4659E1A953}';
|
||||
RID_PresupuestosCliente = '{13857C95-50E8-4EF5-8544-ABFCE393A83E}';
|
||||
RID_PresupuestosCliente_Detalles = '{FE4E1E48-710A-404F-B2DD-4547549B420D}';
|
||||
RID_PresupuestosCliente = '{E1C79C14-6D88-4DE2-8C1C-9027B44498C9}';
|
||||
RID_PresupuestosCliente_Detalles = '{198216A6-7817-4E5D-B053-94EF41471C94}';
|
||||
|
||||
{ Data table names }
|
||||
nme_DarReferencia = 'DarReferencia';
|
||||
nme_PresupuestosCliente = 'PresupuestosCliente';
|
||||
nme_PresupuestosCliente_Detalles = 'PresupuestosCliente_Detalles';
|
||||
|
||||
{ DarReferencia fields }
|
||||
fld_DarReferenciaVALOR = 'VALOR';
|
||||
|
||||
{ DarReferencia field indexes }
|
||||
idx_DarReferenciaVALOR = 0;
|
||||
|
||||
{ PresupuestosCliente fields }
|
||||
fld_PresupuestosClienteID = 'ID';
|
||||
fld_PresupuestosClienteID_EMPRESA = 'ID_EMPRESA';
|
||||
@ -117,44 +109,9 @@ const
|
||||
idx_PresupuestosCliente_DetallesREFERENCIA_PROVEEDOR = 13;
|
||||
|
||||
type
|
||||
{ IDarReferencia }
|
||||
IDarReferencia = interface(IDAStronglyTypedDataTable)
|
||||
['{D7753D57-71A2-4C4D-A580-8D58520FCFD3}']
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String;
|
||||
procedure SetVALORValue(const aValue: String);
|
||||
function GetVALORIsNull: Boolean;
|
||||
procedure SetVALORIsNull(const aValue: Boolean);
|
||||
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
TDarReferenciaDataTableRules = class(TIntfObjectDADataTableRules, IDarReferencia)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aDataTable: TDADataTable); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IPresupuestosCliente }
|
||||
IPresupuestosCliente = interface(IDAStronglyTypedDataTable)
|
||||
['{4FCC9A5F-7A94-4A3A-940A-4CA0D4176EDB}']
|
||||
['{6413A346-D037-4FA8-B7B4-CBD611916F97}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -513,7 +470,7 @@ type
|
||||
|
||||
{ IPresupuestosCliente_Detalles }
|
||||
IPresupuestosCliente_Detalles = interface(IDAStronglyTypedDataTable)
|
||||
['{5B7F200F-3962-455D-98BB-A24DE98BD18B}']
|
||||
['{862A13D0-9B6A-44BE-BE39-0779D381B015}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -706,39 +663,6 @@ implementation
|
||||
|
||||
uses Variants, uROBinaryHelpers;
|
||||
|
||||
{ TDarReferenciaDataTableRules }
|
||||
constructor TDarReferenciaDataTableRules.Create(aDataTable: TDADataTable);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaDataTableRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORValue: String;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].AsString;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsString := aValue;
|
||||
end;
|
||||
|
||||
function TDarReferenciaDataTableRules.GetVALORIsNull: boolean;
|
||||
begin
|
||||
result := DataTable.Fields[idx_DarReferenciaVALOR].IsNull;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaDataTableRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
DataTable.Fields[idx_DarReferenciaVALOR].AsVariant := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TPresupuestosClienteDataTableRules }
|
||||
constructor TPresupuestosClienteDataTableRules.Create(aDataTable: TDADataTable);
|
||||
var
|
||||
@ -1668,7 +1592,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterDataTableRules(RID_DarReferencia, TDarReferenciaDataTableRules);
|
||||
RegisterDataTableRules(RID_PresupuestosCliente, TPresupuestosClienteDataTableRules);
|
||||
RegisterDataTableRules(RID_PresupuestosCliente_Detalles, TPresupuestosCliente_DetallesDataTableRules);
|
||||
|
||||
|
||||
@ -9,48 +9,13 @@ const
|
||||
{ Delta rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_DarReferenciaDelta = '{0B34135E-0FB6-4CBA-AF23-A26B88542C10}';
|
||||
RID_PresupuestosClienteDelta = '{847B43BF-5186-406F-92E6-2135D35EF01F}';
|
||||
RID_PresupuestosCliente_DetallesDelta = '{1DA22D38-0DB5-450C-AF43-3F7F4D2EA56E}';
|
||||
RID_PresupuestosClienteDelta = '{D14C4979-8012-4543-A051-FA40304370C4}';
|
||||
RID_PresupuestosCliente_DetallesDelta = '{D3649E01-484C-44F1-8B19-9592C984B428}';
|
||||
|
||||
type
|
||||
{ IDarReferenciaDelta }
|
||||
IDarReferenciaDelta = interface(IDarReferencia)
|
||||
['{0B34135E-0FB6-4CBA-AF23-A26B88542C10}']
|
||||
{ Property getters and setters }
|
||||
function GetOldVALORValue : String;
|
||||
|
||||
{ Properties }
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
end;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
TDarReferenciaBusinessProcessorRules = class(TDABusinessProcessorRules, IDarReferencia, IDarReferenciaDelta)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
function GetOldVALORValue: String; virtual;
|
||||
function GetOldVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR : String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull : Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
property OldVALORIsNull : Boolean read GetOldVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IPresupuestosClienteDelta }
|
||||
IPresupuestosClienteDelta = interface(IPresupuestosCliente)
|
||||
['{847B43BF-5186-406F-92E6-2135D35EF01F}']
|
||||
['{D14C4979-8012-4543-A051-FA40304370C4}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_EMPRESAValue : Integer;
|
||||
@ -412,7 +377,7 @@ type
|
||||
|
||||
{ IPresupuestosCliente_DetallesDelta }
|
||||
IPresupuestosCliente_DetallesDelta = interface(IPresupuestosCliente_Detalles)
|
||||
['{1DA22D38-0DB5-450C-AF43-3F7F4D2EA56E}']
|
||||
['{D3649E01-484C-44F1-8B19-9592C984B428}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_PRESUPUESTOValue : Integer;
|
||||
@ -605,49 +570,6 @@ implementation
|
||||
uses
|
||||
Variants, uROBinaryHelpers, uDAInterfaces;
|
||||
|
||||
{ TDarReferenciaBusinessProcessorRules }
|
||||
constructor TDarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TDarReferenciaBusinessProcessorRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TDarReferenciaBusinessProcessorRules.GetOldVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_DarReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := aValue;
|
||||
end;
|
||||
|
||||
procedure TDarReferenciaBusinessProcessorRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_DarReferenciaVALOR] := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TPresupuestosClienteBusinessProcessorRules }
|
||||
constructor TPresupuestosClienteBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
var
|
||||
@ -2001,7 +1923,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(RID_DarReferenciaDelta, TDarReferenciaBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_PresupuestosClienteDelta, TPresupuestosClienteBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_PresupuestosCliente_DetallesDelta, TPresupuestosCliente_DetallesBusinessProcessorRules);
|
||||
|
||||
|
||||
@ -8,69 +8,95 @@ uses
|
||||
|
||||
const
|
||||
BIZ_SERVER_PRESUPUESTOS_CLIENTE = 'Server.PresupuestosCliente';
|
||||
REF_PRESUPUESTOS_CLIENTE = 'REF_PRESUPUESTOS_CLIENTE';
|
||||
|
||||
type
|
||||
TBizPresupuestosClienteServer = class(TPresupuestosClienteBusinessProcessorRules)
|
||||
private
|
||||
FReferenciaAutomatica : Boolean;
|
||||
function DarReferencia : String;
|
||||
function IncrementarReferencia : Boolean;
|
||||
protected
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta); override;
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor;
|
||||
const aDelta: IDADelta); override;
|
||||
procedure AfterProcessChange(Sender: TDABusinessProcessor;
|
||||
aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Variants, uDAClasses, uReferenciasUtils, uBusinessUtils, uROClasses, uDataModuleServer,
|
||||
schPresupuestosClienteClient_Intf;
|
||||
schPresupuestosClienteClient_Intf, srvReferencias_Impl;
|
||||
|
||||
const
|
||||
REF_PRESUPUESTOS_CLIENTE = 'REF_PRESUPUESTOS_CLIENTE';
|
||||
|
||||
{ TBizPresupuestosClienteServer }
|
||||
|
||||
procedure TBizPresupuestosClienteServer.BeforeProcessDelta(
|
||||
Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
Empresa : Variant;
|
||||
|
||||
procedure TBizPresupuestosClienteServer.AfterProcessChange(
|
||||
Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
{ Por defecto, mantenemos los deltas por si alguna tabla hija los necesita }
|
||||
CanRemoveFromDelta := False;
|
||||
|
||||
case aChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
if FReferenciaAutomatica then
|
||||
begin
|
||||
IncrementarReferencia;
|
||||
FReferenciaAutomatica := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizPresupuestosClienteServer.BeforeProcessDelta(
|
||||
Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
FReferenciaAutomatica := False;
|
||||
|
||||
case Sender.CurrentChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
//Si la referencia no ha sido asignada le asignamos una nosotros
|
||||
if (VarIsNull(Sender.CurrentChange.NewValueByName[fld_PresupuestosClienteREFERENCIA]))
|
||||
or (VarToStr(Sender.CurrentChange.NewValueByName[fld_PresupuestosClienteREFERENCIA]) = '') then
|
||||
if REFERENCIAIsNull or (Length(REFERENCIA) = 0) then
|
||||
begin
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
try
|
||||
//Siempre va a estar rellena
|
||||
Empresa := Sender.CurrentChange.NewValueByName[fld_PresupuestosClienteID_EMPRESA];
|
||||
dsData := ASchema.NewDataset(ACurrentConn, 'DarReferencia', ['CODIGO', 'EMPRESA'], [REF_PRESUPUESTOS_CLIENTE, Empresa]);
|
||||
except
|
||||
RaiseError('No existe la tabla REFERENCIAS');
|
||||
end;
|
||||
|
||||
dsData.Active := True;
|
||||
|
||||
if dsData.IsEmpty then
|
||||
RaiseError('NO HAY REFERENCIA ' + REF_PRESUPUESTOS_CLIENTE + ' DECLARADA EN TABLA REFERENCIAS');
|
||||
|
||||
REFERENCIA := dsData.FieldByName(fld_DarReferenciaVALOR).AsString;
|
||||
|
||||
try
|
||||
ASchema.NewCommand(ACurrentConn, 'ModificarReferencia', ['CODIGO', 'VALOR', 'EMPRESA'], [REF_PRESUPUESTOS_CLIENTE, DarReferenciaSiguiente(REFERENCIA), Empresa]);
|
||||
except
|
||||
RaiseError('Error al asignar la nueva ' + REFERENCIA + ' referencia en tabla');
|
||||
end;
|
||||
|
||||
FReferenciaAutomatica := True;
|
||||
REFERENCIA := DarReferencia;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function TBizPresupuestosClienteServer.DarReferencia: String;
|
||||
begin
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := DarNuevaReferencia(REF_PRESUPUESTOS_CLIENTE, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function TBizPresupuestosClienteServer.IncrementarReferencia: Boolean;
|
||||
begin
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := IncrementarValorReferencia(REF_PRESUPUESTOS_CLIENTE,
|
||||
Self.REFERENCIA, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(BIZ_SERVER_PRESUPUESTOS_CLIENTE, TBizPresupuestosClienteServer);
|
||||
|
||||
end.
|
||||
|
||||
|
||||
@ -13,43 +13,6 @@ object srvPresupuestosCliente: TsrvPresupuestosCliente
|
||||
ConnectionManager = dmServer.ConnectionManager
|
||||
DataDictionary = DADataDictionary
|
||||
Datasets = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
ConnectionType = 'Interbase'
|
||||
Default = True
|
||||
TargetTable = 'REFERENCIAS'
|
||||
Name = 'IBX'
|
||||
SQL =
|
||||
'SELECT VALOR'#10'FROM REFERENCIAS'#10'WHERE CODIGO = :CODIGO'#10'AND ID_EMPR' +
|
||||
'ESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'VALOR'
|
||||
TableField = 'VALOR'
|
||||
end>
|
||||
end>
|
||||
Name = 'DarReferencia'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <>
|
||||
Statements = <
|
||||
@ -487,34 +450,6 @@ object srvPresupuestosCliente: TsrvPresupuestosCliente
|
||||
JoinDataTables = <>
|
||||
UnionDataTables = <>
|
||||
Commands = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
ConnectionType = 'Interbase'
|
||||
Default = True
|
||||
Name = 'IBX'
|
||||
SQL =
|
||||
'UPDATE REFERENCIAS SET'#10' VALOR = :VALOR'#10'WHERE CODIGO = :COD' +
|
||||
'IGO AND'#10' ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'ModificarReferencia'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
|
||||
@ -11,6 +11,14 @@ type
|
||||
function GetFechaPago: TDateTime;
|
||||
procedure SetFechaPago(const Value: TDateTime);
|
||||
property FechaPago: TDateTime Read GetFechaPago write SetFechaPago;
|
||||
|
||||
function GetIgnorarContabilidad: Integer;
|
||||
procedure SetIgnorarContabilidad(const Value: Integer);
|
||||
property IgnorarContabilidad: Integer Read GetIgnorarContabilidad write SetIgnorarContabilidad;
|
||||
|
||||
function GetIdSubCuenta: Integer;
|
||||
procedure SetIdSubCuenta(const Value: Integer);
|
||||
property IdSubCuenta: Integer Read GetIdSubCuenta write SetIdSubCuenta;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
@ -32,8 +32,8 @@ uses
|
||||
type
|
||||
IPagosClienteController = interface(ISujeto)
|
||||
['{1864471E-74FA-4E96-BA8D-21357DA38B0F}']
|
||||
function Anadir(APagosCliente: IBizPagosCliente; Const Fecha: String = ''): Boolean;
|
||||
procedure Modificar(APagosCliente: IBizPagosCliente; Const Fecha: String);
|
||||
function Anadir(APagosCliente: IBizPagosCliente; Const Fecha: String = ''; Const IgnorarContabilidad: Integer = 0; Const IdSubCuenta: Integer = 0): Boolean;
|
||||
procedure Modificar(APagosCliente: IBizPagosCliente; Const Fecha: String; Const IgnorarContabilidad: Integer);
|
||||
function Eliminar(APagoCliente : IBizPagosCliente): Boolean;
|
||||
function EliminarTodo(APagossCliente : IBizPagosCliente): Boolean;
|
||||
end;
|
||||
@ -47,8 +47,8 @@ type
|
||||
public
|
||||
constructor Create; virtual;
|
||||
destructor Destroy; override;
|
||||
function Anadir(APagosCliente: IBizPagosCliente; Const Fecha: String = ''): Boolean;
|
||||
procedure Modificar(APagosCliente: IBizPagosCliente; Const Fecha: String);
|
||||
function Anadir(APagosCliente: IBizPagosCliente; Const Fecha: String = ''; Const IgnorarContabilidad: Integer = 0; Const IdSubCuenta: Integer = 0): Boolean;
|
||||
procedure Modificar(APagosCliente: IBizPagosCliente; Const Fecha: String; Const IgnorarContabilidad: Integer);
|
||||
function Eliminar(APagoCliente : IBizPagosCliente): Boolean;
|
||||
function EliminarTodo(APagosCliente : IBizPagosCliente): Boolean;
|
||||
end;
|
||||
@ -63,7 +63,7 @@ uses
|
||||
|
||||
{ TPagosClienteController }
|
||||
|
||||
function TPagosClienteController.Anadir(APagosCliente: IBizPagosCliente; Const Fecha: String = ''): Boolean;
|
||||
function TPagosClienteController.Anadir(APagosCliente: IBizPagosCliente; Const Fecha: String = ''; Const IgnorarContabilidad: Integer = 0; Const IdSubCuenta: Integer = 0): Boolean;
|
||||
{ Si el pago introducido es un pago y no una devolución devolvemos true en caso de ser
|
||||
una devolución devolvemos false}
|
||||
begin
|
||||
@ -79,7 +79,10 @@ begin
|
||||
else
|
||||
APagosCliente.TIPO := CTE_DEVOLUCION;
|
||||
|
||||
Result := (APagosCliente.TIPO = CTE_PAGO);
|
||||
APagosCliente.IGNORAR_CONTABILIDAD := IgnorarContabilidad;
|
||||
APagosCliente.CUENTA := IntToStr(IdSubCuenta);
|
||||
|
||||
Result := (APagosCliente.TIPO = CTE_PAGO);
|
||||
APagosCliente.Post;
|
||||
end;
|
||||
|
||||
@ -136,10 +139,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TPagosClienteController.Modificar(APagosCliente: IBizPagosCliente; const Fecha: String);
|
||||
procedure TPagosClienteController.Modificar(APagosCliente: IBizPagosCliente; const Fecha: String; Const IgnorarContabilidad: Integer);
|
||||
begin
|
||||
APagosCliente.DataTable.Edit;
|
||||
APagosCliente.FECHA_PAGO := StrToDate(Fecha);
|
||||
APagosCliente.IGNORAR_CONTABILIDAD := IgnorarContabilidad;
|
||||
APagosCliente.DataTable.Post;
|
||||
end;
|
||||
|
||||
|
||||
@ -161,6 +161,8 @@ end;
|
||||
function TRecibosClienteController.AnadirPago(ARecibosCliente: IBizRecibosCliente; FechaPago: String =''): Boolean;
|
||||
var
|
||||
AEditor : IEditorFechaPago;
|
||||
AIgnorarContabilidad : Integer;
|
||||
ASubCuenta: Integer;
|
||||
begin
|
||||
Result := False;
|
||||
|
||||
@ -174,7 +176,11 @@ begin
|
||||
if Assigned(AEditor) then
|
||||
try
|
||||
if (AEditor.ShowModal = mrOk) then
|
||||
begin
|
||||
FechaPago := DateToStr(AEditor.FechaPago);
|
||||
AIgnorarContabilidad := AEditor.IgnorarContabilidad;
|
||||
ASubCuenta := AEditor.IdSubcuenta;
|
||||
end;
|
||||
AEditor.Release;
|
||||
finally
|
||||
AEditor := NIL;
|
||||
@ -198,7 +204,7 @@ begin
|
||||
Exit;
|
||||
|
||||
//Finalmente añadimos el pago (cobro o devolucion)
|
||||
if PagosController.Anadir(ARecibosCliente.Pagos, FechaPago) then
|
||||
if PagosController.Anadir(ARecibosCliente.Pagos, FechaPago, AIgnorarContabilidad, ASubCuenta) then
|
||||
begin
|
||||
ARecibosCliente.Edit;
|
||||
ARecibosCliente.SITUACION := CTE_COBRADO;
|
||||
@ -753,21 +759,26 @@ procedure TRecibosClienteController.ModificarPago(ARecibosCliente: IBizRecibosCl
|
||||
var
|
||||
AEditor : IEditorFechaPago;
|
||||
FechaPago: String;
|
||||
IgnorarContabilidad: Integer;
|
||||
begin
|
||||
try
|
||||
//Pedimos la fecha del pago
|
||||
CreateEditor('EditorFechaPago', IEditorFechaPago, AEditor);
|
||||
if Assigned(AEditor) then
|
||||
FechaPago:= '';
|
||||
AEditor.FechaPago := ARecibosCliente.Pagos.FECHA_PAGO;
|
||||
AEditor.IgnorarContabilidad := ARecibosCliente.Pagos.IGNORAR_CONTABILIDAD;
|
||||
if (AEditor.ShowModal = mrOk) then
|
||||
begin
|
||||
FechaPago := DateToStr(AEditor.FechaPago);
|
||||
IgnorarContabilidad := AEditor.IgnorarContabilidad;
|
||||
end;
|
||||
AEditor.Release;
|
||||
finally
|
||||
AEditor := NIL;
|
||||
end;
|
||||
|
||||
if Length(FechaPago) > 0 then
|
||||
PagosController.Modificar(ARecibosCliente.Pagos, FechaPago);
|
||||
PagosController.Modificar(ARecibosCliente.Pagos, FechaPago, IgnorarContabilidad);
|
||||
end;
|
||||
|
||||
function TRecibosClienteController.Nuevo: IBizRecibosCliente;
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{f10782d8-a2a3-45bb-9ae0-98f0b23968fc}</ProjectGuid>
|
||||
<MainSource>RecibosCliente_data.dpk</MainSource>
|
||||
@ -48,10 +49,11 @@
|
||||
<DelphiCompile Include="RecibosCliente_data.dpk">
|
||||
<MainSource>MainSource</MainSource>
|
||||
</DelphiCompile>
|
||||
<DCCReference Include="..\..\Lib\ApplicationBase.dcp" />
|
||||
<DCCReference Include="..\..\Lib\RecibosCliente_model.dcp" />
|
||||
<DCCReference Include="..\ApplicationBase.dcp" />
|
||||
<DCCReference Include="..\RecibosCliente_model.dcp" />
|
||||
<DCCReference Include="uDataModuleRecibosCliente.pas">
|
||||
<Form>DataModuleRecibosCliente</Form>
|
||||
<DesignClass>TDAClientDataModule</DesignClass>
|
||||
</DCCReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
@ -107,6 +107,10 @@ inherited DataModuleRecibosCliente: TDataModuleRecibosCliente
|
||||
Size = 20
|
||||
DisplayLabel = 'PagosCliente_USUARIO'
|
||||
DictionaryEntry = 'PagosCliente_USUARIO'
|
||||
end
|
||||
item
|
||||
Name = 'IGNORAR_CONTABILIDAD'
|
||||
DataType = datSmallInt
|
||||
end>
|
||||
Params = <>
|
||||
MasterMappingMode = mmWhere
|
||||
|
||||
@ -9,9 +9,9 @@ const
|
||||
{ Data table rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_RecibosCliente = '{5410D8EC-FA59-43E6-96AB-C7C2E1292FBB}';
|
||||
RID_PagosCliente = '{A9A33A29-1E9F-40C7-9F00-73776CAA6D93}';
|
||||
RID_RecibosCompensadosCli = '{55474263-530A-458F-ADE8-497B260FA9A3}';
|
||||
RID_RecibosCliente = '{BD713121-B67A-4555-B1F6-8C79907169A8}';
|
||||
RID_PagosCliente = '{51327032-C47B-4B5A-A2FB-4FF7FA518830}';
|
||||
RID_RecibosCompensadosCli = '{942FEF94-88F0-4687-9F8F-420A53607386}';
|
||||
|
||||
{ Data table names }
|
||||
nme_RecibosCliente = 'RecibosCliente';
|
||||
@ -93,6 +93,7 @@ const
|
||||
fld_PagosClienteFECHA_ALTA = 'FECHA_ALTA';
|
||||
fld_PagosClienteFECHA_MODIFICACION = 'FECHA_MODIFICACION';
|
||||
fld_PagosClienteUSUARIO = 'USUARIO';
|
||||
fld_PagosClienteIGNORAR_CONTABILIDAD = 'IGNORAR_CONTABILIDAD';
|
||||
|
||||
{ PagosCliente field indexes }
|
||||
idx_PagosClienteID = 0;
|
||||
@ -107,6 +108,7 @@ const
|
||||
idx_PagosClienteFECHA_ALTA = 9;
|
||||
idx_PagosClienteFECHA_MODIFICACION = 10;
|
||||
idx_PagosClienteUSUARIO = 11;
|
||||
idx_PagosClienteIGNORAR_CONTABILIDAD = 12;
|
||||
|
||||
{ RecibosCompensadosCli fields }
|
||||
fld_RecibosCompensadosCliID = 'ID';
|
||||
@ -173,7 +175,7 @@ const
|
||||
type
|
||||
{ IRecibosCliente }
|
||||
IRecibosCliente = interface(IDAStronglyTypedDataTable)
|
||||
['{11D2AB69-38A8-41B8-8139-2C32F3732B9C}']
|
||||
['{13B23B67-01E0-4206-8F77-7C86FAB5765C}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -544,7 +546,7 @@ type
|
||||
|
||||
{ IPagosCliente }
|
||||
IPagosCliente = interface(IDAStronglyTypedDataTable)
|
||||
['{A77D5C00-617A-4A1C-B34F-B24E6AC72E0D}']
|
||||
['{CACDCDCC-257B-4007-87DE-DDB16A31FA1E}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -594,6 +596,10 @@ type
|
||||
procedure SetUSUARIOValue(const aValue: String);
|
||||
function GetUSUARIOIsNull: Boolean;
|
||||
procedure SetUSUARIOIsNull(const aValue: Boolean);
|
||||
function GetIGNORAR_CONTABILIDADValue: SmallInt;
|
||||
procedure SetIGNORAR_CONTABILIDADValue(const aValue: SmallInt);
|
||||
function GetIGNORAR_CONTABILIDADIsNull: Boolean;
|
||||
procedure SetIGNORAR_CONTABILIDADIsNull(const aValue: Boolean);
|
||||
|
||||
|
||||
{ Properties }
|
||||
@ -621,6 +627,8 @@ type
|
||||
property FECHA_MODIFICACIONIsNull: Boolean read GetFECHA_MODIFICACIONIsNull write SetFECHA_MODIFICACIONIsNull;
|
||||
property USUARIO: String read GetUSUARIOValue write SetUSUARIOValue;
|
||||
property USUARIOIsNull: Boolean read GetUSUARIOIsNull write SetUSUARIOIsNull;
|
||||
property IGNORAR_CONTABILIDAD: SmallInt read GetIGNORAR_CONTABILIDADValue write SetIGNORAR_CONTABILIDADValue;
|
||||
property IGNORAR_CONTABILIDADIsNull: Boolean read GetIGNORAR_CONTABILIDADIsNull write SetIGNORAR_CONTABILIDADIsNull;
|
||||
end;
|
||||
|
||||
{ TPagosClienteDataTableRules }
|
||||
@ -676,6 +684,10 @@ type
|
||||
procedure SetUSUARIOValue(const aValue: String); virtual;
|
||||
function GetUSUARIOIsNull: Boolean; virtual;
|
||||
procedure SetUSUARIOIsNull(const aValue: Boolean); virtual;
|
||||
function GetIGNORAR_CONTABILIDADValue: SmallInt; virtual;
|
||||
procedure SetIGNORAR_CONTABILIDADValue(const aValue: SmallInt); virtual;
|
||||
function GetIGNORAR_CONTABILIDADIsNull: Boolean; virtual;
|
||||
procedure SetIGNORAR_CONTABILIDADIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property ID: Integer read GetIDValue write SetIDValue;
|
||||
@ -702,6 +714,8 @@ type
|
||||
property FECHA_MODIFICACIONIsNull: Boolean read GetFECHA_MODIFICACIONIsNull write SetFECHA_MODIFICACIONIsNull;
|
||||
property USUARIO: String read GetUSUARIOValue write SetUSUARIOValue;
|
||||
property USUARIOIsNull: Boolean read GetUSUARIOIsNull write SetUSUARIOIsNull;
|
||||
property IGNORAR_CONTABILIDAD: SmallInt read GetIGNORAR_CONTABILIDADValue write SetIGNORAR_CONTABILIDADValue;
|
||||
property IGNORAR_CONTABILIDADIsNull: Boolean read GetIGNORAR_CONTABILIDADIsNull write SetIGNORAR_CONTABILIDADIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aDataTable: TDADataTable); override;
|
||||
@ -711,7 +725,7 @@ type
|
||||
|
||||
{ IRecibosCompensadosCli }
|
||||
IRecibosCompensadosCli = interface(IDAStronglyTypedDataTable)
|
||||
['{3E3D9FC0-4E90-4A4D-AE58-8B53087B5A5F}']
|
||||
['{318980D4-1AED-437D-A1BB-40D176B7F41A}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -1968,6 +1982,27 @@ begin
|
||||
DataTable.Fields[idx_PagosClienteUSUARIO].AsVariant := Null;
|
||||
end;
|
||||
|
||||
function TPagosClienteDataTableRules.GetIGNORAR_CONTABILIDADValue: SmallInt;
|
||||
begin
|
||||
result := DataTable.Fields[idx_PagosClienteIGNORAR_CONTABILIDAD].AsSmallInt;
|
||||
end;
|
||||
|
||||
procedure TPagosClienteDataTableRules.SetIGNORAR_CONTABILIDADValue(const aValue: SmallInt);
|
||||
begin
|
||||
DataTable.Fields[idx_PagosClienteIGNORAR_CONTABILIDAD].AsSmallInt := aValue;
|
||||
end;
|
||||
|
||||
function TPagosClienteDataTableRules.GetIGNORAR_CONTABILIDADIsNull: boolean;
|
||||
begin
|
||||
result := DataTable.Fields[idx_PagosClienteIGNORAR_CONTABILIDAD].IsNull;
|
||||
end;
|
||||
|
||||
procedure TPagosClienteDataTableRules.SetIGNORAR_CONTABILIDADIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
DataTable.Fields[idx_PagosClienteIGNORAR_CONTABILIDAD].AsVariant := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TRecibosCompensadosCliDataTableRules }
|
||||
constructor TRecibosCompensadosCliDataTableRules.Create(aDataTable: TDADataTable);
|
||||
|
||||
@ -9,14 +9,14 @@ const
|
||||
{ Delta rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_RecibosClienteDelta = '{E1FDCE22-19B3-498A-BEBA-6CFB34FC22C2}';
|
||||
RID_PagosClienteDelta = '{B09875FA-0962-46A9-9A3A-40F618B4230D}';
|
||||
RID_RecibosCompensadosCliDelta = '{43471651-957E-47B2-B810-E0227C1BB163}';
|
||||
RID_RecibosClienteDelta = '{0886304E-ADCF-4985-93CD-63C479B0592E}';
|
||||
RID_PagosClienteDelta = '{D5A42190-E981-46DA-BADE-32C8DD8A03B3}';
|
||||
RID_RecibosCompensadosCliDelta = '{46B04689-C995-45CE-B3CA-C602E1142822}';
|
||||
|
||||
type
|
||||
{ IRecibosClienteDelta }
|
||||
IRecibosClienteDelta = interface(IRecibosCliente)
|
||||
['{E1FDCE22-19B3-498A-BEBA-6CFB34FC22C2}']
|
||||
['{0886304E-ADCF-4985-93CD-63C479B0592E}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_RECIBO_COMPENSADOValue : Integer;
|
||||
@ -386,7 +386,7 @@ type
|
||||
|
||||
{ IPagosClienteDelta }
|
||||
IPagosClienteDelta = interface(IPagosCliente)
|
||||
['{B09875FA-0962-46A9-9A3A-40F618B4230D}']
|
||||
['{D5A42190-E981-46DA-BADE-32C8DD8A03B3}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_RECIBOValue : Integer;
|
||||
@ -400,6 +400,7 @@ type
|
||||
function GetOldFECHA_ALTAValue : DateTime;
|
||||
function GetOldFECHA_MODIFICACIONValue : DateTime;
|
||||
function GetOldUSUARIOValue : String;
|
||||
function GetOldIGNORAR_CONTABILIDADValue : SmallInt;
|
||||
|
||||
{ Properties }
|
||||
property OldID : Integer read GetOldIDValue;
|
||||
@ -414,6 +415,7 @@ type
|
||||
property OldFECHA_ALTA : DateTime read GetOldFECHA_ALTAValue;
|
||||
property OldFECHA_MODIFICACION : DateTime read GetOldFECHA_MODIFICACIONValue;
|
||||
property OldUSUARIO : String read GetOldUSUARIOValue;
|
||||
property OldIGNORAR_CONTABILIDAD : SmallInt read GetOldIGNORAR_CONTABILIDADValue;
|
||||
end;
|
||||
|
||||
{ TPagosClienteBusinessProcessorRules }
|
||||
@ -493,6 +495,12 @@ type
|
||||
function GetOldUSUARIOIsNull: Boolean; virtual;
|
||||
procedure SetUSUARIOValue(const aValue: String); virtual;
|
||||
procedure SetUSUARIOIsNull(const aValue: Boolean); virtual;
|
||||
function GetIGNORAR_CONTABILIDADValue: SmallInt; virtual;
|
||||
function GetIGNORAR_CONTABILIDADIsNull: Boolean; virtual;
|
||||
function GetOldIGNORAR_CONTABILIDADValue: SmallInt; virtual;
|
||||
function GetOldIGNORAR_CONTABILIDADIsNull: Boolean; virtual;
|
||||
procedure SetIGNORAR_CONTABILIDADValue(const aValue: SmallInt); virtual;
|
||||
procedure SetIGNORAR_CONTABILIDADIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property ID : Integer read GetIDValue write SetIDValue;
|
||||
@ -543,6 +551,10 @@ type
|
||||
property USUARIOIsNull : Boolean read GetUSUARIOIsNull write SetUSUARIOIsNull;
|
||||
property OldUSUARIO : String read GetOldUSUARIOValue;
|
||||
property OldUSUARIOIsNull : Boolean read GetOldUSUARIOIsNull;
|
||||
property IGNORAR_CONTABILIDAD : SmallInt read GetIGNORAR_CONTABILIDADValue write SetIGNORAR_CONTABILIDADValue;
|
||||
property IGNORAR_CONTABILIDADIsNull : Boolean read GetIGNORAR_CONTABILIDADIsNull write SetIGNORAR_CONTABILIDADIsNull;
|
||||
property OldIGNORAR_CONTABILIDAD : SmallInt read GetOldIGNORAR_CONTABILIDADValue;
|
||||
property OldIGNORAR_CONTABILIDADIsNull : Boolean read GetOldIGNORAR_CONTABILIDADIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
|
||||
@ -552,7 +564,7 @@ type
|
||||
|
||||
{ IRecibosCompensadosCliDelta }
|
||||
IRecibosCompensadosCliDelta = interface(IRecibosCompensadosCli)
|
||||
['{43471651-957E-47B2-B810-E0227C1BB163}']
|
||||
['{46B04689-C995-45CE-B3CA-C602E1142822}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_RECIBO_COMPENSADOValue : Integer;
|
||||
@ -2219,6 +2231,37 @@ begin
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_PagosClienteUSUARIO] := Null;
|
||||
end;
|
||||
|
||||
function TPagosClienteBusinessProcessorRules.GetIGNORAR_CONTABILIDADValue: SmallInt;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.NewValueByName[fld_PagosClienteIGNORAR_CONTABILIDAD];
|
||||
end;
|
||||
|
||||
function TPagosClienteBusinessProcessorRules.GetIGNORAR_CONTABILIDADIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_PagosClienteIGNORAR_CONTABILIDAD]);
|
||||
end;
|
||||
|
||||
function TPagosClienteBusinessProcessorRules.GetOldIGNORAR_CONTABILIDADValue: SmallInt;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.OldValueByName[fld_PagosClienteIGNORAR_CONTABILIDAD];
|
||||
end;
|
||||
|
||||
function TPagosClienteBusinessProcessorRules.GetOldIGNORAR_CONTABILIDADIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_PagosClienteIGNORAR_CONTABILIDAD]);
|
||||
end;
|
||||
|
||||
procedure TPagosClienteBusinessProcessorRules.SetIGNORAR_CONTABILIDADValue(const aValue: SmallInt);
|
||||
begin
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_PagosClienteIGNORAR_CONTABILIDAD] := aValue;
|
||||
end;
|
||||
|
||||
procedure TPagosClienteBusinessProcessorRules.SetIGNORAR_CONTABILIDADIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_PagosClienteIGNORAR_CONTABILIDAD] := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TRecibosCompensadosCliBusinessProcessorRules }
|
||||
constructor TRecibosCompensadosCliBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
|
||||
@ -40,8 +40,11 @@ type
|
||||
end;
|
||||
|
||||
TBizPagosCliente = class(TPagosClienteDataTableRules, IBizPagosCliente)
|
||||
private
|
||||
procedure IniciarValoresIBizPagosClienteNuevo;
|
||||
protected
|
||||
procedure BeforeInsert(Sender: TDADataTable); override;
|
||||
procedure BeforeInsert(Sender: TDADataTable); override;
|
||||
procedure OnNewRecord(Sender: TDADataTable); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -61,6 +64,17 @@ begin
|
||||
AMasterTable.Post;
|
||||
end;
|
||||
|
||||
procedure TBizPagosCliente.IniciarValoresIBizPagosClienteNuevo;
|
||||
begin
|
||||
IGNORAR_CONTABILIDAD := 0;
|
||||
end;
|
||||
|
||||
procedure TBizPagosCliente.OnNewRecord(Sender: TDADataTable);
|
||||
begin
|
||||
inherited;
|
||||
IniciarValoresIBizPagosClienteNuevo;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterDataTableRules(BIZ_CLIENT_IBIZPAGOSCLIENTE, TBizPagosCliente);
|
||||
|
||||
|
||||
@ -0,0 +1,118 @@
|
||||
unit uBizPagosClienteServer;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
uDAInterfaces, uDADelta, uDABusinessProcessor,
|
||||
schRecibosClienteServer_Intf;
|
||||
|
||||
const
|
||||
BIZ_SERVER_PAGOS_CLIENTE = 'Server.PagosCliente';
|
||||
|
||||
type
|
||||
TBizPagosClienteServer = class(TPagosClienteBusinessProcessorRules)
|
||||
protected
|
||||
procedure Insert_Asiento_Pago(aChange: TDADeltaChange); virtual;
|
||||
procedure Update_Asiento_Pago(aChange: TDADeltaChange); virtual;
|
||||
procedure Delete_Asiento_Pago(aChange: TDADeltaChange); virtual;
|
||||
|
||||
procedure AfterProcessChange(Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean; var CanRemoveFromDelta: Boolean); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Variants, uDAClasses, uReferenciasUtils, uBusinessUtils, uROClasses, uDataModuleServer,
|
||||
schRecibosClienteClient_Intf;
|
||||
|
||||
{ TBizFacturasClienteServer }
|
||||
|
||||
procedure TBizPagosClienteServer.AfterProcessChange(Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean);
|
||||
begin
|
||||
case aChange.ChangeType of
|
||||
ctInsert: begin
|
||||
Insert_Asiento_Pago(aChange);
|
||||
end;
|
||||
ctUpdate: begin
|
||||
Update_Asiento_Pago(aChange);
|
||||
end;
|
||||
ctDelete: begin
|
||||
Delete_Asiento_Pago(aChange);
|
||||
end;
|
||||
end;
|
||||
|
||||
// No hay que quitar los deltas para que los datos del contacto se
|
||||
// mantengan por si alguna tabla detalle lo necesita
|
||||
// (por ejemplo, DireccionesContacto)
|
||||
CanRemoveFromDelta := False;
|
||||
end;
|
||||
|
||||
procedure TBizPagosClienteServer.Delete_Asiento_Pago(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
begin
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
ACommand := ASchema.NewCommand(ACurrentConn, 'Delete_AsientoPago');
|
||||
try
|
||||
with ACommand do
|
||||
begin
|
||||
ParamByName('IdPago').Value := aChange.OldValueByName[fld_PagosClienteID];
|
||||
Execute;
|
||||
end;
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizPagosClienteServer.Insert_Asiento_Pago(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
begin
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
ACommand := ASchema.NewCommand(ACurrentConn, 'Insert_AsientoPago');
|
||||
try
|
||||
with ACommand do
|
||||
begin
|
||||
ParamByName('IdPago').Value := aChange.NewValueByName[fld_PagosClienteID];
|
||||
ParamByName('IdSubCuentaPago').Value := aChange.NewValueByName[fld_PagosClienteCUENTA];
|
||||
Execute;
|
||||
end;
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizPagosClienteServer.Update_Asiento_Pago(aChange: TDADeltaChange);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
begin
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
ACommand := ASchema.NewCommand(ACurrentConn, 'Insert_AsientoPago');
|
||||
try
|
||||
with ACommand do
|
||||
begin
|
||||
ParamByName('IdPago').Value := aChange.NewValueByName[fld_PagosClienteID];
|
||||
Execute;
|
||||
end;
|
||||
finally
|
||||
ACommand := NIL;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(BIZ_SERVER_PAGOS_CLIENTE, TBizPagosClienteServer);
|
||||
|
||||
end.
|
||||
@ -9,6 +9,8 @@
|
||||
<Projects Include="..\..\Cliente\FactuGES.dproj" />
|
||||
<Projects Include="..\..\GUIBase\GUIBase.dproj" />
|
||||
<Projects Include="..\..\Servidor\FactuGES_Server.dproj" />
|
||||
<Projects Include="..\Contabilidad\Controller\Contabilidad_controller.dproj" />
|
||||
<Projects Include="..\Contactos\Views\Contactos_view.dproj" />
|
||||
<Projects Include="Controller\RecibosCliente_controller.dproj" />
|
||||
<Projects Include="Data\RecibosCliente_data.dproj" />
|
||||
<Projects Include="Model\RecibosCliente_model.dproj" />
|
||||
@ -111,14 +113,32 @@
|
||||
<Target Name="FactuGES_Server:Make">
|
||||
<MSBuild Projects="..\..\Servidor\FactuGES_Server.dproj" Targets="Make" />
|
||||
</Target>
|
||||
<Target Name="Contactos_view">
|
||||
<MSBuild Projects="..\Contactos\Views\Contactos_view.dproj" Targets="" />
|
||||
</Target>
|
||||
<Target Name="Contactos_view:Clean">
|
||||
<MSBuild Projects="..\Contactos\Views\Contactos_view.dproj" Targets="Clean" />
|
||||
</Target>
|
||||
<Target Name="Contactos_view:Make">
|
||||
<MSBuild Projects="..\Contactos\Views\Contactos_view.dproj" Targets="Make" />
|
||||
</Target>
|
||||
<Target Name="Contabilidad_controller">
|
||||
<MSBuild Projects="..\Contabilidad\Controller\Contabilidad_controller.dproj" Targets="" />
|
||||
</Target>
|
||||
<Target Name="Contabilidad_controller:Clean">
|
||||
<MSBuild Projects="..\Contabilidad\Controller\Contabilidad_controller.dproj" Targets="Clean" />
|
||||
</Target>
|
||||
<Target Name="Contabilidad_controller:Make">
|
||||
<MSBuild Projects="..\Contabilidad\Controller\Contabilidad_controller.dproj" Targets="Make" />
|
||||
</Target>
|
||||
<Target Name="Build">
|
||||
<CallTarget Targets="Base;GUIBase;ApplicationBase;RecibosCliente_model;RecibosCliente_data;RecibosCliente_controller;RecibosCliente_view;RecibosCliente_plugin;FactuGES;FactuGES_Server" />
|
||||
<CallTarget Targets="Base;GUIBase;ApplicationBase;RecibosCliente_model;RecibosCliente_data;RecibosCliente_controller;RecibosCliente_view;RecibosCliente_plugin;FactuGES;FactuGES_Server;Contactos_view;Contabilidad_controller" />
|
||||
</Target>
|
||||
<Target Name="Clean">
|
||||
<CallTarget Targets="Base:Clean;GUIBase:Clean;ApplicationBase:Clean;RecibosCliente_model:Clean;RecibosCliente_data:Clean;RecibosCliente_controller:Clean;RecibosCliente_view:Clean;RecibosCliente_plugin:Clean;FactuGES:Clean;FactuGES_Server:Clean" />
|
||||
<CallTarget Targets="Base:Clean;GUIBase:Clean;ApplicationBase:Clean;RecibosCliente_model:Clean;RecibosCliente_data:Clean;RecibosCliente_controller:Clean;RecibosCliente_view:Clean;RecibosCliente_plugin:Clean;FactuGES:Clean;FactuGES_Server:Clean;Contactos_view:Clean;Contabilidad_controller:Clean" />
|
||||
</Target>
|
||||
<Target Name="Make">
|
||||
<CallTarget Targets="Base:Make;GUIBase:Make;ApplicationBase:Make;RecibosCliente_model:Make;RecibosCliente_data:Make;RecibosCliente_controller:Make;RecibosCliente_view:Make;RecibosCliente_plugin:Make;FactuGES:Make;FactuGES_Server:Make" />
|
||||
<CallTarget Targets="Base:Make;GUIBase:Make;ApplicationBase:Make;RecibosCliente_model:Make;RecibosCliente_data:Make;RecibosCliente_controller:Make;RecibosCliente_view:Make;RecibosCliente_plugin:Make;FactuGES:Make;FactuGES_Server:Make;Contactos_view:Make;Contabilidad_controller:Make" />
|
||||
</Target>
|
||||
<Import Condition="Exists('$(MSBuildBinPath)\Borland.Group.Targets')" Project="$(MSBuildBinPath)\Borland.Group.Targets" />
|
||||
</Project>
|
||||
@ -358,6 +358,10 @@ object srvRecibosCliente: TsrvRecibosCliente
|
||||
item
|
||||
DatasetField = 'USUARIO'
|
||||
TableField = 'USUARIO'
|
||||
end
|
||||
item
|
||||
DatasetField = 'IGNORAR_CONTABILIDAD'
|
||||
TableField = 'IGNORAR_CONTABILIDAD'
|
||||
end>
|
||||
end>
|
||||
Name = 'PagosCliente'
|
||||
@ -431,6 +435,10 @@ object srvRecibosCliente: TsrvRecibosCliente
|
||||
DataType = datString
|
||||
Size = 20
|
||||
DictionaryEntry = 'PagosCliente_USUARIO'
|
||||
end
|
||||
item
|
||||
Name = 'IGNORAR_CONTABILIDAD'
|
||||
DataType = datSmallInt
|
||||
end>
|
||||
end
|
||||
item
|
||||
@ -695,6 +703,48 @@ object srvRecibosCliente: TsrvRecibosCliente
|
||||
JoinDataTables = <>
|
||||
UnionDataTables = <>
|
||||
Commands = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'IdPago'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
ConnectionType = 'Interbase'
|
||||
Default = True
|
||||
Name = 'IBX'
|
||||
SQL = 'execute procedure proc_delete_asiento_pago :IdPago'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'Delete_AsientoPago'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'IdPago'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'IdSubCuentaPago'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
ConnectionType = 'Interbase'
|
||||
Default = True
|
||||
Name = 'IBX'
|
||||
SQL =
|
||||
'execute procedure proc_new_asiento_pago :IdPago, :IdSubCuentaPag' +
|
||||
'o'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'Insert_AsientoPago'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
@ -876,68 +926,46 @@ object srvRecibosCliente: TsrvRecibosCliente
|
||||
DataType = datAutoInc
|
||||
GeneratorName = 'GEN_PAGOS_CLIENTE_ID'
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'ID_RECIBO'
|
||||
DataType = datInteger
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'TIPO'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'FECHA_PAGO'
|
||||
DataType = datDateTime
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'TITULAR'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'ENTIDAD'
|
||||
DataType = datString
|
||||
Size = 15
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'SUCURSAL'
|
||||
DataType = datString
|
||||
Size = 15
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'DC'
|
||||
DataType = datString
|
||||
Size = 15
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'CUENTA'
|
||||
DataType = datString
|
||||
Size = 15
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'USUARIO'
|
||||
DataType = datString
|
||||
Size = 20
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'IGNORAR_CONTABILIDAD'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
@ -945,9 +973,10 @@ object srvRecibosCliente: TsrvRecibosCliente
|
||||
TargetTable = 'PAGOS_CLIENTE'
|
||||
SQL =
|
||||
'INSERT'#10' INTO PAGOS_CLIENTE'#10' (ID, ID_RECIBO, TIPO, FECHA_PAGO' +
|
||||
', TITULAR, ENTIDAD, '#10' SUCURSAL, DC, CUENTA, USUARIO)'#10' VALUE' +
|
||||
'S'#10' (:ID, :ID_RECIBO, :TIPO, :FECHA_PAGO, :TITULAR, :ENTIDAD, ' +
|
||||
#10' :SUCURSAL, :DC, :CUENTA, :USUARIO)'
|
||||
', TITULAR, ENTIDAD, '#10' SUCURSAL, DC, CUENTA, USUARIO, IGNORAR' +
|
||||
'_CONTABILIDAD)'#10' VALUES'#10' (:ID, :ID_RECIBO, :TIPO, :FECHA_PAGO' +
|
||||
', :TITULAR, :ENTIDAD, '#10' :SUCURSAL, :DC, :CUENTA, :USUARIO, :' +
|
||||
'IGNORAR_CONTABILIDAD)'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
@ -975,69 +1004,47 @@ object srvRecibosCliente: TsrvRecibosCliente
|
||||
Params = <
|
||||
item
|
||||
Name = 'ID'
|
||||
DataType = datInteger
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'ID_RECIBO'
|
||||
DataType = datInteger
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'TIPO'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'FECHA_PAGO'
|
||||
DataType = datDateTime
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'TITULAR'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'ENTIDAD'
|
||||
DataType = datString
|
||||
Size = 15
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'SUCURSAL'
|
||||
DataType = datString
|
||||
Size = 15
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'DC'
|
||||
DataType = datString
|
||||
Size = 15
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'CUENTA'
|
||||
DataType = datString
|
||||
Size = 15
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'IGNORAR_CONTABILIDAD'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'OLD_ID'
|
||||
DataType = datInteger
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
@ -1047,8 +1054,8 @@ object srvRecibosCliente: TsrvRecibosCliente
|
||||
'UPDATE PAGOS_CLIENTE'#10' SET '#10' ID = :ID, '#10' ID_RECIBO = :ID_R' +
|
||||
'ECIBO, '#10' TIPO = :TIPO, '#10' FECHA_PAGO = :FECHA_PAGO, '#10' TI' +
|
||||
'TULAR = :TITULAR, '#10' ENTIDAD = :ENTIDAD, '#10' SUCURSAL = :SUCU' +
|
||||
'RSAL, '#10' DC = :DC, '#10' CUENTA = :CUENTA'#10' WHERE'#10' (ID = :OL' +
|
||||
'D_ID)'
|
||||
'RSAL, '#10' DC = :DC, '#10' CUENTA = :CUENTA,'#10' IGNORAR_CONTABIL' +
|
||||
'IDAD = :IGNORAR_CONTABILIDAD'#10' WHERE'#10' (ID = :OLD_ID)'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
|
||||
@ -42,9 +42,9 @@ implementation
|
||||
uses
|
||||
Dialogs,
|
||||
{Generated:} FactuGES_Invk, uDataModuleServer, uDatabaseUtils,
|
||||
schRecibosClienteClient_Intf, uRestriccionesUsuarioUtils;
|
||||
schRecibosClienteClient_Intf, uRestriccionesUsuarioUtils, uBizPagosClienteServer;
|
||||
// uRptRecibosCliente_Server;
|
||||
//, uBizRecibosClienteServer;
|
||||
|
||||
|
||||
procedure Create_srvRecibosCliente(out anInstance : IUnknown);
|
||||
begin
|
||||
@ -69,6 +69,7 @@ end;
|
||||
procedure TsrvRecibosCliente.DARemoteServiceCreate(Sender: TObject);
|
||||
begin
|
||||
SessionManager := dmServer.SessionManager;
|
||||
bpPagosCliente.BusinessRulesID := BIZ_SERVER_PAGOS_CLIENTE;
|
||||
end;
|
||||
|
||||
procedure TsrvRecibosCliente.DataAbstractServiceBeforeAcquireConnection(aSender: TObject; var aConnectionName: string);
|
||||
|
||||
@ -3,8 +3,8 @@ object fEditorFechaPago: TfEditorFechaPago
|
||||
Top = 0
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Fecha del cobro / devoluci'#243'n'
|
||||
ClientHeight = 167
|
||||
ClientWidth = 283
|
||||
ClientHeight = 295
|
||||
ClientWidth = 383
|
||||
Color = clWindow
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
@ -13,7 +13,11 @@ object fEditorFechaPago: TfEditorFechaPago
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
OnClose = FormClose
|
||||
OnShow = FormShow
|
||||
DesignSize = (
|
||||
383
|
||||
295)
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object Label1: TLabel
|
||||
@ -26,16 +30,16 @@ object fEditorFechaPago: TfEditorFechaPago
|
||||
'la devoluci'#243'n:'
|
||||
end
|
||||
object Label2: TLabel
|
||||
Left = 38
|
||||
Left = 39
|
||||
Top = 67
|
||||
Width = 33
|
||||
Width = 77
|
||||
Height = 13
|
||||
Alignment = taRightJustify
|
||||
Caption = 'Fecha:'
|
||||
Caption = 'Fecha del pago:'
|
||||
FocusControl = eFechaPago
|
||||
end
|
||||
object eFechaPago: TcxDateEdit
|
||||
Left = 77
|
||||
Left = 122
|
||||
Top = 64
|
||||
Properties.OnChange = eFechaPagoPropertiesChange
|
||||
Style.LookAndFeel.Kind = lfStandard
|
||||
@ -51,8 +55,8 @@ object fEditorFechaPago: TfEditorFechaPago
|
||||
end
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
Top = 126
|
||||
Width = 283
|
||||
Top = 254
|
||||
Width = 383
|
||||
Height = 41
|
||||
Align = alBottom
|
||||
TabOrder = 1
|
||||
@ -64,6 +68,7 @@ object fEditorFechaPago: TfEditorFechaPago
|
||||
Caption = 'Aceptar'
|
||||
ModalResult = 1
|
||||
TabOrder = 0
|
||||
OnClick = bAceptarClick
|
||||
end
|
||||
object bCancelar: TButton
|
||||
Left = 200
|
||||
@ -75,4 +80,81 @@ object fEditorFechaPago: TfEditorFechaPago
|
||||
TabOrder = 1
|
||||
end
|
||||
end
|
||||
object eContabilizar: TcxCheckBox
|
||||
Left = 38
|
||||
Top = 120
|
||||
Caption = 'Ignorar en contabiliad'
|
||||
Properties.ValueChecked = 1
|
||||
Properties.ValueUnchecked = 0
|
||||
Properties.OnChange = eContabilizarPropertiesChange
|
||||
TabOrder = 2
|
||||
Width = 203
|
||||
end
|
||||
object eRefSubCuenta: TcxTextEdit
|
||||
Left = 39
|
||||
Top = 147
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
AutoSize = False
|
||||
Properties.ReadOnly = True
|
||||
Properties.ValidateOnEnter = True
|
||||
Style.BorderColor = clWindowFrame
|
||||
Style.BorderStyle = ebs3D
|
||||
Style.Color = 14745599
|
||||
Style.HotTrack = False
|
||||
Style.LookAndFeel.NativeStyle = True
|
||||
StyleDisabled.LookAndFeel.NativeStyle = True
|
||||
StyleFocused.LookAndFeel.NativeStyle = True
|
||||
StyleHot.LookAndFeel.NativeStyle = True
|
||||
TabOrder = 3
|
||||
Height = 21
|
||||
Width = 215
|
||||
end
|
||||
object eSubCuenta: TcxTextEdit
|
||||
Left = 38
|
||||
Top = 174
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
AutoSize = False
|
||||
Properties.ReadOnly = True
|
||||
Properties.ValidateOnEnter = True
|
||||
Style.BorderColor = clWindowFrame
|
||||
Style.BorderStyle = ebs3D
|
||||
Style.Color = 14745599
|
||||
Style.HotTrack = False
|
||||
Style.LookAndFeel.NativeStyle = True
|
||||
StyleDisabled.LookAndFeel.NativeStyle = True
|
||||
StyleFocused.LookAndFeel.NativeStyle = True
|
||||
StyleHot.LookAndFeel.NativeStyle = True
|
||||
TabOrder = 4
|
||||
Height = 21
|
||||
Width = 297
|
||||
end
|
||||
object BitBtn3: TBitBtn
|
||||
Left = 260
|
||||
Top = 143
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = 'Elegir subcuenta'
|
||||
TabOrder = 5
|
||||
OnClick = BitBtn3Click
|
||||
end
|
||||
object eIDSubcuenta: TcxTextEdit
|
||||
Left = 38
|
||||
Top = 201
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
AutoSize = False
|
||||
Properties.ReadOnly = True
|
||||
Properties.ValidateOnEnter = True
|
||||
Properties.OnChange = eIDSubcuentaPropertiesChange
|
||||
Style.BorderColor = clWindowFrame
|
||||
Style.BorderStyle = ebs3D
|
||||
Style.Color = 14745599
|
||||
Style.HotTrack = False
|
||||
Style.LookAndFeel.NativeStyle = True
|
||||
StyleDisabled.LookAndFeel.NativeStyle = True
|
||||
StyleFocused.LookAndFeel.NativeStyle = True
|
||||
StyleHot.LookAndFeel.NativeStyle = True
|
||||
TabOrder = 6
|
||||
Height = 21
|
||||
Width = 43
|
||||
end
|
||||
end
|
||||
|
||||
@ -5,7 +5,8 @@ interface
|
||||
uses
|
||||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, cxControls, cxContainer, cxEdit, cxTextEdit, cxMaskEdit,
|
||||
cxDropDownEdit, cxCalendar, ExtCtrls, uEditorBasico, uIEditorFechaPago;
|
||||
cxDropDownEdit, cxCalendar, ExtCtrls, uEditorBasico, uIEditorFechaPago,
|
||||
cxCheckBox, uSubCuentasController, Buttons, cxDBEdit;
|
||||
|
||||
type
|
||||
TfEditorFechaPago = class(TfEditorBasico, IEditorFechaPago)
|
||||
@ -15,14 +16,35 @@ type
|
||||
bCancelar: TButton;
|
||||
Label2: TLabel;
|
||||
Panel1: TPanel;
|
||||
eContabilizar: TcxCheckBox;
|
||||
eRefSubCuenta: TcxTextEdit;
|
||||
eSubCuenta: TcxTextEdit;
|
||||
BitBtn3: TBitBtn;
|
||||
eIDSubcuenta: TcxTextEdit;
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure eFechaPagoPropertiesChange(Sender: TObject);
|
||||
procedure eContabilizarPropertiesChange(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
procedure BitBtn3Click(Sender: TObject);
|
||||
procedure eIDSubcuentaPropertiesChange(Sender: TObject);
|
||||
procedure bAceptarClick(Sender: TObject);
|
||||
private
|
||||
FController : ISubcuentasController;
|
||||
FIdSubCuenta : Integer;
|
||||
FIgnorarContabilidad : Integer;
|
||||
FFechaPago : TDateTime;
|
||||
function GetFechaPago: TDateTime;
|
||||
procedure SetFechaPago(const Value: TDateTime);
|
||||
function GetIgnorarContabilidad: Integer;
|
||||
procedure SetIgnorarContabilidad(const Value: Integer);
|
||||
function GetIdSubCuenta: Integer;
|
||||
procedure SetIdSubCuenta(const Value: Integer);
|
||||
|
||||
public
|
||||
property FechaPago: TDateTime Read GetFechaPago write SetFechaPago;
|
||||
property IgnorarContabilidad: Integer Read GetIgnorarContabilidad write SetIgnorarContabilidad;
|
||||
property IdSubCuenta: Integer Read GetIdSubCuenta write SetIdSubCuenta;
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
end;
|
||||
|
||||
var
|
||||
@ -32,14 +54,59 @@ implementation
|
||||
|
||||
{$R *.dfm}
|
||||
|
||||
uses uBizSubCuentas;
|
||||
|
||||
procedure TfEditorFechaPago.bAceptarClick(Sender: TObject);
|
||||
begin
|
||||
if (not eContabilizar.Checked)
|
||||
and (eIdSubcuenta.Text = '') then
|
||||
raise Exception.Create ('Es necesario que elija la SubCuenta donde se realizará el pago');
|
||||
end;
|
||||
|
||||
procedure TfEditorFechaPago.BitBtn3Click(Sender: TObject);
|
||||
var
|
||||
ASubCuenta: IBizSubcuenta;
|
||||
begin
|
||||
ASubCuenta := FController.ElegirSubCuenta(FController.BuscarTodos,'sssss', False);
|
||||
eIDSubcuenta.Text := IntToStr(ASubcuenta.ID);
|
||||
eRefSubCuenta.Text := ASubcuenta.REF_SUBCUENTA;
|
||||
eSubCuenta.Text := ASubcuenta.DESCRIPCION;
|
||||
ASubCuenta := Nil;
|
||||
end;
|
||||
|
||||
constructor TfEditorFechaPago.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited;
|
||||
FController := TSubcuentasController.Create;
|
||||
end;
|
||||
|
||||
procedure TfEditorFechaPago.eContabilizarPropertiesChange(Sender: TObject);
|
||||
begin
|
||||
FIgnorarContabilidad := eContabilizar.EditValue;
|
||||
end;
|
||||
|
||||
procedure TfEditorFechaPago.eFechaPagoPropertiesChange(Sender: TObject);
|
||||
begin
|
||||
FechaPago := eFechaPago.Date;
|
||||
end;
|
||||
|
||||
procedure TfEditorFechaPago.eIDSubcuentaPropertiesChange(Sender: TObject);
|
||||
begin
|
||||
if not VarIsNull(eIDSubCuenta.EditValue) then
|
||||
FIDSubCuenta := eIDSubCuenta.EditValue;
|
||||
end;
|
||||
|
||||
procedure TfEditorFechaPago.FormClose(Sender: TObject;
|
||||
var Action: TCloseAction);
|
||||
begin
|
||||
FController := Nil;
|
||||
end;
|
||||
|
||||
procedure TfEditorFechaPago.FormShow(Sender: TObject);
|
||||
begin
|
||||
eFechaPago.Date := Date;
|
||||
if (length(eFechaPago.Text) = 0) then
|
||||
eFechaPago.Date := Date;
|
||||
// FController.
|
||||
end;
|
||||
|
||||
function TfEditorFechaPago.GetFechaPago: TDateTime;
|
||||
@ -47,9 +114,31 @@ begin
|
||||
Result := FFechaPago;
|
||||
end;
|
||||
|
||||
function TfEditorFechaPago.GetIdSubCuenta: Integer;
|
||||
begin
|
||||
Result := eIDSubCuenta.EditValue; //FIdSubCuenta;
|
||||
end;
|
||||
|
||||
function TfEditorFechaPago.GetIgnorarContabilidad: Integer;
|
||||
begin
|
||||
Result := FIgnorarContabilidad;
|
||||
end;
|
||||
|
||||
procedure TfEditorFechaPago.SetFechaPago(const Value: TDateTime);
|
||||
begin
|
||||
FFechaPago := Value;
|
||||
eFechaPago.EditValue := FFechaPago;
|
||||
end;
|
||||
|
||||
procedure TfEditorFechaPago.SetIdSubCuenta(const Value: Integer);
|
||||
begin
|
||||
FIdSubCuenta := Value;
|
||||
end;
|
||||
|
||||
procedure TfEditorFechaPago.SetIgnorarContabilidad(const Value: Integer);
|
||||
begin
|
||||
FIgnorarContabilidad := Value;
|
||||
eContabilizar.EditValue := FIgnorarContabilidad;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@ -324,8 +324,6 @@ inherited fEditorReciboCliente: TfEditorReciboCliente
|
||||
inherited eImporte: TcxDBCurrencyEdit
|
||||
DataBinding.DataSource = dsDataTable
|
||||
Properties.OnEditValueChanged = frViewReciboCliImportes1eImportePropertiesEditValueChanged
|
||||
ExplicitWidth = 150
|
||||
Width = 150
|
||||
end
|
||||
inherited eOtrosGastos: TcxDBCurrencyEdit
|
||||
DataBinding.DataSource = dsDataTable
|
||||
|
||||
@ -9,19 +9,11 @@ const
|
||||
{ Data table rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_darReferencia = '{2A669FBE-2DE4-4257-8CA5-518E3E7FE0A3}';
|
||||
RID_RemesasCliente = '{6AD59CC0-CB4B-4B42-87E9-0C30BF117732}';
|
||||
RID_RemesasCliente = '{A346376B-965B-4865-A253-9DDF4D88E9C5}';
|
||||
|
||||
{ Data table names }
|
||||
nme_darReferencia = 'darReferencia';
|
||||
nme_RemesasCliente = 'RemesasCliente';
|
||||
|
||||
{ darReferencia fields }
|
||||
fld_darReferenciaVALOR = 'VALOR';
|
||||
|
||||
{ darReferencia field indexes }
|
||||
idx_darReferenciaVALOR = 0;
|
||||
|
||||
{ RemesasCliente fields }
|
||||
fld_RemesasClienteID = 'ID';
|
||||
fld_RemesasClienteID_EMPRESA = 'ID_EMPRESA';
|
||||
@ -63,44 +55,9 @@ const
|
||||
idx_RemesasClienteIMPORTE_TOTAL = 17;
|
||||
|
||||
type
|
||||
{ IdarReferencia }
|
||||
IdarReferencia = interface(IDAStronglyTypedDataTable)
|
||||
['{41ABA49E-1EC4-40B5-8174-E851C8735EF6}']
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String;
|
||||
procedure SetVALORValue(const aValue: String);
|
||||
function GetVALORIsNull: Boolean;
|
||||
procedure SetVALORIsNull(const aValue: Boolean);
|
||||
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
end;
|
||||
|
||||
{ TdarReferenciaDataTableRules }
|
||||
TdarReferenciaDataTableRules = class(TIntfObjectDADataTableRules, IdarReferencia)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aDataTable: TDADataTable); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IRemesasCliente }
|
||||
IRemesasCliente = interface(IDAStronglyTypedDataTable)
|
||||
['{2DFC502B-A484-4565-BFCB-F4A172BBF594}']
|
||||
['{FDEB4748-8F61-4BFF-BED3-8A4904D1F593}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -341,39 +298,6 @@ implementation
|
||||
|
||||
uses Variants, uROBinaryHelpers;
|
||||
|
||||
{ TdarReferenciaDataTableRules }
|
||||
constructor TdarReferenciaDataTableRules.Create(aDataTable: TDADataTable);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TdarReferenciaDataTableRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TdarReferenciaDataTableRules.GetVALORValue: String;
|
||||
begin
|
||||
result := DataTable.Fields[idx_darReferenciaVALOR].AsString;
|
||||
end;
|
||||
|
||||
procedure TdarReferenciaDataTableRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
DataTable.Fields[idx_darReferenciaVALOR].AsString := aValue;
|
||||
end;
|
||||
|
||||
function TdarReferenciaDataTableRules.GetVALORIsNull: boolean;
|
||||
begin
|
||||
result := DataTable.Fields[idx_darReferenciaVALOR].IsNull;
|
||||
end;
|
||||
|
||||
procedure TdarReferenciaDataTableRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
DataTable.Fields[idx_darReferenciaVALOR].AsVariant := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TRemesasClienteDataTableRules }
|
||||
constructor TRemesasClienteDataTableRules.Create(aDataTable: TDADataTable);
|
||||
begin
|
||||
@ -765,7 +689,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterDataTableRules(RID_darReferencia, TdarReferenciaDataTableRules);
|
||||
RegisterDataTableRules(RID_RemesasCliente, TRemesasClienteDataTableRules);
|
||||
|
||||
end.
|
||||
|
||||
@ -9,47 +9,12 @@ const
|
||||
{ Delta rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_darReferenciaDelta = '{93BE415A-B388-496F-B435-1AA6D4F3535C}';
|
||||
RID_RemesasClienteDelta = '{090FFD4E-3541-40D8-9577-9A6BBB35ECEB}';
|
||||
RID_RemesasClienteDelta = '{F8C1BED7-3DDB-4A8B-9E23-7ACFF1822443}';
|
||||
|
||||
type
|
||||
{ IdarReferenciaDelta }
|
||||
IdarReferenciaDelta = interface(IdarReferencia)
|
||||
['{93BE415A-B388-496F-B435-1AA6D4F3535C}']
|
||||
{ Property getters and setters }
|
||||
function GetOldVALORValue : String;
|
||||
|
||||
{ Properties }
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
end;
|
||||
|
||||
{ TdarReferenciaBusinessProcessorRules }
|
||||
TdarReferenciaBusinessProcessorRules = class(TDABusinessProcessorRules, IdarReferencia, IdarReferenciaDelta)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
function GetOldVALORValue: String; virtual;
|
||||
function GetOldVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR : String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull : Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
property OldVALORIsNull : Boolean read GetOldVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IRemesasClienteDelta }
|
||||
IRemesasClienteDelta = interface(IRemesasCliente)
|
||||
['{090FFD4E-3541-40D8-9577-9A6BBB35ECEB}']
|
||||
['{F8C1BED7-3DDB-4A8B-9E23-7ACFF1822443}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_EMPRESAValue : Integer;
|
||||
@ -290,49 +255,6 @@ implementation
|
||||
uses
|
||||
Variants, uROBinaryHelpers, uDAInterfaces;
|
||||
|
||||
{ TdarReferenciaBusinessProcessorRules }
|
||||
constructor TdarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TdarReferenciaBusinessProcessorRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TdarReferenciaBusinessProcessorRules.GetVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.NewValueByName[fld_darReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TdarReferenciaBusinessProcessorRules.GetVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_darReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
function TdarReferenciaBusinessProcessorRules.GetOldVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.OldValueByName[fld_darReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TdarReferenciaBusinessProcessorRules.GetOldVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_darReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
procedure TdarReferenciaBusinessProcessorRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_darReferenciaVALOR] := aValue;
|
||||
end;
|
||||
|
||||
procedure TdarReferenciaBusinessProcessorRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_darReferenciaVALOR] := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TRemesasClienteBusinessProcessorRules }
|
||||
constructor TRemesasClienteBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
begin
|
||||
@ -904,7 +826,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(RID_darReferenciaDelta, TdarReferenciaBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_RemesasClienteDelta, TRemesasClienteBusinessProcessorRules);
|
||||
|
||||
end.
|
||||
|
||||
@ -8,70 +8,91 @@ uses
|
||||
|
||||
const
|
||||
BIZ_SERVER_REMESAS_CLIENTE = 'Server.RemesasCliente';
|
||||
REF_REMESAS_CLIENTE = 'REF_REMESAS_CLIENTE';
|
||||
|
||||
type
|
||||
TBizRemesasClienteServer = class(TRemesasClienteBusinessProcessorRules)
|
||||
private
|
||||
FReferenciaAutomatica : Boolean;
|
||||
function DarReferencia : String;
|
||||
function IncrementarReferencia : Boolean;
|
||||
protected
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta); override;
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor;
|
||||
const aDelta: IDADelta); override;
|
||||
procedure AfterProcessChange(Sender: TDABusinessProcessor;
|
||||
aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean); override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Variants, uDAClasses, uReferenciasUtils, uBusinessUtils, uROClasses, uDataModuleServer,
|
||||
schRemesasClienteClient_Intf;
|
||||
|
||||
schRemesasClienteClient_Intf, srvReferencias_Impl;
|
||||
|
||||
const
|
||||
REF_REMESAS_CLIENTE = 'REF_REMESAS_CLIENTE';
|
||||
|
||||
{ TBizRemesasClienteServer }
|
||||
|
||||
procedure TBizRemesasClienteServer.AfterProcessChange(
|
||||
Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
{ Por defecto, mantenemos los deltas por si alguna tabla hija los necesita }
|
||||
CanRemoveFromDelta := False;
|
||||
|
||||
case aChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
if FReferenciaAutomatica then
|
||||
begin
|
||||
IncrementarReferencia;
|
||||
FReferenciaAutomatica := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizRemesasClienteServer.BeforeProcessDelta(
|
||||
Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
Empresa : Variant;
|
||||
|
||||
begin
|
||||
inherited;
|
||||
FReferenciaAutomatica := False;
|
||||
|
||||
case Sender.CurrentChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
//Si la referencia no ha sido asignada le asignamos una nosotros
|
||||
if (VarIsNull(Sender.CurrentChange.NewValueByName[fld_RemesasClienteREFERENCIA]))
|
||||
or (VarToStr(Sender.CurrentChange.NewValueByName[fld_RemesasClienteREFERENCIA]) = '') then
|
||||
if REFERENCIAIsNull or (Length(REFERENCIA) = 0) then
|
||||
begin
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
try
|
||||
//Siempre va a estar rellena
|
||||
Empresa := Sender.CurrentChange.NewValueByName[fld_RemesasClienteID_EMPRESA];
|
||||
|
||||
dsData := ASchema.NewDataset(ACurrentConn, 'DarReferencia', ['CODIGO', 'EMPRESA'], [REF_REMESAS_CLIENTE, Empresa]);
|
||||
except
|
||||
RaiseError('No existe la tabla REFERENCIAS');
|
||||
end;
|
||||
|
||||
dsData.Active := True;
|
||||
|
||||
if dsData.IsEmpty then
|
||||
RaiseError('NO HAY REFERENCIA ' + REF_REMESAS_CLIENTE + ' DECLARADA EN TABLA REFERENCIAS');
|
||||
|
||||
REFERENCIA := dsData.FieldByName('VALOR').AsString;
|
||||
|
||||
try
|
||||
ASchema.NewCommand(ACurrentConn, 'ModificarReferencia', ['CODIGO', 'VALOR', 'ID_EMPRESA'], [REF_Remesas_CLIENTE, DarReferenciaSiguiente(REFERENCIA), Empresa]);
|
||||
except
|
||||
RaiseError('Error al asignar la nueva ' + REFERENCIA + ' referencia en tabla');
|
||||
end;
|
||||
|
||||
FReferenciaAutomatica := True;
|
||||
REFERENCIA := DarReferencia;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizRemesasClienteServer.DarReferencia: String;
|
||||
begin
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := DarNuevaReferencia(REF_REMESAS_CLIENTE, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizRemesasClienteServer.IncrementarReferencia: Boolean;
|
||||
begin
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := IncrementarValorReferencia(REF_REMESAS_CLIENTE,
|
||||
Self.REFERENCIA, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(BIZ_SERVER_REMESAS_CLIENTE, TBizRemesasClienteServer);
|
||||
|
||||
end.
|
||||
|
||||
|
||||
@ -136,42 +136,6 @@ object srvRemesasCliente: TsrvRemesasCliente
|
||||
DataDictionary = DataDictionary
|
||||
Diagrams = Diagrams
|
||||
Datasets = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
DataType = datString
|
||||
Size = 50
|
||||
Value = 'REF_REMESAS_CLIENTE'
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = '1'
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'SELECT VALOR'#10'FROM REFERENCIAS'#10'WHERE CODIGO = :CODIGO'#10'AND ID_EMPR' +
|
||||
'ESA = :EMPRESA'
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'VALOR'
|
||||
TableField = 'VALOR'
|
||||
end>
|
||||
end>
|
||||
Name = 'darReferencia'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <>
|
||||
Statements = <
|
||||
@ -363,32 +327,6 @@ object srvRemesasCliente: TsrvRemesasCliente
|
||||
JoinDataTables = <>
|
||||
UnionDataTables = <>
|
||||
Commands = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'UPDATE REFERENCIAS SET'#10' VALOR = :VALOR'#10'WHERE CODIGO = :COD' +
|
||||
'IGO AND'#10' ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'ModificarReferencia'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
|
||||
@ -23,9 +23,9 @@ type
|
||||
TsrvRemesasCliente = class(TDataAbstractService, IsrvRemesasCliente)
|
||||
Diagrams: TDADiagrams;
|
||||
bpRemesasCliente: TDABusinessProcessor;
|
||||
Bin2DataStreamer: TDABin2DataStreamer;
|
||||
schRemesasCliente: TDASchema;
|
||||
DataDictionary: TDADataDictionary;
|
||||
Bin2DataStreamer: TDABin2DataStreamer;
|
||||
procedure DARemoteServiceCreate(Sender: TObject);
|
||||
procedure DARemoteServiceBeforeGetDatasetData(const Dataset: IDADataset;
|
||||
const IncludeSchema: Boolean; const MaxRecords: Integer);
|
||||
@ -42,7 +42,7 @@ implementation
|
||||
uses
|
||||
{Generated:} FactuGES_Invk, uDataModuleServer,
|
||||
uDatabaseUtils, schRemesasClienteClient_Intf, uRestriccionesUsuarioUtils,
|
||||
// uBizRemesasClienteServer,
|
||||
uBizRemesasClienteServer,
|
||||
// uRptRemesasCliente_Server,
|
||||
Dialogs;
|
||||
|
||||
@ -57,21 +57,19 @@ procedure TsrvRemesasCliente.DARemoteServiceBeforeGetDatasetData(
|
||||
const Dataset: IDADataset; const IncludeSchema: Boolean;
|
||||
const MaxRecords: Integer);
|
||||
begin
|
||||
{
|
||||
if DataSet.Name = nme_RemesasCliente then
|
||||
begin
|
||||
{ Aquí se asegura que el usuario sólo accede a los RemesasCliente
|
||||
de las empresas a las que tiene permiso para acceder
|
||||
filtrando DataSet por ID_EMPRESA. }
|
||||
{ FiltrarAccesoUsuario(Session, Connection, schRemesasCliente, DataSet, fld_RemesasClienteID_EMPRESA);
|
||||
FiltrarAccesoUsuario(Session, Connection, schRemesasCliente, DataSet, fld_RemesasClienteID_EMPRESA);
|
||||
end;
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TsrvRemesasCliente.DARemoteServiceCreate(Sender: TObject);
|
||||
begin
|
||||
SessionManager := dmServer.SessionManager;
|
||||
// bpRemesasCliente.BusinessRulesID := BIZ_SERVER_REMESAS_CLIENTE;
|
||||
bpRemesasCliente.BusinessRulesID := BIZ_SERVER_REMESAS_CLIENTE;
|
||||
end;
|
||||
|
||||
procedure TsrvRemesasCliente.DataAbstractServiceBeforeAcquireConnection(
|
||||
|
||||
@ -9,19 +9,11 @@ const
|
||||
{ Data table rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_darReferencia = '{60F91383-6F77-4AD3-9E84-B27C782A1482}';
|
||||
RID_RemesasProveedor = '{044A9E1D-90AB-4E1C-BFCB-98772BB603BE}';
|
||||
RID_RemesasProveedor = '{23D3FD39-C8A1-424C-A738-908158D36ED1}';
|
||||
|
||||
{ Data table names }
|
||||
nme_darReferencia = 'darReferencia';
|
||||
nme_RemesasProveedor = 'RemesasProveedor';
|
||||
|
||||
{ darReferencia fields }
|
||||
fld_darReferenciaVALOR = 'VALOR';
|
||||
|
||||
{ darReferencia field indexes }
|
||||
idx_darReferenciaVALOR = 0;
|
||||
|
||||
{ RemesasProveedor fields }
|
||||
fld_RemesasProveedorID = 'ID';
|
||||
fld_RemesasProveedorID_EMPRESA = 'ID_EMPRESA';
|
||||
@ -63,44 +55,9 @@ const
|
||||
idx_RemesasProveedorIMPORTE_TOTAL = 17;
|
||||
|
||||
type
|
||||
{ IdarReferencia }
|
||||
IdarReferencia = interface(IDAStronglyTypedDataTable)
|
||||
['{3EC7EB36-5C81-4D96-924C-BFBAD8D38041}']
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String;
|
||||
procedure SetVALORValue(const aValue: String);
|
||||
function GetVALORIsNull: Boolean;
|
||||
procedure SetVALORIsNull(const aValue: Boolean);
|
||||
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
end;
|
||||
|
||||
{ TdarReferenciaDataTableRules }
|
||||
TdarReferenciaDataTableRules = class(TIntfObjectDADataTableRules, IdarReferencia)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR: String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull: Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aDataTable: TDADataTable); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IRemesasProveedor }
|
||||
IRemesasProveedor = interface(IDAStronglyTypedDataTable)
|
||||
['{33E0651A-D061-431F-9EAD-9B9B0458B888}']
|
||||
['{7A79CD94-9A3A-4E75-89AD-C1D0A728A7F5}']
|
||||
{ Property getters and setters }
|
||||
function GetIDValue: Integer;
|
||||
procedure SetIDValue(const aValue: Integer);
|
||||
@ -341,39 +298,6 @@ implementation
|
||||
|
||||
uses Variants, uROBinaryHelpers;
|
||||
|
||||
{ TdarReferenciaDataTableRules }
|
||||
constructor TdarReferenciaDataTableRules.Create(aDataTable: TDADataTable);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TdarReferenciaDataTableRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TdarReferenciaDataTableRules.GetVALORValue: String;
|
||||
begin
|
||||
result := DataTable.Fields[idx_darReferenciaVALOR].AsString;
|
||||
end;
|
||||
|
||||
procedure TdarReferenciaDataTableRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
DataTable.Fields[idx_darReferenciaVALOR].AsString := aValue;
|
||||
end;
|
||||
|
||||
function TdarReferenciaDataTableRules.GetVALORIsNull: boolean;
|
||||
begin
|
||||
result := DataTable.Fields[idx_darReferenciaVALOR].IsNull;
|
||||
end;
|
||||
|
||||
procedure TdarReferenciaDataTableRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
DataTable.Fields[idx_darReferenciaVALOR].AsVariant := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TRemesasProveedorDataTableRules }
|
||||
constructor TRemesasProveedorDataTableRules.Create(aDataTable: TDADataTable);
|
||||
begin
|
||||
@ -765,7 +689,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterDataTableRules(RID_darReferencia, TdarReferenciaDataTableRules);
|
||||
RegisterDataTableRules(RID_RemesasProveedor, TRemesasProveedorDataTableRules);
|
||||
|
||||
end.
|
||||
|
||||
@ -9,47 +9,12 @@ const
|
||||
{ Delta rules ids
|
||||
Feel free to change them to something more human readable
|
||||
but make sure they are unique in the context of your application }
|
||||
RID_darReferenciaDelta = '{654CD172-ED14-43A0-85CD-7D5714EF6CA6}';
|
||||
RID_RemesasProveedorDelta = '{66615F2E-3E7A-49C6-AE86-A922790A3D92}';
|
||||
RID_RemesasProveedorDelta = '{D08A9960-77D0-4CFF-95F2-209EA3322B70}';
|
||||
|
||||
type
|
||||
{ IdarReferenciaDelta }
|
||||
IdarReferenciaDelta = interface(IdarReferencia)
|
||||
['{654CD172-ED14-43A0-85CD-7D5714EF6CA6}']
|
||||
{ Property getters and setters }
|
||||
function GetOldVALORValue : String;
|
||||
|
||||
{ Properties }
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
end;
|
||||
|
||||
{ TdarReferenciaBusinessProcessorRules }
|
||||
TdarReferenciaBusinessProcessorRules = class(TDABusinessProcessorRules, IdarReferencia, IdarReferenciaDelta)
|
||||
private
|
||||
protected
|
||||
{ Property getters and setters }
|
||||
function GetVALORValue: String; virtual;
|
||||
function GetVALORIsNull: Boolean; virtual;
|
||||
function GetOldVALORValue: String; virtual;
|
||||
function GetOldVALORIsNull: Boolean; virtual;
|
||||
procedure SetVALORValue(const aValue: String); virtual;
|
||||
procedure SetVALORIsNull(const aValue: Boolean); virtual;
|
||||
|
||||
{ Properties }
|
||||
property VALOR : String read GetVALORValue write SetVALORValue;
|
||||
property VALORIsNull : Boolean read GetVALORIsNull write SetVALORIsNull;
|
||||
property OldVALOR : String read GetOldVALORValue;
|
||||
property OldVALORIsNull : Boolean read GetOldVALORIsNull;
|
||||
|
||||
public
|
||||
constructor Create(aBusinessProcessor: TDABusinessProcessor); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
end;
|
||||
|
||||
{ IRemesasProveedorDelta }
|
||||
IRemesasProveedorDelta = interface(IRemesasProveedor)
|
||||
['{66615F2E-3E7A-49C6-AE86-A922790A3D92}']
|
||||
['{D08A9960-77D0-4CFF-95F2-209EA3322B70}']
|
||||
{ Property getters and setters }
|
||||
function GetOldIDValue : Integer;
|
||||
function GetOldID_EMPRESAValue : Integer;
|
||||
@ -290,49 +255,6 @@ implementation
|
||||
uses
|
||||
Variants, uROBinaryHelpers, uDAInterfaces;
|
||||
|
||||
{ TdarReferenciaBusinessProcessorRules }
|
||||
constructor TdarReferenciaBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
destructor TdarReferenciaBusinessProcessorRules.Destroy;
|
||||
begin
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TdarReferenciaBusinessProcessorRules.GetVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.NewValueByName[fld_darReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TdarReferenciaBusinessProcessorRules.GetVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.NewValueByName[fld_darReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
function TdarReferenciaBusinessProcessorRules.GetOldVALORValue: String;
|
||||
begin
|
||||
result := BusinessProcessor.CurrentChange.OldValueByName[fld_darReferenciaVALOR];
|
||||
end;
|
||||
|
||||
function TdarReferenciaBusinessProcessorRules.GetOldVALORIsNull: Boolean;
|
||||
begin
|
||||
result := VarIsNull(BusinessProcessor.CurrentChange.OldValueByName[fld_darReferenciaVALOR]);
|
||||
end;
|
||||
|
||||
procedure TdarReferenciaBusinessProcessorRules.SetVALORValue(const aValue: String);
|
||||
begin
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_darReferenciaVALOR] := aValue;
|
||||
end;
|
||||
|
||||
procedure TdarReferenciaBusinessProcessorRules.SetVALORIsNull(const aValue: Boolean);
|
||||
begin
|
||||
if aValue then
|
||||
BusinessProcessor.CurrentChange.NewValueByName[fld_darReferenciaVALOR] := Null;
|
||||
end;
|
||||
|
||||
|
||||
{ TRemesasProveedorBusinessProcessorRules }
|
||||
constructor TRemesasProveedorBusinessProcessorRules.Create(aBusinessProcessor: TDABusinessProcessor);
|
||||
begin
|
||||
@ -904,7 +826,6 @@ end;
|
||||
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(RID_darReferenciaDelta, TdarReferenciaBusinessProcessorRules);
|
||||
RegisterBusinessProcessorRules(RID_RemesasProveedorDelta, TRemesasProveedorBusinessProcessorRules);
|
||||
|
||||
end.
|
||||
|
||||
@ -8,68 +8,90 @@ uses
|
||||
|
||||
const
|
||||
BIZ_SERVER_REMESAS_Proveedor = 'Server.RemesasProveedor';
|
||||
REF_REMESAS_PROVEEDOR = 'REF_REMESAS_PROVEEDOR';
|
||||
|
||||
type
|
||||
TBizRemesasProveedorServer = class(TRemesasProveedorBusinessProcessorRules)
|
||||
private
|
||||
FReferenciaAutomatica : Boolean;
|
||||
function DarReferencia : String;
|
||||
function IncrementarReferencia : Boolean;
|
||||
protected
|
||||
procedure BeforeProcessDelta(Sender: TDABusinessProcessor; const aDelta: IDADelta); override;
|
||||
procedure AfterProcessChange(Sender: TDABusinessProcessor;
|
||||
aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean);
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Variants, uDAClasses, uReferenciasUtils, uBusinessUtils, uROClasses, uDataModuleServer,
|
||||
schRemesasProveedorClient_Intf;
|
||||
schRemesasProveedorClient_Intf, srvReferencias_Impl;
|
||||
|
||||
const
|
||||
REF_REMESAS_PROVEEDOR = 'REF_REMESAS_PROVEEDOR';
|
||||
|
||||
{ TBizRemesasProveedorServer }
|
||||
|
||||
procedure TBizRemesasProveedorServer.BeforeProcessDelta(
|
||||
Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
var
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
dsData: IDADataset;
|
||||
Empresa : Variant;
|
||||
|
||||
procedure TBizRemesasProveedorServer.AfterProcessChange(
|
||||
Sender: TDABusinessProcessor; aChange: TDADeltaChange; Processed: Boolean;
|
||||
var CanRemoveFromDelta: Boolean);
|
||||
begin
|
||||
inherited;
|
||||
|
||||
{ Por defecto, mantenemos los deltas por si alguna tabla hija los necesita }
|
||||
CanRemoveFromDelta := False;
|
||||
|
||||
case aChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
if FReferenciaAutomatica then
|
||||
begin
|
||||
IncrementarReferencia;
|
||||
FReferenciaAutomatica := False;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBizRemesasProveedorServer.BeforeProcessDelta(
|
||||
Sender: TDABusinessProcessor; const aDelta: IDADelta);
|
||||
begin
|
||||
FReferenciaAutomatica := False;
|
||||
|
||||
case Sender.CurrentChange.ChangeType of
|
||||
ctInsert, ctUpdate: begin
|
||||
//Si la referencia no ha sido asignada le asignamos una nosotros
|
||||
if (VarIsNull(Sender.CurrentChange.NewValueByName[fld_RemesasProveedorREFERENCIA]))
|
||||
or (VarToStr(Sender.CurrentChange.NewValueByName[fld_RemesasProveedorREFERENCIA]) = '') then
|
||||
if REFERENCIAIsNull or (Length(REFERENCIA) = 0) then
|
||||
begin
|
||||
ASchema := BusinessProcessor.Schema;
|
||||
ACurrentConn := GetBusinessProcessorConnection(BusinessProcessor);
|
||||
|
||||
try
|
||||
//Siempre va a estar rellena
|
||||
Empresa := Sender.CurrentChange.NewValueByName[fld_RemesasProveedorID_EMPRESA];
|
||||
|
||||
dsData := ASchema.NewDataset(ACurrentConn, 'DarReferencia', ['CODIGO', 'EMPRESA'], [REF_REMESAS_PROVEEDOR, Empresa]);
|
||||
except
|
||||
RaiseError('No existe la tabla REFERENCIAS');
|
||||
end;
|
||||
|
||||
dsData.Active := True;
|
||||
|
||||
if dsData.IsEmpty then
|
||||
RaiseError('NO HAY REFERENCIA ' + REF_REMESAS_PROVEEDOR + ' DECLARADA EN TABLA REFERENCIAS');
|
||||
|
||||
REFERENCIA := dsData.FieldByName('VALOR').AsString;
|
||||
|
||||
try
|
||||
ASchema.NewCommand(ACurrentConn, 'ModificarReferencia', ['CODIGO', 'VALOR', 'ID_EMPRESA'], [REF_REMESAS_PROVEEDOR, DarReferenciaSiguiente(REFERENCIA), Empresa]);
|
||||
except
|
||||
RaiseError('Error al asignar la nueva ' + REFERENCIA + ' referencia en tabla');
|
||||
end;
|
||||
|
||||
FReferenciaAutomatica := True;
|
||||
REFERENCIA := DarReferencia;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
function TBizRemesasProveedorServer.DarReferencia: String;
|
||||
begin
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := DarNuevaReferencia(REF_REMESAS_PROVEEDOR, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBizRemesasProveedorServer.IncrementarReferencia: Boolean;
|
||||
begin
|
||||
with TsrvReferencias.Create(NIL) do
|
||||
try
|
||||
Result := IncrementarValorReferencia(REF_REMESAS_PROVEEDOR,
|
||||
Self.REFERENCIA, ID_EMPRESA)
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
initialization
|
||||
RegisterBusinessProcessorRules(BIZ_SERVER_REMESAS_Proveedor, TBizRemesasProveedorServer);
|
||||
|
||||
|
||||
@ -136,42 +136,6 @@ object srvRemesasProveedor: TsrvRemesasProveedor
|
||||
DataDictionary = DataDictionary
|
||||
Diagrams = Diagrams
|
||||
Datasets = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
DataType = datString
|
||||
Size = 50
|
||||
Value = 'REF_REMESAS_CLIENTE'
|
||||
ParamType = daptInput
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = '1'
|
||||
ParamType = daptInput
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'SELECT VALOR'#10'FROM REFERENCIAS'#10'WHERE CODIGO = :CODIGO'#10'AND ID_EMPR' +
|
||||
'ESA = :EMPRESA'
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <
|
||||
item
|
||||
DatasetField = 'VALOR'
|
||||
TableField = 'VALOR'
|
||||
end>
|
||||
end>
|
||||
Name = 'darReferencia'
|
||||
Fields = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
DataType = datString
|
||||
Size = 255
|
||||
end>
|
||||
end
|
||||
item
|
||||
Params = <>
|
||||
Statements = <
|
||||
@ -363,32 +327,6 @@ object srvRemesasProveedor: TsrvRemesasProveedor
|
||||
JoinDataTables = <>
|
||||
UnionDataTables = <>
|
||||
Commands = <
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
Name = 'VALOR'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'CODIGO'
|
||||
Value = ''
|
||||
end
|
||||
item
|
||||
Name = 'EMPRESA'
|
||||
Value = ''
|
||||
end>
|
||||
Statements = <
|
||||
item
|
||||
Connection = 'IBX'
|
||||
TargetTable = 'REFERENCIAS'
|
||||
SQL =
|
||||
'UPDATE REFERENCIAS SET'#10' VALOR = :VALOR'#10'WHERE CODIGO = :COD' +
|
||||
'IGO AND'#10' ID_EMPRESA = :EMPRESA'#10
|
||||
StatementType = stSQL
|
||||
ColumnMappings = <>
|
||||
end>
|
||||
Name = 'ModificarReferencia'
|
||||
end
|
||||
item
|
||||
Params = <
|
||||
item
|
||||
|
||||
@ -23,9 +23,9 @@ type
|
||||
TsrvRemesasProveedor = class(TDataAbstractService, IsrvRemesasProveedor)
|
||||
Diagrams: TDADiagrams;
|
||||
bpRemesasProveedor: TDABusinessProcessor;
|
||||
Bin2DataStreamer: TDABin2DataStreamer;
|
||||
schRemesasProveedor: TDASchema;
|
||||
DataDictionary: TDADataDictionary;
|
||||
Bin2DataStreamer: TDABin2DataStreamer;
|
||||
procedure DARemoteServiceCreate(Sender: TObject);
|
||||
procedure DARemoteServiceBeforeGetDatasetData(const Dataset: IDADataset;
|
||||
const IncludeSchema: Boolean; const MaxRecords: Integer);
|
||||
@ -34,7 +34,6 @@ type
|
||||
private
|
||||
protected
|
||||
{ IsrvRemesasProveedor methods }
|
||||
function GetNextAutoInc(const GeneratorName: String): Integer;
|
||||
function GenerateReport(const ID: String): Binary;
|
||||
end;
|
||||
|
||||
@ -44,7 +43,8 @@ implementation
|
||||
uses
|
||||
{Generated:} FactuGES_Invk, uDataModuleServer,
|
||||
uDatabaseUtils, schRemesasProveedorClient_Intf, uRestriccionesUsuarioUtils,
|
||||
// uBizRemesasProveedorServer, uRptRemesasProveedor_Server,
|
||||
uBizRemesasProveedorServer,
|
||||
//uRptRemesasProveedor_Server,
|
||||
Dialogs;
|
||||
|
||||
procedure Create_srvRemesasProveedor(out anInstance : IUnknown);
|
||||
@ -58,21 +58,19 @@ procedure TsrvRemesasProveedor.DARemoteServiceBeforeGetDatasetData(
|
||||
const Dataset: IDADataset; const IncludeSchema: Boolean;
|
||||
const MaxRecords: Integer);
|
||||
begin
|
||||
{
|
||||
if DataSet.Name = nme_RemesasProveedor then
|
||||
begin
|
||||
{ Aquí se asegura que el usuario sólo accede a los RemesasProveedor
|
||||
de las empresas a las que tiene permiso para acceder
|
||||
filtrando DataSet por ID_EMPRESA. }
|
||||
{ FiltrarAccesoUsuario(Session, Connection, schRemesasProveedor, DataSet, fld_RemesasProveedorID_EMPRESA);
|
||||
FiltrarAccesoUsuario(Session, Connection, schRemesasProveedor, DataSet, fld_RemesasProveedorID_EMPRESA);
|
||||
end;
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TsrvRemesasProveedor.DARemoteServiceCreate(Sender: TObject);
|
||||
begin
|
||||
SessionManager := dmServer.SessionManager;
|
||||
// bpRemesasProveedor.BusinessRulesID := BIZ_SERVER_REMESAS_PROVEEDOR;
|
||||
bpRemesasProveedor.BusinessRulesID := BIZ_SERVER_REMESAS_PROVEEDOR;
|
||||
end;
|
||||
|
||||
procedure TsrvRemesasProveedor.DataAbstractServiceBeforeAcquireConnection(
|
||||
@ -95,11 +93,6 @@ begin
|
||||
}
|
||||
end;
|
||||
|
||||
function TsrvRemesasProveedor.GetNextAutoInc(const GeneratorName: String): Integer;
|
||||
begin
|
||||
Result := uDatabaseUtils.GetNextAutoInc(GeneratorName)
|
||||
end;
|
||||
|
||||
initialization
|
||||
TROClassFactory.Create('srvRemesasProveedor', Create_srvRemesasProveedor, TsrvRemesasProveedor_Invoker);
|
||||
|
||||
|
||||
Binary file not shown.
@ -54,36 +54,22 @@ uses
|
||||
schFormasPagoClient_Intf in '..\Modulos\Formas de pago\Model\schFormasPagoClient_Intf.pas',
|
||||
schFormasPagoServer_Intf in '..\Modulos\Formas de pago\Model\schFormasPagoServer_Intf.pas',
|
||||
uRptPresupuestosCliente_Server in '..\Modulos\Presupuestos de cliente\Reports\uRptPresupuestosCliente_Server.pas' {RptPresupuestosCliente},
|
||||
schAlbaranesClienteClient_Intf in '..\Modulos\Albaranes de cliente\Model\schAlbaranesClienteClient_Intf.pas',
|
||||
schAlbaranesClienteServer_Intf in '..\Modulos\Albaranes de cliente\Model\schAlbaranesClienteServer_Intf.pas',
|
||||
srvRecibosProveedor_Impl in '..\Modulos\Recibos de proveedor\Servidor\srvRecibosProveedor_Impl.pas' {srvRecibosProveedor: TDataAbstractService},
|
||||
uBizFacturasClienteServer in '..\Modulos\Facturas de cliente\Model\uBizFacturasClienteServer.pas',
|
||||
srvFacturasProveedor_Impl in '..\Modulos\Facturas de proveedor\Servidor\srvFacturasProveedor_Impl.pas' {srvFacturasProveedor: TDataAbstractService},
|
||||
srvAlbaranesProveedor_Impl in '..\Modulos\Albaranes de proveedor\Servidor\srvAlbaranesProveedor_Impl.pas' {srvAlbaranesProveedor: TDataAbstractService},
|
||||
srvPedidosProveedor_Impl in '..\Modulos\Pedidos a proveedor\Servidor\srvPedidosProveedor_Impl.pas' {srvPedidosProveedor: TDataAbstractService},
|
||||
uBizPedidosProveedorServer in '..\Modulos\Pedidos a proveedor\Model\uBizPedidosProveedorServer.pas',
|
||||
schPedidosProveedorClient_Intf in '..\Modulos\Pedidos a proveedor\Model\schPedidosProveedorClient_Intf.pas',
|
||||
schPedidosProveedorServer_Intf in '..\Modulos\Pedidos a proveedor\Model\schPedidosProveedorServer_Intf.pas',
|
||||
schAlbaranesProveedorClient_Intf in '..\Modulos\Albaranes de proveedor\Model\schAlbaranesProveedorClient_Intf.pas',
|
||||
schAlbaranesProveedorServer_Intf in '..\Modulos\Albaranes de proveedor\Model\schAlbaranesProveedorServer_Intf.pas',
|
||||
uBizAlbaranProveedorServer in '..\Modulos\Albaranes de proveedor\Model\uBizAlbaranProveedorServer.PAS',
|
||||
uBizFacturasProveedorServer in '..\Modulos\Facturas de proveedor\Model\uBizFacturasProveedorServer.pas',
|
||||
schAlmacenesClient_Intf in '..\Modulos\Almacenes\Model\schAlmacenesClient_Intf.pas',
|
||||
schAlmacenesServer_Intf in '..\Modulos\Almacenes\Model\schAlmacenesServer_Intf.pas',
|
||||
schFacturasProveedorClient_Intf in '..\Modulos\Facturas de proveedor\Model\schFacturasProveedorClient_Intf.pas',
|
||||
schFacturasProveedorServer_Intf in '..\Modulos\Facturas de proveedor\Model\schFacturasProveedorServer_Intf.pas',
|
||||
schPresupuestosClienteClient_Intf in '..\Modulos\Presupuestos de cliente\Model\schPresupuestosClienteClient_Intf.pas',
|
||||
schPresupuestosClienteServer_Intf in '..\Modulos\Presupuestos de cliente\Model\schPresupuestosClienteServer_Intf.pas',
|
||||
schArticulosClient_Intf in '..\Modulos\Articulos\Model\schArticulosClient_Intf.pas',
|
||||
schArticulosServer_Intf in '..\Modulos\Articulos\Model\schArticulosServer_Intf.pas',
|
||||
schRecibosProveedorClient_Intf in '..\Modulos\Recibos de proveedor\Model\schRecibosProveedorClient_Intf.pas',
|
||||
schRecibosProveedorServer_Intf in '..\Modulos\Recibos de proveedor\Model\schRecibosProveedorServer_Intf.pas',
|
||||
srvRemesasCliente_Impl in '..\Modulos\Remesas de cliente\Servidor\srvRemesasCliente_Impl.pas' {srvRemesasCliente: TDataAbstractService},
|
||||
srvRemesasProveedor_Impl in '..\Modulos\Remesas de proveedor\Servidor\srvRemesasProveedor_Impl.pas' {srvRemesasProveedor: TDataAbstractService},
|
||||
schRemesasProveedorClient_Intf in '..\Modulos\Remesas de proveedor\Model\schRemesasProveedorClient_Intf.pas',
|
||||
schRemesasProveedorServer_Intf in '..\Modulos\Remesas de proveedor\Model\schRemesasProveedorServer_Intf.pas',
|
||||
schRemesasClienteClient_Intf in '..\Modulos\Remesas de cliente\Model\schRemesasClienteClient_Intf.pas',
|
||||
schRemesasClienteServer_Intf in '..\Modulos\Remesas de cliente\Model\schRemesasClienteServer_Intf.pas',
|
||||
srvInventario_Impl in '..\Modulos\Inventario\Servidor\srvInventario_Impl.pas' {srvInventario: TDataAbstractService},
|
||||
srvHistoricoMovimientos_Impl in '..\Modulos\Historico de movimientos\Servidor\srvHistoricoMovimientos_Impl.pas' {srvHistoricoMovimientos: TDataAbstractService},
|
||||
srvReferencias_Impl in 'srvReferencias_Impl.pas' {srvReferencias: TDataAbstractService},
|
||||
@ -96,15 +82,31 @@ uses
|
||||
schEjerciciosServer_Intf in '..\ApplicationBase\Ejercicios\Model\schEjerciciosServer_Intf.pas',
|
||||
schEjerciciosClient_Intf in '..\ApplicationBase\Ejercicios\Model\schEjerciciosClient_Intf.pas',
|
||||
srvContabilidad_Impl in '..\Modulos\Contabilidad\Servidor\srvContabilidad_Impl.pas' {srvContabilidad: TDataAbstractService},
|
||||
schFacturasClienteClient_Intf in '..\Modulos\Facturas de cliente\Model\schFacturasClienteClient_Intf.pas',
|
||||
schFacturasClienteServer_Intf in '..\Modulos\Facturas de cliente\Model\schFacturasClienteServer_Intf.pas',
|
||||
uBizPagosClienteServer in '..\Modulos\Recibos de cliente\Model\uBizPagosClienteServer.pas',
|
||||
schContabilidadServer_Intf in '..\Modulos\Contabilidad\Model\schContabilidadServer_Intf.pas',
|
||||
schContabilidadClient_Intf in '..\Modulos\Contabilidad\Model\schContabilidadClient_Intf.pas',
|
||||
schRecibosClienteClient_Intf in '..\Modulos\Recibos de cliente\Model\schRecibosClienteClient_Intf.pas',
|
||||
schRecibosClienteServer_Intf in '..\Modulos\Recibos de cliente\Model\schRecibosClienteServer_Intf.pas',
|
||||
schContactosClient_Intf in '..\Modulos\Contactos\Model\schContactosClient_Intf.pas',
|
||||
schContactosServer_Intf in '..\Modulos\Contactos\Model\schContactosServer_Intf.pas';
|
||||
schContactosServer_Intf in '..\Modulos\Contactos\Model\schContactosServer_Intf.pas',
|
||||
schAlbaranesClienteClient_Intf in '..\Modulos\Albaranes de cliente\Model\schAlbaranesClienteClient_Intf.pas',
|
||||
schAlbaranesClienteServer_Intf in '..\Modulos\Albaranes de cliente\Model\schAlbaranesClienteServer_Intf.pas',
|
||||
schAlbaranesProveedorClient_Intf in '..\Modulos\Albaranes de proveedor\Model\schAlbaranesProveedorClient_Intf.pas',
|
||||
schAlbaranesProveedorServer_Intf in '..\Modulos\Albaranes de proveedor\Model\schAlbaranesProveedorServer_Intf.pas',
|
||||
schFacturasClienteClient_Intf in '..\Modulos\Facturas de cliente\Model\schFacturasClienteClient_Intf.pas',
|
||||
schFacturasClienteServer_Intf in '..\Modulos\Facturas de cliente\Model\schFacturasClienteServer_Intf.pas',
|
||||
schFacturasProveedorClient_Intf in '..\Modulos\Facturas de proveedor\Model\schFacturasProveedorClient_Intf.pas',
|
||||
schFacturasProveedorServer_Intf in '..\Modulos\Facturas de proveedor\Model\schFacturasProveedorServer_Intf.pas',
|
||||
schPedidosProveedorClient_Intf in '..\Modulos\Pedidos a proveedor\Model\schPedidosProveedorClient_Intf.pas',
|
||||
schPedidosProveedorServer_Intf in '..\Modulos\Pedidos a proveedor\Model\schPedidosProveedorServer_Intf.pas',
|
||||
schPresupuestosClienteClient_Intf in '..\Modulos\Presupuestos de cliente\Model\schPresupuestosClienteClient_Intf.pas',
|
||||
schPresupuestosClienteServer_Intf in '..\Modulos\Presupuestos de cliente\Model\schPresupuestosClienteServer_Intf.pas',
|
||||
schRemesasClienteClient_Intf in '..\Modulos\Remesas de cliente\Model\schRemesasClienteClient_Intf.pas',
|
||||
schRemesasClienteServer_Intf in '..\Modulos\Remesas de cliente\Model\schRemesasClienteServer_Intf.pas',
|
||||
uBizRemesasClienteServer in '..\Modulos\Remesas de cliente\Model\uBizRemesasClienteServer.pas',
|
||||
uBizRemesasProveedorServer in '..\Modulos\Remesas de proveedor\Model\uBizRemesasProveedorServer.pas',
|
||||
schRemesasProveedorClient_Intf in '..\Modulos\Remesas de proveedor\Model\schRemesasProveedorClient_Intf.pas',
|
||||
schRemesasProveedorServer_Intf in '..\Modulos\Remesas de proveedor\Model\schRemesasProveedorServer_Intf.pas';
|
||||
|
||||
{$R *.res}
|
||||
{$R ..\Servicios\RODLFile.res}
|
||||
@ -116,7 +118,6 @@ begin
|
||||
|
||||
Application.ShowMainForm := False;
|
||||
Application.CreateForm(TfServerForm, fServerForm);
|
||||
Application.CreateForm(TdmServer, dmServer);
|
||||
Application.Run;
|
||||
Application.Terminate;
|
||||
end.
|
||||
|
||||
@ -29,6 +29,11 @@
|
||||
<Borland.ProjectType />
|
||||
<BorlandProject>
|
||||
<BorlandProject><Delphi.Personality><Parameters><Parameters Name="UseLauncher">False</Parameters><Parameters Name="LoadAllSymbols">True</Parameters><Parameters Name="LoadUnspecifiedSymbols">False</Parameters></Parameters><VersionInfo><VersionInfo Name="IncludeVerInfo">True</VersionInfo><VersionInfo Name="AutoIncBuild">False</VersionInfo><VersionInfo Name="MajorVer">1</VersionInfo><VersionInfo Name="MinorVer">0</VersionInfo><VersionInfo Name="Release">0</VersionInfo><VersionInfo Name="Build">0</VersionInfo><VersionInfo Name="Debug">False</VersionInfo><VersionInfo Name="PreRelease">False</VersionInfo><VersionInfo Name="Special">False</VersionInfo><VersionInfo Name="Private">False</VersionInfo><VersionInfo Name="DLL">False</VersionInfo><VersionInfo Name="Locale">3082</VersionInfo><VersionInfo Name="CodePage">1252</VersionInfo></VersionInfo><VersionInfoKeys><VersionInfoKeys Name="CompanyName"></VersionInfoKeys><VersionInfoKeys Name="FileDescription"></VersionInfoKeys><VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys><VersionInfoKeys Name="InternalName"></VersionInfoKeys><VersionInfoKeys Name="LegalCopyright"></VersionInfoKeys><VersionInfoKeys Name="LegalTrademarks"></VersionInfoKeys><VersionInfoKeys Name="OriginalFilename"></VersionInfoKeys><VersionInfoKeys Name="ProductName"></VersionInfoKeys><VersionInfoKeys Name="ProductVersion">3.0.0.0</VersionInfoKeys><VersionInfoKeys Name="Comments"></VersionInfoKeys><VersionInfoKeys Name="CompileDate">lunes, 19 de noviembre de 2007 18:58</VersionInfoKeys></VersionInfoKeys><Excluded_Packages>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<Excluded_Packages Name="C:\Archivos de programa\RemObjects Software\Pascal Script\Dcu\D10\PascalScript_RO_D10.bpl">RemObjects Pascal Script - RemObjects SDK 3.0 Integration</Excluded_Packages>
|
||||
</Excluded_Packages><Source><Source Name="MainSource">FactuGES_Server.dpr</Source></Source></Delphi.Personality></BorlandProject></BorlandProject>
|
||||
</ProjectExtensions>
|
||||
@ -157,12 +162,14 @@
|
||||
</DCCReference>
|
||||
<DCCReference Include="..\Modulos\Remesas de cliente\Model\schRemesasClienteClient_Intf.pas" />
|
||||
<DCCReference Include="..\Modulos\Remesas de cliente\Model\schRemesasClienteServer_Intf.pas" />
|
||||
<DCCReference Include="..\Modulos\Remesas de cliente\Model\uBizRemesasClienteServer.pas" />
|
||||
<DCCReference Include="..\Modulos\Remesas de cliente\Servidor\srvRemesasCliente_Impl.pas">
|
||||
<Form>srvRemesasCliente</Form>
|
||||
<DesignClass>TDataAbstractService</DesignClass>
|
||||
</DCCReference>
|
||||
<DCCReference Include="..\Modulos\Remesas de proveedor\Model\schRemesasProveedorClient_Intf.pas" />
|
||||
<DCCReference Include="..\Modulos\Remesas de proveedor\Model\schRemesasProveedorServer_Intf.pas" />
|
||||
<DCCReference Include="..\Modulos\Remesas de proveedor\Model\uBizRemesasProveedorServer.pas" />
|
||||
<DCCReference Include="..\Modulos\Remesas de proveedor\Servidor\srvRemesasProveedor_Impl.pas">
|
||||
<Form>srvRemesasProveedor</Form>
|
||||
<DesignClass>TDataAbstractService</DesignClass>
|
||||
@ -196,6 +203,10 @@
|
||||
<Form>srvLogin</Form>
|
||||
<DesignClass>TDARemoteService</DesignClass>
|
||||
</DCCReference>
|
||||
<DCCReference Include="srvReferencias_Impl.pas">
|
||||
<Form>srvReferencias</Form>
|
||||
<DesignClass>TDataAbstractService</DesignClass>
|
||||
</DCCReference>
|
||||
<DCCReference Include="uAcercaDe.pas">
|
||||
<Form>fAcercaDe</Form>
|
||||
</DCCReference>
|
||||
|
||||
@ -14,7 +14,7 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "FileVersion", "1.0.0.0\0"
|
||||
VALUE "ProductVersion", "1.0.0.0\0"
|
||||
VALUE "CompileDate", "miércoles, 26 de diciembre de 2007 16:31\0"
|
||||
VALUE "CompileDate", "miércoles, 26 de diciembre de 2007 20:04\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user