2025-03-01 10:55:52 +08:00
|
|
|
|
unit FrameDateTimeSel;
|
|
|
|
|
|
|
|
|
|
|
|
interface
|
|
|
|
|
|
|
|
|
|
|
|
uses
|
|
|
|
|
|
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants,
|
|
|
|
|
|
System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, cxGraphics,
|
|
|
|
|
|
cxControls, cxLookAndFeels, cxLookAndFeelPainters, cxContainer, cxEdit,
|
|
|
|
|
|
Vcl.ComCtrls, dxCore, cxDateUtils,
|
|
|
|
|
|
cxTextEdit, cxMaskEdit, cxDropDownEdit, cxCalendar, Vcl.StdCtrls,
|
|
|
|
|
|
Vcl.Menus, cxButtons, Vcl.ExtCtrls, DateUtils,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2025-06-27 14:21:45 +08:00
|
|
|
|
cxSpinEdit, cxTimeEdit, dxSkinsCore, dxSkinBasic, dxSkinBlack, dxSkinBlue,
|
|
|
|
|
|
dxSkinBlueprint, dxSkinCaramel, dxSkinCoffee, dxSkinDarkroom, dxSkinDarkSide,
|
|
|
|
|
|
dxSkinDevExpressDarkStyle, dxSkinDevExpressStyle, dxSkinFoggy,
|
|
|
|
|
|
dxSkinGlassOceans, dxSkinHighContrast, dxSkiniMaginary, dxSkinLilian,
|
|
|
|
|
|
dxSkinLiquidSky, dxSkinLondonLiquidSky, dxSkinMcSkin, dxSkinMetropolis,
|
|
|
|
|
|
dxSkinMetropolisDark, dxSkinMoneyTwins, dxSkinOffice2007Black,
|
|
|
|
|
|
dxSkinOffice2007Blue, dxSkinOffice2007Green, dxSkinOffice2007Pink,
|
|
|
|
|
|
dxSkinOffice2007Silver, dxSkinOffice2010Black, dxSkinOffice2010Blue,
|
|
|
|
|
|
dxSkinOffice2010Silver, dxSkinOffice2013DarkGray, dxSkinOffice2013LightGray,
|
|
|
|
|
|
dxSkinOffice2013White, dxSkinOffice2016Colorful, dxSkinOffice2016Dark,
|
|
|
|
|
|
dxSkinOffice2019Black, dxSkinOffice2019Colorful, dxSkinOffice2019DarkGray,
|
|
|
|
|
|
dxSkinOffice2019White, dxSkinPumpkin, dxSkinSeven, dxSkinSevenClassic,
|
|
|
|
|
|
dxSkinSharp, dxSkinSharpPlus, dxSkinSilver, dxSkinSpringtime, dxSkinStardust,
|
|
|
|
|
|
dxSkinSummer2008, dxSkinTheAsphaltWorld, dxSkinTheBezier,
|
|
|
|
|
|
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVisualStudio2013Blue,
|
|
|
|
|
|
dxSkinVisualStudio2013Dark, dxSkinVisualStudio2013Light, dxSkinVS2010,
|
|
|
|
|
|
dxSkinWhiteprint, dxSkinWXI, dxSkinXmas2008Blue;
|
2025-03-01 10:55:52 +08:00
|
|
|
|
|
|
|
|
|
|
type
|
|
|
|
|
|
TfrmFrameDateTimeSel = class(TFrame)
|
|
|
|
|
|
lbl1: TLabel;
|
|
|
|
|
|
lbl2: TLabel;
|
|
|
|
|
|
BegDate: TcxDateEdit;
|
|
|
|
|
|
EndDate: TcxDateEdit;
|
|
|
|
|
|
cxButton1: TcxButton;
|
|
|
|
|
|
cxButton2: TcxButton;
|
|
|
|
|
|
cxButton3: TcxButton;
|
|
|
|
|
|
cbbType: TcxComboBox;
|
|
|
|
|
|
cxButton4: TcxButton;
|
|
|
|
|
|
cxButton5: TcxButton;
|
|
|
|
|
|
BegTime: TcxTimeEdit;
|
|
|
|
|
|
EndTime: TcxTimeEdit;
|
|
|
|
|
|
procedure cxButton4Click(Sender: TObject);
|
|
|
|
|
|
procedure cxButton1Click(Sender: TObject);
|
|
|
|
|
|
procedure cxButton5Click(Sender: TObject);
|
|
|
|
|
|
procedure cxButton2Click(Sender: TObject);
|
|
|
|
|
|
procedure cxButton3Click(Sender: TObject);
|
|
|
|
|
|
private
|
|
|
|
|
|
{ Private declarations }
|
|
|
|
|
|
public
|
|
|
|
|
|
{ Public declarations }
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
implementation
|
|
|
|
|
|
|
|
|
|
|
|
//uses
|
|
|
|
|
|
// U_RTFun;
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmFrameDateTimeSel.cxButton1Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
BegDate.Date := StartOfTheMonth(strToDate(FormatDateTime('yyyy-MM-dd', Now)));
|
|
|
|
|
|
EndDate.Date := EndOfTheMonth(strToDate(FormatDateTime('yyyy-MM-dd', Now)));
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmFrameDateTimeSel.cxButton2Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if cbbType.Text = '<27><>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
BegDate.Date := BegDate.Date - 1;
|
|
|
|
|
|
EndDate.Date := EndDate.Date - 1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if cbbType.Text = '<27><>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
BegDate.Date := StartOfTheMonth(StartOfTheMonth(EndDate.Date) - 1);
|
|
|
|
|
|
EndDate.Date := EndOfTheMonth(StartOfTheMonth(EndDate.Date) - 1);
|
|
|
|
|
|
end;
|
|
|
|
|
|
if cbbType.Text = '<27><>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
BegDate.Date := StartOfTheMonth(strToDate(FormatDateTime('yyyy-01-01', strToDate(FormatDateTime('yyyy-01-01', EndDate.Date)) - 1)));
|
|
|
|
|
|
EndDate.Date := EndOfTheMonth(strToDate(FormatDateTime('yyyy-12-01', BegDate.Date)));
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmFrameDateTimeSel.cxButton3Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
if cbbType.Text = '<27><>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
BegDate.Date := BegDate.Date + 1;
|
|
|
|
|
|
EndDate.Date := EndDate.Date + 1;
|
|
|
|
|
|
end;
|
|
|
|
|
|
if cbbType.Text = '<27><>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
BegDate.Date := EndOfTheMonth(EndDate.Date) + 1;
|
|
|
|
|
|
EndDate.Date := EndOfTheMonth(EndOfTheMonth(EndDate.Date) + 1);
|
|
|
|
|
|
end;
|
|
|
|
|
|
if cbbType.Text = '<27><>' then
|
|
|
|
|
|
begin
|
|
|
|
|
|
BegDate.Date := StartOfTheMonth(strToDate(FormatDateTime('yyyy-01-01', strToDate(FormatDateTime('yyyy-12-31', EndDate.Date)) + 1)));
|
|
|
|
|
|
EndDate.Date := EndOfTheMonth(strToDate(FormatDateTime('yyyy-12-01', BegDate.Date)));
|
|
|
|
|
|
end;
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmFrameDateTimeSel.cxButton4Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
BegDate.Date := strToDate(FormatDateTime('yyyy-MM-dd', Now));
|
|
|
|
|
|
EndDate.Date := strToDate(FormatDateTime('yyyy-MM-dd', Now));
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
procedure TfrmFrameDateTimeSel.cxButton5Click(Sender: TObject);
|
|
|
|
|
|
begin
|
|
|
|
|
|
BegDate.Date := StartOfTheMonth(strToDate(FormatDateTime('yyyy-01-01', Now)));
|
|
|
|
|
|
EndDate.Date := EndOfTheMonth(strToDate(FormatDateTime('yyyy-12-01', Now)));
|
|
|
|
|
|
end;
|
|
|
|
|
|
|
|
|
|
|
|
end.
|
|
|
|
|
|
|