Ver Mensaje Individual
  #7  
Antiguo 24-11-2021
Avatar de Dexter182
Dexter182 Dexter182 is offline
Miembro
 
Registrado: jul 2005
Ubicación: Argentina
Posts: 95
Reputación: 19
Dexter182 Va por buen camino
Muchas gracias a ambos por responder.


Les dejo el código del formulario en el que lo estoy implementando (le quité el código de los procedimientos que consideré poco relevantes para que no quede tan largo):
Código Delphi [-]
unit Tarjetas;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ExtCtrls, StdCtrls, Spin, IniFiles, XPStyleActnCtrls,
  ActnList, ActnMan, ToolWin, ActnCtrls, StdStyleActnCtrls, Buttons, StrUtils,
  Tipos, System.Actions, PngSpeedButton, System.UITypes;

type
  TForm_Tarjetas = class(TForm)
    ActionManager: TActionManager;
    ActionToolBar: TActionToolBar;
    actAceptar: TAction;
    actCancelar: TAction;
    actCredito: TAction;
    actCtaCte: TAction;
    actDebito: TAction;
    actEfectivo: TAction;
    btnAceptar: TPngSpeedButton;
    btnCancelar: TPngSpeedButton;
    cbCredito: TComboBox;
    cbCtaCte: TComboBox;
    cbDebito: TComboBox;
    eCuotas: TEdit;
    eInteres: TEdit;
    eTotal: TEdit;
    lCuotas: TLabel;
    lInteres: TLabel;
    lTotal: TLabel;
    Panel: TPanel;
    seCuotas: TSpinEdit;
    procedure actAceptarExecute(Sender: TObject);
    procedure actCancelarExecute(Sender: TObject);
    procedure actCreditoExecute(Sender: TObject);
    procedure actCtaCteExecute(Sender: TObject);
    procedure actDebitoExecute(Sender: TObject);
    procedure actEfectivoExecute(Sender: TObject);
    procedure cbCreditoChange(Sender: TObject);
    procedure eInteresExit(Sender: TObject);
    procedure eInteresKeyPress(Sender: TObject; var Key: Char);
    procedure eInteresKeyUp(Sender: TObject; var Key: Word;  Shift: TShiftState);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure FormShow(Sender: TObject);
    procedure seCuotasChange(Sender: TObject);
    procedure seCuotasKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
    Archivo_Tarjetas : TIniFile;
    Venta : TDatosPago;
    procedure Actualizar_Total(Interes_Personalizado: Boolean);
    procedure ResetControls;
  public
    { Public declarations }
    property DatosPago:TDatosPago read Venta write Venta;
    procedure Show; reintroduce;
    function ShowModal: Integer; override;
  end;

var
  Form_Tarjetas: TForm_Tarjetas;

implementation

{$R *.dfm}

uses
  Principal, Varios;

procedure TForm_Tarjetas.actEfectivoExecute(Sender: TObject);
//Al presionar el botón de "Efectivo"
begin
  cbDebito.Visible  := FALSE;
  cbCredito.Visible := FALSE;
  cbCtaCte.Visible  := FALSE;
  lCuotas.Visible   := FALSE;
  seCuotas.Visible  := FALSE;
  eCuotas.Visible   := FALSE;
  lInteres.Visible  := FALSE;
  eInteres.Visible  := FALSE;

  eTotal.Text := Venta.Total;
end;

procedure TForm_Tarjetas.actDebitoExecute(Sender: TObject);
//Al presionar el botón de "Tarjeta de Débito"
begin
  cbDebito.Visible  := TRUE;
  cbCredito.Visible := FALSE;
  cbCtaCte.Visible  := FALSE;
  lCuotas.Visible   := FALSE;
  seCuotas.Visible  := FALSE;
  eCuotas.Visible   := FALSE;
  lInteres.Visible  := FALSE;
  eInteres.Visible  := FALSE;
//  cbDebito.SetFocus;

  eTotal.Text := Venta.Total;
end;

procedure TForm_Tarjetas.actCreditoExecute(Sender: TObject);
//Al presionar el botón de "Tarjeta de Crédito"
begin
  cbDebito.Visible  := FALSE;
  cbCredito.Visible := TRUE;
  cbCtaCte.Visible  := FALSE;
  lCuotas.Visible   := TRUE;
  seCuotas.Visible  := TRUE;
  eCuotas.Visible   := TRUE;
  lInteres.Visible  := TRUE;
  eInteres.Visible  := TRUE;

  seCuotas.Text  := IntToStr(Venta.Cuotas);
//  cbCredito.SetFocus;

  Actualizar_Total(FALSE);
end;

procedure TForm_Tarjetas.actCtaCteExecute(Sender: TObject);
//Al presionar el botón de "Cuenta Corriente"
begin
  cbCtaCte.Visible  := TRUE;
  cbDebito.Visible  := FALSE;
  cbCredito.Visible := FALSE;
  lCuotas.Visible   := FALSE;
  seCuotas.Visible  := FALSE;
  eCuotas.Visible   := FALSE;
  lInteres.Visible  := FALSE;
  eInteres.Visible  := FALSE;
//  cbCtaCte.SetFocus;

  eTotal.Text := Venta.Total;
end;

procedure TForm_Tarjetas.FormClose(Sender: TObject; var Action: TCloseAction);
//Libera la memoria ocupada por el archivo INI
begin
  Archivo_Tarjetas.Free;
end;

procedure TForm_Tarjetas.ResetControls;
begin
  Hide;

  //Abre el archivo Tarjetas.ini y completa el ComboBox con los nombres de las tarjetas
  Archivo_Tarjetas := TIniFile.Create (RutaAplicacion+'Datos\Tarjetas\Tarjetas.ini');

  ActualizarCombo(cbDebito, TARJETA, '2');
  ActualizarCombo(cbCredito, TARJETA, '3');
  ActualizarComboClientes(cbCtaCte);
  cbDebito.ItemIndex  := 0;
  cbCredito.ItemIndex := 0;
  seCuotas.Alignment  := taRightJustify;

  Case Venta.FormaPago of
    Contado :
      actEfectivo.Execute;

    Credito :
      begin
        If Venta.Tarjeta <> '' then
          cbCredito.ItemIndex := cbCredito.Items.IndexOf(Venta.Tarjeta);
        actCredito.Execute;
      end;

    Debito :
      begin
        If Venta.Tarjeta <> '' then
          cbDebito.ItemIndex := cbDebito.Items.IndexOf(Venta.Tarjeta);
        actDebito.Execute;
      end;

    CtaCte :
      begin
        If Venta.Cliente <> '' then
          cbCtaCte.ItemIndex := cbCtaCte.Items.IndexOf(Venta.Cliente);
        actCtaCte.Execute;
      end;
  end; {case}
end;

procedure TForm_Tarjetas.Show;
begin
  ResetControls;

  inherited Show;
end;

function TForm_Tarjetas.ShowModal: Integer;
begin
  ResetControls;

  Result := inherited ShowModal;
end;

end.

No lo mencioné, pero el defecto no lo alcanzo a percibir en mi PC (o al menos no se nota tanto)
Yo creo que es porque es una máquina más nueva que en la PC dónde se usa el programa.

Saludos y gracias!!!

Última edición por Dexter182 fecha: 24-11-2021 a las 20:21:54.
Responder Con Cita