Informes -> arreglo en la localización de los ficheros de informes (dependencia de empresa)
git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@789 0c75b7a4-871f-7646-8a2f-f78d34cc349f
This commit is contained in:
parent
c85cae7c75
commit
9c42c97007
@ -151,7 +151,7 @@ begin
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, rptInforme, tbl_Cabecera.FieldByName('ID_EMPRESA').AsString);
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarFactura, no encuentra informe' + rptInforme));
|
||||
raise Exception.Create (('Error Servidor: _GenerarFactura, no encuentra informe ' + rptInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.PrepareReport(False);
|
||||
|
||||
@ -91,7 +91,7 @@ begin
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, rptEtiquetasContacto);
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: GenerarInforme, no encuentra informe' + rptEtiquetasContacto));
|
||||
raise Exception.Create (('Error Servidor: GenerarInforme, no encuentra informe ' + rptEtiquetasContacto));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.PrepareReport(True);
|
||||
|
||||
@ -91,7 +91,7 @@ begin
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, rptFichaEmpleado);
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarFicha, no encuentra informe' + rptFichaEmpleado));
|
||||
raise Exception.Create (('Error Servidor: _GenerarFicha, no encuentra informe ' + rptFichaEmpleado));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.PrepareReport(False);
|
||||
|
||||
@ -251,7 +251,7 @@ begin
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, rptFacturaCliente, tbl_Cabecera.FieldByName('ID_EMPRESA').AsString);
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarFactura, no encuentra informe' + rptFacturaCliente));
|
||||
raise Exception.Create (('Error Servidor: _GenerarFactura, no encuentra informe ' + rptFacturaCliente));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
if VerSello then
|
||||
@ -343,9 +343,9 @@ begin
|
||||
|
||||
tbl_InformeListadoFacturas.Active := True;
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, tbl_InformeListadoFacturas.FieldByName('ID_EMPRESA').AsString);
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, IntToStr(IdEmpresa));
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe' + TipoInforme));
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe ' + TipoInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.Variables.Variables['FechaInicio'] := FechaInicio;
|
||||
|
||||
@ -265,9 +265,9 @@ begin
|
||||
|
||||
tbl_InformeListadoFacturas.Active := True;
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, tbl_InformeListadoFacturas.FieldByName('ID_EMPRESA').AsString);
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, IntToStr(IdEmpresa));
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe' + TipoInforme));
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe ' + TipoInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.Variables.Variables['FechaInicio'] := FechaInicio;
|
||||
|
||||
@ -5,15 +5,9 @@ object srvGestorInformes: TsrvGestorInformes
|
||||
ServiceDataStreamer = Bin2DataStreamer
|
||||
ExportedDataTables = <
|
||||
item
|
||||
DataTable = dtComboDataset
|
||||
LogicalName = 'ComboDataset'
|
||||
end
|
||||
item
|
||||
DataTable = dtWindowsDir
|
||||
LogicalName = 'DirectoryData'
|
||||
end>
|
||||
BeforeGetDatasetData = DataAbstractServiceBeforeGetDatasetData
|
||||
ValidateDatasetAccess = DataAbstractServiceValidateDatasetAccess
|
||||
Height = 162
|
||||
Width = 313
|
||||
object Schema: TDASchema
|
||||
@ -36,72 +30,6 @@ object srvGestorInformes: TsrvGestorInformes
|
||||
Left = 32
|
||||
Top = 64
|
||||
end
|
||||
object dtComboDataset: TDAMemDataTable
|
||||
RemoteUpdatesOptions = []
|
||||
Fields = <
|
||||
item
|
||||
Name = 'AutoIncField'
|
||||
DataType = datAutoInc
|
||||
InPrimaryKey = True
|
||||
end
|
||||
item
|
||||
Name = 'TextField'
|
||||
DataType = datString
|
||||
Size = 50
|
||||
DisplayWidth = 50
|
||||
end>
|
||||
Params = <
|
||||
item
|
||||
Name = 'CustomParameter'
|
||||
DataType = datString
|
||||
Size = 50
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
MasterMappingMode = mmDataRequest
|
||||
StreamingOptions = [soDisableEventsWhileStreaming]
|
||||
RemoteFetchEnabled = False
|
||||
LocalDataStreamer = Bin2DataStreamer
|
||||
DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch]
|
||||
MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates]
|
||||
LogicalName = 'ComboDataset'
|
||||
IndexDefs = <>
|
||||
Left = 128
|
||||
Top = 56
|
||||
end
|
||||
object dtWindowsDir: TDAMemDataTable
|
||||
RemoteUpdatesOptions = []
|
||||
Fields = <
|
||||
item
|
||||
Name = 'FileName'
|
||||
DataType = datString
|
||||
Size = 200
|
||||
DisplayWidth = 50
|
||||
InPrimaryKey = True
|
||||
end
|
||||
item
|
||||
Name = 'FileSize'
|
||||
DataType = datInteger
|
||||
end>
|
||||
Params = <
|
||||
item
|
||||
Name = 'Directory'
|
||||
DataType = datString
|
||||
Size = 200
|
||||
Value = ''
|
||||
ParamType = daptInput
|
||||
end>
|
||||
MasterMappingMode = mmDataRequest
|
||||
StreamingOptions = [soDisableEventsWhileStreaming]
|
||||
RemoteFetchEnabled = False
|
||||
LocalDataStreamer = Bin2DataStreamer
|
||||
DetailOptions = [dtCascadeOpenClose, dtCascadeApplyUpdates, dtAutoFetch, dtCascadeDelete, dtCascadeUpdate, dtDisableLogOfCascadeDeletes, dtDisableLogOfCascadeUpdates, dtIncludeInAllInOneFetch]
|
||||
MasterOptions = [moCascadeOpenClose, moCascadeApplyUpdates, moCascadeDelete, moCascadeUpdate, moDisableLogOfCascadeDeletes, moDisableLogOfCascadeUpdates]
|
||||
LogicalName = 'DirectoryData'
|
||||
IndexDefs = <>
|
||||
Left = 216
|
||||
Top = 56
|
||||
end
|
||||
object Bin2DataStreamer: TDABin2DataStreamer
|
||||
Left = 32
|
||||
Top = 8
|
||||
|
||||
@ -28,22 +28,8 @@ const
|
||||
type
|
||||
{ TGestorInformes }
|
||||
TsrvGestorInformes = class(TDataAbstractService, IsrvGestorInformes)
|
||||
dtComboDataset: TDAMemDataTable;
|
||||
dtWindowsDir: TDAMemDataTable;
|
||||
Schema: TDASchema;
|
||||
Bin2DataStreamer: TDABin2DataStreamer;
|
||||
procedure DataAbstractServiceBeforeGetDatasetData(aSender: TObject;
|
||||
const aDataset: IDADataset; const aIncludeSchema: Boolean;
|
||||
const aMaxRecords: Integer);
|
||||
procedure DataAbstractServiceValidateDatasetAccess(Sender: TObject;
|
||||
const aConnection: IDAConnection; const aDatasetName: string;
|
||||
const aParamNames: array of string;
|
||||
const aParamValues: array of Variant; aSchema: TDASchema;
|
||||
var Allowed: Boolean);
|
||||
private
|
||||
procedure FillComboDataset(const aDataset: IDAEditableDataset);
|
||||
procedure FillWinDirDataset(const aDataset: IDAEditableDataset);
|
||||
|
||||
public
|
||||
//MODULO PRESUPUESTOS CLIENTE
|
||||
function GenerarInformeListadoPresupuestos(const IdEmpresa: Integer; const FechaInicio: DateTime; const FechaFin: DateTime; const ListaIDClientes: TIntegerArray; const Desglosado: Boolean; const ImporteMinimo: Currency): Binary;
|
||||
@ -83,89 +69,6 @@ begin
|
||||
anInstance := TsrvGestorInformes.Create(nil);
|
||||
end;
|
||||
|
||||
procedure TsrvGestorInformes.FillComboDataset(const aDataset: IDAEditableDataset);
|
||||
var
|
||||
employees,
|
||||
customers,
|
||||
regions: IDADataset;
|
||||
textfield: TDAField;
|
||||
begin
|
||||
{
|
||||
with aDataset do begin
|
||||
// Opens the in memory data table
|
||||
Open;
|
||||
textfield := FieldByName('TextField');
|
||||
|
||||
// Adds 3 dummy records
|
||||
Insert;
|
||||
textfield.AsString := 'String A';
|
||||
Post;
|
||||
|
||||
Insert;
|
||||
textfield.AsString := 'String B';
|
||||
Post;
|
||||
|
||||
Insert;
|
||||
textfield.AsString := 'String C';
|
||||
Post;
|
||||
|
||||
// Fetches data from other datasets, according to the value of the parameter "CustomParameter"
|
||||
if (Pos('EMPLOYEES', UpperCase(ParamByName('CustomParameter').AsString)) > 0) then begin
|
||||
employees := Schema.NewDataset(Connection, ds_Employees, [], [], TRUE);
|
||||
while not employees.EOF do begin
|
||||
Insert;
|
||||
textfield.AsString := employees.FieldByName('FirstName').AsString + ' ' + employees.FieldByName('LastName').AsString;
|
||||
Post;
|
||||
|
||||
employees.Next;
|
||||
end;
|
||||
employees:=nil;
|
||||
end;
|
||||
if (Pos('CUSTOMERS', UpperCase(ParamByName('CustomParameter').AsString)) > 0) then begin
|
||||
customers := Schema.NewDataset(Connection, ds_Customers, [], [], TRUE);
|
||||
while not customers.EOF do begin
|
||||
Insert;
|
||||
textfield.AsString := customers.FieldByName('CompanyName').AsString;
|
||||
Post;
|
||||
|
||||
customers.Next;
|
||||
end;
|
||||
customers := nil;
|
||||
end;
|
||||
if (Pos('REGIONS', UpperCase(ParamByName('CustomParameter').AsString)) > 0) then begin
|
||||
regions := Schema.NewDataset(Connection, ds_Regions, [], [], TRUE);
|
||||
while not regions.EOF do begin
|
||||
Insert;
|
||||
textfield.AsString := regions.FieldByName('RegionDescription').AsString;
|
||||
Post;
|
||||
|
||||
regions.Next;
|
||||
end;
|
||||
regions := nil;
|
||||
end;
|
||||
end;
|
||||
}
|
||||
end;
|
||||
|
||||
procedure TsrvGestorInformes.FillWinDirDataset(const aDataset: IDAEditableDataset);
|
||||
var
|
||||
dirinfo: TSearchRec;
|
||||
begin
|
||||
aDataset.Open;
|
||||
{
|
||||
if (FindFirst(IncludeTrailingPathDelimiter(aDataset.ParamByName('Directory').AsString) + '*.*', faArchive, dirinfo) = 0) then repeat
|
||||
}
|
||||
aDataset.Insert;
|
||||
|
||||
aDataset.FieldByName('FileName').AsString := 'hola';
|
||||
aDataset.FieldByName('FileSize').AsInteger := 10;
|
||||
|
||||
aDataset.Post;
|
||||
{
|
||||
until (FindNext(dirinfo) <> 0);
|
||||
}
|
||||
end;
|
||||
|
||||
function TsrvGestorInformes.GenerarInformeIVAClientes(const IdEmpresa: Integer; const FechaInicio: DateTime; const FechaFin: DateTime; const ListaIDClientes: TIntegerArray; const Desglosado: Boolean; const ImporteMinimo: Currency): Binary;
|
||||
var
|
||||
AReportGenerator : TRptFacturasCliente;
|
||||
@ -340,40 +243,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TsrvGestorInformes.DataAbstractServiceBeforeGetDatasetData(
|
||||
aSender: TObject; const aDataset: IDADataset;
|
||||
const aIncludeSchema: Boolean; const aMaxRecords: Integer);
|
||||
begin
|
||||
if SameText(aDataset.LogicalName, dtComboDataset.LogicalName) then
|
||||
FillComboDataset((dtComboDataset as IDAEditableDataset))
|
||||
else if SameText(aDataset.LogicalName, dtWindowsDir.LogicalName) then
|
||||
FillWinDirDataset((dtWindowsDir as IDAEditableDataset));
|
||||
end;
|
||||
|
||||
procedure TsrvGestorInformes.DataAbstractServiceValidateDatasetAccess(
|
||||
Sender: TObject; const aConnection: IDAConnection;
|
||||
const aDatasetName: string; const aParamNames: array of string;
|
||||
const aParamValues: array of Variant; aSchema: TDASchema;
|
||||
var Allowed: Boolean);
|
||||
|
||||
procedure FillParameters(aDataSet: TDAMemDataTable);
|
||||
var
|
||||
i: integer;
|
||||
begin
|
||||
for i := Low(aParamNames) to High(aParamNames) do
|
||||
begin
|
||||
showmessage(aParamValues[i]);
|
||||
aDataset.ParamByName(aParamNames[i]).Value := aParamValues[i];
|
||||
end;
|
||||
end;
|
||||
|
||||
begin
|
||||
if SameText(aDatasetName, dtComboDataset.LogicalName) then
|
||||
FillParameters(dtComboDataset)
|
||||
else if SameText(aDatasetName, dtWindowsDir.LogicalName) then
|
||||
FillParameters(dtWindowsDir)
|
||||
end;
|
||||
|
||||
initialization
|
||||
TROClassFactory.Create('srvGestorInformes', Create_srvGestorInformes, TsrvGestorInformes_Invoker);
|
||||
|
||||
|
||||
@ -243,9 +243,9 @@ begin
|
||||
|
||||
tbl_InformeListadoPedidos.Active := True;
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, tbl_InformeListadoPedidos.FieldByName('ID_EMPRESA').AsString);
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, IntToStr(IdEmpresa));
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe' + TipoInforme));
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe ' + TipoInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.Variables.Variables['FechaInicio'] := FechaInicio;
|
||||
@ -276,7 +276,7 @@ begin
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, rptInforme, tbl_Cabecera.FieldByName('ID_EMPRESA').AsString);
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarPedido, no encuentra informe' + rptInforme));
|
||||
raise Exception.Create (('Error Servidor: _GenerarPedido, no encuentra informe ' + rptInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.PrepareReport(False);
|
||||
|
||||
@ -248,9 +248,9 @@ begin
|
||||
|
||||
tbl_InformeListadoPresupuestos.Active := True;
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, tbl_InformeListadoPresupuestos.FieldByName('ID_EMPRESA').AsString);
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, IntToStr(IdEmpresa));
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe' + TipoInforme));
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe ' + TipoInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.Variables.Variables['FechaInicio'] := FechaInicio;
|
||||
@ -287,7 +287,7 @@ begin
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, rptInforme, tbl_Cabecera.FieldByName('ID_EMPRESA').AsString);
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarPresupuesto, no encuentra informe' + rptInforme));
|
||||
raise Exception.Create (('Error Servidor: _GenerarPresupuesto, no encuentra informe ' + rptInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.PrepareReport(False);
|
||||
|
||||
@ -216,9 +216,9 @@ begin
|
||||
|
||||
tbl_InformeListadoRecibos.Active := True;
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, tbl_InformeListadoRecibos.FieldByName('ID_EMPRESA').AsString);
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, IntToStr(IdEmpresa));
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe' + TipoInforme));
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe ' + TipoInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.Variables.Variables['FechaInicio'] := FechaInicio;
|
||||
@ -250,7 +250,7 @@ begin
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, rptInforme, tbl_Cabecera.FieldByName('ID_EMPRESA').AsString);
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarRecibo, no encuentra informe' + rptInforme));
|
||||
raise Exception.Create (('Error Servidor: _GenerarRecibo, no encuentra informe ' + rptInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.PrepareReport(False);
|
||||
|
||||
@ -199,9 +199,9 @@ begin
|
||||
|
||||
tbl_InformeListadoRecibos.Active := True;
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, tbl_InformeListadoRecibos.FieldByName('ID_EMPRESA').AsString);
|
||||
AInforme := DarRutaFichero(DarRutaInformes, TipoInforme, IntToStr(IdEmpresa));
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe' + TipoInforme));
|
||||
raise Exception.Create (('Error Servidor: _GenerarInforme, no encuentra informe ' + TipoInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.Variables.Variables['FechaInicio'] := FechaInicio;
|
||||
|
||||
@ -108,7 +108,7 @@ begin
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, rptInforme);
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: GenerarRemesa, no encuentra informe' + rptInforme));
|
||||
raise Exception.Create (('Error Servidor: GenerarRemesa, no encuentra informe ' + rptInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.PrepareReport(False);
|
||||
|
||||
@ -108,7 +108,7 @@ begin
|
||||
|
||||
AInforme := DarRutaFichero(DarRutaInformes, rptInforme);
|
||||
if VarIsNull(AInforme) then
|
||||
raise Exception.Create (('Error Servidor: GenerarRemesa, no encuentra informe' + rptInforme));
|
||||
raise Exception.Create (('Error Servidor: GenerarRemesa, no encuentra informe ' + rptInforme));
|
||||
|
||||
frxReport.LoadFromFile(AInforme, True);
|
||||
frxReport.PrepareReport(False);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user