2007-08-01 16:16:26 +00:00
|
|
|
|
unit uViewControGridStockPrendasCentros;
|
|
|
|
|
|
|
|
|
|
|
|
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, Grids, DBGrids, uDAInterfaces, TBXDkPanels,
|
2008-01-31 17:16:03 +00:00
|
|
|
|
uViewParametrosCentro, uViewParametrosColeccion, TB2Dock, uBizStock,
|
|
|
|
|
|
uViewParametrosFecha;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
IViewControlGridStockPrendasCentros = interface(IViewGrid)
|
|
|
|
|
|
['{E6251B25-10FE-4D0C-94CD-0E554F88B54D}']
|
2007-09-18 17:11:41 +00:00
|
|
|
|
function GetItems: IBizStockPrendasCentros;
|
|
|
|
|
|
procedure SetItems(const Value: IBizStockPrendasCentros);
|
|
|
|
|
|
property Items: IBizStockPrendasCentros read GetItems write SetItems;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
TfrViewControlGridStockPrendasCentros = class(TfrViewGrid, IViewControlGridStockPrendasCentros)
|
|
|
|
|
|
dxComponentPrinterLink1: TdxGridReportLink;
|
|
|
|
|
|
cxStyleEntrada: TcxStyle;
|
|
|
|
|
|
cxStyleSalida: TcxStyle;
|
|
|
|
|
|
cxStyleRepositoryInforme: TcxStyleRepository;
|
|
|
|
|
|
cxStyleContentInforme: TcxStyle;
|
|
|
|
|
|
cxStyleFooterInforme: TcxStyle;
|
|
|
|
|
|
cxStyleGroupInforme: TcxStyle;
|
|
|
|
|
|
cxStyleHeaderInforme: TcxStyle;
|
|
|
|
|
|
cxStyleSelectionInforme: TcxStyle;
|
|
|
|
|
|
cxStyleTotales: TcxStyle;
|
|
|
|
|
|
cxGridViewCODIGO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewPRODUCTO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewTIPO_PRODUCTO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewGRUPO_PRODUCTO: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewCOLECCION: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewCOLOR: TcxGridDBColumn;
|
|
|
|
|
|
cxGridView38: TcxGridDBColumn;
|
|
|
|
|
|
cxGridView40: TcxGridDBColumn;
|
|
|
|
|
|
cxGridView42: TcxGridDBColumn;
|
|
|
|
|
|
cxGridView44: TcxGridDBColumn;
|
|
|
|
|
|
cxGridView46: TcxGridDBColumn;
|
|
|
|
|
|
cxGridView48: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewTOTAL: TcxGridDBColumn;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
TBXDockablePanel1: TTBXDockablePanel;
|
|
|
|
|
|
frViewParametrosColeccion1: TfrViewParametrosColeccion;
|
|
|
|
|
|
pnlAgrupaciones: TTBXAlignmentPanel;
|
|
|
|
|
|
TBXButton3: TTBXButton;
|
|
|
|
|
|
TBXLabel1: TTBXLabel;
|
2008-01-31 17:16:03 +00:00
|
|
|
|
frViewParametrosFecha1: TfrViewParametrosFecha;
|
2008-05-06 17:55:55 +00:00
|
|
|
|
cxGridView36: TcxGridDBColumn;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
procedure cxGridViewKTCustomDrawCell(Sender: TcxCustomGridTableView;
|
|
|
|
|
|
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
|
|
|
|
|
var ADone: Boolean);
|
|
|
|
|
|
procedure cxGridViewCOLUMN7StylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
procedure cxGridView38GetDataText(Sender: TcxCustomGridTableItem; ARecordIndex: Integer; var AText: String);
|
|
|
|
|
|
protected
|
2007-09-18 17:11:41 +00:00
|
|
|
|
FItems : IBizStockPrendasCentros;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
function GetFocusedView : TcxGridDBTableView; override;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
function GetItems: IBizStockPrendasCentros;
|
|
|
|
|
|
procedure SetItems(const Value: IBizStockPrendasCentros);
|
|
|
|
|
|
|
2007-08-01 16:16:26 +00:00
|
|
|
|
public
|
2007-09-18 17:11:41 +00:00
|
|
|
|
property Items: IBizStockPrendasCentros 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;
|
|
|
|
|
|
procedure Refresh;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
uses uViewGridBase;
|
|
|
|
|
|
|
|
|
|
|
|
{ TfrViewControlGridResumenVentas }
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockPrendasCentros.Preview;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
// dxComponentPrinterLink1.ReportTitle.Text := 'Resumen de stock por centros de colecci<63>n: ' + frViewFiltrosStock1.cbColeccion.Text;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
dxComponentPrinterLink1.Preview;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockPrendasCentros.Print;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
// dxComponentPrinterLink1.ReportTitle.Text := 'Resumen de stock por centros de colecci<63>n: ' + frViewFiltrosStock1.cbColeccion.Text;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
dxComponentPrinterLink1.Print(True, Nil);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockPrendasCentros.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;
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
destructor TfrViewControlGridStockPrendasCentros.Destroy;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FItems := Nil;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-08-01 16:16:26 +00:00
|
|
|
|
constructor TfrViewControlGridStockPrendasCentros.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 TfrViewControlGridStockPrendasCentros.GetFocusedView: TcxGridDBTableView;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := cxGridView;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
function TfrViewControlGridStockPrendasCentros.GetItems: IBizStockPrendasCentros;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
begin
|
2007-09-18 17:11:41 +00:00
|
|
|
|
Result := FItems;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockPrendasCentros.SetItems(const Value: IBizStockPrendasCentros);
|
|
|
|
|
|
begin
|
|
|
|
|
|
FItems := Value;
|
|
|
|
|
|
if Assigned(FItems) then
|
|
|
|
|
|
dsDataSource.DataTable := FItems.DataTable;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockPrendasCentros.cxGridViewCOLUMN7StylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
AStyle := cxStyleTotales;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockPrendasCentros.Refresh;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
var
|
2008-01-31 17:16:03 +00:00
|
|
|
|
AFecha : Variant;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
AColeccionesList : TStringList;
|
|
|
|
|
|
ACentrosList : TStringList;
|
|
|
|
|
|
AWhereColeccion : String;
|
|
|
|
|
|
AWhereCentro : String;
|
2008-01-31 17:16:03 +00:00
|
|
|
|
AWhereFecha : String;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
AWhere : String;
|
|
|
|
|
|
i : integer;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
begin
|
2007-09-18 17:11:41 +00:00
|
|
|
|
AColeccionesList := Nil;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(FItems) then
|
|
|
|
|
|
Items.DataTable.Active := False;
|
|
|
|
|
|
AColeccionesList := frViewParametrosColeccion1.ColeccionesSeleccionadas;
|
2008-01-31 17:16:03 +00:00
|
|
|
|
AFecha := frViewParametrosFecha1.Fecha;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
|
|
|
|
|
|
ShowHourglassCursor;
|
|
|
|
|
|
try
|
|
|
|
|
|
if Assigned(AColeccionesList) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
AWhereColeccion := '';
|
|
|
|
|
|
if AColeccionesList.Count = 0 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ShowMessage('Debe seleccionar al menos una colecci<63>n en los par<61>metros de la consulta.');
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end
|
|
|
|
|
|
else begin
|
|
|
|
|
|
AWhereColeccion := AWhereColeccion + ' COLECCION in (';
|
|
|
|
|
|
for i := 0 to AColeccionesList.Count - 1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if i > 0 then
|
|
|
|
|
|
AWhereColeccion := AWhereColeccion + ', ';
|
|
|
|
|
|
AWhereColeccion := AWhereColeccion + '''' + AColeccionesList[i] + '''';
|
|
|
|
|
|
end;
|
|
|
|
|
|
AWhereColeccion := AWhereColeccion + ')';
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-01-31 17:16:03 +00:00
|
|
|
|
AWhereFecha := '';
|
|
|
|
|
|
if not VarIsNull(AFecha) then
|
|
|
|
|
|
AWhereFecha := '(FECHA >= ''' + VarToStr(AFecha) + ''')';
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
AWhere := '';
|
|
|
|
|
|
if AWhereColeccion <> '' then
|
|
|
|
|
|
AWhere := AWhere + AWhereColeccion;
|
|
|
|
|
|
|
2008-01-31 17:16:03 +00:00
|
|
|
|
if AWhereFecha <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if AWhere <> '' then
|
|
|
|
|
|
AWhere := AWhere + ' AND ';
|
|
|
|
|
|
AWhere := AWhere + AWhereFecha;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
Items.DataTable.Where.Clear;
|
2007-09-24 18:08:48 +00:00
|
|
|
|
Items.DataTable.Where.AddText(AWhere, False);
|
2007-09-18 17:11:41 +00:00
|
|
|
|
Items.DataTable.Active := True;
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
FreeAndNIL(AColeccionesList);
|
|
|
|
|
|
end;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockPrendasCentros.cxGridView38GetDataText(
|
|
|
|
|
|
Sender: TcxCustomGridTableItem; ARecordIndex: Integer;
|
|
|
|
|
|
var AText: String);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if AText = '0' then
|
|
|
|
|
|
AText := '';
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|