git-svn-id: https://192.168.0.254/svn/Proyectos.ConstruccionesCNJ_FactuGES/trunk@4 6cb6b671-b4a0-dd4c-8bdc-3006503d97e9
180 lines
5.2 KiB
ObjectPascal
180 lines
5.2 KiB
ObjectPascal
unit uEditorSituacionMontaje;
|
|
|
|
interface
|
|
|
|
uses
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|
Dialogs, StdCtrls, ExtCtrls,
|
|
uIEditorSituacionMontaje, uMontajesController, uBizMontajes,
|
|
JvExControls, JvComponent, JvgWizardHeader, cxControls, cxContainer, cxEdit,
|
|
cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalendar, cxDBEdit, ActnList;
|
|
|
|
type
|
|
TfEditorSituacionMontaje = class(TForm, IEditorSituacionMontaje)
|
|
pnlSeleccion: TPanel;
|
|
bAceptar: TButton;
|
|
bCancelar: TButton;
|
|
JvgWizardHeader1: TJvgWizardHeader;
|
|
rbPendiente: TRadioButton;
|
|
rbEjecucion: TRadioButton;
|
|
rbTerminado: TRadioButton;
|
|
Label1: TLabel;
|
|
Label2: TLabel;
|
|
Label3: TLabel;
|
|
edtFechaInicio: TcxDateEdit;
|
|
edtFechaFinalizacion: TcxDateEdit;
|
|
ActionList1: TActionList;
|
|
actPendiente: TAction;
|
|
actEjecucion: TAction;
|
|
actTerminado: TAction;
|
|
actAceptar: TAction;
|
|
Label4: TLabel;
|
|
edtFechaMontajeIni: TEdit;
|
|
Label5: TLabel;
|
|
edtFechaMontajeFin: TEdit;
|
|
actPagado: TAction;
|
|
rbPagado: TRadioButton;
|
|
Label6: TLabel;
|
|
procedure actPendienteExecute(Sender: TObject);
|
|
procedure actEjecucionExecute(Sender: TObject);
|
|
procedure actTerminadoExecute(Sender: TObject);
|
|
procedure actPagadoExecute(Sender: TObject);
|
|
procedure actAceptarExecute(Sender: TObject);
|
|
|
|
private
|
|
FController: IMontajesController;
|
|
FMontaje: IBizMontaje;
|
|
function GetController : IMontajesController;
|
|
procedure SetController (const Value : IMontajesController);
|
|
|
|
function GetMontaje: IBizMontaje;
|
|
procedure SetMontaje(const Value: IBizMontaje);
|
|
procedure RefrescarEstado;
|
|
public
|
|
property Montaje: IBizMontaje read GetMontaje write SetMontaje;
|
|
property Controller : IMontajesController read GetController write SetController;
|
|
end;
|
|
|
|
implementation
|
|
|
|
{$R *.dfm}
|
|
|
|
uses
|
|
uDateUtils, DateUtils;
|
|
|
|
{ TfEditorSituacionPedido }
|
|
|
|
procedure TfEditorSituacionMontaje.actEjecucionExecute(Sender: TObject);
|
|
begin
|
|
RefrescarEstado;
|
|
end;
|
|
|
|
procedure TfEditorSituacionMontaje.actAceptarExecute(Sender: TObject);
|
|
var
|
|
AControllerMontajes: IMontajesController;
|
|
AMontaje: IBizMontaje;
|
|
begin
|
|
if rbPendiente.Checked then
|
|
if (FMontaje.SITUACION <> SITUACION_MONTAJE_PENDIENTE) then
|
|
FController.CambiarSituacion(FMontaje, SITUACION_MONTAJE_PENDIENTE);
|
|
|
|
if rbEjecucion.Checked then
|
|
if (FMontaje.SITUACION <> SITUACION_MONTAJE_EJECUCION) then
|
|
FController.CambiarSituacion(FMontaje, SITUACION_MONTAJE_EJECUCION, edtFechaInicio.Date);
|
|
|
|
if rbTerminado.Checked then
|
|
if (FMontaje.SITUACION <> SITUACION_MONTAJE_TERMINADO) then
|
|
FController.CambiarSituacion(FMontaje, SITUACION_MONTAJE_TERMINADO, edtFechaFinalizacion.Date);
|
|
|
|
if rbPagado.Checked then
|
|
if (FMontaje.SITUACION <> SITUACION_MONTAJE_PAGADO) then
|
|
FController.CambiarSituacion(FMontaje, SITUACION_MONTAJE_PAGADO);
|
|
|
|
ModalResult := mrOk;
|
|
Close;
|
|
end;
|
|
|
|
procedure TfEditorSituacionMontaje.actPagadoExecute(Sender: TObject);
|
|
begin
|
|
RefrescarEstado;
|
|
end;
|
|
|
|
procedure TfEditorSituacionMontaje.actPendienteExecute(Sender: TObject);
|
|
begin
|
|
RefrescarEstado;
|
|
end;
|
|
|
|
procedure TfEditorSituacionMontaje.actTerminadoExecute(Sender: TObject);
|
|
begin
|
|
RefrescarEstado;
|
|
end;
|
|
|
|
function TfEditorSituacionMontaje.GetController: IMontajesController;
|
|
begin
|
|
Result := FController;
|
|
end;
|
|
|
|
function TfEditorSituacionMontaje.GetMontaje: IBizMontaje;
|
|
begin
|
|
Result := FMontaje;
|
|
end;
|
|
|
|
procedure TfEditorSituacionMontaje.SetController(const Value: IMontajesController);
|
|
begin
|
|
FController := Value;
|
|
end;
|
|
|
|
procedure TfEditorSituacionMontaje.SetMontaje(const Value: IBizMontaje);
|
|
begin
|
|
FMontaje := Value;
|
|
if not FMontaje.DataTable.Active then
|
|
FMontaje.DataTable.Open;
|
|
|
|
edtFechaMontajeIni.Text := DateToStr(FMontaje.FECHA_INICIO);
|
|
edtFechaMontajeFin.Text := DateToStr(FMontaje.FECHA_FIN);
|
|
|
|
rbPendiente.Checked := (FMontaje.Situacion = SITUACION_MONTAJE_PENDIENTE);
|
|
rbEjecucion.Checked := (FMontaje.Situacion = SITUACION_MONTAJE_EJECUCION);
|
|
rbTerminado.Checked := (FMontaje.Situacion = SITUACION_MONTAJE_TERMINADO);
|
|
rbPagado.Checked := (FMontaje.Situacion = SITUACION_MONTAJE_PAGADO);
|
|
|
|
if not EsFechaVacia(FMontaje.FECHA_INICIO) then
|
|
begin
|
|
edtFechaMontajeIni.Text := DateToStr(FMontaje.FECHA_INICIO);
|
|
edtFechaInicio.Date := FMontaje.FECHA_INICIO;
|
|
end
|
|
else begin
|
|
edtFechaMontajeIni.Clear;
|
|
edtFechaInicio.Clear;
|
|
end;
|
|
|
|
if not EsFechaVacia(FMontaje.FECHA_FIN) then
|
|
begin
|
|
edtFechaMontajeFin.Text := DateToStr(FMontaje.FECHA_FIN);
|
|
edtFechaFinalizacion.Date := FMontaje.FECHA_FIN;
|
|
end
|
|
else begin
|
|
edtFechaMontajeFin.Clear;
|
|
edtFechaFinalizacion.Clear;
|
|
end;
|
|
end;
|
|
|
|
procedure TfEditorSituacionMontaje.RefrescarEstado;
|
|
begin
|
|
edtFechaInicio.Enabled := rbEjecucion.Checked;
|
|
if (edtFechaInicio.Enabled) then
|
|
begin
|
|
if (edtFechaInicio.Date < FMontaje.FECHA_INICIO) then
|
|
edtFechaInicio.Date := DateOf(Now);
|
|
end;
|
|
|
|
edtFechaFinalizacion.Enabled := rbTerminado.Checked;
|
|
if (edtFechaFinalizacion.Enabled) then
|
|
begin
|
|
if (edtFechaFinalizacion.Date < FMontaje.FECHA_FIN) then
|
|
edtFechaFinalizacion.Date := DateOf(Now);
|
|
end;
|
|
end;
|
|
|
|
end.
|