2007-06-21 16:02:50 +00:00
|
|
|
|
unit uEditorFacturasCliente;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, uEditorGrid, Menus, DB, uDADataTable, JvAppStorage,
|
|
|
|
|
|
JvAppRegistryStorage, JvComponent, JvFormPlacement, ImgList,
|
|
|
|
|
|
PngImageList, StdActns, ActnList, ComCtrls, TB2ExtItems, TBXExtItems,
|
|
|
|
|
|
TBX, TB2Item, TB2Dock, TB2Toolbar, ExtCtrls, JvExControls,
|
|
|
|
|
|
JvNavigationPane, uViewGrid, pngimage, uBizFacturasCliente,
|
|
|
|
|
|
JvComponentBase, StdCtrls, cxControls, cxContainer, cxEdit, cxTextEdit,
|
|
|
|
|
|
cxMaskEdit, cxDropDownEdit, cxCalendar, cxDBEdit, TBXDkPanels,
|
|
|
|
|
|
dxLayoutControl, JvButton, cxRadioGroup, Buttons;
|
|
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
IEditorFacturasCliente = interface(IEditorGrid)
|
|
|
|
|
|
['{597BF875-BD19-4B68-898F-B09982B3360A}']
|
|
|
|
|
|
function GetFacturasCliente: IBizFacturasCliente;
|
|
|
|
|
|
procedure SetFacturasCliente(const Value: IBizFacturasCliente);
|
|
|
|
|
|
property FacturasCliente: IBizFacturasCliente read GetFacturasCliente
|
|
|
|
|
|
write SetFacturasCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
TfEditorFacturasCliente = class(TfEditorGrid, IEditorFacturasCliente)
|
|
|
|
|
|
procedure actEliminarExecute(Sender: TObject);
|
|
|
|
|
|
procedure actModificarExecute(Sender: TObject);
|
|
|
|
|
|
procedure actNuevoExecute(Sender: TObject);
|
2009-03-05 18:57:06 +00:00
|
|
|
|
procedure OnListaAnosChange(Sender: TObject; const Text: string);
|
|
|
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
|
|
|
|
2007-06-21 16:02:50 +00:00
|
|
|
|
private
|
|
|
|
|
|
FFacturasCliente: IBizFacturasCliente;
|
2009-03-05 18:57:06 +00:00
|
|
|
|
|
2007-06-21 16:02:50 +00:00
|
|
|
|
protected
|
|
|
|
|
|
function GetFacturasCliente: IBizFacturasCliente;
|
|
|
|
|
|
procedure SetFacturasCliente(const Value: IBizFacturasCliente);
|
|
|
|
|
|
procedure SetViewGrid(const Value: IViewGrid); override;
|
2009-03-05 18:57:06 +00:00
|
|
|
|
|
2007-06-21 16:02:50 +00:00
|
|
|
|
public
|
|
|
|
|
|
constructor Create(AOwner: TComponent); override;
|
|
|
|
|
|
destructor Destroy; override;
|
|
|
|
|
|
property FacturasCliente: IBizFacturasCliente read GetFacturasCliente write SetFacturasCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
var
|
|
|
|
|
|
fEditorFacturasCliente: TfEditorFacturasCliente;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
uDataModuleFacturasCliente, uViewFacturasCliente,
|
2010-01-04 18:48:47 +00:00
|
|
|
|
uEditorUtils, uDBSelectionList;
|
2007-06-21 16:02:50 +00:00
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
function ShowEditorFacturasCliente (ABizObject : TDADataTableRules) : TModalResult;
|
|
|
|
|
|
var
|
|
|
|
|
|
AEditor: TfEditorFacturasCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AEditor := TfEditorFacturasCliente.Create(Application);
|
|
|
|
|
|
try
|
|
|
|
|
|
AEditor.FacturasCliente := (ABizObject as IBizFacturasCliente);
|
|
|
|
|
|
Result := AEditor.ShowModal;
|
|
|
|
|
|
finally
|
|
|
|
|
|
AEditor.Release;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function ShowSelectEditorFacturasCliente (ABizObject : TDADataTableRules) : TModalResult;
|
|
|
|
|
|
var
|
|
|
|
|
|
AEditor: TfEditorFacturasCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AEditor := TfEditorFacturasCliente.Create(Application);
|
|
|
|
|
|
try
|
|
|
|
|
|
AEditor.FacturasCliente := (ABizObject as IBizFacturasCliente);
|
|
|
|
|
|
// AEditor.SelectionBarVisible := True;
|
|
|
|
|
|
Result := AEditor.ShowModal;
|
|
|
|
|
|
finally
|
|
|
|
|
|
AEditor.Release;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
*************************** TfEditorFacturasCliente ***************************
|
|
|
|
|
|
}
|
|
|
|
|
|
constructor TfEditorFacturasCliente.Create(AOwner: TComponent);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
ViewGrid := CreateView(TfrViewFacturasCliente) as IViewFacturasCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
destructor TfEditorFacturasCliente.Destroy;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FFacturasCliente := NIL;
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorFacturasCliente.actEliminarExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if (Application.MessageBox('<27>Desea borrar esta factura de cliente?', 'Atenci<63>n', MB_YESNO) = IDYES) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
ViewGrid.RefreshGrid;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorFacturasCliente.actModificarExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FacturasCliente.Show;
|
|
|
|
|
|
ViewGrid.RefreshGrid;
|
|
|
|
|
|
ViewGrid.SyncFocusedRecordsFromDataSet;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorFacturasCliente.actNuevoExecute(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
FacturasCliente.Insert;
|
|
|
|
|
|
FacturasCliente.Show;
|
|
|
|
|
|
ViewGrid.RefreshGrid;
|
|
|
|
|
|
ViewGrid.SyncFocusedRecordsFromDataSet;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfEditorFacturasCliente.GetFacturasCliente: IBizFacturasCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FFacturasCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2009-03-05 18:57:06 +00:00
|
|
|
|
procedure TfEditorFacturasCliente.SetFacturasCliente(const Value: IBizFacturasCliente);
|
2007-06-21 16:02:50 +00:00
|
|
|
|
begin
|
|
|
|
|
|
FFacturasCliente := Value;
|
2009-03-05 18:57:06 +00:00
|
|
|
|
|
|
|
|
|
|
if Assigned(FFacturasCliente) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
//Se guarda el where de la sentencia origen, por si el editor tiene filtros que
|
|
|
|
|
|
//afecten a este where y en un futuro se desea volver al where origen (filtro de a<>o))
|
|
|
|
|
|
WhereDataTable := FFacturasCliente.DataTable.Where.Clause;
|
|
|
|
|
|
|
|
|
|
|
|
dsDataTable.DataTable := FFacturasCliente.DataTable;
|
|
|
|
|
|
if Assigned(ViewGrid) then
|
|
|
|
|
|
(ViewGrid as IViewFacturasCliente).FacturasCliente := FacturasCliente;
|
|
|
|
|
|
end;
|
2007-06-21 16:02:50 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorFacturasCliente.SetViewGrid(const Value: IViewGrid);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
if Assigned(ViewGrid) and Assigned(FacturasCliente) then
|
|
|
|
|
|
(ViewGrid as IViewFacturasCliente).FacturasCliente := FFacturasCliente;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2009-03-05 18:57:06 +00:00
|
|
|
|
procedure TfEditorFacturasCliente.FormShow(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
ListaAnos := dmFacturasCliente.DarListaAnosFacturas;
|
|
|
|
|
|
cbxListaAnos.OnChange := OnListaAnosChange; //OJO SIEMPRE ANTES DEL INHERITED
|
|
|
|
|
|
|
|
|
|
|
|
inherited;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfEditorFacturasCliente.OnListaAnosChange(Sender: TObject; const Text: string);
|
2010-01-04 18:48:47 +00:00
|
|
|
|
var
|
|
|
|
|
|
aAux : ISelectedRowList;
|
2009-03-05 18:57:06 +00:00
|
|
|
|
begin
|
|
|
|
|
|
dmFacturasCliente.FiltrarAno(FacturasCliente, WhereDataTable, Text);
|
|
|
|
|
|
if FacturasCliente.DataTable.Active then
|
|
|
|
|
|
actRefrescar.Execute;
|
2010-01-04 18:48:47 +00:00
|
|
|
|
|
|
|
|
|
|
// Quitar las selecciones que hubiera anteriormente porque ya no valen
|
|
|
|
|
|
if Supports(FacturasCliente, ISelectedRowList, aAux) then
|
|
|
|
|
|
if (aAux.SelectedRows.Count > 0) then
|
|
|
|
|
|
aAux.SelectedRows.Clear;
|
2009-03-05 18:57:06 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
2007-06-21 16:02:50 +00:00
|
|
|
|
initialization
|
|
|
|
|
|
RegisterEditor(IBizFacturasCliente, ShowEditorFacturasCliente, etItems);
|
|
|
|
|
|
RegisterEditor(IBizFacturasCliente, ShowSelectEditorFacturasCliente, etSelectItems);
|
|
|
|
|
|
|
|
|
|
|
|
finalization
|
|
|
|
|
|
|
|
|
|
|
|
end.
|