FactuGES2/Source/Modulos/Contabilidad/Views/uViewApuntes.pas

167 lines
5.0 KiB
ObjectPascal

unit uViewApuntes;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uViewDetallesGenerico, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, DB, cxDBData, uDADataTable, cxGridLevel,
cxClasses, cxControls, cxGridCustomView, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGrid, uBizApuntes, ActnList, Menus,
cxGridBandedTableView, cxGridDBBandedTableView, JvComponent,
JvFormAutoSize, PngImageList, ImgList, dxPSGlbl, dxPSUtl, dxPSEngn,
dxPrnPg, dxBkgnd, dxWrap, dxPrnDev, dxPSCompsProvider, dxPSFillPatterns,
dxPSEdgePatterns, cxIntlPrintSys3, dxPSCore, dxPScxCommon, dxPScxGridLnk,
cxGridCustomPopupMenu, cxGridPopupMenu, uViewFiltroBase, TB2Item, TBX,
TB2Toolbar, TBXDkPanels, TB2Dock, dxPgsDlg, uDAInterfaces, cxCalendar,
cxImageComboBox, cxTextEdit, cxCurrencyEdit, ComCtrls, ToolWin, cxButtonEdit,
uApuntesController;
type
IViewApuntes = interface
['{BEEA820D-80E5-4B7F-8659-A9C37BAFECFF}']
function GetApuntes: IBizApunte;
procedure SetApuntes(const Value: IBizApunte);
property Apuntes: IBizApunte read GetApuntes write SetApuntes;
end;
TfrViewApuntes = class(TfrViewDetallesGenerico, IViewApuntes)
cxGridViewCONCEPTO: TcxGridDBColumn;
cxGridViewREF_SUBCUENTA: TcxGridDBColumn;
PngImageList: TPngImageList;
cxGridViewSUBCUENTA: TcxGridDBColumn;
cxGridViewDEBE: TcxGridDBColumn;
cxGridViewHABER: TcxGridDBColumn;
cxGridViewDOCUMENTO: TcxGridDBColumn;
cxGridViewID_ASIENTO: TcxGridDBColumn;
actElegirSubCuenta: TAction;
procedure cxGridViewIDCustomDrawCell(Sender: TcxCustomGridTableView; ACanvas: TcxCanvas;
AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean);
procedure cxGridViewREF_SUBCUENTAPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
procedure actElegirSubCuentaExecute(Sender: TObject);
procedure cxGridViewDEBEPropertiesEditValueChanged(Sender: TObject);
procedure cxGridViewHABERPropertiesEditValueChanged(Sender: TObject);
protected
FApuntes: IBizApunte;
FController : IApuntesController;
function GetApuntes: IBizApunte; virtual;
procedure SetApuntes(const Value: IBizApunte); virtual;
procedure AnadirInterno; override;
procedure ModificarInterno; override;
public
property Apuntes: IBizApunte read GetApuntes write SetApuntes;
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
end;
implementation
{$R *.dfm}
{ TfrViewApuntes }
{
******************************* TfrViewApuntes *******************************
}
function TfrViewApuntes.GetApuntes: IBizApunte;
begin
Result := FApuntes;
end;
procedure TfrViewApuntes.ModificarInterno;
begin
inherited;
{
with TDireccionesContactoController.Create do
Ver((dsDetalles.DataTable) as IBizDireccionesContacto);
}
end;
procedure TfrViewApuntes.SetApuntes(const Value: IBizApunte);
begin
FApuntes := Value;
if Assigned(FApuntes) then
dsDetalles.DataTable := FApuntes.DataTable;
end;
procedure TfrViewApuntes.actElegirSubCuentaExecute(Sender: TObject);
begin
inherited;
FController.ElegirSubCuenta(Apuntes);
end;
procedure TfrViewApuntes.AnadirInterno;
begin
inherited;
// try
// with TApuntesController.Create do
// begin
// Anadir(Apuntes);
// Ver(Apuntes);
// end;
// finally
// if (dsDetalles.DataTable.State in dsEditModes) then
// dsDetalles.DataTable.Post;
// end;
end;
constructor TfrViewApuntes.Create(AOwner: TComponent);
begin
inherited;
FController := TApuntesController.Create;
end;
procedure TfrViewApuntes.cxGridViewDEBEPropertiesEditValueChanged(Sender: TObject);
begin
inherited;
{
//Tengo que hacer esto para que se haga un post del apunte y pueda ver el nuevo valor
if cxGridView.Controller.EditingController.IsEditing then
cxGridView.Controller.EditingController.Edit.PostEditValue;
FController.AsignarDEBE(Apuntes);
}
end;
procedure TfrViewApuntes.cxGridViewHABERPropertiesEditValueChanged(
Sender: TObject);
begin
inherited;
//Tengo que hacer esto para que se haga un post del apunte y pueda ver el nuevo valor
{ if cxGridView.Controller.EditingController.IsEditing then
cxGridView.Controller.EditingController.Edit.PostEditValue;
FController.AsignarHABER(Apuntes);
}
end;
procedure TfrViewApuntes.cxGridViewIDCustomDrawCell(
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 TfrViewApuntes.cxGridViewREF_SUBCUENTAPropertiesButtonClick(Sender: TObject; AButtonIndex: Integer);
begin
inherited;
actElegirSubCuenta.Execute;
end;
destructor TfrViewApuntes.Destroy;
begin
FController := Nil;
inherited;
end;
end.