2011-11-14 17:40:41 +00:00
|
|
|
|
unit uViewArticulos;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, uViewGrid, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|
|
|
|
|
cxDataStorage, cxEdit, DB, cxDBData, uDADataTable, cxGridLevel,
|
|
|
|
|
|
cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
|
|
|
|
|
|
cxGridTableView, cxGridDBTableView, cxGrid, uBizArticulos, ActnList, Menus,
|
|
|
|
|
|
cxGridBandedTableView, cxGridDBBandedTableView, JvComponent,
|
|
|
|
|
|
JvFormAutoSize, PngImageList, ImgList, dxPSGlbl, dxPSUtl, dxPSEngn,
|
|
|
|
|
|
dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns,
|
|
|
|
|
|
dxPSEdgePatterns, dxPSCore, dxPScxCommon, dxPScxGrid6Lnk,
|
|
|
|
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, cxCurrencyEdit, cxSpinEdit, cxCheckBox,
|
|
|
|
|
|
cxCheckComboBox, cxImageComboBox, TB2Item, TBX, TB2Toolbar, TBXDkPanels,
|
|
|
|
|
|
TB2Dock, uViewFiltroBase, dxPgsDlg, uDAInterfaces, uCustomView, uViewBase;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
IViewArticulos = interface(IViewGrid)
|
|
|
|
|
|
['{4C09BEC8-C82B-4DE8-8C36-40DB62224E95}']
|
|
|
|
|
|
function GetArticulos: IBizArticulo;
|
|
|
|
|
|
procedure SetArticulos(const Value: IBizArticulo);
|
|
|
|
|
|
property Articulos: IBizArticulo read GetArticulos write SetArticulos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
TfrViewArticulos = class(TfrViewGrid, IViewArticulos)
|
|
|
|
|
|
PngImageList: TPngImageList;
|
|
|
|
|
|
cxGridViewREFERENCIA: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewDESCRIPCION: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewFAMILIA: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewNOMBRE_PROVEEDOR: TcxGridDBColumn;
|
|
|
|
|
|
actFamilia: TAction;
|
|
|
|
|
|
actProveedor: TAction;
|
|
|
|
|
|
TBXItem2: TTBXItem;
|
|
|
|
|
|
TBXItem3: TTBXItem;
|
|
|
|
|
|
TBXSeparatorItem1: TTBXSeparatorItem;
|
|
|
|
|
|
TBXSeparatorItem2: TTBXSeparatorItem;
|
|
|
|
|
|
cxGridViewINVENTARIABLE: TcxGridDBColumn;
|
2013-04-25 17:15:39 +00:00
|
|
|
|
cxGridViewPRECIO_COSTE: TcxGridDBColumn;
|
2012-07-11 15:39:13 +00:00
|
|
|
|
cxGridViewPRECIO_PVP: TcxGridDBColumn;
|
2013-04-25 17:15:39 +00:00
|
|
|
|
cxGridViewPRECIOPVP2: TcxGridDBColumn;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
procedure cxGridViewIDCustomDrawCell(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|
|
|
|
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|
|
|
|
|
procedure actProveedorExecute(Sender: TObject);
|
|
|
|
|
|
procedure actProveedorUpdate(Sender: TObject);
|
|
|
|
|
|
procedure actFamiliaExecute(Sender: TObject);
|
|
|
|
|
|
procedure actFamiliaUpdate(Sender: TObject);
|
|
|
|
|
|
procedure cxGridViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
2013-04-25 17:15:39 +00:00
|
|
|
|
procedure cxGridViewPRECIOPVP2GetDisplayText(Sender: TcxCustomGridTableItem;
|
|
|
|
|
|
ARecord: TcxCustomGridRecord; var AText: string);
|
2011-11-14 17:40:41 +00:00
|
|
|
|
protected
|
|
|
|
|
|
FArticulos: IBizArticulo;
|
|
|
|
|
|
function GetArticulos: IBizArticulo; virtual;
|
|
|
|
|
|
procedure SetArticulos(const Value: IBizArticulo); virtual;
|
|
|
|
|
|
public
|
|
|
|
|
|
property Articulos: IBizArticulo read GetArticulos write SetArticulos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
uses //uDataModuleArticulos,
|
|
|
|
|
|
|
2015-05-04 15:46:17 +00:00
|
|
|
|
schArticulosClient_Intf, uFactuGES_App, uNumUtils;
|
2011-11-14 17:40:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{ TfrViewArticulos }
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
******************************* TfrViewArticulos *******************************
|
|
|
|
|
|
}
|
|
|
|
|
|
function TfrViewArticulos.GetArticulos: IBizArticulo;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FArticulos;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewArticulos.SetArticulos(const Value: IBizArticulo);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FArticulos := Value;
|
|
|
|
|
|
if Assigned(FArticulos) then
|
|
|
|
|
|
dsDataSource.DataTable := FArticulos.DataTable;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewArticulos.actFamiliaExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (cxGridViewFAMILIA.GroupIndex < 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewFAMILIA.GroupIndex := cxGridView.GroupedColumnCount;
|
|
|
|
|
|
cxGridViewFAMILIA.Visible := False;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewFAMILIA.GroupIndex := -1;
|
|
|
|
|
|
cxGridViewFAMILIA.Visible := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewArticulos.actFamiliaUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Checked := not (cxGridViewFAMILIA.GroupIndex < 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewArticulos.actProveedorExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if (cxGridViewNOMBRE_PROVEEDOR.GroupIndex < 0) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewNOMBRE_PROVEEDOR.GroupIndex := cxGridView.GroupedColumnCount;
|
|
|
|
|
|
cxGridViewNOMBRE_PROVEEDOR.Visible := False;
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
begin
|
|
|
|
|
|
cxGridViewNOMBRE_PROVEEDOR.GroupIndex := -1;
|
|
|
|
|
|
cxGridViewNOMBRE_PROVEEDOR.Visible := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewArticulos.actProveedorUpdate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
(Sender as TAction).Checked := not (cxGridViewNOMBRE_PROVEEDOR.GroupIndex < 0);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewArticulos.cxGridViewIDCustomDrawCell(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|
|
|
|
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|
|
|
|
|
var
|
|
|
|
|
|
R : TRect;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
R := AViewInfo.ContentBounds;
|
|
|
|
|
|
ACanvas.FillRect(R);
|
|
|
|
|
|
ACanvas.DrawImage(PngImageList, R.Left, R.Top, 0);
|
|
|
|
|
|
ADone := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewArticulos.cxGridViewMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
|
|
|
|
|
var
|
|
|
|
|
|
Site : TcxGridSite;
|
|
|
|
|
|
HitTest : TcxCustomGridHitTest;
|
|
|
|
|
|
Item : TcxCustomGridTableItem;
|
|
|
|
|
|
Rec : TcxCustomGridRecord;
|
|
|
|
|
|
sNewHint : string;
|
|
|
|
|
|
begin
|
|
|
|
|
|
{Este m<>todo desaparecer<65> cuando se migre la aplicaci<63>n, es para sacar la causa de la incidencia sin necesidad de entrar en el documento}
|
|
|
|
|
|
Site := Sender as TcxGridSite;
|
|
|
|
|
|
HitTest := Site.GridView.ViewInfo.GetHitTest(X, Y);
|
|
|
|
|
|
if HitTest is TcxGridRecordCellHitTest then
|
|
|
|
|
|
begin
|
|
|
|
|
|
Item := TcxGridRecordCellHitTest(HitTest).Item;
|
|
|
|
|
|
Rec := TcxGridRecordCellHitTest(HitTest).GridRecord;
|
|
|
|
|
|
|
|
|
|
|
|
if (Item.Index = cxGridView.GetColumnByFieldName(fld_ArticulosCOMISIONABLE).Index) then begin
|
|
|
|
|
|
sNewHint := 'Todo art<72>culo comisionable se tendr<64> en cuenta para la liquidaci<63>n de comisiones de los agentes';
|
|
|
|
|
|
if (cxGrid.Hint <> sNewHint) then begin
|
|
|
|
|
|
cxGrid.ShowHint := false;
|
|
|
|
|
|
cxGrid.Hint := sNewHint;
|
|
|
|
|
|
end
|
|
|
|
|
|
else cxGrid.ShowHint := true;
|
|
|
|
|
|
end
|
|
|
|
|
|
else if (Item.Index = cxGridView.GetColumnByFieldName(fld_ArticulosINVENTARIABLE).Index) then begin
|
|
|
|
|
|
sNewHint := 'Todo art<72>culo inventariable se tendr<64> en cuenta para el control de almacenes (inventario de almac<61>n)';
|
|
|
|
|
|
if (cxGrid.Hint <> sNewHint) then begin
|
|
|
|
|
|
cxGrid.ShowHint := false;
|
|
|
|
|
|
cxGrid.Hint := sNewHint;
|
|
|
|
|
|
end
|
|
|
|
|
|
else cxGrid.ShowHint := true;
|
|
|
|
|
|
end
|
|
|
|
|
|
else begin
|
|
|
|
|
|
cxGrid.ShowHint := false;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2013-04-25 17:15:39 +00:00
|
|
|
|
procedure TfrViewArticulos.cxGridViewPRECIOPVP2GetDisplayText(
|
|
|
|
|
|
Sender: TcxCustomGridTableItem; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
var AText: string);
|
|
|
|
|
|
var
|
|
|
|
|
|
ImportePVP : Double;
|
|
|
|
|
|
begin
|
|
|
|
|
|
//Se encarga de mostrar el campo calculado de importe PVP
|
|
|
|
|
|
ImportePVP := -1;
|
|
|
|
|
|
|
|
|
|
|
|
if not VarIsNull(ARecord.Values[cxGridViewPRECIO_COSTE.Index]) then
|
|
|
|
|
|
if not VarIsNull(AppFactuGES.EmpresaActiva.PRECIO_PUNTO) then
|
2015-05-04 15:46:17 +00:00
|
|
|
|
|
|
|
|
|
|
ImportePVP := RoundCurrency(ARecord.Values[cxGridViewPRECIO_COSTE.Index] * AppFactuGES.EmpresaActiva.PRECIO_PUNTO)
|
2013-04-25 17:15:39 +00:00
|
|
|
|
else
|
|
|
|
|
|
ImportePVP := 0;
|
|
|
|
|
|
|
|
|
|
|
|
if (ImportePVP <> -1) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
AText := FormatCurr(',0.00 <20>;-,0.00 <20>', FloatToCurr(ImportePVP))
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2011-11-14 17:40:41 +00:00
|
|
|
|
end.
|