2007-08-01 16:16:26 +00:00
|
|
|
|
unit uViewControGridStockVARELA;
|
|
|
|
|
|
|
|
|
|
|
|
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, uCustomView, uViewBase,
|
2007-09-18 17:11:41 +00:00
|
|
|
|
uViewParametrosControlGrid, uDAInterfaces, TBXDkPanels,
|
|
|
|
|
|
uViewParametrosColeccion, TB2Dock, uBizStock;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
IViewControlGridStockVARELA = interface(IViewGrid)
|
|
|
|
|
|
['{19831B1A-1D3B-4352-A848-52B00BFEF4EF}']
|
2007-09-18 17:11:41 +00:00
|
|
|
|
function GetItems: IBizStockVARELA;
|
|
|
|
|
|
procedure SetItems(const Value: IBizStockVARELA);
|
|
|
|
|
|
property Items: IBizStockVARELA read GetItems write SetItems;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
TfrViewControlGridStockVARELA = class(TfrViewGrid, IViewControlGridStockVARELA)
|
|
|
|
|
|
dxComponentPrinterLink1: TdxGridReportLink;
|
|
|
|
|
|
cxGridViewRecID: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewFILIAL: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewCODIGO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewCOLOR: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewPRODUCTO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewTIPO_PRODUTO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewGRUPO_PRODUTO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewCOLECCION: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewK38: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewK40: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewK42: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewK44: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewK46: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewK48: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewKT: TcxGridDBColumn;
|
|
|
|
|
|
cxStyleEntrada: TcxStyle;
|
|
|
|
|
|
cxStyleSalida: TcxStyle;
|
|
|
|
|
|
cxStyleRepositoryInforme: TcxStyleRepository;
|
|
|
|
|
|
cxStyleContentInforme: TcxStyle;
|
|
|
|
|
|
cxStyleFooterInforme: TcxStyle;
|
|
|
|
|
|
cxStyleGroupInforme: TcxStyle;
|
|
|
|
|
|
cxStyleHeaderInforme: TcxStyle;
|
|
|
|
|
|
cxStyleSelectionInforme: TcxStyle;
|
|
|
|
|
|
cxStyleTotales: TcxStyle;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
TBXDockablePanel1: TTBXDockablePanel;
|
|
|
|
|
|
frViewParametrosColeccion1: TfrViewParametrosColeccion;
|
|
|
|
|
|
pnlAgrupaciones: TTBXAlignmentPanel;
|
|
|
|
|
|
TBXButton3: TTBXButton;
|
|
|
|
|
|
TBXLabel1: TTBXLabel;
|
2008-05-06 17:55:55 +00:00
|
|
|
|
cxGridViewK36: TcxGridDBColumn;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
procedure cxGridViewKTCustomDrawCell(Sender: TcxCustomGridTableView;
|
|
|
|
|
|
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
|
|
|
|
|
var ADone: Boolean);
|
|
|
|
|
|
procedure cxGridViewK38GetDataText(Sender: TcxCustomGridTableItem;
|
|
|
|
|
|
ARecordIndex: Integer; var AText: String);
|
|
|
|
|
|
procedure cxGridViewKTStylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
protected
|
2007-09-18 17:11:41 +00:00
|
|
|
|
FItems : IBizStockVARELA;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
function GetFocusedView : TcxGridDBTableView; override;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
function GetItems: IBizStockVARELA;
|
|
|
|
|
|
procedure SetItems(const Value: IBizStockVARELA);
|
|
|
|
|
|
|
2007-08-01 16:16:26 +00:00
|
|
|
|
public
|
2007-09-18 17:11:41 +00:00
|
|
|
|
procedure Refresh;
|
|
|
|
|
|
property Items: IBizStockVARELA read GetItems write SetItems;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
procedure Preview; override;
|
|
|
|
|
|
procedure Print; override;
|
|
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
destructor Destroy; override;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
uses uViewGridBase;
|
|
|
|
|
|
|
|
|
|
|
|
{ TfrViewControlGridResumenVentas }
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockVARELA.Preview;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
dxComponentPrinterLink1.ReportTitle.Text := 'Control de stock en almac<61>n';
|
|
|
|
|
|
dxComponentPrinterLink1.Preview;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockVARELA.Print;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
dxComponentPrinterLink1.ReportTitle.Text := 'Control de stock en almac<61>n';
|
|
|
|
|
|
dxComponentPrinterLink1.Print(True, Nil);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
procedure TfrViewControlGridStockVARELA.Refresh;
|
|
|
|
|
|
var
|
|
|
|
|
|
AColeccionesList : TStringList;
|
|
|
|
|
|
AWhere : String;
|
|
|
|
|
|
i : integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AWhere := '';
|
|
|
|
|
|
AWhere := AWhere + ' COLECCION in (';
|
|
|
|
|
|
|
|
|
|
|
|
Items.DataTable.Active := False;
|
|
|
|
|
|
AColeccionesList := frViewParametrosColeccion1.ColeccionesSeleccionadas;
|
|
|
|
|
|
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
try
|
|
|
|
|
|
if AColeccionesList.Count = 0 then
|
|
|
|
|
|
ShowMessage('Debe seleccionar al menos una colecci<63>n en los par<61>metros de la consulta.')
|
|
|
|
|
|
else begin
|
|
|
|
|
|
with Items.DataTable.Where do
|
|
|
|
|
|
begin
|
|
|
|
|
|
Clear;
|
|
|
|
|
|
for i := 0 to AColeccionesList.Count - 1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if i > 0 then
|
|
|
|
|
|
AWhere := AWhere + ', ';
|
|
|
|
|
|
AWhere := AWhere + '''' + AColeccionesList[i] + '''';
|
|
|
|
|
|
end;
|
|
|
|
|
|
AWhere := AWhere + ')';
|
|
|
|
|
|
AddText(AWhere, False);
|
|
|
|
|
|
end;
|
|
|
|
|
|
Items.DataTable.Active := True;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
FreeAndNIL(AColeccionesList);
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-08-01 16:16:26 +00:00
|
|
|
|
procedure TfrViewControlGridStockVARELA.cxGridViewKTCustomDrawCell(
|
|
|
|
|
|
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 TfrViewControlGridStockVARELA.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
FItems := Nil;
|
|
|
|
|
|
frViewParametrosColeccion1.Refresh;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrViewControlGridStockVARELA.GetFocusedView: TcxGridDBTableView;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := cxGridView;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
function TfrViewControlGridStockVARELA.GetItems: IBizStockVARELA;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
begin
|
2007-09-18 17:11:41 +00:00
|
|
|
|
Result := FItems;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockVARELA.SetItems(const Value: IBizStockVARELA);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FItems := Value;
|
|
|
|
|
|
if Assigned(FItems) then
|
|
|
|
|
|
dsDataSource.DataTable := FItems.DataTable;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockVARELA.cxGridViewK38GetDataText(
|
|
|
|
|
|
Sender: TcxCustomGridTableItem; ARecordIndex: Integer;
|
|
|
|
|
|
var AText: String);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if AText = '0' then
|
2007-09-18 17:11:41 +00:00
|
|
|
|
AText := '';
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockVARELA.cxGridViewKTStylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
AStyle := cxStyleTotales;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
destructor TfrViewControlGridStockVARELA.Destroy;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
begin
|
2007-09-18 17:11:41 +00:00
|
|
|
|
FItems := Nil;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|