From c91b3c8af4901a1c35afa0d3e54fbfbc09150652 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 16 Dec 2007 22:29:19 +0000 Subject: [PATCH] Vista de detalles: - Habilitado columna descuento - Habilitado tipo de fila (titulo, concepto, pie, subtotal). git-svn-id: https://192.168.0.254/svn/Proyectos.Tecsitel_FactuGES2/trunk@174 0c75b7a4-871f-7646-8a2f-f78d34cc349f --- Source/Base/Base.dproj | 586 ++---------------- .../Controladores/uControllerDetallesBase.pas | 44 +- Source/GUIBase/uViewDetallesBase.dfm | 99 +-- Source/GUIBase/uViewDetallesDTO.dfm | 67 +- .../Views/uViewDetallesArticulos.dfm | 1 - 5 files changed, 211 insertions(+), 586 deletions(-) diff --git a/Source/Base/Base.dproj b/Source/Base/Base.dproj index 3dcc8be0..d69f3f3d 100644 --- a/Source/Base/Base.dproj +++ b/Source/Base/Base.dproj @@ -58,58 +58,58 @@ MainSource - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
fConfigurarConexion
TForm @@ -151,486 +151,4 @@ - + diff --git a/Source/Base/Controladores/uControllerDetallesBase.pas b/Source/Base/Controladores/uControllerDetallesBase.pas index 8198311e..1c415a07 100644 --- a/Source/Base/Controladores/uControllerDetallesBase.pas +++ b/Source/Base/Controladores/uControllerDetallesBase.pas @@ -9,6 +9,7 @@ const TIPO_DETALLE_TITULO = 'Titulo'; TIPO_DETALLE_SUBTOTAL = 'Subtotal'; TIPO_DETALLE_SALTO = 'Salto'; + TIPO_DETALLE_DESCUENTO = 'Descuento'; CTE_DESC_SALTO = 'SALTO DE PAGINA >>'; @@ -59,6 +60,9 @@ type procedure CalculoDetalleTitulo(DataTable: TDADataTable; var ImporteAcumulado : Double; var ImporteTotal : Double); virtual; procedure TratamientoDetalleSubtotal(DataTable: TDADataTable); virtual; procedure CalculoDetalleSubtotal(DataTable: TDADataTable; var ImporteAcumulado : Double; var ImporteTotal : Double); virtual; + procedure TratamientoDetalleDescuento(DataTable: TDADataTable); virtual; + procedure CalculoDetalleDescuento(DataTable: TDADataTable; var ImporteAcumulado : Double; var ImporteTotal : Double); virtual; + //Si sobreescribimos este metodo es para continuar el CalcularTotales segun los tipos de concepto de los hijos function CalcularTotalesHijos(Modificar: boolean; DataTable: TDADataTable; var ImporteAcumulado : Double; var ImporteTotal : Double): Double; virtual; @@ -172,13 +176,20 @@ begin TratamientoDetalleTitulo(DataTable); //Se podrá sobreescribir para que se tengan en cuenta nuevos campos en hijos CalculoDetalleTitulo(DataTable, AuxImporteAcumulado, AuxImporteTotal); //Se podrá sobreescribir para posibles nuevos calculos de los hijos end - //SUBTITULOS + //SUBTOTAL else if (DataTable.FieldByName(CAMPO_TIPO).AsString = TIPO_DETALLE_SUBTOTAL) then begin if Modificar then TratamientoDetalleSubtotal(DataTable); //Se podrá sobreescribir para que se tengan en cuenta nuevos campos CalculoDetalleSubtotal(DataTable, AuxImporteAcumulado, AuxImporteTotal); //Se podrá sobreescribir para posibles nuevos calculos de los hijos end + //DESCUENTO DE CAPITULO + else if (DataTable.FieldByName(CAMPO_TIPO).AsString = TIPO_DETALLE_DESCUENTO) then + begin + if Modificar then + TratamientoDetalleDescuento(DataTable); //Se podrá sobreescribir para que se tengan en cuenta nuevos campos + CalculoDetalleDescuento(DataTable, AuxImporteAcumulado, AuxImporteTotal); //Se podrá sobreescribir para posibles nuevos calculos de los hijos + end //CONCEPTOS else if (DataTable.FieldByName(CAMPO_TIPO).AsString = TIPO_DETALLE_CONCEPTO) then begin @@ -217,6 +228,21 @@ begin end; end; +procedure TControllerDetallesBase.CalculoDetalleDescuento( + DataTable: TDADataTable; var ImporteAcumulado, ImporteTotal: Double); +var + ImporteDto : Double; +begin + with DataTable do + begin + if not Editing then Edit; + ImporteDto := (-1)*((ImporteTotal * DataTable.FieldByName(CAMPO_DESCUENTO).AsFloat) / 100); + ImporteTotal := ImporteTotal + ImporteDto; + FieldByName(CAMPO_IMPORTE_TOTAL).AsFloat := ImporteTotal; + Post; + end; +end; + procedure TControllerDetallesBase.CalculoDetalleSalto(DataTable: TDADataTable; var ImporteAcumulado, ImporteTotal: Double); begin with DataTable do @@ -261,6 +287,7 @@ begin Result.Values[TIPO_DETALLE_CONCEPTO] := 'Concepto'; Result.Values[TIPO_DETALLE_TITULO] := 'Título de capítulo'; Result.Values[TIPO_DETALLE_SUBTOTAL] := 'Final de capítulo'; + Result.Values[TIPO_DETALLE_DESCUENTO] := 'Descuento de capítulo'; Result.Values[TIPO_DETALLE_SALTO] := 'Salto de página'; end; @@ -512,6 +539,21 @@ begin end; end; +procedure TControllerDetallesBase.TratamientoDetalleDescuento( + DataTable: TDADataTable); +begin + with DataTable do + begin + if not Editing then Edit; + if (FieldByName(CAMPO_CONCEPTO).AsString = CTE_DESC_SALTO) then + FieldByName(CAMPO_CONCEPTO).AsVariant := Null; + FieldByName(CAMPO_CANTIDAD).AsVariant := Null; + FieldByName(CAMPO_IMPORTE_UNIDAD).AsVariant := Null; + FieldByName(CAMPO_IMPORTE_TOTAL).AsVariant := Null; + Post; + end; +end; + procedure TControllerDetallesBase.TratamientoDetalleSalto(DataTable: TDADataTable); begin with DataTable do diff --git a/Source/GUIBase/uViewDetallesBase.dfm b/Source/GUIBase/uViewDetallesBase.dfm index 261580f1..4e37775b 100644 --- a/Source/GUIBase/uViewDetallesBase.dfm +++ b/Source/GUIBase/uViewDetallesBase.dfm @@ -1,6 +1,6 @@ inherited frViewDetallesBase: TfrViewDetallesBase - Width = 451 - Height = 304 + Width = 975 + Height = 372 Align = alClient OnCreate = CustomViewCreate OnDestroy = CustomViewDestroy @@ -9,8 +9,8 @@ inherited frViewDetallesBase: TfrViewDetallesBase object ToolBar1: TToolBar Left = 0 Top = 0 - Width = 451 - Height = 46 + Width = 975 + Height = 24 AutoSize = True ButtonWidth = 63 Caption = 'ToolBar1' @@ -25,6 +25,8 @@ inherited frViewDetallesBase: TfrViewDetallesBase TabOrder = 0 Transparent = True Visible = False + ExplicitWidth = 451 + ExplicitHeight = 46 object ToolButton1: TToolButton Left = 0 Top = 0 @@ -54,17 +56,16 @@ inherited frViewDetallesBase: TfrViewDetallesBase Top = 0 Action = FontEdit1 AutoSize = True - Wrap = True end object FontName: TJvFontComboBox - Left = 0 - Top = 22 + Left = 274 + Top = 0 Width = 145 Height = 22 DroppedDownWidth = 145 MaxMRUCount = 0 FontName = 'Tahoma' - ItemIndex = 34 + ItemIndex = 35 Options = [foTrueTypeOnly, foNoOEMFonts, foScalableOnly, foWysiWyg] Sorted = True TabOrder = 2 @@ -73,8 +74,8 @@ inherited frViewDetallesBase: TfrViewDetallesBase OnClick = FontNameChange end object FontSize: TEdit - Left = 145 - Top = 22 + Left = 419 + Top = 0 Width = 26 Height = 22 Hint = 'Font Size|Select font size' @@ -84,8 +85,8 @@ inherited frViewDetallesBase: TfrViewDetallesBase OnChange = FontSizeChange end object UpDown1: TUpDown - Left = 171 - Top = 22 + Left = 445 + Top = 0 Width = 16 Height = 22 Associate = FontSize @@ -93,67 +94,69 @@ inherited frViewDetallesBase: TfrViewDetallesBase Visible = False end object ToolButton13: TToolButton - Left = 187 - Top = 22 + Left = 461 + Top = 0 Width = 8 Caption = 'ToolButton13' ImageIndex = 10 Style = tbsSeparator end object ToolButton6: TToolButton - Left = 195 - Top = 22 + Left = 469 + Top = 0 Action = RichEditBold1 AutoSize = True end object ToolButton7: TToolButton - Left = 229 - Top = 22 + Left = 503 + Top = 0 Action = RichEditItalic1 AutoSize = True end object ToolButton8: TToolButton - Left = 263 - Top = 22 + Left = 537 + Top = 0 Action = RichEditUnderline1 AutoSize = True end object ToolButton12: TToolButton - Left = 297 - Top = 22 + Left = 571 + Top = 0 Width = 8 Caption = 'ToolButton12' ImageIndex = 10 Style = tbsSeparator end object ToolButton9: TToolButton - Left = 305 - Top = 22 + Left = 579 + Top = 0 Action = RichEditAlignLeft1 AutoSize = True end object ToolButton10: TToolButton - Left = 339 - Top = 22 + Left = 613 + Top = 0 Action = RichEditAlignCenter1 AutoSize = True end object ToolButton11: TToolButton - Left = 373 - Top = 22 + Left = 647 + Top = 0 Action = RichEditAlignRight1 AutoSize = True end end object cxGrid: TcxGrid Left = 0 - Top = 72 - Width = 451 - Height = 232 + Top = 50 + Width = 975 + Height = 322 Align = alClient TabOrder = 1 - LookAndFeel.Kind = lfOffice11 + LookAndFeel.Kind = lfStandard LookAndFeel.NativeStyle = True + ExplicitLeft = 24 + ExplicitTop = 74 object cxGridView: TcxGridDBTableView NavigatorButtons.ConfirmDelete = False FilterBox.Visible = fvNever @@ -185,6 +188,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase OptionsCustomize.DataRowSizing = True OptionsData.Appending = True OptionsData.CancelOnExit = False + OptionsSelection.InvertSelect = False OptionsSelection.MultiSelect = True OptionsSelection.UnselectFocusedRecordOnExit = False OptionsView.CellEndEllipsis = True @@ -194,35 +198,36 @@ inherited frViewDetallesBase: TfrViewDetallesBase OptionsView.GroupByBox = False OptionsView.HeaderEndEllipsis = True OptionsView.Indicator = True - OptionsView.NewItemRowInfoText = 'Click here to add a new row' Styles.ContentEven = cxStyleEven Styles.ContentOdd = cxStyleOdd - Styles.Inactive = cxStyleSelection Styles.Selection = cxStyleSelection Styles.OnGetContentStyle = cxGridViewStylesGetContentStyle object cxGridViewID: TcxGridDBColumn DataBinding.FieldName = 'ID' Visible = False + Width = 25 end object cxGridViewPOSICION: TcxGridDBColumn DataBinding.FieldName = 'POSICION' Visible = False SortIndex = 0 SortOrder = soAscending + Width = 25 end object cxGridViewTIPO: TcxGridDBColumn Caption = 'Tipo' DataBinding.FieldName = 'TIPO_DETALLE' PropertiesClassName = 'TcxImageComboBoxProperties' + Properties.ImmediatePost = True Properties.Items = <> BestFitMaxWidth = 64 - Width = 56 + Width = 35 end object cxGridViewDESCRIPCION: TcxGridDBColumn Caption = 'Concepto' DataBinding.FieldName = 'CONCEPTO' PropertiesClassName = 'TcxRichEditProperties' - Width = 224 + Width = 317 end object cxGridViewCANTIDAD: TcxGridDBColumn Caption = 'Cantidad' @@ -231,7 +236,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase Properties.Alignment.Horz = taRightJustify BestFitMaxWidth = 64 HeaderAlignmentHorz = taRightJustify - Width = 130 + Width = 30 end object cxGridViewIMPORTEUNIDAD: TcxGridDBColumn Caption = 'Importe unidad' @@ -241,7 +246,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase BestFitMaxWidth = 120 FooterAlignmentHorz = taRightJustify HeaderAlignmentHorz = taRightJustify - Width = 130 + Width = 60 end object cxGridViewIMPORTETOTAL: TcxGridDBColumn Caption = 'Importe total' @@ -251,7 +256,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase BestFitMaxWidth = 120 HeaderAlignmentHorz = taRightJustify Options.Editing = False - Width = 130 + Width = 60 end object cxGridViewVISIBLE: TcxGridDBColumn Caption = #191'Visible?' @@ -298,6 +303,7 @@ inherited frViewDetallesBase: TfrViewDetallesBase Visible = False FooterAlignmentHorz = taCenter HeaderAlignmentHorz = taCenter + Width = 25 end end object cxGridLevel: TcxGridLevel @@ -306,11 +312,13 @@ inherited frViewDetallesBase: TfrViewDetallesBase end object TBXDock1: TTBXDock Left = 0 - Top = 46 - Width = 451 + Top = 24 + Width = 975 Height = 26 BackgroundOnToolbars = False UseParentBackground = True + ExplicitTop = 46 + ExplicitWidth = 451 object TBXToolbar1: TTBXToolbar Left = 0 Top = 0 @@ -709,8 +717,13 @@ inherited frViewDetallesBase: TfrViewDetallesBase Color = cl3DLight end object cxStyle_TITULO: TcxStyle - AssignedValues = [svColor] - Color = clMenuBar + AssignedValues = [svColor, svFont] + Color = 7977877 + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -15 + Font.Name = 'Tahoma' + Font.Style = [fsBold] end end end diff --git a/Source/GUIBase/uViewDetallesDTO.dfm b/Source/GUIBase/uViewDetallesDTO.dfm index 618d7d45..7584ea4d 100644 --- a/Source/GUIBase/uViewDetallesDTO.dfm +++ b/Source/GUIBase/uViewDetallesDTO.dfm @@ -1,6 +1,10 @@ inherited frViewDetallesDTO: TfrViewDetallesDTO + Width = 927 + Height = 304 inherited ToolBar1: TToolBar + Width = 927 ButtonWidth = 110 + ExplicitHeight = 73 inherited ToolButton1: TToolButton ExplicitWidth = 109 end @@ -9,20 +13,67 @@ inherited frViewDetallesDTO: TfrViewDetallesDTO ExplicitLeft = 109 ExplicitWidth = 114 end - inherited ToolButton3: TToolButton + inherited ToolButton4: TToolButton [2] Left = 223 ExplicitLeft = 223 end - inherited ToolButton4: TToolButton - Left = 278 - ExplicitLeft = 278 + inherited FontName: TJvFontComboBox [3] + Left = 279 + ExplicitLeft = 279 end - inherited ToolButton14: TToolButton - Left = 334 - ExplicitLeft = 334 + inherited ToolButton3: TToolButton [4] + Left = 424 + ExplicitLeft = 424 + end + inherited ToolButton8: TToolButton [5] + Left = 479 + ExplicitLeft = 479 + end + inherited ToolButton13: TToolButton [6] + Left = 513 + ExplicitLeft = 513 + end + inherited ToolButton6: TToolButton [7] + Left = 521 + ExplicitLeft = 521 + end + inherited ToolButton7: TToolButton [8] + Left = 555 + ExplicitLeft = 555 + end + inherited ToolButton12: TToolButton [9] + Left = 589 + ExplicitLeft = 589 + end + inherited ToolButton9: TToolButton [10] + Left = 597 + ExplicitLeft = 597 + end + inherited ToolButton10: TToolButton [11] + Left = 631 + ExplicitLeft = 631 + end + inherited ToolButton11: TToolButton [12] + Left = 665 + ExplicitLeft = 665 + end + inherited ToolButton14: TToolButton [13] + Left = 699 + Enabled = True + ExplicitLeft = 699 + end + inherited FontSize: TEdit [14] + Left = 733 + ExplicitLeft = 733 + end + inherited UpDown1: TUpDown [15] + Left = 759 + ExplicitLeft = 759 end end inherited cxGrid: TcxGrid + Width = 927 + Height = 254 inherited cxGridView: TcxGridDBTableView object cxGridViewDESCUENTO: TcxGridDBColumn [6] Caption = 'Dto' @@ -31,6 +82,7 @@ inherited frViewDetallesDTO: TfrViewDetallesDTO Properties.DisplayFormat = ',0.00 %;-,0.00 %' Properties.EditFormat = ',0.00;-,0.00' Properties.MaxValue = 100.000000000000000000 + Width = 30 end object cxGridViewIMPORTENETO: TcxGridDBColumn [7] Caption = 'Importe neto' @@ -56,6 +108,7 @@ inherited frViewDetallesDTO: TfrViewDetallesDTO end end inherited TBXDock1: TTBXDock + Width = 927 inherited TBXToolbar1: TTBXToolbar ExplicitWidth = 447 end diff --git a/Source/Modulos/Articulos/Views/uViewDetallesArticulos.dfm b/Source/Modulos/Articulos/Views/uViewDetallesArticulos.dfm index a3f7fd72..33bcd8c2 100644 --- a/Source/Modulos/Articulos/Views/uViewDetallesArticulos.dfm +++ b/Source/Modulos/Articulos/Views/uViewDetallesArticulos.dfm @@ -64,7 +64,6 @@ inherited frViewDetallesArticulos: TfrViewDetallesArticulos inherited cxGrid: TcxGrid inherited cxGridView: TcxGridDBTableView inherited cxGridViewTIPO: TcxGridDBColumn - Visible = False Width = 26 end object cxGridViewID_ARTICULO: TcxGridDBColumn [3]