關於報表中心內加入視窗的相關問題
相關報表中心有兩個dll:sys_report 和 sys_report_detail
一
若在一級表中新增視窗則只需要在sys_report中新增popmenu
格式如:
TForm *frm = new TForm(this);
frm->Width = 600;
frm->Height = 240;
frm->Caption = "登記完成時間";
frm->Font->Name = "宋體";
frm->Font->Size = 9;
frm->Position = poDesktopCenter;
TLabel *l1 = new TLabel(frm);
l1->Left = 4;
l1->Top = 8;
l1->Caption = "完成時間";
l1->Parent = frm;
l1->Visible = true;
TDateTimePicker *dt1 = new TDateTimePicker(frm);
dt1->Left = 62;
dt1->Top = 4;
dt1->Width = 140;
dt1->Parent = frm;
dt1->Format="yyyy-MM-dd";
dt1->Visible = true;
TLabel *l0 = new TLabel(frm);
l0->Left = 5;
l0->Top = 30;
l0->Caption = "情況描述:";
l0->Parent = frm;
l0->Visible = true;
TMemo *Edit1 = new TMemo(frm);
Edit1->Left = 60;
Edit1->Top = 30;
Edit1->Width = 500;
Edit1->Height = 120;
Edit1->Parent = frm;
Edit1->Visible = true;
TLabel *l2 = new TLabel(frm);
l2->Left = 5;
l2->Top = 160;
l2->Caption = "責任人:";
l2->Parent = frm;
l2->Visible = true;
TComboBox *ComboBox1=new TComboBox(frm);
ComboBox1->Left = 62;
ComboBox1->Top = 160;
//ComboBox1->Width = 310;
ComboBox1->DropDownCount=16;
ComboBox1->Parent = frm;
ComboBox1->Visible = true;
pubQry->Close();
pubQry->SQL->Clear();
pubQry->SQL->Add("select Name from hr_employee where valid=1 order by Name asc");
pubQry->Open();
for(pubQry->First();!pubQry->Eof;pubQry->Next())
{
ComboBox1->Items->Add(pubQry->FieldByName("Name")->AsString);
}
TButton *btn = new TButton(frm);
btn->Top = 160;
btn->Width = 50;
btn->Left = 360;
btn->Caption = "確定";
btn->ModalResult = mrOk;
btn->Parent = frm;
btn->Visible = true;
TButton *btn1 = new TButton(frm);
btn1->Top = 160;
btn1->Width = 50;
btn1->Left = 430;
btn1->Caption = "取消";
btn1->ModalResult = mrCancel;
btn1->Parent = frm;
btn1->Visible = true;
if (frm->ShowModal() == mrOk){
if(ComboBox1->Text.Trim().IsEmpty())
{
ShowMessage("責任人不能為空");
return;
}
if(Edit1->Text.Trim().IsEmpty())
{
ShowMessage("情況描述不能為空");
return;
}
pubQry->SQL->Clear();
pubQry->SQL->Add("update prod_task_d set Situation_memo=:p1,Situation_applydate=:p2,Situation_zrr=:p3,Situation_appName=:p4,Situation_appDate=getdate() where taskNo=:taskNo");
pubQry->Parameters->ParamByName("p1")->Value = Edit1->Text;
pubQry->Parameters->ParamByName("p2")->Value = FormatDateTime("yyyy-MM-dd",dt1->Date);
pubQry->Parameters->ParamByName("p3")->Value = ComboBox1->Text;
pubQry->Parameters->ParamByName("p4")->Value = userName;
pubQry->Parameters->ParamByName("taskNo")->Value = memDS->FieldByName("taskNo")->Value;
pubQry->ExecSQL();
memDS->Edit();
memDS->FieldByName("Situation_memo")->Value = Edit1->Text;
memDS->FieldByName("Situation_applydate")->Value = FormatDateTime("yyyy-MM-dd",dt1->Date);
memDS->FieldByName("Situation_zrr")->Value = ComboBox1->Text;
memDS->FieldByName("Situation_appName")->Value = userName;
memDS->FieldByName("Situation_appDate")->Value = Now();
}
delete frm;
並在約束條件加:
if (tableName == "prod_machine_unfinish")
listGrid->PopupMenu = pm49;若在二級以上的查詢視窗,則需要在 sys_report_detail中新增
二
上傳
三
許可權
四
其它要更新