📄 clinicpriceconfirm.h
字号:
this->groupBox1->TabIndex = 1;
this->groupBox1->TabStop = false;
//
// cmbRegID
//
this->cmbRegID->Location = System::Drawing::Point(112, 40);
this->cmbRegID->Name = S"cmbRegID";
this->cmbRegID->Size = System::Drawing::Size(152, 20);
this->cmbRegID->TabIndex = 8;
this->cmbRegID->DropDown += new System::EventHandler(this, cmbRoomID_DropDown);
//
// dgrdRoomID
//
this->dgrdRoomID->DataMember = S"";
this->dgrdRoomID->HeaderForeColor = System::Drawing::SystemColors::ControlText;
this->dgrdRoomID->Location = System::Drawing::Point(112, 104);
this->dgrdRoomID->Name = S"dgrdRoomID";
this->dgrdRoomID->Size = System::Drawing::Size(544, 256);
this->dgrdRoomID->TabIndex = 4;
this->dgrdRoomID->Visible = false;
this->dgrdRoomID->DoubleClick += new System::EventHandler(this, dgrdRoomID_DoubleClick);
this->dgrdRoomID->Leave += new System::EventHandler(this, dgrdRoomID_Leave);
//
// dgrdMed
//
this->dgrdMed->DataMember = S"";
this->dgrdMed->HeaderForeColor = System::Drawing::SystemColors::ControlText;
this->dgrdMed->Location = System::Drawing::Point(64, 112);
this->dgrdMed->Name = S"dgrdMed";
this->dgrdMed->Size = System::Drawing::Size(600, 256);
this->dgrdMed->TabIndex = 5;
this->dgrdMed->Visible = false;
this->dgrdMed->DoubleClick += new System::EventHandler(this, dgrdMed_DoubleClick);
this->dgrdMed->Leave += new System::EventHandler(this, dgrdMed_Leave);
//
// ClinicPriceConfirm
//
this->AutoScaleBaseSize = System::Drawing::Size(6, 14);
this->ClientSize = System::Drawing::Size(784, 469);
this->Controls->Add(this->dgrdMed);
this->Controls->Add(this->dgrdRoomID);
this->Controls->Add(this->dgrdPrice);
this->Controls->Add(this->groupBox2);
this->Controls->Add(this->groupBox1);
this->Name = S"ClinicPriceConfirm";
this->Text = S"门诊划价";
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dgrdPrice))->EndInit();
this->groupBox2->ResumeLayout(false);
this->groupBox1->ResumeLayout(false);
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dgrdRoomID))->EndInit();
(__try_cast<System::ComponentModel::ISupportInitialize * >(this->dgrdMed))->EndInit();
this->ResumeLayout(false);
}
private:
//-----------------------设置表格各列的属性-----------------------
void DataGridStateRoom()
{
DataGridTableStyle* ts = new DataGridTableStyle();
ts->MappingName = this->ds->Tables->Item[S"门诊挂号"]->TableName;
DataGridNoActiveCellColumn* aTextColumn;
ts->AllowSorting = false;
ts->AlternatingBackColor = Color::LightGray;
int numCols = this->ds->Tables->Item[S"门诊挂号"]->Columns->Count;
for(int i = 0;i < numCols;i++)
{
aTextColumn = new DataGridNoActiveCellColumn();
aTextColumn->get_TextBox()->Enabled = false;
aTextColumn->MappingName = this->ds->Tables->Item[S"门诊挂号"]->Columns->Item[i]->ColumnName;
aTextColumn->HeaderText = this->ds->Tables->Item[S"门诊挂号"]->Columns->Item[i]->ColumnName;
aTextColumn->NullText = S"";
aTextColumn->Format = S"D";
ts->GridColumnStyles->Add(aTextColumn);
}
this->dgrdRoomID->TableStyles->Add(ts);
}
//-----------------------设置表格各列的属性-----------------------
void DataGridStateMed()
{
DataGridTableStyle* ts = new DataGridTableStyle();
ts->MappingName = this->ds->Tables->Item[S"药品资料"]->TableName;
DataGridNoActiveCellColumn* aTextColumn;
ts->AllowSorting = false;
ts->AlternatingBackColor = Color::LightGray;
int numCols = this->ds->Tables->Item[S"药品资料"]->Columns->Count;
for(int i = 0;i < numCols;i++)
{
aTextColumn = new DataGridNoActiveCellColumn();
aTextColumn->get_TextBox()->Enabled = false;
aTextColumn->MappingName = this->ds->Tables->Item[S"药品资料"]->Columns->Item[i]->ColumnName;
aTextColumn->HeaderText = this->ds->Tables->Item[S"药品资料"]->Columns->Item[i]->ColumnName;
aTextColumn->NullText = S"";
aTextColumn->Format = S"D";
ts->GridColumnStyles->Add(aTextColumn);
}
this->dgrdMed->TableStyles->Add(ts);
}
//-----------------------设置表格各列的属性-----------------------
void DataGridStatePrice()
{
DataGridTableStyle* ts = new DataGridTableStyle();
ts->MappingName = this->ds->Tables->Item[S"门诊划价明细"]->TableName;
DataGridTextBoxColumn* aTextColumn;
ts->AllowSorting = false;
ts->AlternatingBackColor = Color::LightGray;
int numCols = this->ds->Tables->Item[S"门诊划价明细"]->Columns->Count;
this->ds->Tables->Item[S"门诊划价明细"]->Columns->Item[6]->Expression = S"单价 * 数量";
for(int i = 0;i < numCols;i++)
{
aTextColumn = new DataGridTextBoxColumn();
if(i == 0)
{
aTextColumn->get_TextBox()->add_DoubleClick(new EventHandler(this,MedID_DoubleClick));
aTextColumn->MappingName = this->ds->Tables->Item[S"门诊划价明细"]->Columns->Item[i]->ColumnName;
aTextColumn->HeaderText = S"药品编号(双击输入)";
}
else if(i == 5)
{
aTextColumn->get_TextBox()->Enabled = true;
aTextColumn->MappingName = this->ds->Tables->Item[S"门诊划价明细"]->Columns->Item[i]->ColumnName;
aTextColumn->HeaderText = this->ds->Tables->Item[S"门诊划价明细"]->Columns->Item[i]->ColumnName;
}
else
{
aTextColumn->get_TextBox()->Enabled = false;
aTextColumn->MappingName = this->ds->Tables->Item[S"门诊划价明细"]->Columns->Item[i]->ColumnName;
aTextColumn->HeaderText = this->ds->Tables->Item[S"门诊划价明细"]->Columns->Item[i]->ColumnName;
}
aTextColumn->NullText = S"";
aTextColumn->Format = S"D";
ts->GridColumnStyles->Add(aTextColumn);
}
this->dgrdPrice->TableStyles->Add(ts);
}
//选择门诊号
private: System::Void cmbRoomID_DropDown(System::Object * sender, System::EventArgs * e)
{
this->dgrdRoomID->Left = this->cmbRegID->Left;
this->dgrdRoomID->Top = this->cmbRegID->Top;
this->dgrdRoomID->Visible = true;
this->dgrdRoomID->Show();
this->dgrdRoomID->Focus();
}
//填写门诊号
private: System::Void dgrdRoomID_DoubleClick(System::Object * sender, System::EventArgs * e)
{
if(this->ds->Tables->Item[S"门诊挂号"]->Rows->Count == 0)
{
this->dgrdRoomID->Hide();
return;
}
//填入门诊信息
int row = this->dgrdRoomID->CurrentRowIndex;
this->cmbRegID->Text = this->ds->Tables->Item[S"门诊挂号"]->Rows->Item[row]->Item[S"编号"]->ToString();
this->tBoxName->Text = this->ds->Tables->Item[S"门诊挂号"]->Rows->Item[row]->Item[S"姓名"]->ToString();
this->tBoxSex->Text = this->ds->Tables->Item[S"门诊挂号"]->Rows->Item[row]->Item[S"性别"]->ToString();
this->tBoxRoom->Text = this->ds->Tables->Item[S"门诊挂号"]->Rows->Item[row]->Item[S"挂号科室"]->ToString();
this->tBoxDoctor->Text = this->ds->Tables->Item[S"门诊挂号"]->Rows->Item[row]->Item[S"医生"]->ToString();
//查询门诊划价明细表
this->ds->Tables->Item[S"门诊划价明细"]->Clear();
//门诊数据表
this->dgrdRoomID->Hide();
//控件属性
this->cmbRegID->Enabled = false;
this->btnSave->Enabled = true;
}
//选择药品
private: System::Void MedID_DoubleClick(System::Object * sender, System::EventArgs * e)
{
MedPinyin* newFrm = new MedPinyin();
if(newFrm->ShowDialog(this) == DialogResult::OK)
{
if(String::Compare(newFrm->strMedPinYin,String::Empty) == 0)
{
return;
}
this->dvMed->RowFilter = String::Format(S"拼音码 like '%{0}%'",newFrm->strMedPinYin);
this->dgrdMed->Left = this->dgrdPrice->Left;
this->dgrdMed->Top = this->dgrdPrice->Top + (this->dgrdPrice->CurrentRowIndex + 1) * 18 + 20;
if(this->dvMed->Count > 0)
{
this->dgrdMed->Show();
this->dgrdMed->Focus();
}
}
}
//填写"药品编号"
private: System::Void dgrdMed_DoubleClick(System::Object * sender, System::EventArgs * e)
{
if(this->ds->Tables->Item[S"药品资料"]->Rows->Count == 0)
{
this->dgrdMed->Hide();
return;
}
int row = this->dgrdMed->CurrentRowIndex;
DataRow* newrow = this->ds->Tables->Item[S"门诊划价明细"]->NewRow();
newrow->Item[S"药品编号"] = this->dgrdMed->get_Item(row,0);
newrow->Item[S"名称"] = this->dgrdMed->get_Item(row,1);
newrow->Item[S"规格"] = this->dgrdMed->get_Item(row,2);
newrow->Item[S"单位"] = this->dgrdMed->get_Item(row,3);
newrow->Item[S"单价"] = __box(System::Convert::ToDecimal(this->dgrdMed->get_Item(row,6)));
this->ds->Tables->Item[S"门诊划价明细"]->Rows->Add(newrow);
this->dgrdMed->Hide();
}
//合计
private: System::Void Money_RowChange(System::Object * sender, DataRowChangeEventArgs * e)
{
Decimal Total = 0;
for(int i = 0;i < this->ds->Tables->Item[S"门诊划价明细"]->Rows->Count;i++)
{
if(String::Compare(this->ds->Tables->Item[S"门诊划价明细"]->Rows->Item[i]->Item[S"金额"]->ToString(),String::Empty) != 0)
Total = Total + System::Convert::ToDecimal(this->ds->Tables->Item[S"门诊划价明细"]->Rows->Item[i]->Item[S"金额"]);
}
this->tBoxTotal->Text = Total.ToString();
}
//保存
private: System::Void btnSave_Click(System::Object * sender, System::EventArgs * e)
{
//控件属性
this->cmbRegID->Enabled = true;
this->btnSave->Enabled = false;
//更新门诊划价表
//设置编号
String* tempSQL = S"Select max(编号) 最大编号 from 门诊划价";
SqlCommand* sqlCmd = new SqlCommand(tempSQL,this->MyDataBase->myConnection);
Int64 MaxID = 1;
Object* r = sqlCmd->ExecuteScalar();
if(r != System::DBNull::Value)
MaxID = System::Convert::ToInt64(r) + 1;
String* Info[] ={MaxID.ToString(),this->tBoxRoom->Text,this->cmbRegID->Text,this->tBoxDoctor->Text,System::DateTime::Now.ToString(),S"否",this->tBoxTotal->Text,S"否"};
tempSQL = String::Format(S"Insert into 门诊划价([编号],[科室],[挂号编号],[医生],[划价时间],[是否收费],[划价金额],[是否发药]) values('{0}','{1}','{2}','{3}','{4}','{5}',{6},'{7}')",Info);
this->MyDataBase->SQLOperate(tempSQL);
//更新门诊划价明细表
//设置编号
tempSQL = S"Select max(编号) 最大编号 from 门诊划价明细";
sqlCmd = new SqlCommand(tempSQL,this->MyDataBase->myConnection);
int MedMaxID = 1;
r = sqlCmd->ExecuteScalar();
if(r != System::DBNull::Value)
MedMaxID = System::Convert::ToInt32(r) + 1;
for(int i = 0;i < this->ds->Tables->Item[S"门诊划价明细"]->Rows->Count;i++)
{
MedMaxID += i;
if(String::Compare(this->ds->Tables->Item[S"门诊划价明细"]->Rows->Item[i]->Item[S"金额"]->ToString(),String::Empty) != 0)
{
String* MedInfo[] ={MaxID.ToString(),this->ds->Tables->Item[S"门诊划价明细"]->Rows->Item[i]->Item[S"药品编号"]->ToString(),this->ds->Tables->Item[S"门诊划价明细"]->Rows->Item[i]->Item[S"单价"]->ToString(),this->ds->Tables->Item[S"门诊划价明细"]->Rows->Item[i]->Item[S"数量"]->ToString(),this->ds->Tables->Item[S"门诊划价明细"]->Rows->Item[i]->Item[S"金额"]->ToString()};
tempSQL = String::Format(S"Insert into 门诊划价明细([划价编号],[药品编号],[单价],[数量],[金额]) values('{0}','{1}',{2},{3},{4})",MedInfo);
this->MyDataBase->SQLOperate(tempSQL);
}
}
//更新门诊挂号表
tempSQL = String::Format(S"Update 门诊挂号 Set 是否已划价 = '是' Where 编号 = '{0}'",this->cmbRegID->Text);
this->MyDataBase->SQLOperate(tempSQL);
this->ds->Tables->Item[S"门诊划价明细"]->Clear();
this->cmbRegID->Text = S"";
this->tBoxName->Text = S"";
this->tBoxSex->Text = S"";
this->tBoxRoom->Text = S"";
this->tBoxDoctor->Text = S"";
this->tBoxTotal->Text = S"";
//查询门诊挂号
this->ds->Tables->Item[S"门诊挂号"]->Clear();
this->strSQL = S"Select * from 门诊挂号 where (是否已划价 = '否')";
this->strTableName = S"门诊挂号";
this->MyDataBase->SelectDataBase(this->PriceAdapter,this->ds,this->strSQL,this->strTableName);
}
//取消
private: System::Void btnCancel_Click(System::Object * sender, System::EventArgs * e)
{
//控件属性
this->cmbRegID->Enabled = true;
this->btnSave->Enabled = false;
this->ds->Tables->Item[S"门诊划价明细"]->Clear();
this->cmbRegID->Text = S"";
this->tBoxName->Text = S"";
this->tBoxSex->Text = S"";
this->tBoxRoom->Text = S"";
this->tBoxDoctor->Text = S"";
this->tBoxTotal->Text = S"";
}
private: System::Void dgrdRoomID_Leave(System::Object * sender, System::EventArgs * e)
{
this->dgrdRoomID->Visible = false;
}
private: System::Void dgrdMed_Leave(System::Object * sender, System::EventArgs * e)
{
this->dgrdMed->Visible = false;
}
};
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -