git-svn-id: https://192.168.0.254/svn/Proyectos.AbetoDesign_FactuGES/trunk@151 93f398dd-4eb6-7a46-baf6-13f46f578da2
212 lines
8.1 KiB
ObjectPascal
212 lines
8.1 KiB
ObjectPascal
unit uViewContratoCliente;
|
||
|
||
interface
|
||
|
||
uses
|
||
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||
Dialogs, uViewBase, uBizContratosCliente, DB, uDADataTable, uCustomView,
|
||
AppEvnts, StdCtrls, Mask, DBCtrls,
|
||
uViewObservaciones, uViewDatosYSeleccionCliente,
|
||
cxGraphics, cxDropDownEdit, cxImageComboBox, cxDBEdit, cxContainer, cxEdit,
|
||
cxTextEdit, cxMaskEdit, cxCalendar, dxLayoutControl, cxControls, cxMemo,
|
||
Buttons, ActnList, cxLookupEdit,
|
||
cxDBLookupEdit, cxDBLookupComboBox, uFormasPagoController, uDAInterfaces,
|
||
uBizFormasPago, cxButtonEdit, uViewDatosYSeleccionClienteContrato, uBizContactos,
|
||
uVendedoresController, uViewDireccionEntregaContratoCli;
|
||
|
||
type
|
||
IViewContratoCliente = interface(IViewBase)
|
||
['{3DE0231D-760E-437B-88E5-144B88024797}']
|
||
function GetContrato: IBizContratoCliente;
|
||
procedure SetContrato(const Value: IBizContratoCliente);
|
||
property Contrato: IBizContratoCliente read GetContrato write SetContrato;
|
||
|
||
function GetViewClienteContrato: IViewDatosYSeleccionClienteContrato;
|
||
property ViewClienteContrato: IViewDatosYSeleccionClienteContrato read GetViewClienteContrato;
|
||
|
||
function GetViewDireccionEntregaContratoCli: IViewDireccionEntregaContratoCli;
|
||
property ViewDireccionEntregaContratoCli: IViewDireccionEntregaContratoCli read GetViewDireccionEntregaContratoCli;
|
||
end;
|
||
|
||
TfrViewContratoCliente = class(TfrViewBase, IViewContratoCliente)
|
||
DADataSource: TDADataSource;
|
||
dxLayoutControl1Group_Root: TdxLayoutGroup;
|
||
dxLayoutControl1: TdxLayoutControl;
|
||
dxLayoutControl1Item2: TdxLayoutItem;
|
||
edtFechaContrato: TcxDBDateEdit;
|
||
dxLayoutControl1Group1: TdxLayoutGroup;
|
||
dxLayoutControl1Group2: TdxLayoutGroup;
|
||
dxLayoutControl1Item6: TdxLayoutItem;
|
||
memObservaciones: TcxDBMemo;
|
||
dxLayoutControl1Item3: TdxLayoutItem;
|
||
eReferencia: TcxDBTextEdit;
|
||
dxLayoutControl1Group7: TdxLayoutGroup;
|
||
ActionList1: TActionList;
|
||
dxLayoutControl1Item4: TdxLayoutItem;
|
||
cbFormaPago: TcxDBLookupComboBox;
|
||
dxLayoutControl1Item5: TdxLayoutItem;
|
||
bFormasPago: TButton;
|
||
dsFormaPago: TDADataSource;
|
||
cbSituacion: TcxDBImageComboBox;
|
||
dxLayoutControl1Item10: TdxLayoutItem;
|
||
dxLayoutControl1Group8: TdxLayoutGroup;
|
||
frViewDatosYSeleccionClienteContrato1: TfrViewDatosYSeleccionClienteContrato;
|
||
dxLayoutControl1Item1: TdxLayoutItem;
|
||
dxLayoutControl1Item8: TdxLayoutItem;
|
||
memFormaPago: TcxDBMemo;
|
||
dxLayoutControl1Group3: TdxLayoutGroup;
|
||
dxLayoutControl1Item9: TdxLayoutItem;
|
||
memPlazoEntrega: TcxDBMemo;
|
||
dxLayoutControl1Group4: TdxLayoutGroup;
|
||
dxLayoutControl1Group6: TdxLayoutGroup;
|
||
dxLayoutControl1Item11: TdxLayoutItem;
|
||
dxLayoutControl1Group9: TdxLayoutGroup;
|
||
cbVendedor: TcxDBLookupComboBox;
|
||
dsVendedor: TDADataSource;
|
||
dxLayoutControl1Item7: TdxLayoutItem;
|
||
cbTipoContrato: TcxDBComboBox;
|
||
dxLayoutControl1Group11: TdxLayoutGroup;
|
||
dxLayoutControl1Item12: TdxLayoutItem;
|
||
edtlReferenciaCliente: TcxDBTextEdit;
|
||
dxLayoutControl1Group5: TdxLayoutGroup;
|
||
dxLayoutControl1Item13: TdxLayoutItem;
|
||
frViewDireccionEntregaContratoCli1: TfrViewDireccionEntregaContratoCli;
|
||
procedure CustomViewCreate(Sender: TObject);
|
||
procedure CustomViewDestroy(Sender: TObject);
|
||
procedure bFormasPagoClick(Sender: TObject);
|
||
procedure frViewClienteContratoButton1Click(Sender: TObject);
|
||
procedure frViewClienteContratoButton2Click(Sender: TObject);
|
||
procedure cbFormaPagoPropertiesValidate(Sender: TObject;
|
||
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||
protected
|
||
FContrato : IBizContratoCliente;
|
||
FFormasPago : IBizFormaPago;
|
||
FVendedor : IBizVendedor;
|
||
FFormasPagoController : IFormasPagoController;
|
||
FVendedoresController : IVendedoresController;
|
||
FViewClienteContrato : IViewDatosYSeleccionClienteContrato;
|
||
FViewDireccionEntregaContratoCli : IViewDireccionEntregaContratoCli;
|
||
|
||
function GetContrato: IBizContratoCliente;
|
||
procedure SetContrato(const Value: IBizContratoCliente); virtual;
|
||
function GetViewClienteContrato: IViewDatosYSeleccionClienteContrato;
|
||
function GetViewDireccionEntregaContratoCli: IViewDireccionEntregaContratoCli;
|
||
|
||
public
|
||
property Contrato: IBizContratoCliente read GetContrato write SetContrato;
|
||
property ViewClienteContrato: IViewDatosYSeleccionClienteContrato read GetViewClienteContrato;
|
||
property ViewDireccionEntregaContratoCli: IViewDireccionEntregaContratoCli read GetViewDireccionEntregaContratoCli;
|
||
|
||
end;
|
||
|
||
implementation
|
||
|
||
{$R *.dfm}
|
||
|
||
{ TfrViewContratoCliente }
|
||
|
||
uses
|
||
schContratosClienteClient_Intf, uClientesController, uBizDireccionesContacto, uContratosClienteController;
|
||
|
||
|
||
procedure TfrViewContratoCliente.bFormasPagoClick(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
if Assigned(FFormasPago) then
|
||
FFormasPagoController.VerTodos(FFormasPago);
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.cbFormaPagoPropertiesValidate(Sender: TObject;
|
||
var DisplayValue: Variant; var ErrorText: TCaption; var Error: Boolean);
|
||
begin
|
||
inherited;
|
||
Contrato.DataTable.FieldByName(fld_ContratosClienteFORMA_PAGO).AsString := FFormasPago.DESCRIPCION;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.CustomViewCreate(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
FFormasPago := Nil;
|
||
FVendedor := Nil;
|
||
FFormasPagoController := TFormasPagoController.Create;
|
||
FVendedoresController := TVendedoresController.Create;
|
||
FViewClienteContrato := frViewDatosYSeleccionClienteContrato1;
|
||
FViewDireccionEntregaContratoCli := frViewDireccionEntregaContratoCli1;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.CustomViewDestroy(Sender: TObject);
|
||
begin
|
||
inherited;
|
||
FFormasPago := Nil;
|
||
FFormasPagoController := NIL;
|
||
FVendedor := Nil;
|
||
FVendedoresController := NIL;
|
||
FViewClienteContrato := NIL;
|
||
FViewDireccionEntregaContratoCli := NIL;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.frViewClienteContratoButton1Click(Sender: TObject);
|
||
begin
|
||
if Assigned(Contrato) and Assigned(Contrato.Cliente) and
|
||
Assigned (Contrato.Detalles) and (Contrato.Detalles.RecordCount > 0) then
|
||
begin
|
||
if (Application.MessageBox('Los descuentos de los art<72>culos del Contrato ser<65>n actualizados con los del nuevo cliente seleccionado, <20>Desea continuar?', 'Atenci<63>n', MB_YESNO) = IDNO) then
|
||
Exit;
|
||
end;
|
||
frViewDatosYSeleccionClienteContrato1.actElegirContacto.Execute;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.frViewClienteContratoButton2Click(Sender: TObject);
|
||
begin
|
||
if Assigned(Contrato) and Assigned(Contrato.Cliente) and
|
||
Assigned (Contrato.Detalles) and (Contrato.Detalles.RecordCount > 0) then
|
||
begin
|
||
if (Application.MessageBox('Los descuentos de los art<72>culos del Contrato ser<65>n actualizados con los del nuevo cliente seleccionado, <20>Desea continuar?', 'Atenci<63>n', MB_YESNO) = IDNO) then
|
||
Exit;
|
||
end;
|
||
frViewDatosYSeleccionClienteContrato1.actAnadirContacto.Execute;
|
||
end;
|
||
|
||
function TfrViewContratoCliente.GetContrato: IBizContratoCliente;
|
||
begin
|
||
Result := FContrato;
|
||
end;
|
||
|
||
function TfrViewContratoCliente.GetViewClienteContrato: IViewDatosYSeleccionClienteContrato;
|
||
begin
|
||
Result := FViewClienteContrato;
|
||
end;
|
||
|
||
function TfrViewContratoCliente.GetViewDireccionEntregaContratoCli: IViewDireccionEntregaContratoCli;
|
||
begin
|
||
Result := FViewDireccionEntregaContratoCli;
|
||
end;
|
||
|
||
procedure TfrViewContratoCliente.SetContrato(const Value: IBizContratoCliente);
|
||
begin
|
||
FContrato := Value;
|
||
if Assigned(FContrato) then
|
||
begin
|
||
DADataSource.DataTable := FContrato.DataTable;
|
||
|
||
FFormasPago := FFormasPagoController.BuscarTodos;
|
||
dsFormaPago.DataTable := FFormasPago.DataTable;
|
||
dsFormaPago.DataTable.Active := True;
|
||
|
||
FVendedor := (FVendedoresController.BuscarTodos as IBizVendedor);
|
||
dsVendedor.DataTable := FVendedor.DataTable;
|
||
dsVendedor.DataTable.Active := True;
|
||
|
||
FViewClienteContrato.Contrato := FContrato;
|
||
frViewDireccionEntregaContratoCli1.ContratoCliente := FContrato;
|
||
end
|
||
else begin
|
||
DADataSource.DataTable := NIL;
|
||
dsFormaPago.DataTable := NIL;
|
||
dsVendedor.DataTable := NIL;
|
||
FViewClienteContrato.Contrato := Nil;
|
||
end;
|
||
end;
|
||
|
||
end.
|