225 lines
8.1 KiB
ObjectPascal
225 lines
8.1 KiB
ObjectPascal
|
|
unit uViewControGridStockEDIInventario;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, uViewControlGrid, DB, uDADataTable, cxStyles, cxCustomData,
|
|||
|
|
cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, cxDBData,
|
|||
|
|
cxTextEdit, cxGridLevel, cxGridCustomTableView, cxGridTableView,
|
|||
|
|
cxGridDBTableView, cxClasses, cxControls, cxGridCustomView, cxGrid,
|
|||
|
|
cxCurrencyEdit, cxCalendar, dxPSGlbl, dxPSUtl, dxPrnPg, dxBkgnd, dxWrap,
|
|||
|
|
dxPrnDev, dxPSEngn, dxPSCompsProvider, dxPSFillPatterns,
|
|||
|
|
dxPSEdgePatterns, dxPSCore, dxPScxCommon, dxPScxGridLnk, dxPgsDlg,
|
|||
|
|
cxDropDownEdit, StdCtrls, cxSpinEdit, uViewGrid, cxMemo,
|
|||
|
|
cxEditRepositoryItems, uDataModuleStock, uViewFiltrosStock;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
IViewControlGridStockEDIInventario = interface(IViewGrid)
|
|||
|
|
['{38BB8BB9-E15D-4D49-970E-14418C4EB1E4}']
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
TfrViewControlGridStockEDIInventario = class(TfrViewGrid, IViewControlGridStockEDIInventario)
|
|||
|
|
dxComponentPrinterLink1: TdxGridReportLink;
|
|||
|
|
cxEditRepository1: TcxEditRepository;
|
|||
|
|
cxEditDia: TcxEditRepositoryTextItem;
|
|||
|
|
cxEditImporte: TcxEditRepositoryCurrencyItem;
|
|||
|
|
cxGridViewRecID: TcxGridDBColumn;
|
|||
|
|
cxGridViewCENTRO: TcxGridDBColumn;
|
|||
|
|
cxGridViewCODIGO: TcxGridDBColumn;
|
|||
|
|
cxGridViewPRODUCTO: TcxGridDBColumn;
|
|||
|
|
cxGridViewTIPO_PRODUCTO: TcxGridDBColumn;
|
|||
|
|
cxGridViewGRUPO_PRODUCTO: TcxGridDBColumn;
|
|||
|
|
cxGridViewCOLECCION: TcxGridDBColumn;
|
|||
|
|
cxGridViewCOLOR: TcxGridDBColumn;
|
|||
|
|
cxGridViewI38: TcxGridDBColumn;
|
|||
|
|
cxGridViewI40: TcxGridDBColumn;
|
|||
|
|
cxGridViewI42: TcxGridDBColumn;
|
|||
|
|
cxGridViewI44: TcxGridDBColumn;
|
|||
|
|
cxGridViewI46: TcxGridDBColumn;
|
|||
|
|
cxGridViewI48: TcxGridDBColumn;
|
|||
|
|
cxGridViewTI: TcxGridDBColumn;
|
|||
|
|
cxGridViewK38: TcxGridDBColumn;
|
|||
|
|
cxGridViewK40: TcxGridDBColumn;
|
|||
|
|
cxGridViewK42: TcxGridDBColumn;
|
|||
|
|
cxGridViewK44: TcxGridDBColumn;
|
|||
|
|
cxGridViewK46: TcxGridDBColumn;
|
|||
|
|
cxGridViewK48: TcxGridDBColumn;
|
|||
|
|
cxGridViewTK: TcxGridDBColumn;
|
|||
|
|
cxGridViewD38: TcxGridDBColumn;
|
|||
|
|
cxGridViewD40: TcxGridDBColumn;
|
|||
|
|
cxGridViewD42: TcxGridDBColumn;
|
|||
|
|
cxGridViewD44: TcxGridDBColumn;
|
|||
|
|
cxGridViewD46: TcxGridDBColumn;
|
|||
|
|
cxGridViewD48: TcxGridDBColumn;
|
|||
|
|
cxGridViewDT: TcxGridDBColumn;
|
|||
|
|
frViewFiltrosStock1: TfrViewFiltrosStock;
|
|||
|
|
cxStyleEntrada: TcxStyle;
|
|||
|
|
cxStyleSalida: TcxStyle;
|
|||
|
|
cxStyleRepositoryInforme: TcxStyleRepository;
|
|||
|
|
cxStyleContentInforme: TcxStyle;
|
|||
|
|
cxStyleFooterInforme: TcxStyle;
|
|||
|
|
cxStyleGroupInforme: TcxStyle;
|
|||
|
|
cxStyleHeaderInforme: TcxStyle;
|
|||
|
|
cxStyleSelectionInforme: TcxStyle;
|
|||
|
|
cxStyleTotales: TcxStyle;
|
|||
|
|
procedure cxGridViewDTCustomDrawCell(Sender: TcxCustomGridTableView;
|
|||
|
|
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
|||
|
|
var ADone: Boolean);
|
|||
|
|
procedure cxGridViewStylesGetContentStyle(
|
|||
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|||
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|||
|
|
procedure cxGridViewI38GetDataText(Sender: TcxCustomGridTableItem;
|
|||
|
|
ARecordIndex: Integer; var AText: String);
|
|||
|
|
procedure cxGridViewTEStylesGetContentStyle(
|
|||
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|||
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|||
|
|
procedure frViewFiltrosStock1cbColeccionPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
procedure frViewFiltrosStock1ccbCentroChange(Sender: TObject);
|
|||
|
|
protected
|
|||
|
|
FNivelFiltrado : TcxFilterCriteriaItemList;
|
|||
|
|
procedure FilterChanged(Sender: TObject); override;
|
|||
|
|
public
|
|||
|
|
procedure Preview; override;
|
|||
|
|
procedure Print; override;
|
|||
|
|
constructor Create(AOwner: TComponent); override;
|
|||
|
|
procedure ShowEmbedded(const AParent : TWinControl); override;
|
|||
|
|
procedure Refresh; override;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
uViewGridBase;
|
|||
|
|
|
|||
|
|
{ TfrViewControlGridResumenVentas }
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.Preview;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
dxComponentPrinterLink1.ReportTitle.Text := 'Diferencias con <20>ltimo inventario de colecci<63>n ' + frViewFiltrosStock1.cbColeccion.Text + ' en centro(s) ' + frViewFiltrosStock1.ccbCentro.Text;
|
|||
|
|
dxComponentPrinterLink1.Preview;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.Print;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
dxComponentPrinterLink1.ReportTitle.Text := 'Diferencias con <20>ltimo inventario de colecci<63>n ' + frViewFiltrosStock1.cbColeccion.Text + ' en centro(s) ' + frViewFiltrosStock1.ccbCentro.Text;
|
|||
|
|
dxComponentPrinterLink1.Print(True, Nil);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.cxGridViewDTCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|||
|
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if not VarIsNull(AViewInfo.Value) then
|
|||
|
|
if Pos('-', AViewInfo.Value) > 0 then
|
|||
|
|
ACanvas.Canvas.Font.Color := $000000CC;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
constructor TfrViewControlGridStockEDIInventario.Create(AOwner: TComponent);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frViewFiltrosStock1.FocusedView := cxGridView;
|
|||
|
|
frViewFiltrosStock1.ColeccionColumnIndex := cxGridViewCOLECCION.Index;
|
|||
|
|
frViewFiltrosStock1.CentroColumnIndex := cxGridViewCENTRO.Index;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.ShowEmbedded(
|
|||
|
|
const AParent: TWinControl);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frViewFiltrosStock1.Refresh;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.cxGridViewStylesGetContentStyle(
|
|||
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|||
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
//
|
|||
|
|
if Assigned(AItem) then
|
|||
|
|
if (AItem.Index = cxGridViewTI.Index) or
|
|||
|
|
(AItem.Index = cxGridViewTK.Index) or
|
|||
|
|
(AItem.Index = cxGridViewDT.Index) then
|
|||
|
|
AStyle := cxStyleTotales;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.cxGridViewI38GetDataText(
|
|||
|
|
Sender: TcxCustomGridTableItem; ARecordIndex: Integer;
|
|||
|
|
var AText: String);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if AText = '0' then
|
|||
|
|
AText := '';
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.cxGridViewTEStylesGetContentStyle(
|
|||
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|||
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
AStyle := cxStyleTotales;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.Refresh;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frViewFiltrosStock1.Refresh;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.frViewFiltrosStock1cbColeccionPropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
FreeAndNil(FNivelFiltrado);
|
|||
|
|
FilterChanged(self);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.FilterChanged(Sender: TObject);
|
|||
|
|
var
|
|||
|
|
AItemList: TcxFilterCriteriaItemList;
|
|||
|
|
i : Integer;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
|
|||
|
|
cxGridView.DataController.Filter.BeginUpdate;
|
|||
|
|
ShowHourglassCursor;
|
|||
|
|
try
|
|||
|
|
AItemList := cxGridView.DataController.Filter.Root;
|
|||
|
|
AItemList.Clear;
|
|||
|
|
FNivelFiltrado := AItemList.AddItemList(fboAnd);
|
|||
|
|
|
|||
|
|
if (Length(frViewFiltrosStock1.cbColeccion.Text) > 0) and (frViewFiltrosStock1.cbColeccion.Text <> 'Todos') then
|
|||
|
|
FNivelFiltrado.AddItem(cxGridView.Columns[frViewFiltrosStock1.ColeccionColumnIndex], foEqual, frViewFiltrosStock1.cbColeccion.Text, frViewFiltrosStock1.cbColeccion.Text);
|
|||
|
|
|
|||
|
|
if (Length(frViewFiltrosStock1.ccbCentro.Text) > 0) and
|
|||
|
|
(Pos('Todos', frViewFiltrosStock1.ccbCentro.Text) = 0) then
|
|||
|
|
begin
|
|||
|
|
FNivelFiltrado := FNivelFiltrado.AddItemList(fboOr);
|
|||
|
|
for i := 0 to frViewFiltrosStock1.ccbCentro.Items.Count - 1 do
|
|||
|
|
if frViewFiltrosStock1.ccbCentro.IsChecked(i) then
|
|||
|
|
FNivelFiltrado.AddItem(cxGridView.Columns[frViewFiltrosStock1.CentroColumnIndex], foEqual, frViewFiltrosStock1.ccbCentro.Items[i], frViewFiltrosStock1.ccbCentro.Items[i]);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
if cxGridView.DataController.Filter.IsEmpty then
|
|||
|
|
cxGridView.DataController.Filter.Active := False
|
|||
|
|
else
|
|||
|
|
cxGridView.DataController.Filter.Active := True;
|
|||
|
|
finally
|
|||
|
|
cxGridView.DataController.Filter.EndUpdate;
|
|||
|
|
HideHourglassCursor;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewControlGridStockEDIInventario.frViewFiltrosStock1ccbCentroChange(
|
|||
|
|
Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
FreeAndNil(FNivelFiltrado);
|
|||
|
|
FilterChanged(self);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
end.
|
|||
|
|
|