2007-09-12 14:11:44 +00:00
{
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Copyright ( <EFBFBD> ) 2 0 0 6 . Rodax Software.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Los contenidos de este fichero son propiedad de Rodax Software titular del
copyright. Este fichero s<EFBFBD> lo podr<EFBFBD> ser copiado, distribuido y utilizado,
en su totalidad o en parte, con el permiso escrito de Rodax Software, o de
acuerdo con los t<EFBFBD> rminos y condiciones establecidas en el acuerdo/ contrato
bajo el que se suministra.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Web: www. rodax- software. com
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Fecha primera versi<EFBFBD> n: 2 2 - 0 5 - 2 0 0 6
Versi<EFBFBD> n actual: 1.0 . 0
Fecha versi<EFBFBD> n actual: 2 2 - 0 5 - 2 0 0 6
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Modificaciones:
Fecha Comentarios
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
}
unit uEditorFormaPago;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Grids, DBGrids, StdCtrls, Mask, DBCtrls, DB,
uBizFormasPago, uBizFormasPagoPlazos,
uFormasPagoController, uFormasPagoPlazosController,
uDADataTable, uIEditorFormaPago, ActnList, ExtCtrls, JvExControls,
JvComponent, JvEnterTab, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
cxDataStorage, cxEdit, cxDBData, cxSpinEdit, cxGridCustomTableView,
cxGridTableView, cxGridDBTableView, cxGridLevel, cxClasses, cxControls,
2007-09-24 11:09:48 +00:00
cxGridCustomView, cxGrid, uDAInterfaces;
2007-09-12 14:11:44 +00:00
type
TfEditorFormaPago = class( TForm, IEditorFormaPago)
ActionList1: TActionList;
dsFormaPago: TDADataSource;
actAnadir: TAction;
actEliminar: TAction;
actAceptar: TAction;
actCancelar: TAction;
bAceptar: TButton;
bCancelar: TButton;
actCerrar: TAction;
actModificar: TAction;
eReferencia: TDBEdit;
eDescripcion: TDBEdit;
dsPlazos: TDADataSource;
Label1: TLabel;
Bevel1: TBevel;
Label2: TLabel;
Label3: TLabel;
Label11: TLabel;
Bevel3: TBevel;
Bevel4: TBevel;
bAnadir: TButton;
bEliminar: TButton;
JvEnterAsTab1: TJvEnterAsTab;
ListaFormasPagoDBTableView1: TcxGridDBTableView;
ListaFormasPagoLevel1: TcxGridLevel;
ListaFormasPago: TcxGrid;
ListaFormasPagoDBTableView1NUM_DIAS: TcxGridDBColumn;
ListaFormasPagoDBTableView1PORCENTAJE: TcxGridDBColumn;
procedure FormShow( Sender: TObject) ;
procedure actAnadirExecute( Sender: TObject) ;
procedure actEliminarExecute( Sender: TObject) ;
procedure actAceptarExecute( Sender: TObject) ;
procedure actCancelarExecute( Sender: TObject) ;
procedure actCerrarExecute( Sender: TObject) ;
procedure actAnadirUpdate( Sender: TObject) ;
procedure actEliminarUpdate( Sender: TObject) ;
protected
FFormaPago: IBizFormaPago;
FPlazos : IBizFormaPagoPlazos;
FController : IFormasPagoController;
FPlazosController: IFormasPagoPlazosController;
function GetFormaPago: IBizFormaPago;
procedure SetFormaPago( const Value: IBizFormaPago) ;
public
constructor Create( AOwner: TComponent) ; override ;
destructor Destroy; override ;
property FormaPago: IBizFormaPago read GetFormaPago write SetFormaPago;
end ;
implementation
{$R *.dfm}
{ TfEditorFormasPago }
uses
2007-09-24 11:09:48 +00:00
Dialogs, uDialogUtils, uDataModuleFormasPago;
2007-09-12 14:11:44 +00:00
function TfEditorFormaPago. GetFormaPago: IBizFormaPago;
begin
Result : = FFormaPago;
end ;
procedure TfEditorFormaPago. SetFormaPago( const Value: IBizFormaPago) ;
begin
FFormaPago : = Value;
if Assigned( FFormaPago) then
begin
FPlazos : = FFormaPago. Plazos;
dsFormaPago. DataTable : = FFormaPago. DataTable;
dsPlazos. DataTable : = FPlazos. DataTable;
dsFormaPago. DataTable. Open;
dsPlazos. DataTable. Open;
end
else begin
dsFormaPago. DataTable : = NIL ;
dsPlazos. DataTable : = NIL ;
end ;
end ;
procedure TfEditorFormaPago. actAnadirExecute( Sender: TObject) ;
begin
2022-06-23 10:11:48 +00:00
if Assigned( FFormaPago) and ( FFormaPago. State = dsInsert) then
FController. Guardar( FFormaPago) ;
2007-09-12 14:11:44 +00:00
FPlazos. Append;
end ;
procedure TfEditorFormaPago. actEliminarExecute( Sender: TObject) ;
begin
FPlazos. Delete;
end ;
procedure TfEditorFormaPago. actEliminarUpdate( Sender: TObject) ;
begin
2014-01-28 17:18:58 +00:00
( Sender as TAction) . Enabled : = False ;
// No operar con los plazos
{ ( Sender as TAction) . Enabled : = Assigned( FPlazos) and
2007-09-12 14:11:44 +00:00
FPlazos. DataTable. Active and
2014-01-28 17:18:58 +00:00
( FPlazos. DataTable. RecordCount > 0 ) ; }
2007-09-12 14:11:44 +00:00
end ;
constructor TfEditorFormaPago. Create( AOwner: TComponent) ;
begin
inherited ;
FController : = TFormasPagoController. Create;
FPlazosController : = TFormasPagoPlazosController. Create;
end ;
destructor TfEditorFormaPago. Destroy;
begin
FFormaPago : = NIL ;
FPlazosController : = NIL ;
FController : = NIL ;
inherited ;
end ;
procedure TfEditorFormaPago. actAceptarExecute( Sender: TObject) ;
begin
2014-01-28 17:18:58 +00:00
{ if ( ListaFormasPago. ActiveView. DataController. RecordCount = 0 ) then
2007-09-24 11:09:48 +00:00
if ( ShowConfirmMessage( 'Forma de pago sin plazos' , 'No ha indicado plazos de pago para esta forma de pago por lo tanto no se podr<64> n generarar los recibos correspondientes.' + #10 #13 + '<27> Desea continuar guardando la forma de pago?' ) = IDNO) then
2014-01-28 17:18:58 +00:00
Exit; }
if ( FPlazos. RecordCount > 0 ) then
begin
FPlazos. Last;
while FPlazos. RecordCount > 0 do
begin
FPlazos. Delete;
end ;
end ;
2007-09-24 11:09:48 +00:00
2007-09-12 14:11:44 +00:00
if FController. Guardar( FFormaPago) then
2007-09-24 11:09:48 +00:00
actCerrar. Execute;
2007-09-12 14:11:44 +00:00
end ;
procedure TfEditorFormaPago. actCancelarExecute( Sender: TObject) ;
begin
FController. DescartarCambios( FFormaPago) ;
actCerrar. Execute;
end ;
procedure TfEditorFormaPago. actCerrarExecute( Sender: TObject) ;
begin
Close;
end ;
procedure TfEditorFormaPago. actAnadirUpdate( Sender: TObject) ;
begin
( Sender as TAction) . Enabled : = Assigned( FPlazos) and
FPlazos. DataTable. Active;
end ;
procedure TfEditorFormaPago. FormShow( Sender: TObject) ;
begin
2014-01-28 17:18:58 +00:00
// Ocultar los plazos
Label11. Visible : = False ;
Bevel3. Visible : = False ;
ListaFormasPago. Visible : = False ;
bAnadir. Visible : = False ;
bEliminar. Visible : = False ;
actAnadir. Enabled : = False ;
actEliminar. Enabled : = False ;
2007-09-12 14:11:44 +00:00
if not FFormaPago. DataTable. Active then
FFormaPago. DataTable. Active : = True ;
if FFormaPago. EsNuevo then
Self. Caption : = 'Nueva forma de pago'
else
Self. Caption : = 'Modificar forma de pago' ;
end ;
end .