//--------------------------------------------------------------------------- #include #pragma hdrstop #include "Date_F.h" //--------------------------------------------------------------------------- #pragma package(smart_init) #pragma link "RzPanel" #pragma link "RzPopups" #pragma link "RzCmboBx" #pragma link "RzButton" #pragma link "RzEdit" #pragma link "RzLabel" #pragma link "RzSpnEdt" #pragma link "TntStdCtrls" #pragma link "RzRadChk" #pragma resource "*.dfm" //--------------------------------------------------------------------------- #include "MainReport.h" TDate_Form *Date_Form; //--------------------------------------------------------------------------- #define IDS_DATE StringTable[0] #define IDS_TYPE StringTable[1] #define IDS_CELL_REF StringTable[2] #define IDS_CELL StringTable[3] #define IDS_FROM StringTable[4] #define IDS_AFTER StringTable[5] #define IDS_OK StringTable[6] #define IDS_CANCEL StringTable[7] //--------------------------------------------------------------------------- __fastcall TDate_Form::TDate_Form(TComponent* Owner) : TForm(Owner) { RzSpinEditDifference->Value = 0; refDateTime = refDateTime.CurrentDate(); //ÇöÀç ³¯Â¥·Î ÃʱâÈ­ AnsiString Language = ReadRegistry("Language", false); dir = ReadRegistry("DefaultDir", true); StringTable.Create(dir + "\\Program", Language, "Date"); Caption = IDS_DATE; RzLabelFormat->Caption = IDS_TYPE; RzCheckBoxRef->Caption = IDS_CELL_REF; RzLabelCellName->Caption = IDS_CELL; RzLabelFrom->Caption = IDS_FROM; RzLabelDifference->Caption = IDS_AFTER; btnOk->Caption = IDS_OK; btnCancel->Caption = IDS_CANCEL; //³¯Â¥ Çü½Ä item ¼³Á¤ TnTDateFormatCombo->Items->Clear(); TnTDateFormatCombo->Items->Add("2001-3-14"); TnTDateFormatCombo->Items->Add("2001/3/14"); TnTDateFormatCombo->Items->Add("2001"+ MainReportForm->ReportDoc->YearText + " 3" + MainReportForm->ReportDoc->MonthText + " 14" + MainReportForm->ReportDoc->DayText); TnTDateFormatCombo->Items->Add("01-3-14"); TnTDateFormatCombo->Items->Add("01/3/14"); TnTDateFormatCombo->Items->Add("01"+ MainReportForm->ReportDoc->YearText + " 3" + MainReportForm->ReportDoc->MonthText + " 14" + MainReportForm->ReportDoc->DayText); TnTDateFormatCombo->Items->Add("3-14"); TnTDateFormatCombo->Items->Add("3/14"); TnTDateFormatCombo->Items->Add("3" + MainReportForm->ReportDoc->MonthText + " 14" + MainReportForm->ReportDoc->DayText); TnTDateFormatCombo->Items->Add("3/14/01"); TnTDateFormatCombo->Items->Add("03/14/01"); } //--------------------------------------------------------------------------- void __fastcall TDate_Form::SetFunction() { //ÇÔ¼ö ÃʱâÈ­ (MainReportForm¿¡ ÀÖ´Â ÇÔ¼öµéÀ» ¿¬°á) if (MainReportForm) { btnOk->OnClick = MainReportForm->btnDateFormOKClick; btnCancel->OnClick = MainReportForm->btnDateFormCancelClick; RzCalendar->OnDblClick = MainReportForm->btnDateFormOKClick; } } //--------------------------------------------------------------------------- void __fastcall TDate_Form::RzSpinEditDifferenceChange(TObject *Sender) { if(RzCheckBoxRef->Checked){ RzDateTimeEditDifference->Date = refDateTime + (int)RzSpinEditDifference->Value; } } //--------------------------------------------------------------------------- void __fastcall TDate_Form::RzDateTimeEditDifferenceCloseUp( TObject *Sender) { if(RzCheckBoxRef->Checked){ RzSpinEditDifference->Value = RzDateTimeEditDifference->Date - refDateTime; } } //--------------------------------------------------------------------------- void __fastcall TDate_Form::RzCheckBoxRefClick(TObject *Sender) { RzLabelCellName->Caption = "CELL"; RzLabelRefDate->Caption = "0000-00-00"; if(!RzCheckBoxRef->Checked){ RzDateTimeEditDifference->Text = ""; RzDateTimeEditDifference->Clear(); RzSpinEditDifference->Value = 0; refDateTime = refDateTime.CurrentDate(); } else { RzDateTimeEditDifference->Date = refDateTime + (int)RzSpinEditDifference->Value; RzCalendar->Date = RzCalendar->Date.CurrentDate(); } RzCalendar->Enabled = !RzCheckBoxRef->Checked; RzLabelCellName->Enabled = RzCheckBoxRef->Checked; RzSpinEditDifference->Enabled = RzCheckBoxRef->Checked; RzDateTimeEditDifference->Enabled = RzCheckBoxRef->Checked; } //--------------------------------------------------------------------------- void __fastcall TDate_Form::FormClose(TObject *Sender, TCloseAction &Action) { ((TMainReportForm*)(this->Owner))->btnDateFormCancelClick(Sender); } //---------------------------------------------------------------------------