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.
LuisLeon_FactuGES/Source/Base/GUIBase/uViewDetallesDTO.pas

64 lines
2.3 KiB
ObjectPascal
Raw Normal View 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, TBX, TB2Dock, TB2Toolbar, cxGridLevel,
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxClasses,
cxControls, cxGridCustomView, cxGrid, ComCtrls, StdCtrls, JvExStdCtrls,
JvCombobox, JvColorCombo, ToolWin;
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);
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;
function TfrViewDetallesDTO.HayQueRecalcular(AItem: TcxCustomGridTableItem): Boolean;
begin
Result := inherited HayQueRecalcular(AItem);
if not Result then
Result := (AItem = cxGridViewDESCUENTO) or (AItem = cxGridViewIMPORTEPORTE);
end;
end.