git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@267 c93665c3-c93d-084d-9b98-7d5f4a9c3376
This commit is contained in:
parent
9738b2cc39
commit
27e40864a2
@ -1,194 +0,0 @@
|
|||||||
object srvImpresiones: TsrvImpresiones
|
|
||||||
OldCreateOrder = True
|
|
||||||
OnCreate = DARemoteServiceCreate
|
|
||||||
RequiresSession = True
|
|
||||||
SessionManager = dmServer.SessionManager
|
|
||||||
AcquireConnection = True
|
|
||||||
ServiceSchema = schImpresiones
|
|
||||||
ServiceAdapter = DABINAdapter
|
|
||||||
OnBeforeAcquireConnection = DARemoteServiceBeforeAcquireConnection
|
|
||||||
Height = 202
|
|
||||||
Width = 392
|
|
||||||
object Diagrams: TDADiagrams
|
|
||||||
Left = 150
|
|
||||||
Top = 90
|
|
||||||
DiagramData = '<Diagrams>'#13#10'</Diagrams>'#13#10
|
|
||||||
end
|
|
||||||
object DataDictionary: TDADataDictionary
|
|
||||||
Fields = <
|
|
||||||
item
|
|
||||||
Name = 'Referencias_CODIGO'
|
|
||||||
DataType = datString
|
|
||||||
Size = 50
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
DisplayWidth = 0
|
|
||||||
DisplayLabel = 'CODIGO'
|
|
||||||
Alignment = taLeftJustify
|
|
||||||
end
|
|
||||||
item
|
|
||||||
Name = 'Referencias_DESCRIPCION'
|
|
||||||
DataType = datString
|
|
||||||
Size = 255
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
DisplayWidth = 0
|
|
||||||
DisplayLabel = 'Referencias'
|
|
||||||
Alignment = taLeftJustify
|
|
||||||
end
|
|
||||||
item
|
|
||||||
Name = 'Referencias_VALOR'
|
|
||||||
DataType = datString
|
|
||||||
Size = 255
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
DisplayWidth = 0
|
|
||||||
DisplayLabel = 'C'#243'digo'
|
|
||||||
Alignment = taLeftJustify
|
|
||||||
end
|
|
||||||
item
|
|
||||||
Name = 'Referencias_ID_EMPRESA'
|
|
||||||
DataType = datInteger
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
DisplayWidth = 0
|
|
||||||
DisplayLabel = 'ID_EMPRESA'
|
|
||||||
Alignment = taLeftJustify
|
|
||||||
end>
|
|
||||||
Left = 150
|
|
||||||
Top = 24
|
|
||||||
end
|
|
||||||
object schImpresiones: TDASchema
|
|
||||||
ConnectionManager = dmServer.ConnectionManager
|
|
||||||
DataDictionary = DataDictionary
|
|
||||||
Diagrams = Diagrams
|
|
||||||
Datasets = <
|
|
||||||
item
|
|
||||||
Params = <>
|
|
||||||
Statements = <
|
|
||||||
item
|
|
||||||
Connection = 'IBX'
|
|
||||||
TargetTable = 'REFERENCIAS'
|
|
||||||
SQL =
|
|
||||||
'SELECT '#10' CODIGO, DESCRIPCION, VALOR, ID_EMPRESA'#10' FROM'#10' RE' +
|
|
||||||
'FERENCIAS'
|
|
||||||
StatementType = stSQL
|
|
||||||
ColumnMappings = <
|
|
||||||
item
|
|
||||||
DatasetField = 'DESCRIPCION'
|
|
||||||
TableField = 'DESCRIPCION'
|
|
||||||
end
|
|
||||||
item
|
|
||||||
DatasetField = 'CODIGO'
|
|
||||||
TableField = 'CODIGO'
|
|
||||||
end
|
|
||||||
item
|
|
||||||
DatasetField = 'VALOR'
|
|
||||||
TableField = 'VALOR'
|
|
||||||
end
|
|
||||||
item
|
|
||||||
DatasetField = 'ID_EMPRESA'
|
|
||||||
TableField = 'ID_EMPRESA'
|
|
||||||
end>
|
|
||||||
end>
|
|
||||||
Name = 'Referencias'
|
|
||||||
Fields = <
|
|
||||||
item
|
|
||||||
Name = 'CODIGO'
|
|
||||||
DataType = datString
|
|
||||||
Size = 50
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
DictionaryEntry = 'Referencias_CODIGO'
|
|
||||||
InPrimaryKey = False
|
|
||||||
Calculated = False
|
|
||||||
Lookup = False
|
|
||||||
LookupCache = False
|
|
||||||
end
|
|
||||||
item
|
|
||||||
Name = 'DESCRIPCION'
|
|
||||||
DataType = datString
|
|
||||||
Size = 255
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
DictionaryEntry = 'Referencias_DESCRIPCION'
|
|
||||||
InPrimaryKey = False
|
|
||||||
Calculated = False
|
|
||||||
Lookup = False
|
|
||||||
LookupCache = False
|
|
||||||
end
|
|
||||||
item
|
|
||||||
Name = 'VALOR'
|
|
||||||
DataType = datString
|
|
||||||
Size = 255
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
DictionaryEntry = 'Referencias_VALOR'
|
|
||||||
InPrimaryKey = False
|
|
||||||
Calculated = False
|
|
||||||
Lookup = False
|
|
||||||
LookupCache = False
|
|
||||||
end
|
|
||||||
item
|
|
||||||
Name = 'ID_EMPRESA'
|
|
||||||
DataType = datInteger
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
DictionaryEntry = 'Referencias_ID_EMPRESA'
|
|
||||||
InPrimaryKey = False
|
|
||||||
Calculated = False
|
|
||||||
Lookup = False
|
|
||||||
LookupCache = False
|
|
||||||
end>
|
|
||||||
BusinessRulesClient.ScriptLanguage = rslPascalScript
|
|
||||||
BusinessRulesServer.ScriptLanguage = rslPascalScript
|
|
||||||
end>
|
|
||||||
Commands = <
|
|
||||||
item
|
|
||||||
Params = <
|
|
||||||
item
|
|
||||||
Name = 'VALOR'
|
|
||||||
DataType = datString
|
|
||||||
Size = 255
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
Value = ''
|
|
||||||
ParamType = daptInput
|
|
||||||
end
|
|
||||||
item
|
|
||||||
Name = 'OLD_CODIGO'
|
|
||||||
DataType = datString
|
|
||||||
Size = 50
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
Value = ''
|
|
||||||
ParamType = daptInput
|
|
||||||
end
|
|
||||||
item
|
|
||||||
Name = 'OLD_ID_EMPRESA'
|
|
||||||
DataType = datInteger
|
|
||||||
BlobType = dabtUnknown
|
|
||||||
Value = ''
|
|
||||||
ParamType = daptInput
|
|
||||||
end>
|
|
||||||
Statements = <
|
|
||||||
item
|
|
||||||
Connection = 'IBX'
|
|
||||||
TargetTable = 'REFERENCIAS'
|
|
||||||
SQL =
|
|
||||||
'UPDATE REFERENCIAS'#10' SET '#10' VALOR = :VALOR'#10' WHERE'#10' (CODIGO' +
|
|
||||||
' = :OLD_CODIGO)'#10' AND (ID_EMPRESA = :OLD_ID_EMPRESA)'
|
|
||||||
StatementType = stSQL
|
|
||||||
ColumnMappings = <>
|
|
||||||
end>
|
|
||||||
Name = 'Update_Referencias'
|
|
||||||
end>
|
|
||||||
RelationShips = <>
|
|
||||||
UpdateRules = <>
|
|
||||||
Left = 48
|
|
||||||
Top = 24
|
|
||||||
end
|
|
||||||
object DABINAdapter: TDABINAdapter
|
|
||||||
Left = 48
|
|
||||||
Top = 90
|
|
||||||
end
|
|
||||||
object bpImpresiones: TDABusinessProcessor
|
|
||||||
Schema = schImpresiones
|
|
||||||
UpdateCommandName = 'Update_Referencias'
|
|
||||||
ReferencedDataset = 'Referencias'
|
|
||||||
ProcessorOptions = [poAutoGenerateRefreshDataset, poPrepareCommands]
|
|
||||||
UpdateMode = updWhereKeyOnly
|
|
||||||
Left = 248
|
|
||||||
Top = 24
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@ -1,130 +0,0 @@
|
|||||||
unit srvImpresiones_Impl;
|
|
||||||
|
|
||||||
{----------------------------------------------------------------------------}
|
|
||||||
{ This unit was automatically generated by the RemObjects SDK after reading }
|
|
||||||
{ the RODL file associated with this project . }
|
|
||||||
{ }
|
|
||||||
{ This is where you are supposed to code the implementation of your objects. }
|
|
||||||
{----------------------------------------------------------------------------}
|
|
||||||
|
|
||||||
interface
|
|
||||||
|
|
||||||
uses
|
|
||||||
{vcl:} Classes, SysUtils,
|
|
||||||
{RemObjects:} uROClientIntf, uROTypes, uROServer, uROServerIntf, uROSessions,
|
|
||||||
{Ancestor Implementation:} DARemoteService_Impl,
|
|
||||||
{Used RODLs:} DataAbstract_Intf,
|
|
||||||
{Generated:} FactuGES_Intf, uDADataTable, uDABINAdapter, uDAClasses,
|
|
||||||
uDAScriptingProvider, uDABusinessProcessor;
|
|
||||||
|
|
||||||
type
|
|
||||||
{ TsrvImpresiones }
|
|
||||||
TsrvImpresiones = class(TDARemoteService, IsrvImpresiones)
|
|
||||||
Diagrams: TDADiagrams;
|
|
||||||
DABINAdapter: TDABINAdapter;
|
|
||||||
bpImpresiones: TDABusinessProcessor;
|
|
||||||
schImpresiones: TDASchema;
|
|
||||||
DataDictionary: TDADataDictionary;
|
|
||||||
procedure DARemoteServiceCreate(Sender: TObject);
|
|
||||||
procedure DARemoteServiceBeforeAcquireConnection(Sender: TDARemoteService;
|
|
||||||
var ConnectionName: string);
|
|
||||||
protected
|
|
||||||
{ IsrvImpresiones methods }
|
|
||||||
function InsertarMarcaImpresion(const NombreTabla: String; const IdTabla: Integer): Boolean;
|
|
||||||
function IncrementarMarcaImpresion(const IdMarcaImpresion: Integer): Boolean;
|
|
||||||
end;
|
|
||||||
|
|
||||||
implementation
|
|
||||||
|
|
||||||
{$R *.dfm}
|
|
||||||
uses
|
|
||||||
{Generated:} FactuGES_Invk, uDataModuleServer, uDatabaseUtils;
|
|
||||||
|
|
||||||
procedure Create_srvImpresiones(out anInstance : IUnknown);
|
|
||||||
begin
|
|
||||||
anInstance := TsrvImpresiones.Create(NIL);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ srvImpresiones }
|
|
||||||
procedure TsrvImpresiones.DARemoteServiceBeforeAcquireConnection(
|
|
||||||
Sender: TDARemoteService; var ConnectionName: string);
|
|
||||||
begin
|
|
||||||
ConnectionName := dmServer.ConnectionName;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TsrvImpresiones.DARemoteServiceCreate(Sender: TObject);
|
|
||||||
begin
|
|
||||||
SessionManager := dmServer.SessionManager;
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TsrvImpresiones.IncrementarMarcaImpresion(
|
|
||||||
const IdMarcaImpresion: Integer): Boolean;
|
|
||||||
begin
|
|
||||||
//
|
|
||||||
end;
|
|
||||||
|
|
||||||
function TsrvImpresiones.InsertarMarcaImpresion(const NombreTabla: String;
|
|
||||||
const IdTabla: Integer): Boolean;
|
|
||||||
begin
|
|
||||||
var
|
|
||||||
ASchema : TDASchema;
|
|
||||||
AConn : IDAConnection;
|
|
||||||
dsData: IDADataset;
|
|
||||||
|
|
||||||
AWhere : TDAWhereExpression;
|
|
||||||
AWhereExpr1: TDAWhereExpression;
|
|
||||||
AWhereExpr2: TDAWhereExpression;
|
|
||||||
begin
|
|
||||||
Result := '';
|
|
||||||
|
|
||||||
{ Construir la expresión del Where a partir de los parámetros
|
|
||||||
que se reciban.
|
|
||||||
}
|
|
||||||
with TDAWhereBuilder.Create do
|
|
||||||
try
|
|
||||||
AWhereExpr1 := NewBinaryExpression(NewField('', 'CODIGO'),
|
|
||||||
NewConstant(NombreReferencia, datString),
|
|
||||||
dboEqual);
|
|
||||||
if (EmpresaID <> -1) then
|
|
||||||
begin
|
|
||||||
AWhereExpr2 := NewBinaryExpression(NewField('', 'ID_EMPRESA'),
|
|
||||||
NewConstant(EmpresaID, datInteger),
|
|
||||||
dboEqual);
|
|
||||||
|
|
||||||
AWhere := NewBinaryExpression(AWhereExpr1, AWhereExpr2, dboAnd);
|
|
||||||
end
|
|
||||||
else
|
|
||||||
AWhere := AWhereExpr1;
|
|
||||||
finally
|
|
||||||
Free;
|
|
||||||
end;
|
|
||||||
|
|
||||||
ASchema := schReferencias;
|
|
||||||
AConn := dmServer.ConnectionManager.NewConnection(dmServer.ConnectionManager.GetDefaultConnectionName);
|
|
||||||
|
|
||||||
try
|
|
||||||
try
|
|
||||||
dsData := ASchema.NewDataset(AConn, 'Referencias', ['VALOR'], '', '', False, True);
|
|
||||||
dsData.DynamicWhere.Expression := AWhere;
|
|
||||||
except
|
|
||||||
RaiseError('No existe la tabla REFERENCIAS');
|
|
||||||
end;
|
|
||||||
|
|
||||||
dsData.Active := True;
|
|
||||||
|
|
||||||
if dsData.IsEmpty then
|
|
||||||
RaiseError('No existe la referencia ' + NombreReferencia + ' en la tabla REFERENCIAS.');
|
|
||||||
|
|
||||||
Result := dsData.FieldByName('VALOR').AsString;
|
|
||||||
finally
|
|
||||||
dsData := NIL;
|
|
||||||
end;
|
|
||||||
|
|
||||||
end;
|
|
||||||
|
|
||||||
initialization
|
|
||||||
TROClassFactory.Create('srvImpresiones', Create_srvImpresiones, TsrvImpresiones_Invoker);
|
|
||||||
|
|
||||||
finalization
|
|
||||||
|
|
||||||
end.
|
|
||||||
Reference in New Issue
Block a user