⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 payitemsdlg.cpp

📁 该程序医院信息管理系统
💻 CPP
字号:
// PayItemsDlg.cpp : implementation file
//

#include "stdafx.h"
#include "HosptialMan.h"
#include "PayItemsDlg.h"
#include "PayItems.h"
#include "MedSelectionDlg.h"
#include "ItemSelectionDlg.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CPayItemsDlg dialog


CPayItemsDlg::CPayItemsDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CPayItemsDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CPayItemsDlg)
	m_Name = _T("");
	m_SalePrice = _T("");
	m_SaleSum = _T("");
	m_Total = _T("");
	m_Unit = _T("");
	m_SaleTotal = 0.0;
	m_Radio = -1;
	//}}AFX_DATA_INIT
}


void CPayItemsDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CPayItemsDlg)
	DDX_Text(pDX, IDC_NAME_STATIC, m_Name);
	DDX_Text(pDX, IDC_SALEPRICE_STATIC, m_SalePrice);
	DDX_Text(pDX, IDC_SALESUM_STATIC, m_SaleSum);
	DDX_Text(pDX, IDC_TOTAL_STATIC, m_Total);
	DDX_Text(pDX, IDC_UNIT_STATIC, m_Unit);
	DDX_Text(pDX, IDC_SALETOTAL_EDIT, m_SaleTotal);
	DDX_Radio(pDX, IDC_RADIO1, m_Radio);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CPayItemsDlg, CDialog)
	//{{AFX_MSG_MAP(CPayItemsDlg)
	ON_BN_CLICKED(IDC_SELECTION_BUTTON, OnSelectionButton)
	ON_EN_CHANGE(IDC_SALETOTAL_EDIT, OnChangeSaletotalEdit)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CPayItemsDlg message handlers

void CPayItemsDlg::OnSelectionButton() 
{
	UpdateData(true);
	// 根据选择的收费类型选择窗口
	if(m_Radio==0)  // 药品
	{
		CMedSelectionDlg dlg;
		if(dlg.DoModal()==IDOK)
		{
			m_Name = Reg_ItemName;				//项目名称
			m_Unit = Reg_ItemUnit;				//计量单位
			m_SalePrice = Reg_ItemSalePrice;	//销售价格
			m_Total = Reg_ItemTotal;			//数量
		}
	}
	else					// 其它收费项目
	{
		CItemSelectionDlg dlg;
		if(dlg.DoModal()==IDOK)
		{
			m_Name = Reg_ItemName;				//项目名称
			m_Unit = Reg_ItemUnit;				//计量单位
			m_SalePrice = Reg_ItemSalePrice;	//销售价格
			m_Total = Reg_ItemTotal;			//数量
		}
	}
	UpdateData(FALSE);							//更新显示
}

BOOL CPayItemsDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
    return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CPayItemsDlg::OnChangeSaletotalEdit() 
{
	// 更改销售数量,总额同时更改
	UpdateData(TRUE);
	CString cSum;
	double dSum;
	dSum = atof(m_SalePrice)*m_SaleTotal;
	cSum.Format("%f",dSum);
	m_SaleSum = cSum;
	UpdateData(FALSE);
}

void CPayItemsDlg::OnOK() 
{
	UpdateData(TRUE);						//更新控件值到成员变量中
	if(m_SaleTotal<=0)						//判断用户数据的有效性
	{
		MessageBox("请输入销售数量!");
		return;
	}
	CPayItems cPI;							//保存控件值
	cPI.SetItemId(atoi(Reg_ItemId));		//收费项目编号
	cPI.SetPNum(m_SaleTotal);				//数量
	cPI.SetPrice(atof(m_SalePrice));		//价格
	cPI.SetRegId(atoi(RegistrationID));		//门诊登记单号
	cPI.SetPType(m_Radio + 1);						//收费类别
	if (cPayId == "")						//插入记录
		cPI.sql_Insert();
	else									//修改记录
		cPI.sql_Update(cPayId);	
	//关闭对话框
	CDialog::OnOK();
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -