diff --git a/Database/scripts/factuges.sql b/Database/scripts/factuges.sql
index 9a3d489..9ace080 100644
--- a/Database/scripts/factuges.sql
+++ b/Database/scripts/factuges.sql
@@ -3859,7 +3859,7 @@ SELECT
CONTACTOS.NOMBRE,
PEDIDOS_CLIENTE.REFERENCIA,
PEDIDOS_CLIENTE.REFERENCIA_CLIENTE,
- V_PED_CLI_SITUACION.SITUACION,
+ TRIM(V_PED_CLI_SITUACION.SITUACION),
PEDIDOS_CLIENTE.FECHA_PEDIDO,
PEDIDOS_CLIENTE.ID_DIRECCION,
PEDIDOS_CLIENTE.CALLE,
diff --git a/Source/Base/Base.dproj b/Source/Base/Base.dproj
index f702c15..cbe1f69 100644
--- a/Source/Base/Base.dproj
+++ b/Source/Base/Base.dproj
@@ -55,58 +55,58 @@
MainSource
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
TForm
diff --git a/Source/Base/Base.res b/Source/Base/Base.res
index 8b251f3..1641339 100644
Binary files a/Source/Base/Base.res and b/Source/Base/Base.res differ
diff --git a/Source/Informes/InfPedidoCliente.fr3 b/Source/Informes/InfPedidoCliente.fr3
new file mode 100644
index 0000000..1f0f344
--- /dev/null
+++ b/Source/Informes/InfPedidoCliente.fr3
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.dproj b/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.dproj
index 59c3a69..11075d0 100644
--- a/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.dproj
+++ b/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.dproj
@@ -49,23 +49,23 @@
MainSource
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.res b/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.res
index 8b251f3..1641339 100644
Binary files a/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.res and b/Source/Modulos/Pedidos de cliente/Controller/PedidosCliente_controller.res differ
diff --git a/Source/Modulos/Pedidos de cliente/Controller/uDetallesPedidoClienteController.pas b/Source/Modulos/Pedidos de cliente/Controller/uDetallesPedidoClienteController.pas
index 35e6f10..2ef8e00 100644
--- a/Source/Modulos/Pedidos de cliente/Controller/uDetallesPedidoClienteController.pas
+++ b/Source/Modulos/Pedidos de cliente/Controller/uDetallesPedidoClienteController.pas
@@ -1,4 +1,4 @@
- unit uDetallesPedidoClienteController;
+unit uDetallesPedidoClienteController;
interface
diff --git a/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteController.pas b/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteController.pas
index 9d2e061..fb84df1 100644
--- a/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteController.pas
+++ b/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteController.pas
@@ -147,7 +147,7 @@ uses
uBizContactos, uDataTableUtils, uDataModuleUsuarios, uFactuGES_App,
schPedidosClienteClient_Intf, uDAInterfaces, uDateUtils, uIEditorPedidoCliente,
uIEditorElegirPedidosCliente, uIEditorDireccionEntregaPedidoCliente,
- schContactosClient_Intf, uPedidosClienteReportController,
+ schContactosClient_Intf, uPedidosClienteReportController, uIntegerListUtils,
uIDialogListaPedidosCliEnvioEMail, uSistemaFunc, uStringsUtils, uDialogElegirEMail, Forms, uEMailUtils;
{ TPedidosClienteController }
@@ -672,10 +672,10 @@ begin
Result := (APedido.SITUACION <> SITUACION_PEDIDO_SERVIDO);
end;
-procedure TPedidosClienteController.RecalcularImportes(
- APedido: IBizPedidoCliente);
+procedure TPedidosClienteController.RecalcularImportes(APedido: IBizPedidoCliente);
var
bEnEdicion : Boolean;
+ ADetallePosAct : Integer;
begin
if not Assigned(APedido) then
raise Exception.Create ('Pedido no asignado (RecalcularImportes)');
@@ -683,18 +683,26 @@ begin
if APedido.DataTable.Active then
APedido.DataTable.Active := True;
+ { Hay que guardar la posición en la que estamos en los detalles por que
+ la asignación de valores a los campos IMPORTE_NETO e IMPORTE_PORTE
+ (ver más adelante) colocan el puntero en la tabla detalle al principio.
+ No he encontrado la razón por la que mueve el puntero. }
+
+ ADetallePosAct := APedido.Detalles.POSICION;
+
bEnEdicion := (APedido.DataTable.State in dsEditModes);
if not bEnEdicion then
- APedido.Edit;
+ APedido.Edit;
ShowHourglassCursor;
- APedido.Edit;
try
APedido.IMPORTE_NETO := FDetallesController.DarTotalImporteTotal(APedido.Detalles);
if not bEnEdicion then
APedido.Post;
finally
HideHourglassCursor;
+ // Restaurar la posición que teníamos en los detalles.
+ FDetallesController.LocalizarPosicion(APedido.Detalles, ADetallePosAct);
end;
end;
@@ -903,12 +911,13 @@ end;
procedure TPedidosClienteController.Preview(APedido: IBizPedidoCliente; AllItems: Boolean = false);
var
AReportController : IPedidosClienteReportController;
- ID_Pedidos: TStringList;
+ ID_Pedidos: TIntegerList;
begin
AReportController := TPedidosClienteReportController.Create;
+ ID_Pedidos := TIntegerList.Create;
+
try
- ID_Pedidos := TStringList.Create;
//Si deseamos previsualizar todos los items del objeto albaran
if AllItems then
@@ -918,33 +927,33 @@ begin
First;
while not EOF do
begin
- ID_Pedidos.Add(IntToStr(APedido.ID));
+ ID_Pedidos.Add(APedido.ID);
Next;
end;
end;
end
//Solo previsualizamos el item seleccionado
else
- ID_Pedidos.Add(IntToStr(APedido.ID));
+ ID_Pedidos.Add(APedido.ID);
- AReportController.Preview(ID_Pedidos.CommaText);
+ AReportController.Preview(ID_Pedidos);
finally
AReportController := NIL;
- ID_Pedidos.Free;
+ FreeANDNIL(ID_Pedidos);
end;
end;
function TPedidosClienteController.Print(APedido: IBizPedidoCliente; AllItems: Boolean = false): Boolean;
var
AReportController : IPedidosClienteReportController;
- ID_Pedidos: TStringList;
+ ID_Pedidos: TIntegerList;
begin
- Result := False;
AReportController := TPedidosClienteReportController.Create;
+ ID_Pedidos := TIntegerList.Create;
+
try
- ID_Pedidos := TStringList.Create;
//Si deseamos previsualizar todos los items del objeto albaran
if AllItems then
@@ -954,20 +963,20 @@ begin
First;
while not EOF do
begin
- ID_Pedidos.Add(IntToStr(APedido.ID));
+ ID_Pedidos.Add(APedido.ID);
Next;
end;
end;
end
//Solo previsualizamos el item seleccionado
else
- ID_Pedidos.Add(IntToStr(APedido.ID));
+ ID_Pedidos.Add(APedido.ID);
- Result := AReportController.Print(ID_Pedidos.CommaText);
+ AReportController.Print(ID_Pedidos);
finally
AReportController := NIL;
- ID_Pedidos.Free;
+ FreeANDNIL(ID_Pedidos);
end;
end;
diff --git a/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteReportController.pas b/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteReportController.pas
index 6efbd23..ba47f1e 100644
--- a/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteReportController.pas
+++ b/Source/Modulos/Pedidos de cliente/Controller/uPedidosClienteReportController.pas
@@ -5,41 +5,41 @@ interface
uses
Classes, SysUtils, uDADataTable, uControllerBase, uIDataModulePedidosClienteReport,
uClientesController, uPedidosClienteController, uDetallesPedidoClienteController,
- uBizPedidosCliente;
+ uBizPedidosCliente, uIntegerListUtils;
type
- IPedidosClienteReportController = interface
- ['{D0686358-251C-43C4-9927-6112F2F4D3B8}']
- procedure Preview(const AID : String);
- function Print(const AID : String): Boolean;
- function ExportToPDF(const AID: Integer; const AFileName : String = ''): Boolean;
+ IPedidosClienteReportController = interface(IControllerBase)
+ ['{1F989C7E-9B12-4208-8CB3-C4E1B202D62A}']
+ procedure Preview(const AListaID : TIntegerList);
+ procedure Print(const AListaID : TIntegerList);
end;
- TPedidosClienteReportController = class(TInterfacedObject, IPedidosClienteReportController)
+ TPedidosClienteReportController = class(TControllerBase, IPedidosClienteReportController)
private
FDataModule : IDataModulePedidosClienteReport;
function CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean;
+
public
- constructor Create;
+ constructor Create; override;
destructor Destroy; override;
- procedure Preview(const AID : String);
- function Print(const AID : String): Boolean;
- function ExportToPDF(const AID: Integer; const AFileName : String = ''): Boolean;
+ procedure Preview(const AListaID : TIntegerList);
+ procedure Print(const AListaID : TIntegerList);
end;
implementation
uses
- uROTypes, uEditorRegistryUtils, uIEditorPedidosClientePreview,
- uEditorPreview, uDataModulePedidosCliente, uEditorBase, cxControls,
- schPedidosClienteClient_Intf, uStringsUtils;
+ uROTypes, Controls, uEditorRegistryUtils, uIEditorPedidosClientePreview,
+ uEditorPreview, uDataModulePedidosCliente,
+ uEditorBase, cxControls, uStringsUtils, uSistemaFunc, uFactuGES_App;
{ TPedidosClienteReportController }
constructor TPedidosClienteReportController.Create;
begin
+ inherited;
FDataModule := TDataModulePedidosCliente.Create(Nil);
end;
@@ -56,30 +56,40 @@ begin
inherited;
end;
-function TPedidosClienteReportController.ExportToPDF(const AID: Integer;
- const AFileName: String): Boolean;
+procedure TPedidosClienteReportController.Preview(const AListaID : TIntegerList);
var
AStream: Binary;
+ AEditor : IEditorPedidosClientePreview;
begin
- Result := False;
- if EsCadenaVacia(AFileName) then
- Exit;
+ AEditor := NIL;
ShowHourglassCursor;
try
- AStream := FDataModule.GetRptPDF(AID, True);
+ AStream := FDataModule.GetRptPedidos(AListaID);
try
- AStream.SaveToFile(AFileName);
- Result := True;
+ CreateEditor('EditorPedidosClientePreview', IEditorPedidosClientePreview, AEditor);
+ if Assigned(AEditor) then
+ begin
+ try
+ AEditor.Controller := Self;
+ AEditor.ListaID := AListaID;
+ AEditor.Title := 'Pedido - ' + AppFactuGES.EmpresaActiva.NOMBRE;
+ AEditor.LoadFromStream(AStream);
+ AEditor.Preview;
+ finally
+ AEditor.Release;
+ end;
+ end;
finally
FreeAndNil(AStream);
+ AEditor := Nil;
end;
finally
HideHourglassCursor;
end;
end;
-procedure TPedidosClienteReportController.Preview(const AID : String);
+procedure TPedidosClienteReportController.Print(const AListaID : TIntegerList);
var
AStream: Binary;
AEditor : IEditorPedidosClientePreview;
@@ -88,49 +98,28 @@ begin
ShowHourglassCursor;
try
- AStream := FDataModule.GetReport(AID, True);
+ AStream := FDataModule.GetRptPedidos(AListaID);
try
CreateEditor('EditorPedidosClientePreview', IEditorPedidosClientePreview, AEditor);
- AEditor.LoadFromStream(AStream);
+ if Assigned(AEditor) then
+ begin
+ try
+ AEditor.Controller := Self;
+ AEditor.ListaID := AListaID;
+ AEditor.Title := 'Albarán - ' + AppFactuGES.EmpresaActiva.NOMBRE;
+ AEditor.LoadFromStream(AStream);
+ AEditor.Print;
+ finally
+ AEditor.Release;
+ end;
+ end;
finally
- AStream.Free;
+ FreeAndNil(AStream);
+ AEditor := Nil;
end;
finally
HideHourglassCursor;
end;
-
- if Assigned(AEditor) then
- AEditor.Preview;
-end;
-
-function TPedidosClienteReportController.Print(const AID : String): Boolean;
-var
- AStream: Binary;
- AEditor : IEditorPedidosClientePreview;
-begin
-{ Result := False;
- AEditor := NIL;
-
- ShowHourglassCursor;
- try
- AStream := FDataModule.GetReport(AID);
- try
- CreateEditor('EditorPedidosClientePreview', IEditorPedidosClientePreview, AEditor);
- AEditor.LoadFromStream(AStream);
- finally
- AStream.Free;
- end;
- finally
- HideHourglassCursor;
- end;
-
- if Assigned(AEditor) then
- begin
- AEditor.TablaImpresion := nme_PedidosCliente;
- AEditor.IdTablaImpresion := AID;
- Result := AEditor.Print;
- end;
-}
end;
end.
diff --git a/Source/Modulos/Pedidos de cliente/Data/PedidosCliente_data.dproj b/Source/Modulos/Pedidos de cliente/Data/PedidosCliente_data.dproj
index efd6bda..4f6beab 100644
--- a/Source/Modulos/Pedidos de cliente/Data/PedidosCliente_data.dproj
+++ b/Source/Modulos/Pedidos de cliente/Data/PedidosCliente_data.dproj
@@ -49,13 +49,12 @@
MainSource
-
+
-