AlonsoYSal_FactuGES2/Source/Modulos/Contactos/Views/uViewConfiguracionContactos.pas
2019-11-18 10:36:42 +00:00

140 lines
4.5 KiB
ObjectPascal

unit uViewConfiguracionContactos;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, uViewConfiguracionBase, JvExControls, JvGradientHeaderPanel,
StdCtrls, ExtCtrls, uFormasPagoController, uTiposIVAController,
uBizFormasPago, uBizTiposIVA;
type
TfrViewConfiguracionContactos = class(TfrViewConfiguracionBase)
Panel3: TPanel;
Label1: TLabel;
cbFormaPago: TComboBox;
Label2: TLabel;
Label4: TLabel;
cbRegimenIVA: TComboBox;
Label5: TLabel;
bFormasPago: TButton;
bTiposIVA: TButton;
cbIVA: TComboBox;
Panel4: TPanel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
cbFormaPagoProv: TComboBox;
cbRegimenIVAProv: TComboBox;
Button1: TButton;
Button2: TButton;
cbTipoIVAProv: TComboBox;
Panel2: TPanel;
Label6: TLabel;
procedure bFormasPagoClick(Sender: TObject);
procedure bTiposIVAClick(Sender: TObject);
private
FFormasPagoController : IFormasPagoController;
FTiposIVAController : ITiposIVAController;
public
class function GetViewClass : TClass; override;
class function DarEtiqueta : String; override;
constructor Create(AOwner: TComponent); override;
procedure CargarValores; override;
procedure GuardarValores; override;
destructor Destroy; override;
end;
implementation
{$R *.dfm}
uses
uRegimenIVAUtils, uFactuGES_App, uConfiguracionController;
{ TfrViewConfiguracionBase1 }
procedure TfrViewConfiguracionContactos.bFormasPagoClick(Sender: TObject);
begin
inherited;
with FFormasPagoController do
begin
VerTodos(BuscarTodos);
cbFormaPago.Items := DarListaFormasPago;
end;
end;
procedure TfrViewConfiguracionContactos.bTiposIVAClick(Sender: TObject);
begin
inherited;
with FTiposIVAController do
begin
VerTodos(BuscarTodos);
cbIVA.Items := DarListaTiposIVA;
end;
end;
procedure TfrViewConfiguracionContactos.CargarValores;
begin
inherited;
cbRegimenIVA.Items := DarRegimenesIVA;
cbRegimenIVAProv.Items := cbRegimenIVA.Items;
cbFormaPago.Items := FFormasPagoController.DarListaFormasPago;
cbFormaPagoProv.Items := cbFormaPago.Items;
cbIVA.Items := FTiposIVAController.DarListaTiposIVA;
cbTipoIVAProv.Items := cbIVA.Items;
cbRegimenIVA.ItemIndex := cbRegimenIVA.Items.IndexOf (AppFactuGES.Configuracion.GetSettingAsString(teXML, 'Clientes.RegimenIVA', cbRegimenIVA.Items[0]));
cbRegimenIVAProv.ItemIndex := cbRegimenIVAProv.Items.IndexOf (AppFactuGES.Configuracion.GetSettingAsString(teXML, 'Proveedores.RegimenIVA', cbRegimenIVAProv.Items[0]));
cbFormaPago.ItemIndex := cbFormaPago.Items.IndexOf (AppFactuGES.Configuracion.GetSettingAsString(teXML, 'Clientes.FormaPago', cbFormaPago.Items[0]));
cbFormaPagoProv.ItemIndex := cbFormaPagoProv.Items.IndexOf (AppFactuGES.Configuracion.GetSettingAsString(teXML, 'Proveedores.FormaPago', cbFormaPagoProv.Items[0]));
cbIVA.ItemIndex := cbIVA.Items.IndexOf (AppFactuGES.Configuracion.GetSettingAsString(teXML,'Clientes.TipoIVA'));
cbTipoIVAProv.ItemIndex := cbTipoIVAProv.Items.IndexOf (AppFactuGES.Configuracion.GetSettingAsString(teXML,'Proveedores.TipoIVA'));
end;
constructor TfrViewConfiguracionContactos.Create(AOwner: TComponent);
begin
inherited;
FFormasPagoController := TFormasPagoController.Create;
FTiposIVAController := TTiposIVAController.Create;
end;
class function TfrViewConfiguracionContactos.DarEtiqueta: String;
begin
Result := 'Contactos';
end;
destructor TfrViewConfiguracionContactos.Destroy;
begin
FFormasPagoController := NIL;
FTiposIVAController := NIL;
inherited;
end;
class function TfrViewConfiguracionContactos.GetViewClass: TClass;
begin
Result := TfrViewConfiguracionContactos;
end;
procedure TfrViewConfiguracionContactos.GuardarValores;
begin
inherited;
AppFactuGES.Configuracion.SetSettingAsString(teXML,'Clientes.RegimenIVA', cbRegimenIVA.Text);
AppFactuGES.Configuracion.SetSettingAsString(teXML,'Clientes.FormaPago', cbFormaPago.Text);
AppFactuGES.Configuracion.SetSettingAsString(teXML,'Clientes.TipoIVA', cbIVA.Text);
AppFactuGES.Configuracion.SetSettingAsString(teXML,'Proveedores.RegimenIVA', cbRegimenIVAProv.Text);
AppFactuGES.Configuracion.SetSettingAsString(teXML,'Proveedores.FormaPago', cbFormaPagoProv.Text);
AppFactuGES.Configuracion.SetSettingAsString(teXML,'Proveedores.TipoIVA', cbTipoIVAProv.Text);
end;
end.