121 lines
3.8 KiB
ObjectPascal
121 lines
3.8 KiB
ObjectPascal
|
|
unit uViewControlVentaProceso;
|
||
|
|
|
||
|
|
interface
|
||
|
|
|
||
|
|
uses
|
||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
|
|
Dialogs, uViewControlBase, ActnList, ImgList, PngImageList, uViewGrid,
|
||
|
|
uViewControlGrid, uViewSumarios, TBXDkPanels, StdCtrls,
|
||
|
|
uViewAgrupaciones, uCustomView, uViewBase, uViewColumnas, ComCtrls,
|
||
|
|
TB2Dock, uViewParametrosControlGrid, uBizControlesBase, cxStyles,
|
||
|
|
cxCustomData, cxGraphics, cxFilter, cxData, cxDataStorage, cxEdit, DB,
|
||
|
|
cxDBData, cxGridLevel, cxClasses, cxControls, cxGridCustomView,
|
||
|
|
cxGridCustomTableView, cxGridTableView, cxGridDBTableView, cxGrid,
|
||
|
|
cxTextEdit, uViewControGridlVentaProceso, uViewFiltros;
|
||
|
|
|
||
|
|
type
|
||
|
|
IViewControlVentaProceso = interface(IViewControlBase)
|
||
|
|
['{C3433C18-BB61-4046-BC0B-CE783A6F7189}']
|
||
|
|
end;
|
||
|
|
|
||
|
|
TfrViewControlVentaProceso = class(TfrViewControlBase, IViewControlVentaProceso)
|
||
|
|
frViewControlGridVentaProceso1: TfrViewControlGridVentaProceso;
|
||
|
|
procedure actRefrescarExecute(Sender: TObject);
|
||
|
|
protected
|
||
|
|
FModificado : Boolean;
|
||
|
|
procedure OnViewControlGridChanged(Sender : TObject);
|
||
|
|
procedure OnFilterChanged(Sender : TObject);
|
||
|
|
public
|
||
|
|
constructor Create(AOwner: TComponent); override;
|
||
|
|
procedure Refresh; override;
|
||
|
|
end;
|
||
|
|
|
||
|
|
implementation
|
||
|
|
|
||
|
|
uses uDataModuleVentasProceso, uBizControlVentasProceso, uBizVentasProceso;
|
||
|
|
|
||
|
|
{$R *.dfm}
|
||
|
|
|
||
|
|
{ TfrViewControlVentaProceso }
|
||
|
|
|
||
|
|
constructor TfrViewControlVentaProceso.Create(AOwner: TComponent);
|
||
|
|
begin
|
||
|
|
inherited;
|
||
|
|
frViewControlGridVentaProceso1.OnViewChanged := OnViewControlGridChanged;
|
||
|
|
frViewControlGridVentaProceso1.OnFilterChanged := OnFilterChanged;
|
||
|
|
frViewColumnas1.ViewControlGrid := frViewControlGridVentaProceso1;
|
||
|
|
frViewAgrupaciones1.ViewControlGrid := frViewControlGridVentaProceso1;
|
||
|
|
frViewSumarios1.ViewControlGrid := frViewControlGridVentaProceso1;
|
||
|
|
frViewFiltros1.ViewControlGrid := frViewControlGridVentaProceso1;
|
||
|
|
end;
|
||
|
|
|
||
|
|
procedure TfrViewControlVentaProceso.Refresh;
|
||
|
|
var
|
||
|
|
AColumns : TStringList;
|
||
|
|
begin
|
||
|
|
inherited;
|
||
|
|
ShowHourglassCursor;
|
||
|
|
actRefrescar.Enabled := False;
|
||
|
|
|
||
|
|
frViewControlGridVentaProceso1.OnViewChanged := nil;
|
||
|
|
frViewControlGridVentaProceso1.OnFilterChanged := nil;
|
||
|
|
|
||
|
|
try
|
||
|
|
// Calcular las columnas a pedir al servidor
|
||
|
|
AColumns := frViewColumnas1.GetCheckedColumns;
|
||
|
|
AColumns.Duplicates := dupIgnore;
|
||
|
|
AColumns.AddStrings(frViewAgrupaciones1.GetAgrupaciones);
|
||
|
|
|
||
|
|
(Control as IBizControlVentasProceso).Items.VisibleColumns := AColumns.CommaText;
|
||
|
|
with (Control as IBizControlVentasProceso).Items.DataTable do
|
||
|
|
begin
|
||
|
|
DisableControls;
|
||
|
|
try
|
||
|
|
Active := False;
|
||
|
|
LoadSchema;
|
||
|
|
Active := True;
|
||
|
|
|
||
|
|
frViewColumnas1.Execute;
|
||
|
|
frViewAgrupaciones1.Execute;
|
||
|
|
frViewSumarios1.Refresh;
|
||
|
|
frViewFiltros1.Refresh;
|
||
|
|
pnlTareas.Visible := True;
|
||
|
|
|
||
|
|
if Assigned(FOnViewChanged) then
|
||
|
|
FOnViewChanged(Self);
|
||
|
|
finally
|
||
|
|
EnableControls;
|
||
|
|
frViewControlGridVentaProceso1.Refresh;
|
||
|
|
frViewControlGridVentaProceso1.ExpandirTodo;
|
||
|
|
frViewControlGridVentaProceso1.GotoFirst;
|
||
|
|
end;
|
||
|
|
end;
|
||
|
|
finally
|
||
|
|
FreeAndNil(AColumns);
|
||
|
|
frViewControlGridVentaProceso1.OnViewChanged := OnViewControlGridChanged;
|
||
|
|
frViewControlGridVentaProceso1.OnFilterChanged := OnFilterChanged;
|
||
|
|
actRefrescar.Enabled := True;
|
||
|
|
HideHourglassCursor;
|
||
|
|
end;
|
||
|
|
end;
|
||
|
|
|
||
|
|
procedure TfrViewControlVentaProceso.actRefrescarExecute(Sender: TObject);
|
||
|
|
begin
|
||
|
|
inherited;
|
||
|
|
Refresh;
|
||
|
|
end;
|
||
|
|
|
||
|
|
procedure TfrViewControlVentaProceso.OnViewControlGridChanged(
|
||
|
|
Sender: TObject);
|
||
|
|
begin
|
||
|
|
if Assigned(Self.OnViewChanged) then
|
||
|
|
Self.OnViewChanged(Self);
|
||
|
|
end;
|
||
|
|
|
||
|
|
procedure TfrViewControlVentaProceso.OnFilterChanged(Sender: TObject);
|
||
|
|
begin
|
||
|
|
frViewFiltros1.Refresh;
|
||
|
|
end;
|
||
|
|
|
||
|
|
end.
|