2007-11-05 18:00:22 +00:00
|
|
|
|
unit uViewFacturaCliente;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
|
|
|
|
Dialogs, uViewBase, DB, uDADataTable, uCustomView,
|
|
|
|
|
|
uViewDatosYSeleccionCliente, uBizFacturasCliente,
|
|
|
|
|
|
cxControls, cxContainer, cxEdit, cxTextEdit, cxDBEdit, dxLayoutControl,
|
|
|
|
|
|
cxMemo, cxMaskEdit, cxDropDownEdit, cxCalendar, cxSpinEdit, StdCtrls, Mask,
|
|
|
|
|
|
DBCtrls, cxGraphics, dxLayoutLookAndFeels, cxLookupEdit, cxDBLookupEdit,
|
2008-05-30 16:56:23 +00:00
|
|
|
|
cxDBLookupComboBox, uFormasPagoController, uDAInterfaces, uBizFormasPago,
|
|
|
|
|
|
dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinCaramel, dxSkinCoffee,
|
|
|
|
|
|
dxSkinGlassOceans, dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky,
|
|
|
|
|
|
dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
|
|
|
|
|
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
|
|
|
|
|
dxSkinOffice2007Silver, dxSkinSilver, dxSkinStardust, dxSkinsDefaultPainters,
|
|
|
|
|
|
dxSkinValentine, dxSkinXmas2008Blue, dxSkinsdxLCPainter;
|
2007-11-05 18:00:22 +00:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
IViewFacturaCliente = interface(IViewBase)
|
|
|
|
|
|
['{3A95930C-20B3-41E9-93CB-21138ADB5B70}']
|
|
|
|
|
|
function GetFactura: IBizFacturaCliente;
|
|
|
|
|
|
procedure SetFactura(const Value: IBizFacturaCliente);
|
|
|
|
|
|
property Factura: IBizFacturaCliente read GetFactura write SetFactura;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
TfrViewFacturaCliente = class(TfrViewBase, IViewFacturaCliente)
|
|
|
|
|
|
DADataSource: TDADataSource;
|
|
|
|
|
|
dxLayoutControl1Group_Root: TdxLayoutGroup;
|
|
|
|
|
|
dxLayoutControl1: TdxLayoutControl;
|
|
|
|
|
|
dxLayoutControl1Item1: TdxLayoutItem;
|
|
|
|
|
|
eReferencia: TcxDBTextEdit;
|
|
|
|
|
|
dxLayoutControl1Item2: TdxLayoutItem;
|
|
|
|
|
|
edtFecha: TcxDBDateEdit;
|
|
|
|
|
|
dxLayoutControl1Group1: TdxLayoutGroup;
|
|
|
|
|
|
dxLayoutControl1Group2: TdxLayoutGroup;
|
|
|
|
|
|
dxLayoutControl1Item5: TdxLayoutItem;
|
|
|
|
|
|
memObservaciones: TcxDBMemo;
|
|
|
|
|
|
dxLayoutControl1Group5: TdxLayoutGroup;
|
|
|
|
|
|
dxLayoutControl1Item6: TdxLayoutItem;
|
|
|
|
|
|
frViewClienteFactura: TfrViewDatosYSeleccionCliente;
|
|
|
|
|
|
dxLayoutLookAndFeelList1: TdxLayoutLookAndFeelList;
|
|
|
|
|
|
dxLayoutOfficeLookAndFeel1: TdxLayoutOfficeLookAndFeel;
|
|
|
|
|
|
dsFormaPago: TDADataSource;
|
|
|
|
|
|
dxLayoutControl1Item4: TdxLayoutItem;
|
|
|
|
|
|
cbFormaPago: TcxDBLookupComboBox;
|
|
|
|
|
|
dxLayoutControl1Item10: TdxLayoutItem;
|
|
|
|
|
|
bFormasPago: TButton;
|
|
|
|
|
|
dxLayoutControl1Group3: TdxLayoutGroup;
|
|
|
|
|
|
dxLayoutControl1Group6: TdxLayoutGroup;
|
2008-06-05 18:21:13 +00:00
|
|
|
|
dxLayoutControl1Item3: TdxLayoutItem;
|
|
|
|
|
|
cbCuentaBancaria: TcxDBComboBox;
|
|
|
|
|
|
dxLayoutControl1Group4: TdxLayoutGroup;
|
2007-11-05 18:00:22 +00:00
|
|
|
|
procedure bFormasPagoClick(Sender: TObject);
|
|
|
|
|
|
procedure CustomViewDestroy(Sender: TObject);
|
|
|
|
|
|
procedure CustomViewCreate(Sender: TObject);
|
|
|
|
|
|
protected
|
|
|
|
|
|
FFactura : IBizFacturaCliente;
|
2007-11-12 19:35:30 +00:00
|
|
|
|
FFormasPago : IBizFormaPago;
|
2007-11-05 18:00:22 +00:00
|
|
|
|
FFormasPagoController : IFormasPagoController;
|
|
|
|
|
|
function GetFactura: IBizFacturaCliente;
|
|
|
|
|
|
procedure SetFactura(const Value: IBizFacturaCliente);
|
2008-06-05 18:21:13 +00:00
|
|
|
|
procedure RellenarCuentasBancarias;
|
2007-11-05 18:00:22 +00:00
|
|
|
|
public
|
|
|
|
|
|
property Factura: IBizFacturaCliente read GetFactura write SetFactura;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
2008-06-05 18:21:13 +00:00
|
|
|
|
uDataModuleContactos, schFacturasClienteClient_Intf, uFactuGES_App,
|
|
|
|
|
|
uEmpresasController;
|
2007-11-05 18:00:22 +00:00
|
|
|
|
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
{ TfrViewFacturaCliente }
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturaCliente.bFormasPagoClick(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-11-12 19:35:30 +00:00
|
|
|
|
if Assigned(FFormasPago) then
|
|
|
|
|
|
FFormasPagoController.VerTodos(FFormasPago);
|
2007-11-05 18:00:22 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturaCliente.CustomViewCreate(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-11-12 19:35:30 +00:00
|
|
|
|
FFormasPago := Nil;
|
|
|
|
|
|
FFormasPagoController := TFormasPagoController.Create;
|
2007-11-05 18:00:22 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrViewFacturaCliente.CustomViewDestroy(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
inherited;
|
2007-11-12 19:35:30 +00:00
|
|
|
|
FFormasPago := Nil;
|
|
|
|
|
|
FFormasPagoController := NIL;
|
2007-11-05 18:00:22 +00:00
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
function TfrViewFacturaCliente.GetFactura: IBizFacturaCliente;
|
|
|
|
|
|
begin
|
|
|
|
|
|
Result := FFactura;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2008-06-05 18:21:13 +00:00
|
|
|
|
procedure TfrViewFacturaCliente.RellenarCuentasBancarias;
|
|
|
|
|
|
var
|
|
|
|
|
|
AController : IEmpresasController;
|
|
|
|
|
|
ALista : TStringList;
|
|
|
|
|
|
i : integer;
|
|
|
|
|
|
begin
|
|
|
|
|
|
AController := TEmpresasController.Create;
|
|
|
|
|
|
try
|
|
|
|
|
|
ALista := AController.DarListaCuentasBancarias(AppFactuGES.EmpresaActiva);
|
|
|
|
|
|
try
|
|
|
|
|
|
with cbCuentaBancaria.Properties.Items do
|
|
|
|
|
|
begin
|
|
|
|
|
|
BeginUpdate;
|
|
|
|
|
|
try
|
|
|
|
|
|
Clear;
|
|
|
|
|
|
Add('');
|
|
|
|
|
|
for i := 0 to ALista.Count - 1 do
|
|
|
|
|
|
Add(ALista.Names[i]);
|
|
|
|
|
|
finally
|
|
|
|
|
|
EndUpdate;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
FreeANDNIL(ALista);
|
|
|
|
|
|
end;
|
|
|
|
|
|
finally
|
|
|
|
|
|
AController := NIL;
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
2007-11-05 18:00:22 +00:00
|
|
|
|
procedure TfrViewFacturaCliente.SetFactura(const Value: IBizFacturaCliente);
|
|
|
|
|
|
var
|
|
|
|
|
|
ACadena : String;
|
|
|
|
|
|
begin
|
|
|
|
|
|
FFactura := Value;
|
2008-06-05 18:21:13 +00:00
|
|
|
|
RellenarCuentasBancarias;
|
2007-11-05 18:00:22 +00:00
|
|
|
|
if Assigned(FFactura) then
|
|
|
|
|
|
begin
|
|
|
|
|
|
DADataSource.DataTable := FFactura.DataTable;
|
2007-11-12 19:35:30 +00:00
|
|
|
|
|
|
|
|
|
|
FFormasPago := FFormasPagoController.BuscarTodos;
|
|
|
|
|
|
dsFormaPago.DataTable := FFormasPago.DataTable;
|
2007-11-05 18:00:22 +00:00
|
|
|
|
dsFormaPago.DataTable.Active := True;
|
2007-11-12 19:35:30 +00:00
|
|
|
|
|
2007-11-05 18:00:22 +00:00
|
|
|
|
if FFactura.TIPO = CTE_TIPO_ABONO then
|
|
|
|
|
|
begin
|
|
|
|
|
|
dxLayoutControl1Group1.Caption := 'Datos del abono:';
|
|
|
|
|
|
dxLayoutControl1Item2.Caption := 'Fecha del abono:';
|
|
|
|
|
|
ACadena := 'Elija el cliente al que se le realizar<61> el abono.';
|
|
|
|
|
|
end
|
|
|
|
|
|
else
|
|
|
|
|
|
ACadena := 'Elija el cliente al que se le realizar<61> la factura.';
|
|
|
|
|
|
frViewClienteFactura.MsgElegirCliente := ACadena;
|
|
|
|
|
|
end
|
|
|
|
|
|
else begin
|
|
|
|
|
|
DADataSource.DataTable := NIL;
|
|
|
|
|
|
dsFormaPago.DataTable := NIL;
|
|
|
|
|
|
frViewClienteFactura.Cliente := NIL
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|