//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "PlanManage.h"
#include "PlanInput.h"
#include "GxManage.h"
#include "Print.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TPlanManageForm *PlanManageForm;
//---------------------------------------------------------------------------
__fastcall TPlanManageForm::TPlanManageForm(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TPlanManageForm::FormPaint(TObject *Sender)
{
Panel3->Height=Panel1->Height/2;
if(!start)
{
DBGrid1->Columns->Clear();
start=true;
Edit2->Clear();
AnsiString Str;
ADODataSet1->Close();
ADODataSet1->Connection=ADOConnection1;
if(ComboBox1->Text=="未完工")
Str="Select * From 流程主表 where 完工<>1 order by 订单号";
else
Str="Select * From 流程主表 where 完工=1 order by 订单号";
ADODataSet1->CommandText=Str;
ADODataSet1->Open();
DBGrid1->Columns->Clear();
DataSource1->DataSet=ADODataSet1;
DBGrid1->Columns->Add();
DBGrid1->Columns->Items[0]->FieldName="订单号";
DBGrid1->Columns->Add();
DBGrid1->Columns->Items[1]->FieldName="产品名称及规格";
DBGrid1->Columns->Add();
DBGrid1->Columns->Items[2]->FieldName="数量";
DBGrid1->Columns->Add();
DBGrid1->Columns->Items[3]->FieldName="客户名称";
DBGrid1->Columns->Add();
DBGrid1->Columns->Items[4]->FieldName="下单时间";
DBGrid1->Columns->Add();
DBGrid1->Columns->Items[5]->FieldName="交货时间";
DBGrid1->Columns->Add();
DBGrid1->Columns->Items[6]->FieldName="材料情况";
DBGrid1->Columns->Add();
DBGrid1->Columns->Items[7]->FieldName="具体交货时间";
DBGrid1->Columns->Add();
DBGrid1->Columns->Items[8]->FieldName="技术要求";
ADODataSet1->First();
DBGrid1->DataSource=DataSource1;
DBGrid1ColEnter(Sender);
}
Draw();
}
//---------------------------------------------------------------------------
void __fastcall TPlanManageForm::ToolButton11Click(TObject *Sender)
{
Close();
}
//---------------------------------------------------------------------------
void __fastcall TPlanManageForm::FormClose(TObject *Sender,
TCloseAction &Action)
{
Action=caFree;
}
//---------------------------------------------------------------------------
void __fastcall TPlanManageForm::ToolButton12Click(TObject *Sender)
{
PlanInputForm=new TPlanInputForm(Application);
PlanInputForm->Edit1->Clear();
PlanInputForm->Edit2->Clear();
PlanInputForm->Edit3->Clear();
PlanInputForm->Edit4->Text="0";
PlanInputForm->Edit5->Clear();
PlanInputForm->DateTimePicker1->Date=Now().CurrentDate();
PlanInputForm->DateTimePicker2->Date=Now().CurrentDate();
PlanInputForm->Memo1->Clear();
if(PlanInputForm->ShowModal()==mrOk)
{
TLocateOptions opts;
opts.Clear();
opts<<loCaseInsensitive;
if(!ADODataSet1->Locate("订单号",PlanInputForm->Edit1->Text.Trim(),opts))
{
ADODataSet1->Append();
ADODataSet1->FieldByName("订单号")->Value=PlanInputForm->Edit1->Text.Trim();
ADODataSet1->FieldByName("产品名称及规格")->Value=PlanInputForm->Edit2->Text.Trim();
ADODataSet1->FieldByName("客户名称")->Value=PlanInputForm->Edit3->Text.Trim();
ADODataSet1->FieldByName("数量")->Value=StrToInt(PlanInputForm->Edit4->Text.Trim());
ADODataSet1->FieldByName("材料情况")->Value=PlanInputForm->Edit5->Text.Trim();
ADODataSet1->FieldByName("下单时间")->Value=PlanInputForm->DateTimePicker1->Date;
ADODataSet1->FieldByName("交货时间")->Value=PlanInputForm->DateTimePicker2->Date;
ADODataSet1->FieldByName("技术要求")->Value=PlanInputForm->Memo1->Text.Trim();
ADODataSet1->Post();
}
}
delete PlanInputForm;
PlanInputForm=NULL;
}
//---------------------------------------------------------------------------
void __fastcall TPlanManageForm::ToolButton7Click(TObject *Sender)
{
PlanInputForm=new TPlanInputForm(Application);
PlanInputForm->Edit1->Text=ADODataSet1->FieldByName("订单号")->AsString;
PlanInputForm->Edit2->Text=ADODataSet1->FieldByName("产品名称及规格")->AsString;
PlanInputForm->Edit3->Text=ADODataSet1->FieldByName("客户名称")->AsString;
PlanInputForm->Edit4->Text=ADODataSet1->FieldByName("数量")->AsString;
PlanInputForm->Edit5->Text=ADODataSet1->FieldByName("材料情况")->AsString;
PlanInputForm->DateTimePicker1->Date=ADODataSet1->FieldByName("下单时间")->AsDateTime;
PlanInputForm->DateTimePicker2->Date=ADODataSet1->FieldByName("交货时间")->AsDateTime;
PlanInputForm->Memo1->Text=ADODataSet1->FieldByName("技术要求")->AsString;
if(PlanInputForm->ShowModal()==mrOk)
{
ADODataSet1->Edit();
ADODataSet1->FieldByName("订单号")->Value=PlanInputForm->Edit1->Text.Trim();
ADODataSet1->FieldByName("产品名称及规格")->Value=PlanInputForm->Edit2->Text.Trim();
ADODataSet1->FieldByName("客户名称")->Value=PlanInputForm->Edit3->Text.Trim();
ADODataSet1->FieldByName("数量")->Value=StrToInt(PlanInputForm->Edit4->Text.Trim());
ADODataSet1->FieldByName("材料情况")->Value=PlanInputForm->Edit5->Text.Trim();
ADODataSet1->FieldByName("下单时间")->Value=PlanInputForm->DateTimePicker1->Date;
ADODataSet1->FieldByName("交货时间")->Value=PlanInputForm->DateTimePicker2->Date;
ADODataSet1->FieldByName("技术要求")->Value=PlanInputForm->Memo1->Text.Trim();
ADODataSet1->Post();
}
delete PlanInputForm;
PlanInputForm=NULL;
}
//---------------------------------------------------------------------------
void __fastcall TPlanManageForm::ToolButton8Click(TObject *Sender)
{
if(Application->MessageBoxA("是否确定删除此项数据?","删除数据警告",MB_YESNO)==ID_YES)
{
ADODataSet1->Delete();
}
}
//---------------------------------------------------------------------------
void __fastcall TPlanManageForm::ToolButton9Click(TObject *Sender)
{
GxManageForm=new TGxManageForm(Application);
GxManageForm->ADODataSet1=ADODataSet2;
GxManageForm->ADOConnection1=ADOConnection1;
GxManageForm->Label2->Caption=ADODataSet1->FieldByName("订单号")->AsString.Trim();
GxManageForm->Label4->Caption=ADODataSet1->FieldByName("产品名称及规格")->AsString.Trim();
GxManageForm->ShowModal();
delete GxManageForm;
GxManageForm=NULL;
Draw();
}
//---------------------------------------------------------------------------
void __fastcall TPlanManageForm::DBGrid1ColEnter(TObject *Sender)
{
if(ADODataSet1->RecordCount==0)
return;
ADODataSet2->Close();
ADODataSet2->Connection=ADOConnection1;
AnsiString Str="Select * From 流�