Servidor -> repaso a la generación de reports (BeginTransaction/RollbackTransaction) y limpieza de warnings.
git-svn-id: https://192.168.0.254/svn/Proyectos.Acana_FactuGES2/trunk@327 f4e31baf-9722-1c47-927c-6f952f962d4b
This commit is contained in:
parent
2cb6934575
commit
878cd1f5af
@ -76,17 +76,11 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result := Binary.Create;
|
Result := Binary.Create;
|
||||||
//FConnection.BeginTransaction; <--- Creo que no va a hacer falta.
|
//Vamos generando todos y cada uno de los presupuestos recibidos
|
||||||
|
for i := 0 to ListaID.Count - 1 do
|
||||||
|
_GenerarAlbaran(ListaID.Items[i]);
|
||||||
|
|
||||||
try
|
frxReport.PreviewPages.SaveToStream(Result);
|
||||||
//Vamos generando todos y cada uno de los presupuestos recibidos
|
|
||||||
for i := 0 to ListaID.Count - 1 do
|
|
||||||
_GenerarAlbaran(ListaID.Items[i]);
|
|
||||||
|
|
||||||
frxReport.PreviewPages.SaveToStream(Result);
|
|
||||||
finally
|
|
||||||
//FConnection.RollbackTransaction; <--- Creo que no va a hacer falta.
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TRptAlbaranesCliente.GenerarAlbaranEnPDF(
|
function TRptAlbaranesCliente.GenerarAlbaranEnPDF(
|
||||||
@ -95,29 +89,29 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result := Binary.Create;
|
Result := Binary.Create;
|
||||||
//FConnection.BeginTransaction; <--- Creo que no va a hacer falta.
|
|
||||||
|
|
||||||
try
|
//Vamos generando todos y cada uno de los presupuestos recibidos
|
||||||
//Vamos generando todos y cada uno de los presupuestos recibidos
|
for i := 0 to ListaID.Count - 1 do
|
||||||
for i := 0 to ListaID.Count - 1 do
|
_GenerarAlbaran(ListaID.Items[i]);
|
||||||
_GenerarAlbaran(ListaID.Items[i]);
|
|
||||||
|
|
||||||
frxPDFExport1.Stream := Result;
|
frxPDFExport1.Stream := Result;
|
||||||
frxReport.Export(frxPDFExport1)
|
frxReport.Export(frxPDFExport1)
|
||||||
finally
|
|
||||||
//FConnection.RollbackTransaction; <--- Creo que no va a hacer falta.
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRptAlbaranesCliente._GenerarAlbaran(const ID: integer);
|
procedure TRptAlbaranesCliente._GenerarAlbaran(const ID: integer);
|
||||||
begin
|
begin
|
||||||
tbl_Cabecera.ParamByName('ID').AsInteger := ID;
|
FConnection.BeginTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO"
|
||||||
tbl_Detalles.ParamByName('ID_ALBARAN').AsInteger := ID;
|
try
|
||||||
tbl_Cabecera.Active := True;
|
tbl_Cabecera.ParamByName('ID').AsInteger := ID;
|
||||||
tbl_Detalles.Active := True;
|
tbl_Detalles.ParamByName('ID_ALBARAN').AsInteger := ID;
|
||||||
|
tbl_Cabecera.Active := True;
|
||||||
|
tbl_Detalles.Active := True;
|
||||||
|
|
||||||
frxReport.LoadFromFile(DarRutaInformes + rptInfAlbaran, True);
|
frxReport.LoadFromFile(DarRutaInformes + rptInfAlbaran, True);
|
||||||
frxReport.PrepareReport(False);
|
frxReport.PrepareReport(False);
|
||||||
|
finally
|
||||||
|
FConnection.RollbackTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO"
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TRptAlbaranesCliente.GenerarEtiquetas(const AID: Integer; withRefCliente: Boolean): Binary;
|
function TRptAlbaranesCliente.GenerarEtiquetas(const AID: Integer; withRefCliente: Boolean): Binary;
|
||||||
|
|||||||
@ -61,15 +61,20 @@ end;
|
|||||||
|
|
||||||
procedure TRptComisiones.GenerarComision(const ID: integer);
|
procedure TRptComisiones.GenerarComision(const ID: integer);
|
||||||
begin
|
begin
|
||||||
tbl_Comisiones.ParamByName('ID').AsInteger := ID;
|
FConnection.BeginTransaction;
|
||||||
tbl_Facturas.ParamByName('ID').AsInteger := ID;
|
try
|
||||||
tbl_Vendedores.ParamByName('ID').AsInteger := ID;
|
tbl_Comisiones.ParamByName('ID').AsInteger := ID;
|
||||||
tbl_Comisiones.Active := True;
|
tbl_Facturas.ParamByName('ID').AsInteger := ID;
|
||||||
tbl_Facturas.Active := True;
|
tbl_Vendedores.ParamByName('ID').AsInteger := ID;
|
||||||
tbl_Vendedores.Active := True;
|
tbl_Comisiones.Active := True;
|
||||||
|
tbl_Facturas.Active := True;
|
||||||
|
tbl_Vendedores.Active := True;
|
||||||
|
|
||||||
frxReport.LoadFromFile(DarRutaInformes + rptComision, True);
|
frxReport.LoadFromFile(DarRutaInformes + rptComision, True);
|
||||||
frxReport.PrepareReport(False);
|
frxReport.PrepareReport(False);
|
||||||
|
finally
|
||||||
|
FConnection.RollbackTransaction;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TRptComisiones.GenerarComision(const AComisionID: String): Binary;
|
function TRptComisiones.GenerarComision(const AComisionID: String): Binary;
|
||||||
@ -79,21 +84,15 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
Result := Binary.Create;
|
Result := Binary.Create;
|
||||||
FConnection.BeginTransaction;
|
|
||||||
|
|
||||||
try
|
ID_Comisiones := TStringList.Create;
|
||||||
ID_Comisiones := TStringList.Create;
|
ID_Comisiones.CommaText := AComisionID;
|
||||||
ID_Comisiones.CommaText := AComisionID;
|
|
||||||
|
|
||||||
//Vamos generando todos y cada uno de los albaranes recibidos
|
//Vamos generando todos y cada uno de los albaranes recibidos
|
||||||
for i := 0 to ID_Comisiones.Count - 1 do
|
for i := 0 to ID_Comisiones.Count - 1 do
|
||||||
GenerarComision(StrToInt(ID_Comisiones.Strings[i]));
|
GenerarComision(StrToInt(ID_Comisiones.Strings[i]));
|
||||||
|
|
||||||
frxReport.PreviewPages.SaveToStream(Result);
|
frxReport.PreviewPages.SaveToStream(Result);
|
||||||
|
|
||||||
finally
|
|
||||||
FConnection.RollbackTransaction;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -70,40 +70,38 @@ function TRptFacturasCliente.GenerarFactura(const AFacturaID: String): Binary;
|
|||||||
var
|
var
|
||||||
ID_Facturas: TStringList;
|
ID_Facturas: TStringList;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result := Binary.Create;
|
Result := Binary.Create;
|
||||||
|
ID_Facturas := TStringList.Create;
|
||||||
|
ID_Facturas.CommaText := AFacturaID;
|
||||||
|
|
||||||
|
//Vamos generando todos y cada uno de los albaranes recibidos
|
||||||
|
for i := 0 to ID_Facturas.Count - 1 do
|
||||||
|
GenerarFactura(StrToInt(ID_Facturas.Strings[i]));
|
||||||
|
|
||||||
|
frxReport.PreviewPages.SaveToStream(Result);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TRptFacturasCliente.GenerarFactura(const ID: integer);
|
||||||
|
begin
|
||||||
FConnection.BeginTransaction;
|
FConnection.BeginTransaction;
|
||||||
|
|
||||||
try
|
try
|
||||||
ID_Facturas := TStringList.Create;
|
tbl_FacturaCliente.ParamByName('ID').AsInteger := ID;
|
||||||
ID_Facturas.CommaText := AFacturaID;
|
tbl_DetallesFacturaCliente.ParamByName('ID_FACTURA').AsInteger := ID;
|
||||||
|
tbl_Vencimientos.ParamByName('ID_FACTURA').AsInteger := ID;
|
||||||
//Vamos generando todos y cada uno de los albaranes recibidos
|
tbl_FacturaCliente.Active := True;
|
||||||
for i := 0 to ID_Facturas.Count - 1 do
|
tbl_DetallesFacturaCliente.Active := True;
|
||||||
GenerarFactura(StrToInt(ID_Facturas.Strings[i]));
|
tbl_Vencimientos.Active := True;
|
||||||
|
|
||||||
frxReport.PreviewPages.SaveToStream(Result);
|
|
||||||
|
|
||||||
|
if (tbl_FacturaCliente.FieldByName('ID_TIENDA').AsInteger <> 3) then
|
||||||
|
frxReport.LoadFromFile(DarRutaInformes + rptFacturaCliente, True)
|
||||||
|
else
|
||||||
|
frxReport.LoadFromFile(DarRutaInformes + rptFacturaClienteAbeto, True);
|
||||||
|
frxReport.PrepareReport(False);
|
||||||
finally
|
finally
|
||||||
FConnection.RollbackTransaction;
|
FConnection.RollbackTransaction;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRptFacturasCliente.GenerarFactura(const ID: integer);
|
|
||||||
begin
|
|
||||||
tbl_FacturaCliente.ParamByName('ID').AsInteger := ID;
|
|
||||||
tbl_DetallesFacturaCliente.ParamByName('ID_FACTURA').AsInteger := ID;
|
|
||||||
tbl_Vencimientos.ParamByName('ID_FACTURA').AsInteger := ID;
|
|
||||||
tbl_FacturaCliente.Active := True;
|
|
||||||
tbl_DetallesFacturaCliente.Active := True;
|
|
||||||
tbl_Vencimientos.Active := True;
|
|
||||||
|
|
||||||
if (tbl_FacturaCliente.FieldByName('ID_TIENDA').AsInteger <> 3) then
|
|
||||||
frxReport.LoadFromFile(DarRutaInformes + rptFacturaCliente, True)
|
|
||||||
else
|
|
||||||
frxReport.LoadFromFile(DarRutaInformes + rptFacturaClienteAbeto, True);
|
|
||||||
frxReport.PrepareReport(False);
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -99,8 +99,6 @@ var
|
|||||||
AConfiguracionService : IsrvConfiguracion;
|
AConfiguracionService : IsrvConfiguracion;
|
||||||
Intf : IInterface;
|
Intf : IInterface;
|
||||||
AClientID : TGUID;
|
AClientID : TGUID;
|
||||||
Ruta: String;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
CreateGUID(AClientID);
|
CreateGUID(AClientID);
|
||||||
try
|
try
|
||||||
|
|||||||
@ -74,17 +74,12 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result := Binary.Create;
|
Result := Binary.Create;
|
||||||
//FConnection.BeginTransaction; <--- Creo que no va a hacer falta.
|
|
||||||
|
|
||||||
try
|
//Vamos generando todos y cada uno de los presupuestos recibidos
|
||||||
//Vamos generando todos y cada uno de los presupuestos recibidos
|
for i := 0 to ListaID.Count - 1 do
|
||||||
for i := 0 to ListaID.Count - 1 do
|
_GenerarPresupuesto(ListaID.Items[i]);
|
||||||
_GenerarPresupuesto(ListaID.Items[i]);
|
|
||||||
|
|
||||||
frxReport.PreviewPages.SaveToStream(Result);
|
frxReport.PreviewPages.SaveToStream(Result);
|
||||||
finally
|
|
||||||
//FConnection.RollbackTransaction; <--- Creo que no va a hacer falta.
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TRptPresupuestosCliente.GenerarPresupuestoEnPDF(
|
function TRptPresupuestosCliente.GenerarPresupuestoEnPDF(
|
||||||
@ -93,40 +88,19 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
Result := Binary.Create;
|
Result := Binary.Create;
|
||||||
//FConnection.BeginTransaction; <--- Creo que no va a hacer falta.
|
|
||||||
|
|
||||||
try
|
//Vamos generando todos y cada uno de los presupuestos recibidos
|
||||||
//Vamos generando todos y cada uno de los presupuestos recibidos
|
for i := 0 to ListaID.Count - 1 do
|
||||||
for i := 0 to ListaID.Count - 1 do
|
_GenerarPresupuesto(ListaID.Items[i]);
|
||||||
_GenerarPresupuesto(ListaID.Items[i]);
|
|
||||||
|
|
||||||
frxPDFExport1.Stream := Result;
|
frxPDFExport1.Stream := Result;
|
||||||
frxReport.Export(frxPDFExport1)
|
frxReport.Export(frxPDFExport1)
|
||||||
finally
|
|
||||||
//FConnection.RollbackTransaction; <--- Creo que no va a hacer falta.
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRptPresupuestosCliente._GenerarPresupuesto(const AID: Integer);
|
procedure TRptPresupuestosCliente._GenerarPresupuesto(const AID: Integer);
|
||||||
{var
|
|
||||||
AStream: TMemoryStream;
|
|
||||||
dsMaster: IDADataset;
|
|
||||||
dsDetail: IDADataset;}
|
|
||||||
begin
|
begin
|
||||||
//AStream := TMemoryStream.Create;
|
FConnection.BeginTransaction;
|
||||||
|
try
|
||||||
// try
|
|
||||||
{dsMaster := schReport.NewDataset(FConnection, ds_InformeCabecera, ['ID'], [AID]);
|
|
||||||
dsDetail := schReport.NewDataset(FConnection, ds_InformeDetalles, ['ID'], [AID], False);
|
|
||||||
|
|
||||||
AStream.Clear;
|
|
||||||
Bin2DataStreamer.WriteDataset(AStream, dsMaster, [woRows, woSchema], -1);
|
|
||||||
Bin2DataStreamer.ReadDataset(AStream, tbl_Cabecera, TRUE, '', TRUE, TRUE);
|
|
||||||
|
|
||||||
AStream.Clear;
|
|
||||||
Bin2DataStreamer.WriteDataset(AStream, dsDetail, [woRows, woSchema], -1);
|
|
||||||
Bin2DataStreamer.ReadDataset(AStream, tbl_Detalles, TRUE, '', TRUE, TRUE);}
|
|
||||||
|
|
||||||
tbl_Cabecera.ParamByName('ID').AsInteger := AID;
|
tbl_Cabecera.ParamByName('ID').AsInteger := AID;
|
||||||
tbl_Detalles.ParamByName('ID').AsInteger := AID;
|
tbl_Detalles.ParamByName('ID').AsInteger := AID;
|
||||||
tbl_Cabecera.Active := True;
|
tbl_Cabecera.Active := True;
|
||||||
@ -134,12 +108,9 @@ begin
|
|||||||
|
|
||||||
frxReport.LoadFromFile(DarRutaInformes + rptInforme, True);
|
frxReport.LoadFromFile(DarRutaInformes + rptInforme, True);
|
||||||
frxReport.PrepareReport(False);
|
frxReport.PrepareReport(False);
|
||||||
|
finally
|
||||||
{ finally
|
FConnection.RollbackTransaction;
|
||||||
//AStream.Free;
|
end;
|
||||||
dsMaster := Nil;
|
|
||||||
dsDetail := Nil;
|
|
||||||
end;}
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|||||||
@ -67,44 +67,21 @@ var
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
Result := Binary.Create;
|
Result := Binary.Create;
|
||||||
FConnection.BeginTransaction;
|
|
||||||
|
|
||||||
try
|
ID_Recibos := TStringList.Create;
|
||||||
ID_Recibos := TStringList.Create;
|
ID_Recibos.CommaText := ID;
|
||||||
ID_Recibos.CommaText := ID;
|
|
||||||
|
|
||||||
//Vamos generando todos y cada uno de los albaranes recibidos
|
//Vamos generando todos y cada uno de los albaranes recibidos
|
||||||
for i := 0 to ID_Recibos.Count - 1 do
|
for i := 0 to ID_Recibos.Count - 1 do
|
||||||
GenerarRecibo(StrToInt(ID_Recibos.Strings[i]));
|
GenerarRecibo(StrToInt(ID_Recibos.Strings[i]));
|
||||||
|
|
||||||
frxReport.PreviewPages.SaveToStream(Result);
|
frxReport.PreviewPages.SaveToStream(Result);
|
||||||
|
|
||||||
finally
|
|
||||||
FConnection.RollbackTransaction;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRptRecibosCliente.GenerarRecibo(const ID: Integer);
|
procedure TRptRecibosCliente.GenerarRecibo(const ID: Integer);
|
||||||
{var
|
|
||||||
dsMaster: IDADataset;
|
|
||||||
dsCompensados : IDADataset;
|
|
||||||
AStream: TMemoryStream;
|
|
||||||
}
|
|
||||||
begin
|
begin
|
||||||
// AStream := TMemoryStream.Create;
|
FConnection.BeginTransaction;
|
||||||
|
|
||||||
try
|
try
|
||||||
// dsMaster := schReport.NewDataset(FConnection, ds_InformeCabecera, ['ID'], [ID]);
|
|
||||||
// dsCompensados := schReport.NewDataset(FConnection, ds_InformeCompensados, ['ID_RECIBO'], [ID], False);
|
|
||||||
|
|
||||||
// AStream.Clear;
|
|
||||||
// DABINAdapter.WriteDataset(AStream, dsMaster, [woRows, woSchema], -1);
|
|
||||||
// DABINAdapter.ReadDataset(AStream, tbl_Cabecera, TRUE, '', TRUE, TRUE);
|
|
||||||
|
|
||||||
// AStream.Clear;
|
|
||||||
// DABINAdapter.WriteDataset(AStream, dsCompensados, [woRows, woSchema], -1);
|
|
||||||
// DABINAdapter.ReadDataset(AStream, tbl_Compensados, TRUE, '', TRUE, TRUE);
|
|
||||||
|
|
||||||
tbl_Cabecera.ParamByName('ID').AsInteger := ID;
|
tbl_Cabecera.ParamByName('ID').AsInteger := ID;
|
||||||
tbl_Compensados.ParamByName('ID_RECIBO').AsInteger := ID;
|
tbl_Compensados.ParamByName('ID_RECIBO').AsInteger := ID;
|
||||||
tbl_Cabecera.Active := True;
|
tbl_Cabecera.Active := True;
|
||||||
@ -114,9 +91,7 @@ begin
|
|||||||
frxReport.PrepareReport(False);
|
frxReport.PrepareReport(False);
|
||||||
|
|
||||||
finally
|
finally
|
||||||
// AStream.Free;
|
FConnection.RollbackTransaction;
|
||||||
// dsMaster := Nil;
|
|
||||||
// dsCompensados := Nil;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,6 @@ end;
|
|||||||
function TsrvConfiguracion.DarValor(const CODIGO: String; const ValorPorDefecto: String = ''): String;
|
function TsrvConfiguracion.DarValor(const CODIGO: String; const ValorPorDefecto: String = ''): String;
|
||||||
var
|
var
|
||||||
ADataSet : IDADataset;
|
ADataSet : IDADataset;
|
||||||
ASchema : TDASchema;
|
|
||||||
ACurrentConn : IDAConnection;
|
ACurrentConn : IDAConnection;
|
||||||
ACommand : IDASQLCommand;
|
ACommand : IDASQLCommand;
|
||||||
begin
|
begin
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user