182 lines
5.8 KiB
ObjectPascal
182 lines
5.8 KiB
ObjectPascal
|
|
unit uEditorReciboCliente;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses uEditorDBItem, Forms, uCustomView, uViewBase, uViewReciboCliente,
|
|||
|
|
dxLayoutLookAndFeels, JvAppStorage, JvAppRegistryStorage, DB,
|
|||
|
|
uDADataTable, JvComponentBase, JvFormPlacement, ImgList, Controls,
|
|||
|
|
PngImageList, StdActns, Classes, ActnList, ComCtrls, TBX, TB2Item,
|
|||
|
|
TB2Dock, TB2Toolbar, pngimage, ExtCtrls, JvExControls, JvComponent,
|
|||
|
|
JvNavigationPane, uBizRecibosCliente, uViewTextoRecibo,
|
|||
|
|
uViewDatosYSeleccionContacto2, dxLayoutControl, cxContainer, cxEdit,
|
|||
|
|
cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalendar, cxDBEdit, cxControls,
|
|||
|
|
cxCurrencyEdit;
|
|||
|
|
|
|||
|
|
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
IEditorReciboCliente = interface(IEditorDBItem)
|
|||
|
|
['{91363D98-7206-404F-86F6-2CA55FB0447E}']
|
|||
|
|
function GetReciboCliente: IBizRecibosCliente;
|
|||
|
|
procedure SetReciboCliente(const Value: IBizRecibosCliente);
|
|||
|
|
property ReciboCliente: IBizRecibosCliente read GetReciboCliente write SetReciboCliente;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
TfEditorReciboCliente = class(TfEditorDBItem, IEditorReciboCliente)
|
|||
|
|
TBXSeparatorItem14: TTBXSeparatorItem;
|
|||
|
|
TBXSubmenuItem2: TTBXSubmenuItem;
|
|||
|
|
TBXItem33: TTBXItem;
|
|||
|
|
pagContenido: TTabSheet;
|
|||
|
|
frViewTextoRecibo1: TfrViewTextoRecibo;
|
|||
|
|
dxLayoutControl1Group_Root: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl1: TdxLayoutControl;
|
|||
|
|
dxLayoutControl1Item1: TdxLayoutItem;
|
|||
|
|
edtFecha: TcxDBDateEdit;
|
|||
|
|
dxLayoutControl1Item2: TdxLayoutItem;
|
|||
|
|
frViewDatosYSeleccionContacto21: TfrViewDatosYSeleccionContacto2;
|
|||
|
|
dxLayoutControl1Item3: TdxLayoutItem;
|
|||
|
|
edtImporte: TcxDBCurrencyEdit;
|
|||
|
|
dxLayoutControl1Group1: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl1Item4: TdxLayoutItem;
|
|||
|
|
cxDBCurrencyEdit1: TcxDBCurrencyEdit;
|
|||
|
|
procedure actEliminarExecute(Sender: TObject);
|
|||
|
|
procedure FormShow(Sender: TObject); override;
|
|||
|
|
procedure frViewDatosYSeleccionContacto21edtlNombrePropertiesChange(Sender: TObject);
|
|||
|
|
procedure pgPaginasChanging(Sender: TObject; var AllowChange: Boolean);
|
|||
|
|
procedure frViewDatosYSeleccionContacto21edtlNombrePropertiesEditValueChanged(
|
|||
|
|
Sender: TObject);
|
|||
|
|
procedure edtImportePropertiesValidate(Sender: TObject; var DisplayValue: Variant;
|
|||
|
|
var ErrorText: TCaption; var Error: Boolean);
|
|||
|
|
|
|||
|
|
private
|
|||
|
|
FReciboCliente: IBizRecibosCliente;
|
|||
|
|
|
|||
|
|
protected
|
|||
|
|
procedure OnContactoChanged (Sender : TObject);
|
|||
|
|
|
|||
|
|
function GetReciboCliente: IBizRecibosCliente;
|
|||
|
|
procedure SetReciboCliente(const Value: IBizRecibosCliente);
|
|||
|
|
|
|||
|
|
public
|
|||
|
|
property ReciboCliente: IBizRecibosCliente read GetReciboCliente write SetReciboCliente;
|
|||
|
|
constructor Create(AOwner: TComponent); override;
|
|||
|
|
destructor Destroy; override;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
uses Windows, Variants, SysUtils, Dialogs, uEditorUtils,
|
|||
|
|
uDataModuleRecibosCliente, LiteralesRecibosCliente, uBizContacto;
|
|||
|
|
|
|||
|
|
function ShowEditorReciboCliente (ABizObject : TDADataTableRules) : TModalResult;
|
|||
|
|
var
|
|||
|
|
AEditor: TfEditorReciboCliente;
|
|||
|
|
begin
|
|||
|
|
AEditor := TfEditorReciboCliente.Create(Application);
|
|||
|
|
try
|
|||
|
|
AEditor.ReciboCliente := (ABizObject as IBizRecibosCliente);
|
|||
|
|
Result := AEditor.ShowModal;
|
|||
|
|
finally
|
|||
|
|
AEditor.Release;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
{ TfEditorReciboCliente }
|
|||
|
|
|
|||
|
|
{
|
|||
|
|
**************************** TfEditorReciboCliente ****************************
|
|||
|
|
}
|
|||
|
|
constructor TfEditorReciboCliente.Create(AOwner: TComponent);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
pgPaginas.ActivePageIndex := 0;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
destructor TfEditorReciboCliente.Destroy;
|
|||
|
|
begin
|
|||
|
|
FReciboCliente := NIL;
|
|||
|
|
inherited;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorReciboCliente.actEliminarExecute(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
if (Application.MessageBox(PChar(msgLitBorrar), 'Atenci<63>n', MB_YESNO) = IDYES) then
|
|||
|
|
inherited;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorReciboCliente.FormShow(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
|
|||
|
|
if not Assigned(ReciboCliente) then
|
|||
|
|
raise Exception.Create('No hay ning<6E>n recibo asignado');
|
|||
|
|
|
|||
|
|
ReciboCliente.DataTable.Active := True;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
function TfEditorReciboCliente.GetReciboCliente: IBizRecibosCliente;
|
|||
|
|
begin
|
|||
|
|
Result := FReciboCliente;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorReciboCliente.SetReciboCliente(const Value: IBizRecibosCliente);
|
|||
|
|
begin
|
|||
|
|
FReciboCliente := Value;
|
|||
|
|
|
|||
|
|
if Assigned(FReciboCliente) then
|
|||
|
|
begin
|
|||
|
|
dsDataTable.DataTable := FReciboCliente.DataTable;
|
|||
|
|
frViewTextoRecibo1.Recibo := FReciboCliente;
|
|||
|
|
frViewDatosYSeleccionContacto21.Contacto := FReciboCliente.Cliente;
|
|||
|
|
frViewDatosYSeleccionContacto21.OnContactoChanged := OnContactoChanged;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorReciboCliente.frViewDatosYSeleccionContacto21edtlNombrePropertiesChange(
|
|||
|
|
Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if Length(frViewDatosYSeleccionContacto21.edtlNombre.Text) = 0 then
|
|||
|
|
JvNavPanelHeader.Caption := 'Nuevo recibo de cliente'
|
|||
|
|
else
|
|||
|
|
JvNavPanelHeader.Caption := 'Recibo de ' + frViewDatosYSeleccionContacto21.edtlNombre.Text;
|
|||
|
|
Caption := JvNavPanelHeader.Caption;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorReciboCliente.pgPaginasChanging(Sender: TObject; var AllowChange: Boolean);
|
|||
|
|
begin
|
|||
|
|
if (FReciboCliente.Cliente.NOMBRE = '') then
|
|||
|
|
begin
|
|||
|
|
AllowChange := False;
|
|||
|
|
showmessage(msgLitClienteObligatorio);
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorReciboCliente.OnContactoChanged(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
FReciboCliente.Cliente := (frViewDatosYSeleccionContacto21.Contacto as IBizContacto);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorReciboCliente.frViewDatosYSeleccionContacto21edtlNombrePropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
with (Sender as TcxDBTextEdit) do
|
|||
|
|
Enabled := (FReciboCliente.CODIGOCONTACTO <> 0)
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfEditorReciboCliente.edtImportePropertiesValidate(Sender: TObject;
|
|||
|
|
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
if VarIsNull(DisplayValue) or (DisplayValue = '')then
|
|||
|
|
DisplayValue := 0;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
initialization
|
|||
|
|
RegisterEditor(IBizRecibosCliente, ShowEditorReciboCliente, etItem);
|
|||
|
|
|
|||
|
|
finalization
|
|||
|
|
|
|||
|
|
end.
|