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
david 335f7e65a5 - Incremento de versión -> 2.3.5
- Fallo de conversión de tipos en los campos 'importe del porte' de varios módulos al dejar el valor vacío.


git-svn-id: https://192.168.0.254/svn/Proyectos.LuisLeon_FactuGES/trunk@190 c93665c3-c93d-084d-9b98-7d5f4a9c3376
2007-12-05 17:35:00 +00:00

76 lines
2.9 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, 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);
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)) and (Length(DisplayValue) > 0) 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.