You've already forked lazarus-ccr
TRxDateRangeEdit - add Quarter and HalfYear
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3260 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -89,10 +89,22 @@ msgstr ""
|
|||||||
msgid "File specified is not an executable file, dynamic-link library, or icon file"
|
msgid "File specified is not an executable file, dynamic-link library, or icon file"
|
||||||
msgstr "Fichero especificado no es un fichero ejecutable, vinculo dinamico, o fichero de icono"
|
msgstr "Fichero especificado no es un fichero ejecutable, vinculo dinamico, o fichero de icono"
|
||||||
|
|
||||||
|
#: rxconst.sfirsthalfofyear
|
||||||
|
msgid "First half of year"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.sfirstquarter
|
||||||
|
msgid "First quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sflatbuttons
|
#: rxconst.sflatbuttons
|
||||||
msgid "Flat buttons"
|
msgid "Flat buttons"
|
||||||
msgstr "Botones planos"
|
msgstr "Botones planos"
|
||||||
|
|
||||||
|
#: rxconst.sfourthquarter
|
||||||
|
msgid "Fourth quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sfpcversion
|
#: rxconst.sfpcversion
|
||||||
msgid "FPC version : "
|
msgid "FPC version : "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -169,6 +181,14 @@ msgstr ""
|
|||||||
msgid "Error. Expected value for filed %s."
|
msgid "Error. Expected value for filed %s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.ssecondhalfofyear
|
||||||
|
msgid "Second half of year"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.ssecondquarter
|
||||||
|
msgid "Second quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sshowcaption
|
#: rxconst.sshowcaption
|
||||||
msgid "Show caption"
|
msgid "Show caption"
|
||||||
msgstr "Mostrar titulo"
|
msgstr "Mostrar titulo"
|
||||||
@ -185,6 +205,10 @@ msgstr ""
|
|||||||
msgid "Target OS : "
|
msgid "Target OS : "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.sthirdquarter
|
||||||
|
msgid "Third quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.stocurdate
|
#: rxconst.stocurdate
|
||||||
msgid "Set current date"
|
msgid "Set current date"
|
||||||
msgstr "Poner fecha actual"
|
msgstr "Poner fecha actual"
|
||||||
|
@ -89,10 +89,22 @@ msgstr ""
|
|||||||
msgid "File specified is not an executable file, dynamic-link library, or icon file"
|
msgid "File specified is not an executable file, dynamic-link library, or icon file"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.sfirsthalfofyear
|
||||||
|
msgid "First half of year"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.sfirstquarter
|
||||||
|
msgid "First quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sflatbuttons
|
#: rxconst.sflatbuttons
|
||||||
msgid "Flat buttons"
|
msgid "Flat buttons"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.sfourthquarter
|
||||||
|
msgid "Fourth quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sfpcversion
|
#: rxconst.sfpcversion
|
||||||
msgid "FPC version : "
|
msgid "FPC version : "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -169,6 +181,14 @@ msgstr ""
|
|||||||
msgid "Error. Expected value for filed %s."
|
msgid "Error. Expected value for filed %s."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.ssecondhalfofyear
|
||||||
|
msgid "Second half of year"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.ssecondquarter
|
||||||
|
msgid "Second quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sshowcaption
|
#: rxconst.sshowcaption
|
||||||
msgid "Show caption"
|
msgid "Show caption"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -185,6 +205,10 @@ msgstr ""
|
|||||||
msgid "Target OS : "
|
msgid "Target OS : "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.sthirdquarter
|
||||||
|
msgid "Third quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.stocurdate
|
#: rxconst.stocurdate
|
||||||
msgid "Set current date"
|
msgid "Set current date"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -89,10 +89,22 @@ msgstr "Элемент управления не найден в валидат
|
|||||||
msgid "File specified is not an executable file, dynamic-link library, or icon file"
|
msgid "File specified is not an executable file, dynamic-link library, or icon file"
|
||||||
msgstr "Указанный файл не исполняемый, не библиотека и не иконка"
|
msgstr "Указанный файл не исполняемый, не библиотека и не иконка"
|
||||||
|
|
||||||
|
#: rxconst.sfirsthalfofyear
|
||||||
|
msgid "First half of year"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.sfirstquarter
|
||||||
|
msgid "First quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sflatbuttons
|
#: rxconst.sflatbuttons
|
||||||
msgid "Flat buttons"
|
msgid "Flat buttons"
|
||||||
msgstr "Плавающие кнопки"
|
msgstr "Плавающие кнопки"
|
||||||
|
|
||||||
|
#: rxconst.sfourthquarter
|
||||||
|
msgid "Fourth quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sfpcversion
|
#: rxconst.sfpcversion
|
||||||
msgid "FPC version : "
|
msgid "FPC version : "
|
||||||
msgstr "Версия FPC : "
|
msgstr "Версия FPC : "
|
||||||
@ -169,6 +181,14 @@ msgstr "Графический интерфейс QT"
|
|||||||
msgid "Error. Expected value for filed %s."
|
msgid "Error. Expected value for filed %s."
|
||||||
msgstr "Поле %s. Требуется значение"
|
msgstr "Поле %s. Требуется значение"
|
||||||
|
|
||||||
|
#: rxconst.ssecondhalfofyear
|
||||||
|
msgid "Second half of year"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.ssecondquarter
|
||||||
|
msgid "Second quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sshowcaption
|
#: rxconst.sshowcaption
|
||||||
msgid "Show caption"
|
msgid "Show caption"
|
||||||
msgstr "Отображать заголовок"
|
msgstr "Отображать заголовок"
|
||||||
@ -185,6 +205,10 @@ msgstr "Целевой процессор : "
|
|||||||
msgid "Target OS : "
|
msgid "Target OS : "
|
||||||
msgstr "Целевая ОС : "
|
msgstr "Целевая ОС : "
|
||||||
|
|
||||||
|
#: rxconst.sthirdquarter
|
||||||
|
msgid "Third quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.stocurdate
|
#: rxconst.stocurdate
|
||||||
msgid "Set current date"
|
msgid "Set current date"
|
||||||
msgstr "Установть текущую дату"
|
msgstr "Установть текущую дату"
|
||||||
|
@ -98,10 +98,22 @@ msgstr "Елемент управління не знайдений в валі
|
|||||||
msgid "File specified is not an executable file, dynamic-link library, or icon file"
|
msgid "File specified is not an executable file, dynamic-link library, or icon file"
|
||||||
msgstr "Вказаний файл не виконуваний, не бібліотека і не іконка"
|
msgstr "Вказаний файл не виконуваний, не бібліотека і не іконка"
|
||||||
|
|
||||||
|
#: rxconst.sfirsthalfofyear
|
||||||
|
msgid "First half of year"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.sfirstquarter
|
||||||
|
msgid "First quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sflatbuttons
|
#: rxconst.sflatbuttons
|
||||||
msgid "Flat buttons"
|
msgid "Flat buttons"
|
||||||
msgstr "Плаваючі кнопки"
|
msgstr "Плаваючі кнопки"
|
||||||
|
|
||||||
|
#: rxconst.sfourthquarter
|
||||||
|
msgid "Fourth quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sfpcversion
|
#: rxconst.sfpcversion
|
||||||
msgid "FPC version : "
|
msgid "FPC version : "
|
||||||
msgstr "Версія FPC : "
|
msgstr "Версія FPC : "
|
||||||
@ -178,6 +190,14 @@ msgstr "Набір віджетів QT"
|
|||||||
msgid "Error. Expected value for filed %s."
|
msgid "Error. Expected value for filed %s."
|
||||||
msgstr "Поле %s. Вимагається значення"
|
msgstr "Поле %s. Вимагається значення"
|
||||||
|
|
||||||
|
#: rxconst.ssecondhalfofyear
|
||||||
|
msgid "Second half of year"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: rxconst.ssecondquarter
|
||||||
|
msgid "Second quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.sshowcaption
|
#: rxconst.sshowcaption
|
||||||
msgid "Show caption"
|
msgid "Show caption"
|
||||||
msgstr "Показати заголовок"
|
msgstr "Показати заголовок"
|
||||||
@ -194,6 +214,10 @@ msgstr "Цільовий CPU : "
|
|||||||
msgid "Target OS : "
|
msgid "Target OS : "
|
||||||
msgstr "Цільова OS : "
|
msgstr "Цільова OS : "
|
||||||
|
|
||||||
|
#: rxconst.sthirdquarter
|
||||||
|
msgid "Third quarter"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#: rxconst.stocurdate
|
#: rxconst.stocurdate
|
||||||
msgid "Set current date"
|
msgid "Set current date"
|
||||||
msgstr "Встановити поточну дату"
|
msgstr "Встановити поточну дату"
|
||||||
|
@ -47,10 +47,17 @@ procedure Register;
|
|||||||
implementation
|
implementation
|
||||||
uses
|
uses
|
||||||
PropEdits, folderlister, duallist, RxHistoryNavigator,
|
PropEdits, folderlister, duallist, RxHistoryNavigator,
|
||||||
curredit, rxswitch, rxdice, rxtoolbar, rxxpman, PageMngr, RxAppIcon,
|
curredit, rxswitch, rxdice, rxtoolbar,
|
||||||
Dialogs, ComponentEditors, DBPropEdits, DB, rxctrls,
|
{$IFDEF USE_TRXXPManifest}
|
||||||
RxCustomChartPanel, AutoPanel, pickdate, rxconst, tooledit, rxclock,
|
rxxpman,
|
||||||
rxpopupunit, rxspin, RxTimeEdit, rxDateRangeEditUnit,
|
{$ENDIF}
|
||||||
|
PageMngr,
|
||||||
|
{$IFDEF USE_TRxAppIcon}
|
||||||
|
RxAppIcon,
|
||||||
|
{$ENDIF}
|
||||||
|
Dialogs, ComponentEditors, DBPropEdits, rxctrls,
|
||||||
|
RxCustomChartPanel, AutoPanel, pickdate, tooledit, rxclock,
|
||||||
|
rxspin, RxTimeEdit, rxDateRangeEditUnit,
|
||||||
RxAboutDialog, RxViewsPanel, RxMDI;
|
RxAboutDialog, RxViewsPanel, RxMDI;
|
||||||
|
|
||||||
{$IFDEF USE_TRxAppIcon}
|
{$IFDEF USE_TRxAppIcon}
|
||||||
|
@ -128,6 +128,14 @@ resourcestring
|
|||||||
sCloseAllExceptThis = 'Close all except this';
|
sCloseAllExceptThis = 'Close all except this';
|
||||||
sCloseAllWindows = 'Close all windows';
|
sCloseAllWindows = 'Close all windows';
|
||||||
|
|
||||||
|
{ TRxDateRangeEdit }
|
||||||
|
sFirstQuarter = 'First quarter';
|
||||||
|
sSecondQuarter = 'Second quarter';
|
||||||
|
sThirdQuarter = 'Third quarter';
|
||||||
|
sFourthQuarter = 'Fourth quarter';
|
||||||
|
sFirstHalfOfYear = 'First half of year';
|
||||||
|
sSecondHalfOfYear = 'Second half of year';
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -7,6 +7,10 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, types, Controls, Buttons, StdCtrls, Spin;
|
Classes, SysUtils, types, Controls, Buttons, StdCtrls, Spin;
|
||||||
|
|
||||||
|
type
|
||||||
|
TRxDateRangeEditOption = (reoMonth, reoQuarter, reoHalfYear);
|
||||||
|
TRxDateRangeEditOptions = set of TRxDateRangeEditOption;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
{ TRxCustomDateRangeEdit }
|
{ TRxCustomDateRangeEdit }
|
||||||
@ -18,6 +22,7 @@ type
|
|||||||
FOnEditClick: TNotifyEvent;
|
FOnEditClick: TNotifyEvent;
|
||||||
FOnEditEnter: TNotifyEvent;
|
FOnEditEnter: TNotifyEvent;
|
||||||
FOnEditExit: TNotifyEvent;
|
FOnEditExit: TNotifyEvent;
|
||||||
|
FOptions: TRxDateRangeEditOptions;
|
||||||
FsbDecYear: TSpeedButton;
|
FsbDecYear: TSpeedButton;
|
||||||
FsbDecMonth: TSpeedButton;
|
FsbDecMonth: TSpeedButton;
|
||||||
FsbIncYear: TSpeedButton;
|
FsbIncYear: TSpeedButton;
|
||||||
@ -28,12 +33,18 @@ type
|
|||||||
procedure DoIncYear(Sender: TObject);
|
procedure DoIncYear(Sender: TObject);
|
||||||
procedure DoDecMonth(Sender: TObject);
|
procedure DoDecMonth(Sender: TObject);
|
||||||
procedure DoDecYear(Sender: TObject);
|
procedure DoDecYear(Sender: TObject);
|
||||||
|
function GetHalfYear: word;
|
||||||
function GetMonth: word;
|
function GetMonth: word;
|
||||||
function GetPeriod: TDateTime;
|
function GetPeriod: TDateTime;
|
||||||
|
function GetPeriodEnd: TDateTime;
|
||||||
|
function GetQuarter: word;
|
||||||
function GetYear: word;
|
function GetYear: word;
|
||||||
procedure SetFlat(AValue: Boolean);
|
procedure SetFlat(AValue: Boolean);
|
||||||
|
procedure SetHalfYear(AValue: word);
|
||||||
procedure SetMonth(AValue: word);
|
procedure SetMonth(AValue: word);
|
||||||
|
procedure SetOptions(AValue: TRxDateRangeEditOptions);
|
||||||
procedure SetPeriod(AValue: TDateTime);
|
procedure SetPeriod(AValue: TDateTime);
|
||||||
|
procedure SetQuarter(AValue: word);
|
||||||
procedure SetYear(AValue: word);
|
procedure SetYear(AValue: word);
|
||||||
procedure InternalOnEditChange(Sender: TObject);
|
procedure InternalOnEditChange(Sender: TObject);
|
||||||
procedure InternalOnEditClick(Sender: TObject);
|
procedure InternalOnEditClick(Sender: TObject);
|
||||||
@ -50,10 +61,15 @@ type
|
|||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
|
|
||||||
|
property Quarter:word read GetQuarter write SetQuarter;
|
||||||
|
property HalfYear:word read GetHalfYear write SetHalfYear;
|
||||||
property Flat: Boolean read FFlat write SetFlat default False;
|
property Flat: Boolean read FFlat write SetFlat default False;
|
||||||
property Year:word read GetYear write SetYear;
|
property Year:word read GetYear write SetYear;
|
||||||
property Month:word read GetMonth write SetMonth;
|
property Month:word read GetMonth write SetMonth;
|
||||||
property Period:TDateTime read GetPeriod write SetPeriod;
|
property Period:TDateTime read GetPeriod write SetPeriod;
|
||||||
|
property PeriodEnd:TDateTime read GetPeriodEnd;
|
||||||
|
property Options:TRxDateRangeEditOptions read FOptions write SetOptions default [reoMonth];
|
||||||
property OnChange: TNotifyEvent read FOnEditChange write FOnEditChange;
|
property OnChange: TNotifyEvent read FOnEditChange write FOnEditChange;
|
||||||
property OnClick: TNotifyEvent read FOnEditClick write FOnEditClick;
|
property OnClick: TNotifyEvent read FOnEditClick write FOnEditClick;
|
||||||
property OnEnter: TNotifyEvent read FOnEditEnter write FOnEditEnter;
|
property OnEnter: TNotifyEvent read FOnEditEnter write FOnEditEnter;
|
||||||
@ -63,30 +79,29 @@ type
|
|||||||
type
|
type
|
||||||
TRxDateRangeEdit = class(TRxCustomDateRangeEdit)
|
TRxDateRangeEdit = class(TRxCustomDateRangeEdit)
|
||||||
published
|
published
|
||||||
property Autosize default True;
|
|
||||||
property Align;
|
property Align;
|
||||||
property Anchors;
|
property Anchors;
|
||||||
|
property Autosize default True;
|
||||||
property BiDiMode;
|
property BiDiMode;
|
||||||
property BorderSpacing;
|
property BorderSpacing;
|
||||||
property BorderStyle default bsNone;
|
property BorderStyle default bsNone;
|
||||||
property Constraints;
|
|
||||||
property Color;
|
property Color;
|
||||||
|
property Constraints;
|
||||||
property Cursor;
|
property Cursor;
|
||||||
property Enabled;
|
property Enabled;
|
||||||
property Flat;
|
property Flat;
|
||||||
property Year;
|
|
||||||
property Month;
|
|
||||||
property Hint;
|
property Hint;
|
||||||
|
property Month;
|
||||||
|
property Options;
|
||||||
property ParentBiDiMode;
|
property ParentBiDiMode;
|
||||||
property ParentColor;
|
property ParentColor;
|
||||||
property ParentFont;
|
property ParentFont;
|
||||||
property PopupMenu;
|
property PopupMenu;
|
||||||
// property ReadOnly;
|
|
||||||
property ShowHint;
|
property ShowHint;
|
||||||
property TabOrder;
|
property TabOrder;
|
||||||
property TabStop;
|
property TabStop;
|
||||||
// property Text;
|
|
||||||
property Visible;
|
property Visible;
|
||||||
|
property Year;
|
||||||
|
|
||||||
property OnChange;
|
property OnChange;
|
||||||
property OnClick;
|
property OnClick;
|
||||||
@ -95,18 +110,51 @@ type
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
uses dateutil, rxconst;
|
||||||
|
|
||||||
{ TRxCustomDateRangeEdit }
|
{ TRxCustomDateRangeEdit }
|
||||||
|
|
||||||
procedure TRxCustomDateRangeEdit.DoIncMonth(Sender: TObject);
|
procedure TRxCustomDateRangeEdit.DoIncMonth(Sender: TObject);
|
||||||
|
var
|
||||||
|
i:integer;
|
||||||
begin
|
begin
|
||||||
if FEditMonth.ItemIndex < 11 then
|
if FEditMonth.ItemIndex>=0 then
|
||||||
FEditMonth.ItemIndex := FEditMonth.ItemIndex + 1
|
begin
|
||||||
|
i:=PtrInt(FEditMonth.Items.Objects[FEditMonth.ItemIndex]);
|
||||||
|
|
||||||
|
if I in [17, 18] then
|
||||||
|
begin
|
||||||
|
if i = 18 then
|
||||||
|
begin
|
||||||
|
i:=17;
|
||||||
|
Year:=Year + 1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
i:=18;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if i in [13..16] then
|
||||||
|
begin
|
||||||
|
inc(i);
|
||||||
|
if i> 16 then
|
||||||
|
begin
|
||||||
|
i:=13;
|
||||||
|
Year:=Year + 1;
|
||||||
|
end;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
FEditMonth.ItemIndex := 0;
|
inc(i);
|
||||||
FEditYear.Value:=FEditYear.Value + 1;
|
if i > 12 then
|
||||||
|
begin
|
||||||
|
i:=1;
|
||||||
|
Year:=Year + 1;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
FEditMonth.ItemIndex := i - 1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
FEditMonth.ItemIndex := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxCustomDateRangeEdit.DoIncYear(Sender: TObject);
|
procedure TRxCustomDateRangeEdit.DoIncYear(Sender: TObject);
|
||||||
@ -115,14 +163,46 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxCustomDateRangeEdit.DoDecMonth(Sender: TObject);
|
procedure TRxCustomDateRangeEdit.DoDecMonth(Sender: TObject);
|
||||||
|
var
|
||||||
|
i:integer;
|
||||||
begin
|
begin
|
||||||
if FEditMonth.ItemIndex > 0 then
|
if FEditMonth.ItemIndex>=0 then
|
||||||
FEditMonth.ItemIndex := FEditMonth.ItemIndex - 1
|
begin
|
||||||
|
i:=PtrInt(FEditMonth.Items.Objects[FEditMonth.ItemIndex]);
|
||||||
|
|
||||||
|
if I in [17, 18] then
|
||||||
|
begin
|
||||||
|
if i = 18 then
|
||||||
|
begin
|
||||||
|
i:=17;
|
||||||
|
Year:=Year - 1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
i:=18;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if i in [13..16] then
|
||||||
|
begin
|
||||||
|
Dec(i);
|
||||||
|
if i> 13 then
|
||||||
|
begin
|
||||||
|
i:=16;
|
||||||
|
Year:=Year - 1;
|
||||||
|
end;
|
||||||
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
FEditMonth.ItemIndex := 11;
|
Dec(i);
|
||||||
FEditYear.Value:=FEditYear.Value - 1;
|
if i < 1 then
|
||||||
|
begin
|
||||||
|
i:=12;
|
||||||
|
Year:=Year - 1;
|
||||||
end;
|
end;
|
||||||
|
end;
|
||||||
|
FEditMonth.ItemIndex := i - 1;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
FEditMonth.ItemIndex := 0;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxCustomDateRangeEdit.DoDecYear(Sender: TObject);
|
procedure TRxCustomDateRangeEdit.DoDecYear(Sender: TObject);
|
||||||
@ -130,9 +210,30 @@ begin
|
|||||||
FEditYear.Value:=FEditYear.Value - 1;
|
FEditYear.Value:=FEditYear.Value - 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TRxCustomDateRangeEdit.GetMonth: word;
|
function TRxCustomDateRangeEdit.GetHalfYear: word;
|
||||||
|
var
|
||||||
|
i:integer;
|
||||||
begin
|
begin
|
||||||
Result:=FEditMonth.ItemIndex+1;
|
Result:=0;
|
||||||
|
if reoHalfYear in FOptions then
|
||||||
|
begin
|
||||||
|
i:=PtrInt(FEditMonth.Items.Objects[FEditMonth.ItemIndex]);
|
||||||
|
if i in [17..18] then
|
||||||
|
Result:=i - 16;
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TRxCustomDateRangeEdit.GetMonth: word;
|
||||||
|
var
|
||||||
|
i:integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
if (reoMonth in FOptions) or (FOptions = []) then
|
||||||
|
begin
|
||||||
|
i:=PtrInt(FEditMonth.Items.Objects[FEditMonth.ItemIndex]);
|
||||||
|
if i in [1..12] then
|
||||||
|
Result:=i;
|
||||||
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TRxCustomDateRangeEdit.GetPeriod: TDateTime;
|
function TRxCustomDateRangeEdit.GetPeriod: TDateTime;
|
||||||
@ -140,6 +241,24 @@ begin
|
|||||||
Result:=EncodeDate(Year, Month, 1);
|
Result:=EncodeDate(Year, Month, 1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TRxCustomDateRangeEdit.GetPeriodEnd: TDateTime;
|
||||||
|
begin
|
||||||
|
Result:=EncodeDate(Year, Month, DaysPerMonth(Year, Month));
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TRxCustomDateRangeEdit.GetQuarter: word;
|
||||||
|
var
|
||||||
|
i:integer;
|
||||||
|
begin
|
||||||
|
Result:=0;
|
||||||
|
if reoQuarter in FOptions then
|
||||||
|
begin
|
||||||
|
i:=PtrInt(FEditMonth.Items.Objects[FEditMonth.ItemIndex]);
|
||||||
|
if i in [13..16] then
|
||||||
|
Result:=i - 12;
|
||||||
|
end
|
||||||
|
end;
|
||||||
|
|
||||||
function TRxCustomDateRangeEdit.GetYear: word;
|
function TRxCustomDateRangeEdit.GetYear: word;
|
||||||
begin
|
begin
|
||||||
Result:=FEditYear.Value;
|
Result:=FEditYear.Value;
|
||||||
@ -155,12 +274,24 @@ begin
|
|||||||
FsbIncYear.Flat:=FFlat;
|
FsbIncYear.Flat:=FFlat;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRxCustomDateRangeEdit.SetHalfYear(AValue: word);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRxCustomDateRangeEdit.SetMonth(AValue: word);
|
procedure TRxCustomDateRangeEdit.SetMonth(AValue: word);
|
||||||
begin
|
begin
|
||||||
if (AValue>0) and (AValue < 13) then
|
if (AValue>0) and (AValue < 13) then
|
||||||
FEditMonth.ItemIndex:=AValue-1;
|
FEditMonth.ItemIndex:=AValue-1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRxCustomDateRangeEdit.SetOptions(AValue: TRxDateRangeEditOptions);
|
||||||
|
begin
|
||||||
|
if FOptions=AValue then Exit;
|
||||||
|
FOptions:=AValue;
|
||||||
|
FillMonthNames;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRxCustomDateRangeEdit.SetPeriod(AValue: TDateTime);
|
procedure TRxCustomDateRangeEdit.SetPeriod(AValue: TDateTime);
|
||||||
var
|
var
|
||||||
Y, M, D: word;
|
Y, M, D: word;
|
||||||
@ -170,6 +301,11 @@ begin
|
|||||||
FEditYear.Value:=Y;
|
FEditYear.Value:=Y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TRxCustomDateRangeEdit.SetQuarter(AValue: word);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TRxCustomDateRangeEdit.SetYear(AValue: word);
|
procedure TRxCustomDateRangeEdit.SetYear(AValue: word);
|
||||||
begin
|
begin
|
||||||
FEditYear.Value:=AValue;
|
FEditYear.Value:=AValue;
|
||||||
@ -203,10 +339,40 @@ end;
|
|||||||
|
|
||||||
procedure TRxCustomDateRangeEdit.FillMonthNames;
|
procedure TRxCustomDateRangeEdit.FillMonthNames;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i, k: Integer;
|
||||||
begin
|
begin
|
||||||
|
FEditMonth.Items.BeginUpdate;
|
||||||
|
FEditMonth.Items.Clear;
|
||||||
|
if (reoMonth in FOptions) or (FOptions = []) then
|
||||||
|
begin
|
||||||
for i:=1 to 12 do
|
for i:=1 to 12 do
|
||||||
FEditMonth.Items.Add(DefaultFormatSettings.LongMonthNames[i]);
|
begin
|
||||||
|
k:=FEditMonth.Items.Add(DefaultFormatSettings.LongMonthNames[i]);
|
||||||
|
FEditMonth.Items.Objects[K]:=TObject(Pointer(i));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (reoQuarter in FOptions) or (FOptions = []) then
|
||||||
|
begin
|
||||||
|
k:=FEditMonth.Items.Add(sFirstQuarter);
|
||||||
|
FEditMonth.Items.Objects[K]:=TObject(Pointer(13));
|
||||||
|
k:=FEditMonth.Items.Add(sSecondQuarter);
|
||||||
|
FEditMonth.Items.Objects[K]:=TObject(Pointer(14));
|
||||||
|
k:=FEditMonth.Items.Add(sThirdQuarter);
|
||||||
|
FEditMonth.Items.Objects[K]:=TObject(Pointer(15));
|
||||||
|
k:=FEditMonth.Items.Add(sFourthQuarter);
|
||||||
|
FEditMonth.Items.Objects[K]:=TObject(Pointer(16));
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (reoHalfYear in FOptions) or (FOptions = []) then
|
||||||
|
begin
|
||||||
|
k:=FEditMonth.Items.Add(sFirstHalfOfYear);
|
||||||
|
FEditMonth.Items.Objects[K]:=TObject(Pointer(17));
|
||||||
|
k:=FEditMonth.Items.Add(sSecondHalfOfYear);
|
||||||
|
FEditMonth.Items.Objects[K]:=TObject(Pointer(18));
|
||||||
|
end;
|
||||||
|
FEditMonth.ItemIndex:=0;
|
||||||
|
FEditMonth.Items.EndUpdate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TRxCustomDateRangeEdit.SetAutoSize(AValue: Boolean);
|
procedure TRxCustomDateRangeEdit.SetAutoSize(AValue: Boolean);
|
||||||
@ -241,12 +407,14 @@ end;
|
|||||||
constructor TRxCustomDateRangeEdit.Create(AOwner: TComponent);
|
constructor TRxCustomDateRangeEdit.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
|
FOptions:=[reoMonth];
|
||||||
|
|
||||||
FEditYear:=TSpinEdit.Create(Self);
|
FEditYear:=TSpinEdit.Create(Self);
|
||||||
FEditMonth:=TComboBox.Create(Self);
|
FEditMonth:=TComboBox.Create(Self);
|
||||||
FEditMonth.Style:=csDropDownList;
|
FEditMonth.Style:=csDropDownList;
|
||||||
FEditMonth.DropDownCount:=12;
|
FEditMonth.DropDownCount:=12;
|
||||||
FEditYear.Width:=70;
|
FEditYear.Width:=70;
|
||||||
FEditMonth.Width:=80;
|
FEditMonth.Width:=100;
|
||||||
|
|
||||||
FsbDecYear:=TSpeedButton.Create(Self);
|
FsbDecYear:=TSpeedButton.Create(Self);
|
||||||
FsbDecMonth:=TSpeedButton.Create(Self);
|
FsbDecMonth:=TSpeedButton.Create(Self);
|
||||||
|
Reference in New Issue
Block a user