From 80e9fdb4df62300af9f8c736e2ef399f7f56a90e Mon Sep 17 00:00:00 2001 From: roberto Date: Thu, 1 Jul 2010 14:36:18 +0000 Subject: [PATCH] =?UTF-8?q?Se=20a=C3=B1ade=20el=20modulo=20de=20comisiones?= =?UTF-8?q?=20de=20vendedor?= 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.Noviseda_FactuGES2/trunk@131 f33bb606-9f5c-448d-9c99-757f00063c96 --- .../View/uIEditorComisionesPreview.pas | 16 + .../uComisionesReportController.pas | 117 +++ .../Data/uIDataModuleComisionesReport.pas | 16 + .../Reports/uRptComisiones_Server.dfm | 965 ++++++++++++++++++ .../Reports/uRptComisiones_Server.pas | 105 ++ 5 files changed, 1219 insertions(+) create mode 100644 Source/Modulos/Comisiones/Controller/View/uIEditorComisionesPreview.pas create mode 100644 Source/Modulos/Comisiones/Controller/uComisionesReportController.pas create mode 100644 Source/Modulos/Comisiones/Model/Data/uIDataModuleComisionesReport.pas create mode 100644 Source/Modulos/Comisiones/Reports/uRptComisiones_Server.dfm create mode 100644 Source/Modulos/Comisiones/Reports/uRptComisiones_Server.pas diff --git a/Source/Modulos/Comisiones/Controller/View/uIEditorComisionesPreview.pas b/Source/Modulos/Comisiones/Controller/View/uIEditorComisionesPreview.pas new file mode 100644 index 0000000..b377f52 --- /dev/null +++ b/Source/Modulos/Comisiones/Controller/View/uIEditorComisionesPreview.pas @@ -0,0 +1,16 @@ +unit uIEditorComisionesPreview; + +interface + +uses + uEditorPreview, uComisionesReportController; + +type + IEditorComisionesPreview = interface(IEditorPreview) + ['{532597DC-84EE-4CFD-8F23-E60A5854B311}'] + end; + + +implementation + +end. diff --git a/Source/Modulos/Comisiones/Controller/uComisionesReportController.pas b/Source/Modulos/Comisiones/Controller/uComisionesReportController.pas new file mode 100644 index 0000000..c27ce41 --- /dev/null +++ b/Source/Modulos/Comisiones/Controller/uComisionesReportController.pas @@ -0,0 +1,117 @@ +unit uComisionesReportController; + +interface + +uses + Classes, SysUtils, uDADataTable, uControllerBase, uIDataModuleComisionesReport, + uBizComisiones, uIntegerListUtils; + +type + IComisionesReportController = interface(IControllerBase) + ['{60FDD06C-2B59-4276-BC24-D14EBCB87FE6}'] + procedure Preview(const AListaID : TIntegerList); + procedure Print(const AListaID : TIntegerList); + end; + + TComisionesReportController = class(TControllerBase, IComisionesReportController) + private + FDataModule : IDataModuleComisionesReport; + function CreateEditor(const AName: String; const IID: TGUID; out Intf): Boolean; + public + constructor Create; override; + destructor Destroy; override; + + procedure Preview(const AListaID : TIntegerList); + procedure Print(const AListaID : TIntegerList); + end; + + +implementation + +uses + uROTypes, uEditorRegistryUtils, + uIEditorComisionesPreview, + uEditorPreview, uDataModuleComisiones, uEditorBase, cxControls, + uStringsUtils, uSistemaFunc; + +{ TComisionesReportController } + +constructor TComisionesReportController.Create; +begin + inherited; + FDataModule := TDataModuleComisiones.Create(Nil); +end; + +function TComisionesReportController.CreateEditor(const AName: String; + const IID: TGUID; out Intf): Boolean; +begin + Result := Supports(EditorRegistry.CreateEditor(AName), IID, Intf); +end; + + +destructor TComisionesReportController.Destroy; +begin + FDataModule := NIL; + inherited; +end; + +procedure TComisionesReportController.Preview(const AListaID : TIntegerList); +var + AStream: Binary; + AEditor : IEditorComisionesPreview; +begin + AEditor := NIL; + + ShowHourglassCursor; + try + AStream := FDataModule.GetRptComisiones(AListaID); + try + CreateEditor('EditorComisionesPreview', IEditorComisionesPreview, AEditor); + if Assigned(AEditor) then + try + AEditor.Controller := Self; + AEditor.ListaID := AListaID; + AEditor.LoadFromStream(AStream); + AEditor.Preview; + finally + AEditor.Release; + end; + finally + FreeAndNil(AStream); + AEditor := Nil; + end; + finally + HideHourglassCursor; + end; +end; + +procedure TComisionesReportController.Print(const AListaID : TIntegerList); +var + AStream: Binary; + AEditor : IEditorComisionesPreview; +begin + AEditor := NIL; + + ShowHourglassCursor; + try + AStream := FDataModule.GetRptComisiones(AListaID); + try + CreateEditor('EditorComisionesPreview', IEditorComisionesPreview, AEditor); + if Assigned(AEditor) then + try + AEditor.Controller := Self; + AEditor.LoadFromStream(AStream); + AEditor.Print; + finally + AEditor.Release; + end; + finally + FreeAndNil(AStream); + AEditor := Nil; + end; + finally + HideHourglassCursor; + end; +end; + +end. diff --git a/Source/Modulos/Comisiones/Model/Data/uIDataModuleComisionesReport.pas b/Source/Modulos/Comisiones/Model/Data/uIDataModuleComisionesReport.pas new file mode 100644 index 0000000..aa1b6d9 --- /dev/null +++ b/Source/Modulos/Comisiones/Model/Data/uIDataModuleComisionesReport.pas @@ -0,0 +1,16 @@ +unit uIDataModuleComisionesReport; + +interface + +uses + SysUtils, Classes, uROTypes, uIntegerListUtils; + +type + IDataModuleComisionesReport = interface + ['{D445F984-7696-448F-9FC4-162AA7288515}'] + function GetRptComisiones(const AListaID: TIntegerList): Binary; + end; + +implementation + +end. diff --git a/Source/Modulos/Comisiones/Reports/uRptComisiones_Server.dfm b/Source/Modulos/Comisiones/Reports/uRptComisiones_Server.dfm new file mode 100644 index 0000000..9fc56d8 --- /dev/null +++ b/Source/Modulos/Comisiones/Reports/uRptComisiones_Server.dfm @@ -0,0 +1,965 @@ +object RptComisiones: TRptComisiones + OldCreateOrder = True + OnCreate = DataModuleCreate + Height = 405 + Width = 630 + object DADataCabecera: TDADataSource + DataSet = tbl_Comisiones.Dataset + DataTable = tbl_Comisiones + Left = 264 + Top = 72 + end + object tbl_Comisiones: TDAMemDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ID' + DataType = datInteger + Required = True + InPrimaryKey = True + end + item + Name = 'ID_EMPRESA' + DataType = datInteger + end + item + Name = 'REFERENCIA' + DataType = datString + Size = 255 + end + item + Name = 'ID_AGENTE' + DataType = datInteger + end + item + Name = 'NOMBRE' + DataType = datString + Size = 255 + end + item + Name = 'DESCRIPCION' + DataType = datString + Size = 255 + end + item + Name = 'FECHA' + DataType = datDateTime + end + item + Name = 'IMPORTE_TOTAL' + DataType = datCurrency + end + item + Name = 'FECHA_ALTA' + DataType = datDateTime + end + item + Name = 'FECHA_MODIFICACION' + DataType = datDateTime + end + item + Name = 'USUARIO' + DataType = datString + Size = 30 + end> + Params = < + item + Name = 'ID' + Value = '' + ParamType = daptInput + end> + MasterMappingMode = mmDataRequest + LogChanges = False + StreamingOptions = [soDisableEventsWhileStreaming] + RemoteFetchEnabled = False + LocalSchema = schReport + LocalDataStreamer = Bin2DataStreamer + LogicalName = 'InformeComisiones' + IndexDefs = <> + Left = 264 + Top = 128 + end + object frxRichObject1: TfrxRichObject + Left = 48 + Top = 296 + end + object frxBarCodeObject1: TfrxBarCodeObject + Left = 144 + Top = 296 + end + object frxOLEObject1: TfrxOLEObject + Left = 48 + Top = 344 + end + object frxCrossObject1: TfrxCrossObject + Left = 144 + Top = 344 + end + object frxCheckBoxObject1: TfrxCheckBoxObject + Left = 256 + Top = 296 + end + object frxGradientObject1: TfrxGradientObject + Left = 360 + Top = 296 + end + object frxChartObject1: TfrxChartObject + Left = 256 + Top = 344 + end + object schReport: TDASchema + ConnectionManager = dmServer.ConnectionManager + DataDictionary = DataDictionary + Datasets = < + item + Params = < + item + Name = 'ID' + Value = '' + ParamType = daptInput + end> + Statements = < + item + Connection = 'IBX' + ConnectionType = 'Interbase' + Default = True + TargetTable = 'V_FACTURAS_CLIENTE' + Name = 'IBX' + SQL = + 'SELECT '#10' ID, ID_EMPRESA, REFERENCIA, TIPO, ID_COMISION_LIQUID' + + 'ADA, '#10' FECHA_FACTURA, SITUACION, BASE_IMPONIBLE, DESCUENTO, '#10 + + ' IMPORTE_DESCUENTO, IVA, IMPORTE_IVA, RE, IMPORTE_RE, '#10' IM' + + 'PORTE_TOTAL, OBSERVACIONES, ID_CLIENTE, NOMBRE,'#10' NIF_CIF, CAL' + + 'LE, POBLACION, PROVINCIA, CODIGO_POSTAL,'#10' FECHA_ALTA, FECHA_M' + + 'ODIFICACION, USUARIO, ID_FORMA_PAGO,'#10' RECARGO_EQUIVALENCIA, I' + + 'D_TIPO_IVA, IMPORTE_NETO, IMPORTE_PORTE,'#10' ID_AGENTE, COMISION' + + ', IMPORTE_COMISION'#10' FROM'#10' V_FACTURAS_CLIENTE'#10' WHERE ID_COMI' + + 'SION_LIQUIDADA = :ID'#10 + StatementType = stSQL + ColumnMappings = < + item + DatasetField = 'ID' + TableField = 'ID' + end + item + DatasetField = 'ID_EMPRESA' + TableField = 'ID_EMPRESA' + end + item + DatasetField = 'REFERENCIA' + TableField = 'REFERENCIA' + end + item + DatasetField = 'TIPO' + TableField = 'TIPO' + end + item + DatasetField = 'ID_COMISION_LIQUIDADA' + TableField = 'ID_COMISION_LIQUIDADA' + end + item + DatasetField = 'FECHA_FACTURA' + TableField = 'FECHA_FACTURA' + end + item + DatasetField = 'SITUACION' + TableField = 'SITUACION' + end + item + DatasetField = 'BASE_IMPONIBLE' + TableField = 'BASE_IMPONIBLE' + end + item + DatasetField = 'DESCUENTO' + TableField = 'DESCUENTO' + end + item + DatasetField = 'IMPORTE_DESCUENTO' + TableField = 'IMPORTE_DESCUENTO' + end + item + DatasetField = 'IVA' + TableField = 'IVA' + end + item + DatasetField = 'IMPORTE_IVA' + TableField = 'IMPORTE_IVA' + end + item + DatasetField = 'RE' + TableField = 'RE' + end + item + DatasetField = 'IMPORTE_RE' + TableField = 'IMPORTE_RE' + end + item + DatasetField = 'IMPORTE_TOTAL' + TableField = 'IMPORTE_TOTAL' + end + item + DatasetField = 'OBSERVACIONES' + TableField = 'OBSERVACIONES' + end + item + DatasetField = 'ID_CLIENTE' + TableField = 'ID_CLIENTE' + end + item + DatasetField = 'NIF_CIF' + TableField = 'NIF_CIF' + end + item + DatasetField = 'NOMBRE' + TableField = 'NOMBRE' + end + item + DatasetField = 'CALLE' + TableField = 'CALLE' + end + item + DatasetField = 'POBLACION' + TableField = 'POBLACION' + end + item + DatasetField = 'PROVINCIA' + TableField = 'PROVINCIA' + end + item + DatasetField = 'CODIGO_POSTAL' + TableField = 'CODIGO_POSTAL' + end + item + DatasetField = 'FECHA_ALTA' + TableField = 'FECHA_ALTA' + end + item + DatasetField = 'FECHA_MODIFICACION' + TableField = 'FECHA_MODIFICACION' + end + item + DatasetField = 'USUARIO' + TableField = 'USUARIO' + end + item + DatasetField = 'ID_FORMA_PAGO' + TableField = 'ID_FORMA_PAGO' + end + item + DatasetField = 'RECARGO_EQUIVALENCIA' + TableField = 'RECARGO_EQUIVALENCIA' + end + item + DatasetField = 'ID_TIPO_IVA' + TableField = 'ID_TIPO_IVA' + end + item + DatasetField = 'IMPORTE_NETO' + TableField = 'IMPORTE_NETO' + end + item + DatasetField = 'IMPORTE_PORTE' + TableField = 'IMPORTE_PORTE' + end + item + DatasetField = 'ID_AGENTE' + TableField = 'ID_AGENTE' + end + item + DatasetField = 'COMISION' + TableField = 'COMISION' + end + item + DatasetField = 'IMPORTE_COMISION' + TableField = 'IMPORTE_COMISION' + end> + end> + Name = 'InformeComisionesFacturas' + Fields = < + item + Name = 'ID' + DataType = datInteger + end + item + Name = 'ID_EMPRESA' + DataType = datInteger + end + item + Name = 'REFERENCIA' + DataType = datString + Size = 255 + end + item + Name = 'TIPO' + DataType = datString + Size = 1 + end + item + Name = 'ID_COMISION_LIQUIDADA' + DataType = datInteger + end + item + Name = 'FECHA_FACTURA' + DataType = datDateTime + end + item + Name = 'SITUACION' + DataType = datString + Size = 19 + end + item + Name = 'BASE_IMPONIBLE' + DataType = datCurrency + end + item + Name = 'DESCUENTO' + DataType = datFloat + end + item + Name = 'IMPORTE_DESCUENTO' + DataType = datCurrency + end + item + Name = 'IVA' + DataType = datFloat + end + item + Name = 'IMPORTE_IVA' + DataType = datCurrency + end + item + Name = 'RE' + DataType = datFloat + end + item + Name = 'IMPORTE_RE' + DataType = datCurrency + end + item + Name = 'IMPORTE_TOTAL' + DataType = datCurrency + end + item + Name = 'OBSERVACIONES' + DataType = datMemo + end + item + Name = 'ID_CLIENTE' + DataType = datInteger + end + item + Name = 'NOMBRE' + DataType = datString + Size = 255 + end + item + Name = 'NIF_CIF' + DataType = datString + Size = 15 + end + item + Name = 'CALLE' + DataType = datString + Size = 255 + end + item + Name = 'POBLACION' + DataType = datString + Size = 255 + end + item + Name = 'PROVINCIA' + DataType = datString + Size = 255 + end + item + Name = 'CODIGO_POSTAL' + DataType = datString + Size = 10 + end + item + Name = 'FECHA_ALTA' + DataType = datDateTime + end + item + Name = 'FECHA_MODIFICACION' + DataType = datDateTime + end + item + Name = 'USUARIO' + DataType = datString + Size = 30 + end + item + Name = 'ID_FORMA_PAGO' + DataType = datInteger + end + item + Name = 'RECARGO_EQUIVALENCIA' + DataType = datSmallInt + end + item + Name = 'ID_TIPO_IVA' + DataType = datInteger + end + item + Name = 'IMPORTE_NETO' + DataType = datCurrency + end + item + Name = 'IMPORTE_PORTE' + DataType = datCurrency + end + item + Name = 'ID_AGENTE' + DataType = datInteger + end + item + Name = 'COMISION' + DataType = datFloat + end + item + Name = 'IMPORTE_COMISION' + DataType = datCurrency + end> + end + item + Params = < + item + Name = 'ID' + Value = '' + ParamType = daptInput + end> + Statements = < + item + Connection = 'IBX' + TargetTable = 'COMISIONES_LIQUIDADAS' + SQL = + 'SELECT '#10' COMISIONES_LIQUIDADAS.ID, COMISIONES_LIQUIDADAS.ID_E' + + 'MPRESA, COMISIONES_LIQUIDADAS.REFERENCIA,'#10' COMISIONES_LIQUIDA' + + 'DAS.ID_AGENTE, CONTACTOS.NOMBRE, COMISIONES_LIQUIDADAS.DESCRIPCI' + + 'ON,'#10' COMISIONES_LIQUIDADAS.FECHA, COMISIONES_LIQUIDADAS.IMPOR' + + 'TE_TOTAL,'#10' COMISIONES_LIQUIDADAS.FECHA_ALTA, COMISIONES_LIQUI' + + 'DADAS.FECHA_MODIFICACION,'#10' COMISIONES_LIQUIDADAS.USUARIO'#10' FR' + + 'OM'#10' COMISIONES_LIQUIDADAS'#10' LEFT JOIN CONTACTOS ON (CONTACTOS' + + '.ID = COMISIONES_LIQUIDADAS.ID_AGENTE)'#10' WHERE COMISIONES_LIQUID' + + 'ADAS.ID = :ID'#10 + StatementType = stSQL + ColumnMappings = < + item + DatasetField = 'ID' + TableField = 'ID' + end + item + DatasetField = 'ID_EMPRESA' + TableField = 'ID_EMPRESA' + end + item + DatasetField = 'REFERENCIA' + TableField = 'REFERENCIA' + end + item + DatasetField = 'ID_AGENTE' + TableField = 'ID_AGENTE' + end + item + DatasetField = 'DESCRIPCION' + TableField = 'DESCRIPCION' + end + item + DatasetField = 'FECHA' + TableField = 'FECHA' + end + item + DatasetField = 'IMPORTE_TOTAL' + TableField = 'IMPORTE_TOTAL' + end + item + DatasetField = 'FECHA_ALTA' + TableField = 'FECHA_ALTA' + end + item + DatasetField = 'FECHA_MODIFICACION' + TableField = 'FECHA_MODIFICACION' + end + item + DatasetField = 'USUARIO' + TableField = 'USUARIO' + end + item + DatasetField = 'NOMBRE' + TableField = '' + SQLOrigin = 'NOMBRE' + end> + end> + Name = 'InformeComisiones' + Fields = < + item + Name = 'ID' + DataType = datInteger + Required = True + InPrimaryKey = True + end + item + Name = 'ID_EMPRESA' + DataType = datInteger + end + item + Name = 'REFERENCIA' + DataType = datString + Size = 255 + end + item + Name = 'ID_AGENTE' + DataType = datInteger + end + item + Name = 'NOMBRE' + DataType = datString + Size = 255 + end + item + Name = 'DESCRIPCION' + DataType = datString + Size = 255 + end + item + Name = 'FECHA' + DataType = datDateTime + end + item + Name = 'IMPORTE_TOTAL' + DataType = datCurrency + end + item + Name = 'FECHA_ALTA' + DataType = datDateTime + end + item + Name = 'FECHA_MODIFICACION' + DataType = datDateTime + end + item + Name = 'USUARIO' + DataType = datString + Size = 30 + end> + end> + JoinDataTables = <> + UnionDataTables = <> + Commands = <> + RelationShips = <> + UpdateRules = <> + Version = 0 + Left = 48 + Top = 16 + end + object DataDictionary: TDADataDictionary + Fields = < + item + Name = 'FacturasCliente_ID' + DataType = datAutoInc + Required = True + DisplayLabel = 'ID' + end + item + Name = 'FacturasCliente_ID_EMPRESA' + DataType = datInteger + DisplayLabel = 'ID_EMPRESA' + end + item + Name = 'FacturasCliente_ID_CONTRATO' + DataType = datInteger + DisplayLabel = 'ID_CONTRATO' + end + item + Name = 'FacturasCliente_FECHA_FACTURA' + DataType = datDateTime + DisplayLabel = 'Fecha de las factura' + end + item + Name = 'FacturasCliente_VENCIMIENTO' + DataType = datInteger + DisplayLabel = 'Vencimiento' + end + item + Name = 'FacturasCliente_SITUACION' + DataType = datString + Size = 255 + DisplayLabel = 'Situaci'#243'n' + end + item + Name = 'FacturasCliente_BASE_IMPONIBLE' + DataType = datFloat + DisplayLabel = 'Base imponible' + Alignment = taRightJustify + end + item + Name = 'FacturasCliente_IMPORTE_DESCUENTO' + DataType = datFloat + DisplayLabel = 'Importe dto.' + Alignment = taRightJustify + end + item + Name = 'FacturasCliente_IMPORTE_IVA' + DataType = datFloat + DisplayLabel = 'Importe IVA' + Alignment = taRightJustify + end + item + Name = 'FacturasCliente_IMPORTE_TOTAL' + DataType = datFloat + DisplayLabel = 'Importe total' + Alignment = taRightJustify + end + item + Name = 'FacturasCliente_FORMA_PAGO' + DataType = datMemo + DisplayLabel = 'Forma de pago' + end + item + Name = 'FacturasCliente_ID_CLIENTE' + DataType = datInteger + DisplayLabel = 'ID_CLIENTE' + end + item + Name = 'FacturasCliente_NIF_CIF' + DataType = datString + Size = 15 + DisplayLabel = 'NIF/CIF' + end + item + Name = 'FacturasCliente_CODIGO_POSTAL' + DataType = datString + Size = 10 + DisplayLabel = 'C'#243'd. postal' + end + item + Name = 'FacturasCliente_FECHA_ALTA' + DataType = datDateTime + DisplayLabel = 'FECHA_ALTA' + end + item + Name = 'FacturasCliente_FECHA_MODIFICACION' + DataType = datDateTime + DisplayLabel = 'FECHA_MODIFICACION' + end + item + Name = 'FacturasCliente_OBSERVACIONES' + DataType = datMemo + DisplayLabel = 'Observaciones' + end + item + Name = 'FacturasCliente_NOMBRE' + DataType = datString + Size = 100 + DisplayLabel = 'Cliente' + end + item + Name = 'FacturasCliente_CALLE' + DataType = datString + Size = 150 + DisplayLabel = 'Direcci'#243'n' + end + item + Name = 'FacturasCliente_PROVINCIA' + DataType = datString + Size = 30 + DisplayLabel = 'Provincia' + end + item + Name = 'FacturasCliente_POBLACION' + DataType = datString + Size = 150 + DisplayLabel = 'Poblaci'#243'n' + end + item + Name = 'FacturasCliente_IVA' + DataType = datFloat + DisplayLabel = 'IVA' + end + item + Name = 'FacturasCliente_USUARIO' + DataType = datString + Size = 100 + DisplayLabel = 'USUARIO' + end + item + Name = 'FacturasCliente_REFERENCIA' + DataType = datString + Size = 20 + DisplayLabel = 'Referencia' + end + item + Name = 'FacturasCliente_DESCUENTO' + DataType = datFloat + DisplayLabel = 'Dto.' + end + item + Name = 'FacturasCliente_Detalles_ID' + DataType = datAutoInc + Required = True + DisplayLabel = 'ID' + end + item + Name = 'FacturasCliente_Detalles_ID_FACTURA' + DataType = datInteger + DisplayLabel = 'ID_FACTURA' + end + item + Name = 'FacturasCliente_Detalles_TIPO_DETALLE' + DataType = datString + Size = 10 + DisplayLabel = 'Tipo detalle' + end + item + Name = 'FacturasCliente_Detalles_CONCEPTO' + DataType = datString + Size = 2000 + DisplayLabel = 'Concepto' + end + item + Name = 'FacturasCliente_Detalles_IMPORTE_UNIDAD' + DataType = datFloat + DisplayLabel = 'Importe unidad' + Alignment = taRightJustify + end + item + Name = 'FacturasCliente_Detalles_IMPORTE_TOTAL' + DataType = datFloat + DisplayLabel = 'Importe total' + Alignment = taRightJustify + end + item + Name = 'FacturasCliente_Detalles_VISIBLE' + DataType = datInteger + DisplayLabel = #191'Visible?' + end + item + Name = 'FacturasCliente_Detalles_POSICION' + DataType = datInteger + DisplayLabel = 'Posici'#243'n' + end + item + Name = 'FacturasCliente_Detalles_CANTIDAD' + DataType = datInteger + DisplayLabel = 'Cantidad' + end> + Left = 46 + Top = 150 + end + object frxReport: TfrxReport + Version = '4.8.11' + DotMatrixReport = False + EngineOptions.DoublePass = True + IniFile = '\Software\Fast Reports' + PreviewOptions.Buttons = [pbPrint, pbLoad, pbSave, pbExport, pbZoom, pbFind, pbOutline, pbPageSetup, pbTools, pbEdit, pbNavigator, pbExportQuick] + PreviewOptions.OutlineWidth = 180 + PreviewOptions.Zoom = 1.000000000000000000 + PrintOptions.Printer = 'Default' + PrintOptions.PrintOnSheet = 0 + ReportOptions.CreateDate = 37871.995398692100000000 + ReportOptions.LastChange = 40360.677744004630000000 + ReportOptions.VersionBuild = '1' + ReportOptions.VersionMajor = '12' + ReportOptions.VersionMinor = '13' + ReportOptions.VersionRelease = '1' + ScriptLanguage = 'PascalScript' + ShowProgress = False + StoreInDFM = False + Left = 169 + Top = 16 + end + object frxDBCabecera: TfrxDBDataset + UserName = 'frxDBCabecera' + CloseDataSource = False + DataSource = DADataCabecera + BCDToCurrency = False + Left = 264 + Top = 16 + end + object Bin2DataStreamer: TDABin2DataStreamer + Left = 48 + Top = 80 + end + object frxDBDetalles1: TfrxDBDataset + UserName = 'frxDBDetalles' + CloseDataSource = False + DataSource = DADataDetalles + BCDToCurrency = False + Left = 352 + Top = 16 + end + object DADataDetalles: TDADataSource + DataSet = tbl_Facturas.Dataset + DataTable = tbl_Facturas + Left = 352 + Top = 72 + end + object tbl_Facturas: TDAMemDataTable + RemoteUpdatesOptions = [] + Fields = < + item + Name = 'ID' + DataType = datInteger + end + item + Name = 'ID_EMPRESA' + DataType = datInteger + end + item + Name = 'REFERENCIA' + DataType = datString + Size = 255 + end + item + Name = 'TIPO' + DataType = datString + Size = 1 + end + item + Name = 'ID_COMISION_LIQUIDADA' + DataType = datInteger + end + item + Name = 'FECHA_FACTURA' + DataType = datDateTime + end + item + Name = 'SITUACION' + DataType = datString + Size = 19 + end + item + Name = 'BASE_IMPONIBLE' + DataType = datCurrency + end + item + Name = 'DESCUENTO' + DataType = datFloat + end + item + Name = 'IMPORTE_DESCUENTO' + DataType = datCurrency + end + item + Name = 'IVA' + DataType = datFloat + end + item + Name = 'IMPORTE_IVA' + DataType = datCurrency + end + item + Name = 'RE' + DataType = datFloat + end + item + Name = 'IMPORTE_RE' + DataType = datCurrency + end + item + Name = 'IMPORTE_TOTAL' + DataType = datCurrency + end + item + Name = 'OBSERVACIONES' + DataType = datMemo + end + item + Name = 'ID_CLIENTE' + DataType = datInteger + end + item + Name = 'NOMBRE' + DataType = datString + Size = 255 + end + item + Name = 'NIF_CIF' + DataType = datString + Size = 15 + end + item + Name = 'CALLE' + DataType = datString + Size = 255 + end + item + Name = 'POBLACION' + DataType = datString + Size = 255 + end + item + Name = 'PROVINCIA' + DataType = datString + Size = 255 + end + item + Name = 'CODIGO_POSTAL' + DataType = datString + Size = 10 + end + item + Name = 'FECHA_ALTA' + DataType = datDateTime + end + item + Name = 'FECHA_MODIFICACION' + DataType = datDateTime + end + item + Name = 'USUARIO' + DataType = datString + Size = 30 + end + item + Name = 'ID_FORMA_PAGO' + DataType = datInteger + end + item + Name = 'RECARGO_EQUIVALENCIA' + DataType = datSmallInt + end + item + Name = 'ID_TIPO_IVA' + DataType = datInteger + end + item + Name = 'IMPORTE_NETO' + DataType = datCurrency + end + item + Name = 'IMPORTE_PORTE' + DataType = datCurrency + end + item + Name = 'ID_AGENTE' + DataType = datInteger + end + item + Name = 'COMISION' + DataType = datFloat + end + item + Name = 'IMPORTE_COMISION' + DataType = datCurrency + end> + Params = < + item + Name = 'ID' + Value = '' + ParamType = daptInput + end> + MasterMappingMode = mmDataRequest + LogChanges = False + StreamingOptions = [soDisableEventsWhileStreaming] + RemoteFetchEnabled = False + LocalSchema = schReport + LocalDataStreamer = Bin2DataStreamer + LogicalName = 'InformeComisionesFacturas' + IndexDefs = <> + Left = 352 + Top = 128 + end +end diff --git a/Source/Modulos/Comisiones/Reports/uRptComisiones_Server.pas b/Source/Modulos/Comisiones/Reports/uRptComisiones_Server.pas new file mode 100644 index 0000000..61c8565 --- /dev/null +++ b/Source/Modulos/Comisiones/Reports/uRptComisiones_Server.pas @@ -0,0 +1,105 @@ +unit uRptComisiones_Server; + +interface + +uses + Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, + Dialogs, frxClass, frxDBSet, uDAScriptingProvider, FactuGES_Intf, + uDADataTable, uDACDSDataTable, DB, uDAClasses, frxChart, frxGradient, + frxChBox, frxCross, frxOLE, frxBarcode, frxRich, uDABINAdapter, uROTypes, + uDAInterfaces, uDADataStreamer, uDABin2DataStreamer, uDAMemDataTable; + +type + TRptComisiones = class(TDataModule) + DADataCabecera: TDADataSource; + tbl_Comisiones: TDAMemDataTable; + frxRichObject1: TfrxRichObject; + frxBarCodeObject1: TfrxBarCodeObject; + frxOLEObject1: TfrxOLEObject; + frxCrossObject1: TfrxCrossObject; + frxCheckBoxObject1: TfrxCheckBoxObject; + frxGradientObject1: TfrxGradientObject; + frxChartObject1: TfrxChartObject; + frxDBCabecera: TfrxDBDataset; + frxReport: TfrxReport; + Bin2DataStreamer: TDABin2DataStreamer; + frxDBDetalles1: TfrxDBDataset; + DADataDetalles: TDADataSource; + tbl_Facturas: TDAMemDataTable; + schReport: TDASchema; + DataDictionary: TDADataDictionary; + procedure DataModuleCreate(Sender: TObject); + private + FConnection: IDAConnection; + //Genera cada uno de los albaranes a imprimir + procedure GenerarComision(const ID: integer); overload; + public + function GenerarInforme(const ListaID: TIntegerArray): Binary; + end; + +implementation + +{$R *.dfm} + +uses + uSistemaFunc, uDataModuleServer; + +const + rptComision = 'InfComision.fr3'; + +{ TRptComision } + +procedure TRptComisiones.DataModuleCreate(Sender: TObject); +begin + schReport.ConnectionManager := dmServer.ConnectionManager; + FConnection := dmServer.DarNuevaConexion; + frxReport.EngineOptions.NewSilentMode := simReThrow; +end; + +procedure TRptComisiones.GenerarComision(const ID: integer); +var + AInforme: Variant; + +begin + FConnection.BeginTransaction; + try + tbl_Comisiones.Active := False; + tbl_Facturas.Active := False; + + tbl_Comisiones.ParamByName('ID').AsInteger := ID; + tbl_Facturas.ParamByName('ID').AsInteger := ID; + + tbl_Comisiones.Active := True; + tbl_Facturas.Active := True; + + AInforme := DarRutaFichero(DarRutaInformes, rptComision, tbl_Comisiones.FieldByName('ID_EMPRESA').AsString); + if VarIsNull(AInforme) then + raise Exception.Create (('Error Servidor: GenerarComision, no encuentra informe' + rptComision)); + + frxReport.LoadFromFile(AInforme, True); + frxReport.ReportOptions.Name := 'Comisiones'; + frxReport.PrepareReport(False); + finally + FConnection.RollbackTransaction; + end; +end; + +function TRptComisiones.GenerarInforme(const ListaID: TIntegerArray): Binary; +var + ID_Comisiones: TStringList; + i: Integer; + +begin + Result := Binary.Create; + try + //Vamos generando todos y cada una de las comisiones recibidas + for i := 0 to ListaID.Count - 1 do + GenerarComision(ListaID.Items[i]); + + frxReport.PreviewPages.SaveToStream(Result); + finally + end; + +end; + +end.