git-svn-id: https://192.168.0.254/svn/Proyectos.AlonsoYSal_FactuGES2/trunk@6 40301925-124e-1c4e-b97d-170ad7a8785b
204 lines
6.1 KiB
ObjectPascal
204 lines
6.1 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, dxPSCore, dxPScxCommon, dxPScxGrid6Lnk,
|
|
cxGridCustomPopupMenu, cxGridPopupMenu, uViewFiltroBase, TB2Item, TBX,
|
|
TB2Toolbar, TBXDkPanels, TB2Dock, dxPgsDlg, uDAInterfaces, cxCalendar,
|
|
cxImageComboBox, cxTextEdit, cxCurrencyEdit, ComCtrls, ToolWin, cxButtonEdit,
|
|
uApuntesController, StdCtrls, cxContainer, ExtCtrls, dxLayoutControl;
|
|
|
|
type
|
|
IViewApuntes = interface(IViewDetallesGenerico)
|
|
['{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;
|
|
ToolButton3: TToolButton;
|
|
cxGridViewNUM_ORDEN: TcxGridDBColumn;
|
|
eDescuadre: TcxCurrencyEdit;
|
|
Label1: TLabel;
|
|
Panel1: TPanel;
|
|
Panel2: TPanel;
|
|
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);
|
|
procedure cxGridViewDataControllerSummaryAfterSummary(ASender: TcxDataSummary);
|
|
|
|
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;
|
|
procedure GotoLast; override;
|
|
|
|
end;
|
|
|
|
implementation
|
|
{$R *.dfm}
|
|
|
|
|
|
{ TfrViewApuntes }
|
|
{
|
|
******************************* TfrViewApuntes *******************************
|
|
}
|
|
function TfrViewApuntes.GetApuntes: IBizApunte;
|
|
begin
|
|
Result := FApuntes;
|
|
end;
|
|
|
|
procedure TfrViewApuntes.GotoLast;
|
|
begin
|
|
inherited;
|
|
|
|
if Assigned(FApuntes) then
|
|
begin
|
|
cxGrid.SetFocus;
|
|
cxGridViewCONCEPTO.Focused := true;
|
|
end;
|
|
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;
|
|
FController.Anadir(Apuntes);
|
|
// 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.cxGridViewDataControllerSummaryAfterSummary(ASender: TcxDataSummary);
|
|
var
|
|
Descuadre: Double;
|
|
|
|
begin
|
|
inherited;
|
|
|
|
Descuadre := 0;
|
|
|
|
if not VarIsNull(cxGridView.DataController.Summary.FooterSummaryValues[0]) then
|
|
Descuadre := cxGridView.DataController.Summary.FooterSummaryValues[0];
|
|
|
|
if not VarIsNull(cxGridView.DataController.Summary.FooterSummaryValues[1]) then
|
|
Descuadre := Descuadre - cxGridView.DataController.Summary.FooterSummaryValues[1];
|
|
|
|
eDescuadre.Value := Descuadre;
|
|
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.
|
|
|