git-svn-id: https://192.168.0.254/svn/Proyectos.AlonsoYSal_FactuGES/trunk@5 9a1d36f3-7752-2d40-8ccb-50eb49674c68
233 lines
7.3 KiB
ObjectPascal
233 lines
7.3 KiB
ObjectPascal
unit uViewAsientos;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, uViewGrid, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|
cxDataStorage, cxEdit, DB, cxDBData, uDADataTable, cxGridLevel,
|
|
cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
|
|
cxGridTableView, cxGridDBTableView, cxGrid, uBizAsientos, uBizCuentas, ActnList,
|
|
Menus, cxGridBandedTableView, cxGridDBBandedTableView, JvComponent,
|
|
JvFormAutoSize, PngImageList, ImgList, dxPSGlbl, dxPSUtl, dxPSEngn,
|
|
dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns,
|
|
dxPSEdgePatterns, cxIntlPrintSys3, dxPSCore, dxPScxCommon, dxPScxGridLnk,
|
|
cxContainer, cxTextEdit, cxMaskEdit, cxDropDownEdit, cxLookupEdit,
|
|
cxDBLookupEdit, cxDBLookupComboBox, uCustomView, uViewBase,
|
|
uListaIntervalos;
|
|
|
|
type
|
|
IViewAsientos = interface(IViewGrid)
|
|
['{D28EF069-4ADB-40B5-A117-D07C6CFC4A6F}']
|
|
function GetAsientos: IBizAsiento;
|
|
procedure SetAsientos(const Value: IBizAsiento);
|
|
property Asientos: IBizAsiento read GetAsientos write SetAsientos;
|
|
end;
|
|
|
|
TfrViewAsientos = class(TfrViewGrid, IViewAsientos)
|
|
PngImageList: TPngImageList;
|
|
cxGridViewRecID: TcxGridDBColumn;
|
|
cxGridViewCODIGO: TcxGridDBColumn;
|
|
cxGridViewCODIGOCUENTA: TcxGridDBColumn;
|
|
cxGridViewFECHAALTA: TcxGridDBColumn;
|
|
cxGridViewUSUARIO: TcxGridDBColumn;
|
|
cxGridViewIMPORTE: TcxGridDBColumn;
|
|
cxGridViewFORMAPAGO: TcxGridDBColumn;
|
|
cxGridViewDESCRIPCION: TcxGridDBColumn;
|
|
cxGridViewCODIGOPAGO: TcxGridDBColumn;
|
|
cxGridViewFECHAASIENTO: TcxGridDBColumn;
|
|
cxGridViewIMPORTEANT: TcxGridDBColumn;
|
|
cxGridViewIMPORTEPOS: TcxGridDBColumn;
|
|
cxGridViewPUNTEADO: TcxGridDBColumn;
|
|
cxGridViewTIPOASIENTO: TcxGridDBColumn;
|
|
frListaIntervalos: TfrListaIntervalos;
|
|
cxStylePunteado: TcxStyle;
|
|
cxStyleCierre: TcxStyle;
|
|
procedure cxGridViewICONOCustomDrawCell(
|
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|
procedure cxGridActiveTabChanged(Sender: TcxCustomGrid;
|
|
ALevel: TcxGridLevel);
|
|
procedure cxGridViewCustomDrawCell(Sender: TcxCustomGridTableView;
|
|
ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo;
|
|
var ADone: Boolean);
|
|
procedure cxGridViewPUNTEADOCustomDrawCell(
|
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|
procedure cxGridViewStylesGetContentStyle(
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
private
|
|
protected
|
|
FAsientos: IBizAsiento;
|
|
function GetAsientos: IBizAsiento; virtual;
|
|
procedure SetAsientos(const Value: IBizAsiento); virtual;
|
|
public
|
|
property Asientos: IBizAsiento read GetAsientos write SetAsientos;
|
|
end;
|
|
|
|
var
|
|
frViewAsientos: TfrViewAsientos;
|
|
|
|
implementation
|
|
|
|
uses uDataModuleAsientos, uDataModuleCuentas, schAsientosClient_Intf;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
{ TfrViewClientes }
|
|
|
|
{
|
|
******************************* TfrViewAsientos *******************************
|
|
}
|
|
function TfrViewAsientos.GetAsientos: IBizAsiento;
|
|
begin
|
|
Result := FAsientos;
|
|
end;
|
|
|
|
procedure TfrViewAsientos.SetAsientos(const Value: IBizAsiento);
|
|
var
|
|
Nivel: TcxGridLevel;
|
|
auxb: Boolean;
|
|
|
|
begin
|
|
FAsientos := Value;
|
|
|
|
if Assigned(FAsientos) then
|
|
begin
|
|
DADataSource.DataTable := FAsientos.DataTable;
|
|
|
|
if FAsientos.Cuenta.RecordCount > 0 then
|
|
begin
|
|
with FAsientos.Cuenta do
|
|
begin
|
|
First;
|
|
auxb:=True;
|
|
while not EOF do
|
|
begin
|
|
if auxb
|
|
//Ponemos la primera cuenta en el nivel ya creado
|
|
then Nivel := cxGridLevel
|
|
//Creamos un nuevo nivel
|
|
else Nivel := cxGrid.Levels.Add;
|
|
|
|
Nivel.Caption := NOMBRE;
|
|
Nivel.Tag := CODIGO;
|
|
Next;
|
|
auxb := False;
|
|
end;
|
|
First;
|
|
end;
|
|
end
|
|
else cxGrid.RootLevelOptions.DetailTabsPosition := dtpNone;
|
|
|
|
FAsientos.Intervalo := frListaIntervalos.Intervalo;
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TfrViewAsientos.cxGridViewICONOCustomDrawCell(
|
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|
var
|
|
R : TRect;
|
|
begin
|
|
inherited;
|
|
R := AViewInfo.ContentBounds;
|
|
ACanvas.FillRect(R);
|
|
ACanvas.DrawImage(PngImageList, R.Left, R.Top, 0);
|
|
ADone := True;
|
|
end;
|
|
|
|
procedure TfrViewAsientos.cxGridActiveTabChanged(Sender: TcxCustomGrid; ALevel: TcxGridLevel);
|
|
var
|
|
ACursor: TCursor;
|
|
begin
|
|
ACursor := Screen.Cursor;
|
|
Screen.Cursor := crHourGlass;
|
|
|
|
inherited;
|
|
FAsientos.Cuenta.LocalizarCuenta(cxGrid.Levels.Items[ALevel.Index].Tag);
|
|
cxGrid.Levels.Items[ALevel.Index].GridView := cxGridView;
|
|
Screen.Cursor := ACursor;
|
|
end;
|
|
|
|
procedure TfrViewAsientos.cxGridViewCustomDrawCell(
|
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|
var
|
|
IndiceCol : Integer;
|
|
begin
|
|
inherited;
|
|
{
|
|
if not AViewInfo.Selected then
|
|
begin
|
|
//Apariencia de los cierres
|
|
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_AsientosTIPOASIENTO).Index;
|
|
if UpperCase(AViewInfo.GridRecord.DisplayTexts[IndiceCol]) = CTE_CIERRE then
|
|
begin
|
|
ACanvas.Canvas.Font.Color := $000000CC;
|
|
ACanvas.Canvas.Brush.Color := $00CAEEFF;
|
|
end
|
|
else
|
|
begin
|
|
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_AsientosPUNTEADO).Index;
|
|
if UpperCase(AViewInfo.GridRecord.DisplayTexts[IndiceCol]) = IntToStr(CTE_PUNTEADO) then
|
|
begin
|
|
ACanvas.Canvas.Font.Color := $00CAD1D2;
|
|
end;
|
|
end;
|
|
end; }
|
|
end;
|
|
|
|
procedure TfrViewAsientos.cxGridViewPUNTEADOCustomDrawCell(
|
|
Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
|
|
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
|
|
var
|
|
IndiceCol: Integer;
|
|
R : TRect;
|
|
begin
|
|
inherited;
|
|
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName('PUNTEADO').Index;
|
|
if UpperCase(AViewInfo.GridRecord.DisplayTexts[IndiceCol]) = IntToStr(CTE_PUNTEADO) then
|
|
begin
|
|
R := AViewInfo.ContentBounds;
|
|
ACanvas.FillRect(R);
|
|
ACanvas.DrawImage(PngImageList, R.Left, R.Top, 1);
|
|
ADone := True;
|
|
end
|
|
else
|
|
begin
|
|
R := AViewInfo.ContentBounds;
|
|
ACanvas.FillRect(R);
|
|
// ACanvas.DrawImage(PngImageList, R.Left, R.Top, 1);
|
|
ADone := True;
|
|
end;
|
|
end;
|
|
|
|
procedure TfrViewAsientos.cxGridViewStylesGetContentStyle(
|
|
Sender: TcxCustomGridTableView; ARecord: TcxCustomGridRecord;
|
|
AItem: TcxCustomGridTableItem; out AStyle: TcxStyle);
|
|
var
|
|
IndiceCol: Integer;
|
|
ASituacion: string;
|
|
begin
|
|
inherited;
|
|
if Assigned(ARecord) then
|
|
begin
|
|
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_AsientosPUNTEADO).Index;
|
|
ASituacion := VarToStr(ARecord.DisplayTexts[IndiceCol]);
|
|
if ASituacion = IntToStr(CTE_PUNTEADO) then
|
|
AStyle := cxStylePunteado;
|
|
|
|
IndiceCol := (Sender as TcxGridDBTableView).GetColumnByFieldName(fld_AsientosTIPOASIENTO).Index;
|
|
ASituacion := VarToStr(ARecord.DisplayTexts[IndiceCol]);
|
|
if ASituacion = CTE_CIERRE then
|
|
AStyle := cxStyleCierre;
|
|
|
|
end;
|
|
end;
|
|
|
|
end.
|