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;
|
||||
begin
|
||||
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
|
||||
//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;
|
||||
frxReport.PreviewPages.SaveToStream(Result);
|
||||
end;
|
||||
|
||||
function TRptAlbaranesCliente.GenerarAlbaranEnPDF(
|
||||
@ -95,29 +89,29 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := Binary.Create;
|
||||
//FConnection.BeginTransaction; <--- Creo que no va a hacer falta.
|
||||
|
||||
try
|
||||
//Vamos generando todos y cada uno de los presupuestos recibidos
|
||||
for i := 0 to ListaID.Count - 1 do
|
||||
_GenerarAlbaran(ListaID.Items[i]);
|
||||
//Vamos generando todos y cada uno de los presupuestos recibidos
|
||||
for i := 0 to ListaID.Count - 1 do
|
||||
_GenerarAlbaran(ListaID.Items[i]);
|
||||
|
||||
frxPDFExport1.Stream := Result;
|
||||
frxReport.Export(frxPDFExport1)
|
||||
finally
|
||||
//FConnection.RollbackTransaction; <--- Creo que no va a hacer falta.
|
||||
end;
|
||||
frxPDFExport1.Stream := Result;
|
||||
frxReport.Export(frxPDFExport1)
|
||||
end;
|
||||
|
||||
procedure TRptAlbaranesCliente._GenerarAlbaran(const ID: integer);
|
||||
begin
|
||||
tbl_Cabecera.ParamByName('ID').AsInteger := ID;
|
||||
tbl_Detalles.ParamByName('ID_ALBARAN').AsInteger := ID;
|
||||
tbl_Cabecera.Active := True;
|
||||
tbl_Detalles.Active := True;
|
||||
FConnection.BeginTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO"
|
||||
try
|
||||
tbl_Cabecera.ParamByName('ID').AsInteger := ID;
|
||||
tbl_Detalles.ParamByName('ID_ALBARAN').AsInteger := ID;
|
||||
tbl_Cabecera.Active := True;
|
||||
tbl_Detalles.Active := True;
|
||||
|
||||
frxReport.LoadFromFile(DarRutaInformes + rptInfAlbaran, True);
|
||||
frxReport.PrepareReport(False);
|
||||
frxReport.LoadFromFile(DarRutaInformes + rptInfAlbaran, True);
|
||||
frxReport.PrepareReport(False);
|
||||
finally
|
||||
FConnection.RollbackTransaction; //<--- Creo que no va a hacer falta. "PUES SI ES NECESARIO"
|
||||
end;
|
||||
end;
|
||||
|
||||
function TRptAlbaranesCliente.GenerarEtiquetas(const AID: Integer; withRefCliente: Boolean): Binary;
|
||||
|
||||
@ -61,15 +61,20 @@ end;
|
||||
|
||||
procedure TRptComisiones.GenerarComision(const ID: integer);
|
||||
begin
|
||||
tbl_Comisiones.ParamByName('ID').AsInteger := ID;
|
||||
tbl_Facturas.ParamByName('ID').AsInteger := ID;
|
||||
tbl_Vendedores.ParamByName('ID').AsInteger := ID;
|
||||
tbl_Comisiones.Active := True;
|
||||
tbl_Facturas.Active := True;
|
||||
tbl_Vendedores.Active := True;
|
||||
FConnection.BeginTransaction;
|
||||
try
|
||||
tbl_Comisiones.ParamByName('ID').AsInteger := ID;
|
||||
tbl_Facturas.ParamByName('ID').AsInteger := ID;
|
||||
tbl_Vendedores.ParamByName('ID').AsInteger := ID;
|
||||
tbl_Comisiones.Active := True;
|
||||
tbl_Facturas.Active := True;
|
||||
tbl_Vendedores.Active := True;
|
||||
|
||||
frxReport.LoadFromFile(DarRutaInformes + rptComision, True);
|
||||
frxReport.PrepareReport(False);
|
||||
frxReport.LoadFromFile(DarRutaInformes + rptComision, True);
|
||||
frxReport.PrepareReport(False);
|
||||
finally
|
||||
FConnection.RollbackTransaction;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TRptComisiones.GenerarComision(const AComisionID: String): Binary;
|
||||
@ -79,21 +84,15 @@ var
|
||||
|
||||
begin
|
||||
Result := Binary.Create;
|
||||
FConnection.BeginTransaction;
|
||||
|
||||
try
|
||||
ID_Comisiones := TStringList.Create;
|
||||
ID_Comisiones.CommaText := AComisionID;
|
||||
ID_Comisiones := TStringList.Create;
|
||||
ID_Comisiones.CommaText := AComisionID;
|
||||
|
||||
//Vamos generando todos y cada uno de los albaranes recibidos
|
||||
for i := 0 to ID_Comisiones.Count - 1 do
|
||||
GenerarComision(StrToInt(ID_Comisiones.Strings[i]));
|
||||
//Vamos generando todos y cada uno de los albaranes recibidos
|
||||
for i := 0 to ID_Comisiones.Count - 1 do
|
||||
GenerarComision(StrToInt(ID_Comisiones.Strings[i]));
|
||||
|
||||
frxReport.PreviewPages.SaveToStream(Result);
|
||||
|
||||
finally
|
||||
FConnection.RollbackTransaction;
|
||||
end;
|
||||
frxReport.PreviewPages.SaveToStream(Result);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@ -70,40 +70,38 @@ function TRptFacturasCliente.GenerarFactura(const AFacturaID: String): Binary;
|
||||
var
|
||||
ID_Facturas: TStringList;
|
||||
i: Integer;
|
||||
|
||||
begin
|
||||
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;
|
||||
|
||||
try
|
||||
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);
|
||||
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);
|
||||
finally
|
||||
FConnection.RollbackTransaction;
|
||||
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.
|
||||
|
||||
@ -99,8 +99,6 @@ var
|
||||
AConfiguracionService : IsrvConfiguracion;
|
||||
Intf : IInterface;
|
||||
AClientID : TGUID;
|
||||
Ruta: String;
|
||||
|
||||
begin
|
||||
CreateGUID(AClientID);
|
||||
try
|
||||
|
||||
@ -74,17 +74,12 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := Binary.Create;
|
||||
//FConnection.BeginTransaction; <--- Creo que no va a hacer falta.
|
||||
|
||||
try
|
||||
//Vamos generando todos y cada uno de los presupuestos recibidos
|
||||
for i := 0 to ListaID.Count - 1 do
|
||||
_GenerarPresupuesto(ListaID.Items[i]);
|
||||
//Vamos generando todos y cada uno de los presupuestos recibidos
|
||||
for i := 0 to ListaID.Count - 1 do
|
||||
_GenerarPresupuesto(ListaID.Items[i]);
|
||||
|
||||
frxReport.PreviewPages.SaveToStream(Result);
|
||||
finally
|
||||
//FConnection.RollbackTransaction; <--- Creo que no va a hacer falta.
|
||||
end;
|
||||
frxReport.PreviewPages.SaveToStream(Result);
|
||||
end;
|
||||
|
||||
function TRptPresupuestosCliente.GenerarPresupuestoEnPDF(
|
||||
@ -93,40 +88,19 @@ var
|
||||
i: Integer;
|
||||
begin
|
||||
Result := Binary.Create;
|
||||
//FConnection.BeginTransaction; <--- Creo que no va a hacer falta.
|
||||
|
||||
try
|
||||
//Vamos generando todos y cada uno de los presupuestos recibidos
|
||||
for i := 0 to ListaID.Count - 1 do
|
||||
_GenerarPresupuesto(ListaID.Items[i]);
|
||||
//Vamos generando todos y cada uno de los presupuestos recibidos
|
||||
for i := 0 to ListaID.Count - 1 do
|
||||
_GenerarPresupuesto(ListaID.Items[i]);
|
||||
|
||||
frxPDFExport1.Stream := Result;
|
||||
frxReport.Export(frxPDFExport1)
|
||||
finally
|
||||
//FConnection.RollbackTransaction; <--- Creo que no va a hacer falta.
|
||||
end;
|
||||
frxPDFExport1.Stream := Result;
|
||||
frxReport.Export(frxPDFExport1)
|
||||
end;
|
||||
|
||||
procedure TRptPresupuestosCliente._GenerarPresupuesto(const AID: Integer);
|
||||
{var
|
||||
AStream: TMemoryStream;
|
||||
dsMaster: IDADataset;
|
||||
dsDetail: IDADataset;}
|
||||
begin
|
||||
//AStream := TMemoryStream.Create;
|
||||
|
||||
// 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);}
|
||||
|
||||
FConnection.BeginTransaction;
|
||||
try
|
||||
tbl_Cabecera.ParamByName('ID').AsInteger := AID;
|
||||
tbl_Detalles.ParamByName('ID').AsInteger := AID;
|
||||
tbl_Cabecera.Active := True;
|
||||
@ -134,12 +108,9 @@ begin
|
||||
|
||||
frxReport.LoadFromFile(DarRutaInformes + rptInforme, True);
|
||||
frxReport.PrepareReport(False);
|
||||
|
||||
{ finally
|
||||
//AStream.Free;
|
||||
dsMaster := Nil;
|
||||
dsDetail := Nil;
|
||||
end;}
|
||||
finally
|
||||
FConnection.RollbackTransaction;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
@ -67,44 +67,21 @@ var
|
||||
|
||||
begin
|
||||
Result := Binary.Create;
|
||||
FConnection.BeginTransaction;
|
||||
|
||||
try
|
||||
ID_Recibos := TStringList.Create;
|
||||
ID_Recibos.CommaText := ID;
|
||||
ID_Recibos := TStringList.Create;
|
||||
ID_Recibos.CommaText := ID;
|
||||
|
||||
//Vamos generando todos y cada uno de los albaranes recibidos
|
||||
for i := 0 to ID_Recibos.Count - 1 do
|
||||
GenerarRecibo(StrToInt(ID_Recibos.Strings[i]));
|
||||
//Vamos generando todos y cada uno de los albaranes recibidos
|
||||
for i := 0 to ID_Recibos.Count - 1 do
|
||||
GenerarRecibo(StrToInt(ID_Recibos.Strings[i]));
|
||||
|
||||
frxReport.PreviewPages.SaveToStream(Result);
|
||||
|
||||
finally
|
||||
FConnection.RollbackTransaction;
|
||||
end;
|
||||
frxReport.PreviewPages.SaveToStream(Result);
|
||||
end;
|
||||
|
||||
procedure TRptRecibosCliente.GenerarRecibo(const ID: Integer);
|
||||
{var
|
||||
dsMaster: IDADataset;
|
||||
dsCompensados : IDADataset;
|
||||
AStream: TMemoryStream;
|
||||
}
|
||||
begin
|
||||
// AStream := TMemoryStream.Create;
|
||||
|
||||
FConnection.BeginTransaction;
|
||||
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_Compensados.ParamByName('ID_RECIBO').AsInteger := ID;
|
||||
tbl_Cabecera.Active := True;
|
||||
@ -114,9 +91,7 @@ begin
|
||||
frxReport.PrepareReport(False);
|
||||
|
||||
finally
|
||||
// AStream.Free;
|
||||
// dsMaster := Nil;
|
||||
// dsCompensados := Nil;
|
||||
FConnection.RollbackTransaction;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@ -52,7 +52,6 @@ end;
|
||||
function TsrvConfiguracion.DarValor(const CODIGO: String; const ValorPorDefecto: String = ''): String;
|
||||
var
|
||||
ADataSet : IDADataset;
|
||||
ASchema : TDASchema;
|
||||
ACurrentConn : IDAConnection;
|
||||
ACommand : IDASQLCommand;
|
||||
begin
|
||||
|
||||
Loading…
Reference in New Issue
Block a user