From 9ac9ebceb02d68a58d7fe27829532ccd5875b24d Mon Sep 17 00:00:00 2001 From: roberto Date: Mon, 8 Mar 2010 19:09:51 +0000 Subject: [PATCH] Se depura modulo de pedidos de cliente git-svn-id: https://192.168.0.254/svn/Proyectos.Noviseda_FactuGES2/trunk@103 f33bb606-9f5c-448d-9c99-757f00063c96 --- Database/scripts/factuges.sql | 2 +- Source/Base/Base.dproj | 102 +- Source/Base/Base.res | Bin 384 -> 4748 bytes Source/Informes/InfPedidoCliente.fr3 | 5 + .../PedidosCliente_controller.dproj | 34 +- .../Controller/PedidosCliente_controller.res | Bin 384 -> 4748 bytes .../uDetallesPedidoClienteController.pas | 2 +- .../Controller/uPedidosClienteController.pas | 45 +- .../uPedidosClienteReportController.pas | 107 +- .../Data/PedidosCliente_data.dproj | 3 +- .../Data/PedidosCliente_data.res | Bin 384 -> 4748 bytes .../Data/uDataModulePedidosCliente.pas | 21 +- .../Data/uIDataModulePedidosClienteReport.pas | 5 +- .../Model/PedidosCliente_model.dproj | 24 +- .../Model/PedidosCliente_model.res | Bin 384 -> 4748 bytes .../Model/uBizPedidosCliente.pas | 2 +- .../Reports/uRptPedidosCliente_Server.dfm | 1550 ++++++++++------- .../Reports/uRptPedidosCliente_Server.pas | 175 +- .../Servidor/srvPedidosCliente_Impl.pas | 21 +- .../Views/uEditorPedidoCliente.dfm | 104 +- .../Views/uViewDetallesPedidoCliente.dfm | 89 +- .../Views/uViewPedidosCliente.dfm | 3 + Source/Servidor/FactuGES_Server.dpr | 3 +- Source/Servidor/FactuGES_Server.dproj | 3 + 24 files changed, 1294 insertions(+), 1006 deletions(-) create mode 100644 Source/Informes/InfPedidoCliente.fr3 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 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fConfigurarConexion
TForm diff --git a/Source/Base/Base.res b/Source/Base/Base.res index 8b251f312bcccec5485024f6fe8d80e1cdf25746..1641339fcc482e7e3492d1b45813a86619622c33 100644 GIT binary patch literal 4748 zcmbW5&ub)A5XUPdpe&2#;C*uNAUVhgd+&(4um@dnom`vXF9g}ZuHJ;se=<3UNdFJg zbCw+UD9j$byGIXV`~6hC>h4S?F|k9X-j90q{Z_qtZ<;nUJCO8!h?p${kR>3GhM`oH*q zk=UsjOCIgA_4!`B+Gb&`I84R)bT4dy-BQV<-SyFz?R8ILEQ(+JB$u{sEXE@j@B*7W zT;iZH#|OJ<&DO$RCkM6VbK3(B(k{nbdv1lpc;E$xz9as|v3uE1V{hw2w~g3eD0an7 z{BT%G%irdMe*|oDJmgvJaA2`9B<6Xi*?M~Q;)@Sbfwf3uf zVaWkbUjU=;sL{BlYemIZXv%qZ{SZw{-TCU+;!nH6KDDIJumU+9{E0zXW4>7T)y|>$DQlv zRJe?TjSp{c!DqeayAnSMTtZZT;>LN7J0Rls+5m@q)MbyB*eL%Eu@(+$Cw}Pd@q7N| z%Q0*AHpCP^b9v`@jx-l_FD>khpW2W8(OU2&V5TrnoAY-m_hlcV?zq3;7{2gF{J#Hc z6R+o~mVenX?>@W0@_DVzyOFs(5464CY{!q9ChoF#_*eXi@4gFuV8?vhl=_w5$iKL0 zEV0nMBcN08xtRmsgJrqjh@s#|{?*ssnsG)mH*wa6{efF0JFWHok@kA5%b661{B38= zCcgJ|*ZFTpV$8<-&+AWpa)Q8*`wL&hMeNQ^v6I7$HSdLZhZ^&+6<@Uw_Zsml9^v3W zVvPDBKHh;i=RU4J_ta3E;)Mn>Y+L zKLZ0UQ+*km9FO-b?U4gmn-62iwzH6&*duKGo~aUV)bYDla8wWZ9+^7p-F<8lP@i!m z@vhbD_${F}h>^T;C(?(b*OJDk?{dEXB?nuehoON3HAb!7Mr7-ls!84-5V-jJugbu<_$}mU=Yd9!?TOX;|B-#B)+0x#9q*yqJiqS!`49d=7ztk$O+9=1i;?K_|J<8T z?0b7=-`Z3A#vV$4XJ5(lQ~TOZHUFdA%oWvK5zg&_IKXIbughQBA8XAsd#=@|TFLXC zy(^m((;DnQmDQKatmw!@c`| G?EMQ&4NnpP delta 11 ScmeBCZD5|Duvteife`=|>;pCc 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 8b251f312bcccec5485024f6fe8d80e1cdf25746..1641339fcc482e7e3492d1b45813a86619622c33 100644 GIT binary patch literal 4748 zcmbW5&ub)A5XUPdpe&2#;C*uNAUVhgd+&(4um@d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--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 - +
DataModulePedidosCliente
-