From fb0bf72b636272688c44e445848c2acda0134d1a Mon Sep 17 00:00:00 2001 From: roberto Date: Thu, 26 Aug 2010 17:10:53 +0000 Subject: [PATCH] =?UTF-8?q?Se=20adpatan=20para=20guardar=20el=20n=C3=BAmer?= =?UTF-8?q?o=20de=20impresiones=20de=20todos=20los=20documentos,=20y=20se?= =?UTF-8?q?=20ha=20repasado=20toda=20la=20l=C3=B3gica=20de=20relaciones=20?= =?UTF-8?q?en=20la=20parte=20de=20cliente,=20falta=20solo=20recibos=20de?= =?UTF-8?q?=20cliente=20y=20remesas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES2/trunk@48 b2cfbe5a-eba1-4a0c-8b32-7feea0a119f2 --- Source/Base/Base.dpk | 7 +- Source/Base/Base.dproj | 105 +-- Source/Base/Utiles/uIntegerListUtils.pas | 19 + Source/Cliente/uBootStrap.pas | 8 +- Source/GUIBase/uEditorPreview.dfm | 25 +- Source/GUIBase/uEditorPreview.pas | 61 +- .../AlbaranesCliente_Group.groupproj | 16 +- .../uAlbaranesClienteController.pas | 42 +- .../uAlbaranesClienteReportController.pas | 4 +- .../uDetallesAlbaranClienteController.pas | 37 +- .../Model/uBizAlbaranesCliente.pas | 4 +- .../Servidor/srvAlbaranesCliente_Impl.dfm | 11 +- .../Views/AlbaranesCliente_view.dpk | 9 +- .../Views/AlbaranesCliente_view.dproj | 25 +- .../Views/uEditorAlbaranCliente.dfm | 67 +- .../Views/uEditorAlbaranCliente.pas | 57 +- .../Views/uEditorAlbaranDevCliente.dfm | 104 ++- .../Views/uEditorAlbaranesCliente.dfm | 16 +- .../Views/uEditorAlbaranesCliente.pas | 35 +- .../Views/uEditorAlbaranesDevCliente.dfm | 16 + .../Views/uViewAlbaranCliente.dfm | 72 +- .../Views/uViewAlbaranCliente.pas | 58 +- .../Views/uViewAlbaranDevCliente.dfm | 178 +++-- .../Views/uViewAlbaranDevCliente.pas | 71 +- .../Views/uViewAlbaranesCliente.dfm | 2 - .../Views/uViewAlbaranesDevCliente.dfm | 40 +- .../Views/uViewAlbaranesDevCliente.pas | 4 +- .../uViewDatosYSeleccionClienteAlbaran.dfm | 4 + .../uViewDatosYSeleccionClienteAlbaran.pas | 48 +- .../Views/uViewDetallesAlbaranCliente.dfm | 120 ++- .../uAlbaranesProveedorController.pas | 16 +- .../uAlbaranesProveedorReportController.pas | 19 +- .../schAlbaranesProveedorClient_Intf.pas | 8 +- .../Model/uBizAlbaranesProveedor.pas | 1 + .../Views/uEditorAlbaranesProveedor.pas | 3 +- .../Almacenes/Servidor/srvAlmacenes_Impl.pas | 2 +- .../Views/uViewDetallesArticulos.dfm | 62 +- .../Views/uViewDetallesArticulos.pas | 4 +- .../Controller/uFacturasClienteController.pas | 15 +- .../uFacturasClienteReportController.pas | 13 +- .../Data/uDataModuleFacturasCliente.dfm | 5 + .../FacturasCliente_Group.groupproj | 16 +- .../Model/schFacturasClienteClient_Intf.pas | 107 ++- .../Model/schFacturasClienteServer_Intf.pas | 55 +- .../Servidor/srvFacturasCliente_Impl.dfm | 18 +- .../Views/uEditorFacturaCliente.dfm | 129 ++-- .../Views/uEditorFacturasCliente.pas | 3 +- ...ewDatosYSeleccionClienteFacturaCliente.dfm | 60 +- ...ewDatosYSeleccionClienteFacturaCliente.pas | 22 +- .../Views/uViewDetallesFacturaCliente.dfm | 93 ++- .../Views/uViewDetallesFacturaCliente.pas | 1 + .../Views/uViewFacturaCliente.dfm | 66 +- .../Views/uViewFacturasCliente.dfm | 4 +- .../uFacturasProveedorController.pas | 10 +- .../uFacturasProveedorReportController.pas | 13 +- .../Views/uEditorFacturasProveedor.pas | 3 +- .../Inventario/Data/uDataModuleInventario.dfm | 21 +- .../Model/schInventarioClient_Intf.pas | 177 ++++- .../Model/schInventarioServer_Intf.pas | 185 ++++- .../Servidor/srvInventario_Impl.dfm | 55 +- .../Inventario/Views/uViewInventario.dfm | 18 +- .../Inventario/Views/uViewInventario.pas | 16 +- .../uPedidosProveedorController.pas | 15 +- .../uPedidosProveedorReportController.pas | 19 +- .../Model/schPedidosProveedorClient_Intf.pas | 16 +- .../Model/schPedidosProveedorServer_Intf.pas | 16 +- .../Servidor/srvPedidosProveedor_Impl.dfm | 16 +- .../Views/PedidosProveedor_view.dpk | 6 +- .../Views/PedidosProveedor_view.dproj | 97 +-- .../Views/uEditorPedidoProveedor.dfm | 163 ++-- .../Views/uEditorPedidoProveedor.pas | 2 +- .../Views/uEditorPedidosProveedor.pas | 3 +- .../uViewDatosYSeleccionProveedorPedido.pas | 6 +- .../Views/uViewDetallesPedidoProveedor.dfm | 21 +- .../Views/uViewDireccionEntregaPedidoProv.pas | 3 + .../Views/uViewPedidoProveedor.dfm | 6 + .../Views/uViewPedidoProveedor.pas | 45 +- .../uDetallesPedidoClienteController.pas | 15 +- .../Controller/uPedidosClienteController.pas | 42 +- .../uPedidosClienteReportController.pas | 19 +- .../Model/uBizPedidosCliente.pas | 7 +- .../PedidosCliente_Group.groupproj | 36 +- .../Plugin/PedidosCliente_plugin.dproj | 24 +- .../Views/PedidosCliente_view.dpk | 10 +- .../Views/PedidosCliente_view.dproj | 118 +-- .../Views/uEditorPedidoCliente.dfm | 26 +- .../Views/uEditorPedidoCliente.pas | 2 +- .../Views/uEditorPedidosCliente.dfm | 360 ++++++++- .../Views/uEditorPedidosCliente.pas | 68 +- .../uViewDatosYSeleccionClientePedido.pas | 7 +- .../Views/uViewDireccionEntregaPedidoCli.pas | 5 +- .../uPresupuestosClienteController.pas | 2 +- .../uPresupuestosClienteReportController.pas | 2 + .../Controller/uRecibosClienteController.pas | 9 +- .../uRecibosClienteReportController.pas | 17 +- .../Views/uEditorRecibosCliente.dfm | 5 +- .../Views/uEditorRecibosCliente.pas | 7 +- .../Model/schRecibosProveedorClient_Intf.pas | 10 +- .../uGenerarFacturasCliAlbCliUtils.pas | 14 +- .../PedCli_AlbCli_relation.dpk | 5 +- .../PedCli_AlbCli_relation.rc | 22 + .../PedCli_AlbCli_relation.res | Bin 32 -> 384 bytes .../PedCli_PedProv_relation.dpk | 1 - .../PedCli_PedProv_relation.rc | 22 + .../PedCli_PedProv_relation.res | Bin 32 -> 384 bytes .../uGenerarPedidosProvUtils.pas | 4 +- .../Controller/uRemesasClienteController.pas | 9 +- .../uRemesasClienteReportController.pas | 13 +- .../Views/uEditorRemesasCliente.dfm | 2 +- .../Views/uEditorRemesasCliente.pas | 3 +- .../uRemesasProveedorController.pas | 9 +- .../uRemesasProveedorReportController.pas | 14 +- .../Views/uEditorRemesasProveedor.dfm | 2 +- .../Views/uEditorRemesasProveedor.pas | 3 +- Source/Servicios/FactuGES.RODL | 38 + Source/Servicios/FactuGES_Intf.pas | 108 +++ Source/Servicios/FactuGES_Invk.pas | 86 +++ Source/Servidor/FactuGES_Server.dpr | 18 +- Source/Servidor/FactuGES_Server.dproj | 714 +++++++++--------- 119 files changed, 3139 insertions(+), 1658 deletions(-) diff --git a/Source/Base/Base.dpk b/Source/Base/Base.dpk index 50cf0f2..2c02bf9 100644 --- a/Source/Base/Base.dpk +++ b/Source/Base/Base.dpk @@ -77,7 +77,8 @@ requires dxPSCoreD11, cxIntl6D11, cxIntlPrintSys3D11, - RemObjects_Indy_D11; + RemObjects_Indy_D11, + dxCoreD11; contains uDataTableUtils in 'Utiles\uDataTableUtils.pas', @@ -114,6 +115,8 @@ contains uReferenciasUtils in 'Utiles\uReferenciasUtils.pas', uEMailUtils in 'Utiles\uEMailUtils.pas', uSaveClipboard in 'Utiles\uSaveClipboard.pas', - MidasSpeedFix in 'Utiles\MidasSpeedFix.pas'; + MidasSpeedFix in 'Utiles\MidasSpeedFix.pas', + uDataModuleImpresiones in '..\Modulos\Impresiones\Data\uDataModuleImpresiones.pas' {DataModuleImpresiones: TDataModule}, + uDataModuleRegistroCorreos in '..\Modulos\Registro de correos\Data\uDataModuleRegistroCorreos.pas' {DataModuleRegistroCorreos: TDataModule}; end. diff --git a/Source/Base/Base.dproj b/Source/Base/Base.dproj index 5f09cb2..bf19392 100644 --- a/Source/Base/Base.dproj +++ b/Source/Base/Base.dproj @@ -54,58 +54,61 @@ MainSource - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
fConfigurarConexion
TForm diff --git a/Source/Base/Utiles/uIntegerListUtils.pas b/Source/Base/Utiles/uIntegerListUtils.pas index 9ea3429..14d9628 100644 --- a/Source/Base/Utiles/uIntegerListUtils.pas +++ b/Source/Base/Utiles/uIntegerListUtils.pas @@ -15,10 +15,14 @@ type function Find(Value: integer; var Index: Integer): Boolean; property Integers[index: integer]: integer read GetInteger write SetInteger; default; function ToIntegerArray : TIntegerArray; + function ToString : String; end; implementation +uses + SysUtils; + function TIntegerList.GetInteger(Index: integer): integer; begin Result := Integer(Items[index]); @@ -38,6 +42,21 @@ begin Result.Add(Integers[i]); end; +function TIntegerList.ToString: String; +var + i : Integer; + AList : TStringList; +begin + AList := TStringList.Create; + try + for i := 0 to Count - 1 do + AList.Add(IntToStr(Integers[i])); + Result := AList.CommaText; + finally + FreeANDNIL(AList); + end; +end; + procedure TIntegerList.Add(Value: integer); var Index: integer; diff --git a/Source/Cliente/uBootStrap.pas b/Source/Cliente/uBootStrap.pas index 3441df3..189f1d8 100644 --- a/Source/Cliente/uBootStrap.pas +++ b/Source/Cliente/uBootStrap.pas @@ -13,8 +13,8 @@ procedure Terminate; implementation uses - uDMBase, uDataModuleConexion, uDataModuleConfiguracion, uPlugins_Intf, - uMainMenuController, uNavPaneController, uPantallaPrincipal; + uDMBase, uDataModuleConexion, uDataModuleConfiguracion, uDataModuleImpresiones, + uPlugins_Intf, uMainMenuController, uNavPaneController, uPantallaPrincipal; procedure DoAppLoadModules; begin @@ -71,6 +71,7 @@ begin dmConexion := TdmConexion.Create(NIL); dmConfiguracion := TdmConfiguracion.Create(NIL); dmBase := TdmBase.Create(NIL); + dmImpresiones := TDataModuleImpresiones.Create(NIL); AppFactuGES := TAppFactuGES.Create; with AppFactuGES do @@ -78,7 +79,7 @@ begin AppSplashForm := TAppSplashForm.Create; DoMainFormEvent := DoAppMainForm; DoLoadModulesEvent := DoAppLoadModules; - DoRefreshMainFormEvent := DoRefreshMainForm; + DoRefreshMainFormEvent := DoRefreshMainForm; end; NavPaneController := TNavPaneController.Create; @@ -100,6 +101,7 @@ begin FreeANDNIL(dmBase); FreeANDNIL(dmConfiguracion); FreeAndNil(dmConexion); + FreeAndNil(dmImpresiones); Application.ProcessMessages end; diff --git a/Source/GUIBase/uEditorPreview.dfm b/Source/GUIBase/uEditorPreview.dfm index e0f9966..576ff9f 100644 --- a/Source/GUIBase/uEditorPreview.dfm +++ b/Source/GUIBase/uEditorPreview.dfm @@ -2478,7 +2478,7 @@ inherited fEditorPreview: TfEditorPreview Bitmap = {} end object frxReport1: TfrxReport - Version = '4.3' + Version = '4.7.71' DotMatrixReport = False EngineOptions.DoublePass = True IniFile = '\Software\Fast Reports' @@ -2529,6 +2529,7 @@ inherited fEditorPreview: TfEditorPreview ShowDialog = False UseFileCache = True ShowProgress = True + OverwritePrompt = False Monochrome = True Left = 120 Top = 384 @@ -2536,13 +2537,21 @@ inherited fEditorPreview: TfEditorPreview object frxPDFExport1: TfrxPDFExport UseFileCache = True ShowProgress = True + OverwritePrompt = False PrintOptimized = True Outline = False + Background = False + HTMLTags = False Author = 'FastReport'#174 Subject = 'FastReport PDF export' - Background = False Creator = 'FastReport (http://www.fast-report.com)' - HTMLTags = False + ProtectionFlags = [ePrint, eModify, eCopy, eAnnot] + HideToolbar = False + HideMenubar = False + HideWindowUI = False + FitWindow = False + CenterWindow = False + PrintScaling = False Left = 160 Top = 384 end @@ -2550,6 +2559,7 @@ inherited fEditorPreview: TfEditorPreview ShowDialog = False UseFileCache = True ShowProgress = True + OverwritePrompt = False Monochrome = True Left = 192 Top = 384 @@ -2557,6 +2567,8 @@ inherited fEditorPreview: TfEditorPreview object frxXLSExport1: TfrxXLSExport UseFileCache = True ShowProgress = True + OverwritePrompt = False + ExportEMF = True AsText = False Background = True FastExport = True @@ -2569,25 +2581,32 @@ inherited fEditorPreview: TfEditorPreview object frxMailExport1: TfrxMailExport UseFileCache = True ShowProgress = True + OverwritePrompt = False ShowExportDialog = True SmtpPort = 25 UseIniFile = True + TimeOut = 60 + ConfurmReading = False Left = 80 Top = 384 end object frxRTFExport: TfrxRTFExport UseFileCache = True ShowProgress = True + OverwritePrompt = False + ExportEMF = True Wysiwyg = True Creator = 'FastReport http://www.fast-report.com' SuppressPageHeadersFooters = False HeaderFooterMode = hfText + AutoSize = False Left = 232 Top = 384 end object frxSimpleTextExport1: TfrxSimpleTextExport UseFileCache = True ShowProgress = True + OverwritePrompt = False Frames = False EmptyLines = False OEMCodepage = False diff --git a/Source/GUIBase/uEditorPreview.pas b/Source/GUIBase/uEditorPreview.pas index 61f4067..d4a6df2 100644 --- a/Source/GUIBase/uEditorPreview.pas +++ b/Source/GUIBase/uEditorPreview.pas @@ -26,7 +26,7 @@ type procedure LoadFromStream(AStream : TStream); function ExportToFile : String; - procedure Print; + function Print: Boolean; procedure Preview; function GetController : IControllerBase; @@ -38,6 +38,13 @@ type procedure SetListaID (const Value : TIntegerList); property ListaID : TIntegerList read GetListaID write SetListaID; + + function GetTablaImpresion: String; + function GetIdTablaImpresion: String; + procedure SetTablaImpresion (Value: String); + procedure SetIdTablaImpresion (Value: String); + property TablaImpresion: String read GetTablaImpresion write SetTablaImpresion; + property IdTablaImpresion: String read GetIdTablaImpresion write SetIdTablaImpresion; end; TfEditorPreview = class(TfEditorBase, IEditorPreview) @@ -142,13 +149,23 @@ type procedure actExportarRTFExecute(Sender: TObject); procedure actExportarTextoExecute(Sender: TObject); private + FVariable: Boolean; FPreview : TfrViewPreview; FTitle : TCaption; FController : IControllerBase; FListaID : TIntegerList; procedure OnPageChanged(Sender: TfrxPreview; PageNo: Integer); procedure UpdateZoom; + procedure OnPrint(Sender: Tobject); + protected + FTablaImpresion: String; + FIdTablaImpresion: String; + function GetTablaImpresion: String; + function GetIdTablaImpresion: String; + procedure SetTablaImpresion (Value: String); + procedure SetIdTablaImpresion (Value: String); + function GetReport: TfrxReport; virtual; procedure SetTitle(const Value: string); function GetTitle: string; @@ -157,7 +174,11 @@ type procedure SetController (const Value : IControllerBase); procedure SetListaID (const Value : TIntegerList); function GetListaID : TIntegerList; + public + property TablaImpresion: String read GetTablaImpresion write SetTablaImpresion; + property IdTablaImpresion: String read GetIdTablaImpresion write SetIdTablaImpresion; + constructor Create(AOwner: TComponent); override; property ListaID : TIntegerList read GetListaID write SetListaID; @@ -165,7 +186,7 @@ type write SetController; property Title: string read GetTitle write SetTitle; property Report: TfrxReport read GetReport; - procedure Print; + function Print: boolean; procedure Preview; procedure LoadFromStream(AStream : TStream); function ExportToFile : String; @@ -175,7 +196,7 @@ type implementation uses - frxRes, frxUtils, frxPrinter, + frxRes, frxUtils, frxPrinter, uDataModuleImpresiones, uCustomEditor, uSistemaFunc; {$R *.dfm} @@ -187,6 +208,11 @@ begin Result := FController; end; +function TfEditorPreview.GetIdTablaImpresion: String; +begin + Result := FIdTablaImpresion; +end; + function TfEditorPreview.GetListaID: TIntegerList; begin Result := FListaID; @@ -198,6 +224,11 @@ begin end; +function TfEditorPreview.GetTablaImpresion: String; +begin + Result := FTablaImpresion; +end; + function TfEditorPreview.GetTitle: string; begin Result := FTitle; @@ -399,6 +430,13 @@ begin [PageNo, Sender.PageCount]); end; +procedure TfEditorPreview.OnPrint(Sender: Tobject); +begin + FVariable := True; + if (FTablaImpresion <> '-1') and (FIdTablaImpresion <> '-1') then + dmImpresiones.AnadirMarcaImpresion(TablaImpresion, IdTablaImpresion); +end; + constructor TfEditorPreview.Create(AOwner: TComponent); begin inherited; @@ -441,13 +479,18 @@ begin Self.ShowModal; end; -procedure TfEditorPreview.Print; +function TfEditorPreview.Print: Boolean; begin + FVariable := False; + FPreview.Preview.Report.OnPrintReport := OnPrint; + if not frxPrinters.HasPhysicalPrinters then frxErrorMsg(frxResources.Get('clNoPrinters')) else FPreview.Preview.Print; + Enabled := True; + Result := FVariable; end; procedure TfEditorPreview.SetController(const Value: IControllerBase); @@ -455,11 +498,21 @@ begin FController := Value; end; +procedure TfEditorPreview.SetIdTablaImpresion(Value: String); +begin + FIdTablaImpresion := Value; +end; + procedure TfEditorPreview.SetListaID(const Value: TIntegerList); begin FListaID := Value; end; +procedure TfEditorPreview.SetTablaImpresion(Value: String); +begin + FTablaImpresion := Value; +end; + procedure TfEditorPreview.SetTitle(const Value: string); begin FTitle := Value; diff --git a/Source/Modulos/Albaranes de cliente/AlbaranesCliente_Group.groupproj b/Source/Modulos/Albaranes de cliente/AlbaranesCliente_Group.groupproj index 1a986eb..9424dd9 100644 --- a/Source/Modulos/Albaranes de cliente/AlbaranesCliente_Group.groupproj +++ b/Source/Modulos/Albaranes de cliente/AlbaranesCliente_Group.groupproj @@ -17,6 +17,7 @@ + @@ -261,14 +262,23 @@ + + + + + + + + + - + - + - + \ No newline at end of file diff --git a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas index 8e0ea5e..6bc3d95 100644 --- a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas +++ b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteController.pas @@ -43,6 +43,7 @@ type procedure DescartarCambios(AAlbaran : IBizAlbaranCliente); function Existe(const ID: Integer) : Boolean; function Duplicar(AAlbaran: IBizAlbaranCliente): IBizAlbaranCliente; + function GenerarOrdenDev(AAlbaran: IBizAlbaranCliente): IBizAlbaranCliente; function ExtraerSeleccionados(AAlbaran: IBizAlbaranCliente) : IBizAlbaranCliente; function ElegirAlbaranes(AAlbaran: IBizAlbaranCliente; AMensaje: String; AMultiSelect: Boolean): IBizAlbaranCliente; @@ -132,6 +133,7 @@ type const AHeaderText: String = ''); procedure VerDireccionEntrega(AAlbaran : IBizAlbaranCliente); function Duplicar(AAlbaran: IBizAlbaranCliente): IBizAlbaranCliente; + function GenerarOrdenDev(AAlbaran: IBizAlbaranCliente): IBizAlbaranCliente; procedure CopiarDireccionEnvio (const ADireccionEnvio: IBizDireccionesContacto; AAlbaran: IBizAlbaranCliente); @@ -162,6 +164,7 @@ type function DarListaAnosAlbaranes: TStringList; procedure FiltrarAno(AAlbaran: IBizAlbaranCliente; ADynWhereDataTable: WideString; const Ano: String); + end; implementation @@ -479,7 +482,9 @@ begin FECHA_ENVIO := 0; FECHA_RECEPCION := 0; ID_FACTURA := 0; + REF_FACTURA := ''; ID_PEDIDO := 0; + REF_PEDIDO := ''; end; Result.Post; finally @@ -490,6 +495,8 @@ end; function TAlbaranesClienteController.ValidarAlbaran( AAlbaran: IBizAlbaranCliente): Boolean; begin + Result := False; + if not Assigned(AAlbaran) then raise Exception.Create ('Albarán no asignado'); @@ -502,8 +509,6 @@ begin if (AAlbaran.ID_Cliente <= 0) then // Si hay altas automáticas no hay objeto Cliente pero sí hay ID_CLIENTE -{ (not Assigned(AAlbaran.Cliente)) or - (AAlbaran.Cliente.IsEmpty) then} raise Exception.Create('Debe indicar el cliente de este albarán'); if (EsFechaVacia(AAlbaran.FECHA_ALBARAN)) then @@ -524,8 +529,8 @@ begin raise Exception.Create('Una orden de devolución no puede tener un importe total positivo'); //Una orden de devolución debe tener relleno el almacén de entrada de material -// if (AAlbaran.ID_ALMACEN < 0) or (AAlbaran.ID_ALMACEN = 0) then -// raise Exception.Create('Debe indicar el almacén de entrada de esta orden de devolución'); + if (AAlbaran.ID_ALMACEN < 0) or (AAlbaran.ID_ALMACEN = 0) then + raise Exception.Create('Debe indicar el almacén de entrada de esta orden de devolución'); //Ponemos la fecha del albaran de devolución como fecha de envio para que se contabilice según dicha fecha AAlbaran.Edit; @@ -1162,7 +1167,6 @@ begin ShowHourglassCursor; try AAlbaran.IMPORTE_NETO := FDetallesController.DarTotalImporteTotal(AAlbaran.Detalles); - AAlbaran.IMPORTE_PORTE := FDetallesController.DarTotalPorteTotal(AAlbaran.Detalles); if not bEnEdicion then AAlbaran.Post; @@ -1173,6 +1177,33 @@ begin end; end; +function TAlbaranesClienteController.GenerarOrdenDev(AAlbaran: IBizAlbaranCliente): IBizAlbaranCliente; +var + AOrden : IBizAlbaranCliente; + IdAlbaran: Integer; + +begin + if Assigned(AAlbaran) then + begin + IdAlbaran := AAlbaran.ID; + AOrden := Duplicar(AAlbaran); + if Assigned(AOrden) then + begin + if not AOrden.DataTable.Editing then + AOrden.Edit; + + AOrden.TIPO := CTE_TIPO_ALBARAN_DEV; + AOrden.ID_ALBARAN_DEV := IdAlbaran; + AOrden.Post; + + //Convierte todos los articulos del albaran a negativos por se una orden de devolucion + FDetallesController.CambiarSignoDetalles(AOrden.Detalles); + + end; + Ver(AOrden); + end; +end; + function TAlbaranesClienteController.GetClienteController: IClientesController; begin Result := FClienteController; @@ -1184,4 +1215,3 @@ begin end; end. - \ No newline at end of file diff --git a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteReportController.pas b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteReportController.pas index 7b7d5b4..d202c85 100644 --- a/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteReportController.pas +++ b/Source/Modulos/Albaranes de cliente/Controller/uAlbaranesClienteReportController.pas @@ -49,7 +49,7 @@ implementation uses uROTypes, uEditorRegistryUtils, uIEditorAlbaranesClientePreview, uEditorPreview, uDataModuleAlbaranesCliente, uEditorBase, cxControls, - uStringsUtils, uSistemaFunc, uFactuGES_App; + uStringsUtils, uSistemaFunc, uFactuGES_App, schAlbaranesClienteClient_Intf; { TAlbaranesClienteReportController } @@ -238,6 +238,8 @@ begin AEditor.ListaID := AListaID; AEditor.Title := 'Albarán - ' + AppFactuGES.EmpresaActiva.NOMBRE; AEditor.LoadFromStream(AStream); + AEditor.TablaImpresion := nme_AlbaranesCliente; + AEditor.IdTablaImpresion := AListaID.ToString; AEditor.Print; finally AEditor.Release; diff --git a/Source/Modulos/Albaranes de cliente/Controller/uDetallesAlbaranClienteController.pas b/Source/Modulos/Albaranes de cliente/Controller/uDetallesAlbaranClienteController.pas index f2411e2..67b0d0b 100644 --- a/Source/Modulos/Albaranes de cliente/Controller/uDetallesAlbaranClienteController.pas +++ b/Source/Modulos/Albaranes de cliente/Controller/uDetallesAlbaranClienteController.pas @@ -19,7 +19,6 @@ type private FDataModule : IDataModuleAlbaranesCliente; protected -// procedure AsignarDatos(ADetalles: IDAStronglyTypedDataTable; IDCabecera: Integer); override; procedure RellenarOtros(ADetalles: IDAStronglyTypedDataTable; AArticulos: IBizArticulo); override; procedure RellenarImportes(ADetalles: IDAStronglyTypedDataTable; AArticulos: IBizArticulo); override; @@ -53,7 +52,7 @@ begin try AArticulos := (FArticulosController.BuscarTodos(ACliente) as IBizArticulo); ActualizarDetalles(ADetalles, AArticulos); -// ShowInfoMessage('Se ha actualizado el descuento para el cliente seleccionado'); Esta desactivado el descuento general para los albaranes de cliente + ShowInfoMessage('Se ha actualizado el descuento para el cliente seleccionado'); finally AArticulos := Nil; end; @@ -92,19 +91,6 @@ begin FArticulosController := TArticulosAlbaranClienteController.Create; end; -{procedure TDetallesAlbaranClienteController.AsignarDatos(ADetalles: IDAStronglyTypedDataTable; IDCabecera: Integer); -begin - inherited; - - with (ADetalles as IBizDetallesAlbaranCliente) do - begin - Edit; -// ID := FDataModule.GetNextID(DataTable.LogicalName); - ID_ALBARAN := IDCabecera; - Post - end; -end;} - function TDetallesAlbaranClienteController.CalcularImporteTotalConcepto(DataTable: TDADataTable): Double; begin Result := CalcularLineaConcepto(DataTable); @@ -136,11 +122,10 @@ end; procedure TDetallesAlbaranClienteController.RellenarOtros(ADetalles: IDAStronglyTypedDataTable; AArticulos: IBizArticulo); begin -//En Tecsitel no se tiene en cuenta el descuento de cliente para el precio PVP -// if Assigned(AArticulos) then -// ADetalles.DataTable.FieldByName(CAMPO_DESCUENTO).AsFloat := AArticulos.DESCUENTO -// else -// ADetalles.DataTable.FieldByName(CAMPO_DESCUENTO).AsFloat := 0; + if Assigned(AArticulos) then + ADetalles.DataTable.FieldByName(CAMPO_DESCUENTO).AsFloat := AArticulos.DESCUENTO + else + ADetalles.DataTable.FieldByName(CAMPO_DESCUENTO).AsFloat := 0; end; procedure TDetallesAlbaranClienteController.ValidarCampos(DataTable: TDADataTable); @@ -151,14 +136,10 @@ end; procedure TDetallesAlbaranClienteController.RellenarImportes(ADetalles: IDAStronglyTypedDataTable; AArticulos: IBizArticulo); begin -//Como en tecsitel no hay descuento por linea de detalle, solo recuperamos nuevamente el valor del articulo cuando el detalle no tenga niguno -//de esta forma evitamos que al cambiar de cliente se quiten los importes que se hubiesen establecido para los articulos. - if ADetalles.DataTable.FieldByName(CAMPO_IMPORTE_UNIDAD).IsNull then - if Assigned(AArticulos) then -// ADetalles.DataTable.FieldByName(CAMPO_IMPORTE_UNIDAD).AsVariant := AArticulos.PRECIO_PVP_TOTAL - ADetalles.DataTable.FieldByName(CAMPO_IMPORTE_UNIDAD).AsVariant := AArticulos.PRECIO_NETO - else - ADetalles.DataTable.FieldByName(CAMPO_IMPORTE_UNIDAD).AsVariant := Null; + if Assigned(AArticulos) then + ADetalles.DataTable.FieldByName(CAMPO_IMPORTE_UNIDAD).AsVariant := AArticulos.PRECIO_COSTE + else + ADetalles.DataTable.FieldByName(CAMPO_IMPORTE_UNIDAD).AsVariant := Null; end; end. diff --git a/Source/Modulos/Albaranes de cliente/Model/uBizAlbaranesCliente.pas b/Source/Modulos/Albaranes de cliente/Model/uBizAlbaranesCliente.pas index 096db5e..5beb637 100644 --- a/Source/Modulos/Albaranes de cliente/Model/uBizAlbaranesCliente.pas +++ b/Source/Modulos/Albaranes de cliente/Model/uBizAlbaranesCliente.pas @@ -190,9 +190,7 @@ begin SITUACION := SITUACION_ALBARAN_PENDIENTE; REFERENCIA := ''; TIPO := CTE_TIPO_ALBARAN; - - // NO SE TIENEN EN CUENTA LOS ALBARANES DE CLIENTE PARA EL STOCK DE ALMACEN "DE MOMENTO" - ID_ALMACEN := ID_NULO; + ID_ALMACEN := AppFactuGES.EmpresaActiva.ID_ALMACEN; end; procedure TBizAlbaranCliente.IVAOnChange(Sender: TDACustomField); diff --git a/Source/Modulos/Albaranes de cliente/Servidor/srvAlbaranesCliente_Impl.dfm b/Source/Modulos/Albaranes de cliente/Servidor/srvAlbaranesCliente_Impl.dfm index ca4fa6a..c57eb2e 100644 --- a/Source/Modulos/Albaranes de cliente/Servidor/srvAlbaranesCliente_Impl.dfm +++ b/Source/Modulos/Albaranes de cliente/Servidor/srvAlbaranesCliente_Impl.dfm @@ -524,12 +524,11 @@ object srvAlbaranesCliente: TsrvAlbaranesCliente 'E_UNIDAD,'#10' ALBARANES_CLIENTE_DETALLES.DESCUENTO, ALBARANES_CL' + 'IENTE_DETALLES.IMPORTE_PORTE,'#10' ALBARANES_CLIENTE_DETALLES.IMP' + 'ORTE_TOTAL,'#10' ALBARANES_CLIENTE_DETALLES.VISIBLE,'#10' ALBARANE' + - 'S_CLIENTE_DETALLES.ID_ARTICULO, ARTICULOS.REFERENCIA,'#10' '#39#39' as ' + - 'REFERENCIA_PROVEEDOR, /*Es necesario para que no pete detalles p' + - 'orque tanto en la rama de cliente como de proveedor es comun*/'#10' ' + - ' ALBARANES_CLIENTE_DETALLES.ID_PEDIDO'#10#10#10'FROM ALBARANES_CLIENTE' + - '_DETALLES'#10'LEFT JOIN ARTICULOS ON ALBARANES_CLIENTE_DETALLES.ID_A' + - 'RTICULO = ARTICULOS.ID'#10'where {where}'#10'ORDER BY POSICION;'#10#10 + 'S_CLIENTE_DETALLES.ID_ARTICULO, ARTICULOS.REFERENCIA, ARTICULOS.' + + 'REFERENCIA_PROV as REFERENCIA_PROVEEDOR,'#10' ALBARANES_CLIENTE_D' + + 'ETALLES.ID_PEDIDO'#10#10#10'FROM ALBARANES_CLIENTE_DETALLES'#10'LEFT JOIN AR' + + 'TICULOS ON ALBARANES_CLIENTE_DETALLES.ID_ARTICULO = ARTICULOS.ID' + + #10'where {where}'#10'ORDER BY POSICION;'#10#10 StatementType = stSQL ColumnMappings = < item diff --git a/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dpk b/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dpk index 8fe2fd5..e8d68b1 100644 --- a/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dpk +++ b/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dpk @@ -34,7 +34,12 @@ requires Almacenes_controller, AlbCli_FacCli_relation, rtl, - vcl; + vcl, + PedidosCliente_controller, + PedidosCliente_model, + Inventario_controller, + FacturasCliente_model, + FacturasCliente_controller; contains uAlbaranesClienteViewRegister in 'uAlbaranesClienteViewRegister.pas', @@ -53,6 +58,6 @@ contains uEditorAlbaranDevCliente in 'uEditorAlbaranDevCliente.pas' {fEditorAlbaranDevCliente: TCustomEditor}, uViewAlbaranDevCliente in 'uViewAlbaranDevCliente.pas' {frViewAlbaranDevCliente: TCustomView}, uViewDatosYSeleccionClienteAlbaran in 'uViewDatosYSeleccionClienteAlbaran.pas' {frViewDatosYSeleccionClienteAlbaran: TCustomView}, - uDialogOpcionesImpresionAlbaranesCliente in 'uDialogOpcionesImpresionAlbaranesCliente.pas' {frDialogOpcionesImpresionAlbaranesCliente: TForm}; + uDialogOpcionesImpresionAlbaranesCliente in 'uDialogOpcionesImpresionAlbaranesCliente.pas' {frDialogOpcionesImpresionAlbaranesCliente: T}; end. diff --git a/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj b/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj index 00cf438..fb2bb04 100644 --- a/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj +++ b/Source/Modulos/Albaranes de cliente/Views/AlbaranesCliente_view.dproj @@ -54,15 +54,21 @@ MainSource - - - - - - - - - + + + + + + + + + + + + + + +
frDialogOpcionesImpresionAlbaranesCliente
@@ -128,7 +134,6 @@
frViewElegirArticulosAlbaranesCliente
TFrame
-