This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
Noviseda_FactuGES2/Source/GUIBase/uViewDetallesDTO.pas
david d8aa5d14b7 * Actualización de componentes
- RemObjects 6.0.39.777
- Data_Abstract 6.0.39.777
- JCL 2.1.1
- JVCL 3.39
- DevExpressVCL x.48
- FastReport4 4.8.11
- TB2k 2.2.2
- TntUnicodeControls 2.3.0
- SpTBXLib 2.4.4

* Actualización a FinalBuilder 6

git-svn-id: https://192.168.0.254/svn/Proyectos.Noviseda_FactuGES2/trunk@47 f33bb606-9f5c-448d-9c99-757f00063c96
2010-01-22 09:52:58 +00:00

77 lines
3.0 KiB
ObjectPascal
Raw Blame History

unit uViewDetallesDTO;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uViewDetallesBase, cxStyles, cxCustomData, cxGraphics, cxFilter,
cxData, cxDataStorage, cxEdit, DB, cxDBData, cxImageComboBox, cxRichEdit,
cxMaskEdit, cxCurrencyEdit, cxCheckBox, ImgList, PngImageList, uDADataTable,
StdActns, ExtActns, ActnList, TB2Item, SpTBXItem, TB2Dock, TB2Toolbar, cxGridLevel,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
cxControls, cxGridCustomView, cxGrid, ComCtrls, StdCtrls, JvExStdCtrls,
JvCombobox, JvColorCombo, ToolWin, uDAInterfaces, Menus,
cxGridCustomPopupMenu, cxGridPopupMenu, cxLookAndFeels, cxLookAndFeelPainters;
type
IViewDetallesDTO = interface(IViewDetallesBase)
['{0D221FFB-9F43-48FC-9AE7-0AD0F0791AD1}']
end;
TfrViewDetallesDTO = class(TfrViewDetallesBase, IViewDetallesDTO)
cxGridViewDESCUENTO: TcxGridDBColumn;
cxGridViewIMPORTEPORTE: TcxGridDBColumn;
cxGridViewIMPORTENETO: TcxGridDBColumn;
procedure cxGridViewIMPORTENETOGetDisplayText(Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
var AText: string);
procedure cxGridViewIMPORTENETOPropertiesValidate(Sender: TObject;
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
protected
function HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean; override;
end;
implementation
{$R *.dfm}
{ TfrViewDetallesDTO }
procedure TfrViewDetallesDTO.cxGridViewIMPORTENETOGetDisplayText(Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
var AText: string);
var
ImporteNeto : Double;
begin
//Se encarga de mostrar el campo calculado de importe neto
ImporteNeto := -1;
if not VarIsNull(ARecord.Values[cxGridViewIMPORTEUNIDAD.Index]) then
if not VarIsNull(ARecord.Values[cxGridViewDESCUENTO.Index]) then
ImporteNeto := ARecord.Values[cxGridViewIMPORTEUNIDAD.Index] - ((ARecord.Values[cxGridViewIMPORTEUNIDAD.Index] * ARecord.Values[cxGridViewDESCUENTO.Index])/100)
else
ImporteNeto := ARecord.Values[cxGridViewIMPORTEUNIDAD.Index];
if (ImporteNeto <> -1) then
begin
AText := FormatCurr(',0.00 <20>;-,0.00 <20>', FloatToCurr(ImporteNeto))
end;
end;
procedure TfrViewDetallesDTO.cxGridViewIMPORTENETOPropertiesValidate(Sender: TObject; var DisplayValue: Variant; var ErrorText: TCaption;
var Error: Boolean);
begin
inherited;
if not VarIsNull(DisplayValue) then
begin
cxGridViewDESCUENTO.DataBinding.Field.Value := ((cxGridViewIMPORTEUNIDAD.DataBinding.Field.Value - DisplayValue) * 100) / cxGridViewIMPORTEUNIDAD.DataBinding.Field.Value;
Controller.ActualizarTotales(Detalles);
end;
end;
function TfrViewDetallesDTO.HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean;
begin
Result := inherited HayQueRecalcular(AItem);
if not Result then
Result := (AItem = cxGridViewDESCUENTO) or (AItem = cxGridViewIMPORTEPORTE);
end;
end.