2007-08-01 16:16:26 +00:00
|
|
|
|
unit uViewControGridStockEDI;
|
|
|
|
|
|
|
|
|
|
|
|
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,
|
2007-09-18 17:11:41 +00:00
|
|
|
|
cxEditRepositoryItems, uDataModuleStock, uDAInterfaces, TBXDkPanels,
|
|
|
|
|
|
uViewParametrosCentro, uCustomView, uViewBase, uViewParametrosControlGrid,
|
|
|
|
|
|
uViewParametrosColeccion, TB2Dock, uBizStock;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
IViewControlGridStockEDI = interface(IViewGrid)
|
|
|
|
|
|
['{9342442A-28CD-4EA9-95C3-79B1B5302BCE}']
|
2007-09-18 17:11:41 +00:00
|
|
|
|
function GetItems: IBizStockEDI;
|
|
|
|
|
|
procedure SetItems(const Value: IBizStockEDI);
|
|
|
|
|
|
property Items: IBizStockEDI read GetItems write SetItems;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
TfrViewControlGridStockEDI = class(TfrViewGrid, IViewControlGridStockEDI)
|
|
|
|
|
|
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;
|
|
|
|
|
|
cxGridViewE38: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewE40: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewE42: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewE44: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewE46: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewE48: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewTE: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewS38: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewS40: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewS42: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewS44: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewS46: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewS48: TcxGridDBColumn;
|
|
|
|
|
|
cxGridViewTS: 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;
|
|
|
|
|
|
frViewParametrosCentro1: TfrViewParametrosCentro;
|
|
|
|
|
|
TBXAlignmentPanel1: TTBXAlignmentPanel;
|
|
|
|
|
|
TBXButton1: TTBXButton;
|
|
|
|
|
|
TBXLabel2: TTBXLabel;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
procedure cxGridViewKTCustomDrawCell(Sender: TcxCustomGridTableView;
|
|
|
|
|
|
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
|
|
|
|
|
var ADone: Boolean);
|
|
|
|
|
|
procedure cxGridViewStylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
procedure cxGridViewE38GetDataText(Sender: TcxCustomGridTableItem;
|
|
|
|
|
|
ARecordIndex: Integer; var AText: String);
|
|
|
|
|
|
procedure cxGridViewTEStylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
protected
|
2007-09-18 17:11:41 +00:00
|
|
|
|
FItems : IBizStockEDI;
|
|
|
|
|
|
function GetItems: IBizStockEDI;
|
|
|
|
|
|
procedure SetItems(const Value: IBizStockEDI);
|
|
|
|
|
|
|
2007-08-01 16:16:26 +00:00
|
|
|
|
public
|
2007-09-18 17:11:41 +00:00
|
|
|
|
property Items: IBizStockEDI 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 TfrViewControlGridStockEDI.Preview;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
// dxComponentPrinterLink1.ReportTitle.Text := 'Control de stock de colecci<63>n ' + frViewFiltrosStock1.cbColeccion.Text + ' en centro(s) ' + frViewFiltrosStock1.ccbCentro.Text;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
dxComponentPrinterLink1.Preview;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockEDI.Print;
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
// dxComponentPrinterLink1.ReportTitle.Text := 'Control de stock de colecci<63>n ' + frViewFiltrosStock1.cbColeccion.Text + ' en centro(s) ' + frViewFiltrosStock1.ccbCentro.Text;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
dxComponentPrinterLink1.Print(True, Nil);
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockEDI.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 TfrViewControlGridStockEDI.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-09-18 17:11:41 +00:00
|
|
|
|
FItems := Nil;
|
|
|
|
|
|
frViewParametrosColeccion1.Refresh;
|
|
|
|
|
|
frViewParametrosCentro1.Refresh;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
procedure TfrViewControlGridStockEDI.SetItems(const Value: IBizStockEDI);
|
2007-08-01 16:16:26 +00:00
|
|
|
|
begin
|
2007-09-18 17:11:41 +00:00
|
|
|
|
FItems := Value;
|
|
|
|
|
|
if Assigned(FItems) then
|
|
|
|
|
|
dsDataSource.DataTable := FItems.DataTable;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockEDI.cxGridViewStylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
//
|
|
|
|
|
|
if Assigned(AItem) then
|
|
|
|
|
|
if (AItem.Index = cxGridViewTE.Index) or
|
|
|
|
|
|
(AItem.Index = cxGridViewTS.Index) or
|
|
|
|
|
|
(AItem.Index = cxGridViewKT.Index) then
|
|
|
|
|
|
AStyle := cxStyleTotales;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockEDI.cxGridViewE38GetDataText(
|
|
|
|
|
|
Sender: TcxCustomGridTableItem; ARecordIndex: Integer;
|
|
|
|
|
|
var AText: String);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if AText = '0' then
|
|
|
|
|
|
AText := '';
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewControlGridStockEDI.cxGridViewTEStylesGetContentStyle(
|
|
|
|
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
|
|
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
AStyle := cxStyleTotales;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
destructor TfrViewControlGridStockEDI.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;
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
procedure TfrViewControlGridStockEDI.Refresh;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
var
|
2007-09-18 17:11:41 +00:00
|
|
|
|
AColeccionesList : TStringList;
|
|
|
|
|
|
ACentrosList : TStringList;
|
|
|
|
|
|
AWhereColeccion : String;
|
|
|
|
|
|
AWhereCentro : String;
|
|
|
|
|
|
AWhere : String;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
i : integer;
|
|
|
|
|
|
begin
|
2007-09-18 17:11:41 +00:00
|
|
|
|
AColeccionesList := Nil;
|
|
|
|
|
|
ACentrosList := Nil;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(FItems) then
|
|
|
|
|
|
Items.DataTable.Active := False;
|
|
|
|
|
|
AColeccionesList := frViewParametrosColeccion1.ColeccionesSeleccionadas;
|
|
|
|
|
|
ACentrosList := frViewParametrosCentro1.CentrosSeleccionados;
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
|
if Assigned(ACentrosList) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
AWhereCentro := '';
|
|
|
|
|
|
if ACentrosList.Count = 0 then
|
|
|
|
|
|
begin
|
|
|
|
|
|
ShowMessage('Debe seleccionar al menos un centro en los par<61>metros de la consulta.');
|
|
|
|
|
|
Exit;
|
|
|
|
|
|
end
|
|
|
|
|
|
else begin
|
|
|
|
|
|
AWhereCentro := AWhereCentro + ' CENTRO in (';
|
|
|
|
|
|
for i := 0 to ACentrosList.Count - 1 do
|
|
|
|
|
|
begin
|
|
|
|
|
|
if i > 0 then
|
|
|
|
|
|
AWhereCentro := AWhereCentro + ', ';
|
|
|
|
|
|
AWhereCentro := AWhereCentro + '''' + ACentrosList[i] + '''';
|
|
|
|
|
|
end;
|
|
|
|
|
|
AWhereCentro := AWhereCentro + ')';
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
AWhere := '';
|
|
|
|
|
|
if AWhereColeccion <> '' then
|
|
|
|
|
|
AWhere := AWhere + AWhereColeccion;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
if AWhereCentro <> '' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
if AWhere <> '' then
|
|
|
|
|
|
AWhere := AWhere + ' AND ';
|
|
|
|
|
|
AWhere := AWhere + AWhereCentro;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
Items.DataTable.Where.Clear;
|
|
|
|
|
|
Items.DataTable.Where.AddText(AWhere, False);
|
|
|
|
|
|
Items.DataTable.Active := True;
|
|
|
|
|
|
|
|
|
|
|
|
finally
|
|
|
|
|
|
HideHourglassCursor;
|
|
|
|
|
|
FreeAndNIL(AColeccionesList);
|
|
|
|
|
|
FreeAndNIL(ACentrosList);
|
|
|
|
|
|
end;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2007-09-18 17:11:41 +00:00
|
|
|
|
function TfrViewControlGridStockEDI.GetItems: IBizStockEDI;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
begin
|
2007-09-18 17:11:41 +00:00
|
|
|
|
Result := FItems;
|
2007-08-01 16:16:26 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|