147 lines
4.8 KiB
ObjectPascal
147 lines
4.8 KiB
ObjectPascal
|
|
unit uViewFacturaCliente;
|
|||
|
|
|
|||
|
|
interface
|
|||
|
|
|
|||
|
|
uses
|
|||
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
|
Dialogs, uViewBase, DB, uDADataTable, uCustomView,
|
|||
|
|
uViewDatosYSeleccionContacto, uViewDatosFacturaCliente,
|
|||
|
|
uViewObservaciones, uViewFormaPago, AppEvnts, uBizFacturasCliente,
|
|||
|
|
cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit, uViewTotales,
|
|||
|
|
dxLayoutControl, uViewDatosYSeleccionContacto2;
|
|||
|
|
|
|||
|
|
type
|
|||
|
|
IViewFacturaCliente = interface(IViewBase)
|
|||
|
|
['{3A95930C-20B3-41E9-93CB-21138ADB5B70}']
|
|||
|
|
function GetFacturaCliente: IBizFacturasCliente;
|
|||
|
|
procedure SetFacturaCliente(const Value: IBizFacturasCliente);
|
|||
|
|
property FacturaCliente: IBizFacturasCliente read GetFacturaCliente
|
|||
|
|
write SetFacturaCliente;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
TfrViewFacturaCliente = class(TfrViewBase, IViewFacturaCliente)
|
|||
|
|
DADataSource: TDADataSource;
|
|||
|
|
dxLayoutControl1Group_Root: TdxLayoutGroup;
|
|||
|
|
dxLayoutControl1: TdxLayoutControl;
|
|||
|
|
dxLayoutControl1Item1: TdxLayoutItem;
|
|||
|
|
frViewDatosFacturaCliente1: TfrViewDatosFacturaCliente;
|
|||
|
|
dxLayoutControl1Item2: TdxLayoutItem;
|
|||
|
|
frViewDatosYSeleccionContacto21: TfrViewDatosYSeleccionContacto2;
|
|||
|
|
dxLayoutControl1Item3: TdxLayoutItem;
|
|||
|
|
dxLayoutControl1Group1: TdxLayoutGroup;
|
|||
|
|
procedure frViewDatosYSeleccionContacto21actElegirContactoExecute(Sender: TObject);
|
|||
|
|
procedure frViewDatosYSeleccionContacto21actAnadirContactoExecute(Sender: TObject);
|
|||
|
|
procedure frViewDatosYSeleccionContacto21actVerContactoExecute(Sender: TObject);
|
|||
|
|
procedure frViewDatosYSeleccionContacto21edtlNombrePropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
// procedure frViewObraFactura1actElegirObraExecute(Sender: TObject);
|
|||
|
|
private
|
|||
|
|
FFacturaCliente : IBizFacturasCliente;
|
|||
|
|
procedure OnContactoChanged (Sender : TObject);
|
|||
|
|
// procedure OnObraChanged(Sender : TObject);
|
|||
|
|
protected
|
|||
|
|
function GetFacturaCliente: IBizFacturasCliente;
|
|||
|
|
procedure SetFacturaCliente(const Value: IBizFacturasCliente);
|
|||
|
|
public
|
|||
|
|
property FacturaCliente: IBizFacturasCliente read GetFacturaCliente
|
|||
|
|
write SetFacturaCliente;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
var
|
|||
|
|
frViewFacturaCliente: TfrViewFacturaCliente;
|
|||
|
|
|
|||
|
|
implementation
|
|||
|
|
|
|||
|
|
uses uBizContacto, uExceptions, uDataModuleContactos,
|
|||
|
|
schFacturasClienteClient_Intf;
|
|||
|
|
|
|||
|
|
{$R *.dfm}
|
|||
|
|
|
|||
|
|
{ TfrViewFacturaCliente }
|
|||
|
|
|
|||
|
|
function TfrViewFacturaCliente.GetFacturaCliente: IBizFacturasCliente;
|
|||
|
|
begin
|
|||
|
|
Result := FFacturaCliente;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewFacturaCliente.OnContactoChanged(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
FFacturaCliente.Cliente := (frViewDatosYSeleccionContacto21.Contacto as IBizContacto);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewFacturaCliente.SetFacturaCliente(const Value: IBizFacturasCliente);
|
|||
|
|
begin
|
|||
|
|
FFacturaCliente := Value;
|
|||
|
|
if Assigned(FFacturaCliente) then
|
|||
|
|
begin
|
|||
|
|
DADataSource.DataTable := FFacturaCliente.DataTable;
|
|||
|
|
|
|||
|
|
//Solo se deshabilita al insertar, luego la referencia ser<65> modificable
|
|||
|
|
// if FFacturaCliente.DataTable.State = dsInsert then
|
|||
|
|
// frViewDatosFacturaCliente1.eReferencia.Enabled := False;
|
|||
|
|
end
|
|||
|
|
else
|
|||
|
|
DADataSource.DataTable := NIL;
|
|||
|
|
|
|||
|
|
frViewDatosFacturaCliente1.DADataSource.DataTable := DADataSource.DataTable;
|
|||
|
|
// frViewObservaciones1.DADataSource.DataTable := DADataSource.DataTable;
|
|||
|
|
// frViewFormaPago1.DADataSource.DataTable := DADataSource.DataTable;
|
|||
|
|
|
|||
|
|
frViewDatosYSeleccionContacto21.Contacto := FFacturaCliente.Cliente;
|
|||
|
|
frViewDatosYSeleccionContacto21.OnContactoChanged := OnContactoChanged;
|
|||
|
|
|
|||
|
|
{ frViewObraFactura1.Obra := FFacturaCliente.Obra;
|
|||
|
|
frViewObraFactura1.OnObraChanged := OnObraChanged;}
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewFacturaCliente.frViewDatosYSeleccionContacto21actElegirContactoExecute(
|
|||
|
|
Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frViewDatosYSeleccionContacto21.actElegirContactoExecute(Sender);
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewFacturaCliente.frViewDatosYSeleccionContacto21actAnadirContactoExecute(
|
|||
|
|
Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
frViewDatosYSeleccionContacto21.actAnadirContactoExecute(Sender);
|
|||
|
|
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewFacturaCliente.frViewDatosYSeleccionContacto21actVerContactoExecute(
|
|||
|
|
Sender: TObject);
|
|||
|
|
var
|
|||
|
|
AContacto : IBizContacto;
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
AContacto := dmContactos.GetContacto(FFacturaCliente.CODIGOCONTACTO);
|
|||
|
|
try
|
|||
|
|
AContacto.Show;
|
|||
|
|
finally
|
|||
|
|
AContacto := NIL;
|
|||
|
|
end;
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
procedure TfrViewFacturaCliente.frViewDatosYSeleccionContacto21edtlNombrePropertiesEditValueChanged(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
inherited;
|
|||
|
|
with (Sender as TcxDBTextEdit) do
|
|||
|
|
Enabled := (FFacturaCliente.CODIGOCONTACTO <> 0)
|
|||
|
|
end;
|
|||
|
|
|
|||
|
|
{procedure TfrViewFacturaCliente.OnObraChanged(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
FFacturaCliente.Obra := frViewObraFactura1.Obra;
|
|||
|
|
frViewDatosYSeleccionContacto21.Contacto := FFacturaCliente.Obra.Cliente;
|
|||
|
|
end;}
|
|||
|
|
|
|||
|
|
{procedure TfrViewFacturaCliente.frViewObraFactura1actElegirObraExecute(Sender: TObject);
|
|||
|
|
begin
|
|||
|
|
|
|||
|
|
|
|||
|
|
// frViewObraFactura1.actElegirObra.Execute;
|
|||
|
|
|
|||
|
|
end;}
|
|||
|
|
|
|||
|
|
end.
|