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

📄 dinput.cpp

📁 物流综合管理系统
💻 CPP
字号:
// DInput.cpp: implementation of the CDInput class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "MyProject.h"
#include "DInput.h"

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

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CDInput::CDInput()
: CDSellWare("入库登记")
{

}

CDInput::~CDInput()
{

}

void CDInput::OnButenrol()
{

	this->Format();
	this->Enabled(true);
	//产生自动编号
	CString sNewID=ado.AutoNumber("入库记录表","入库票号","RK",3);
	this->m_StaSellID.SetWindowText(sNewID);
	this->m_EdtInnerID.SetFocus();

}

void CDInput::OnButsave()
{
	if(MessageBox("确定要保存吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
		return;
	//取出编辑文本的值
	CString sSellID,sCliect,sMan,sStore;

	this->m_StaSellID.GetWindowText(sSellID);
	this->m_EdtCliect.GetWindowText(sCliect);
	
	this->m_EdtInnerID.GetWindowText(sStore);
	sStore=ado.FieldToOtherField("仓库信息表","仓库名称",sStore,"编号",1);
	
	sCliect=ado.FieldToOtherField("往来单位信息表","全称",sCliect,"编号",1);
	this->m_EdtMan.GetWindowText(sMan);
	sMan=ado.FieldToOtherField("员工信息表","姓名",sMan,"编号",1);

	if(sStore.IsEmpty()==true)
	{
		MessageBox("请填入入库仓库!","系统提示",MB_OK|MB_ICONSTOP);
		m_EdtInnerID.SetFocus();
		return;
	}

	if(sCliect.IsEmpty()==true)
	{
		MessageBox("请填入供应商名称!","系统提示",MB_OK|MB_ICONSTOP);
		m_EdtCliect.SetFocus();
		return;
	}
	if(sMan.IsEmpty()==true)
	{
		MessageBox("请输入经手人!","系统提示",MB_OK|MB_ICONSTOP);
		m_EdtMan.SetFocus();
		return;
	}
	
	CString sOPID;
	sOPID=ado.FieldToOtherField("操作员信息表","用户名",OP,"操作员编号",1);

	CString sDate,sInnerID,sSumNumber,sSumMoney;
	this->m_StaDate.GetWindowText(sDate);
	this->m_StaSumMoney.GetWindowText(sSumMoney);
	this->m_StaSumNumber.GetWindowText(sSumNumber);

	//存入入库记录表
	CString sSQL;
	sSQL.Format("INSERT INTO 入库记录表 VALUES('%s','%s','%s',%s,%s,%s,%s,%s,0)",sSellID,sCliect,sDate,sStore,sSumNumber,sSumMoney,sOPID,sMan);
	RxRecordset rst;
	rst.Open(sSQL,adCmdText);

	//存入入库明细表
	CString sCode,sNumber,sPrice;
	for(int i=0;i<m_Grid.GetItemCount();i++)
	{
		sCode=m_Grid.GetItemText(i,0);
		sNumber=m_Grid.GetItemText(i,5);
		sPrice=m_Grid.GetItemText(i,6);
		sSQL.Format("INSERT INTO 入库明细表 VALUES('%s','%s',%s,%s)",sSellID,sCode,sNumber,sPrice);
		rst.Open(sSQL,adCmdText);
	}
	this->Enabled(false);
	this->m_Enrol.SetFocus();
}

void CDInput::Init()
{
	this->SetGridHeader("条形码 , 商品名称  , 规格 , 产地 , 计量单位 , 入库数量 , 入库单价 , 合计金额"); 
	this->SetHeadersWidth("110 , 140  , 68 , 140 , 74 , 74 , 74 , 76");

	this->m_StaOP.SetWindowText(OP);
	//为文本框赋提示录入数据的数据源
	RxRecordset rst;
	rst.Open("SELECT * FROM 往来单位信息表 WHERE 类型='供应商'",adCmdText);


	m_EdtCliect.Initialize(this->GetParent());
	m_EdtCliect.StartUpAssciation=true;//启动联想输入
	m_EdtCliect.SetRecordset(rst);
	m_EdtCliect.SetSelectField("全称");
	
	rst.Open("员工信息表");
	m_EdtMan.Initialize(this->GetParent());
	m_EdtMan.SetRecordset(rst);
	m_EdtMan.SetSelectField("姓名");
	
	this->m_StaText.SetWindowText("进货仓库:");
	rst.Open("仓库信息表");
	m_EdtInnerID.Initialize(this->GetParent());
	m_EdtInnerID.SetRecordset(rst);
	m_EdtInnerID.SetSelectField("仓库名称");
	
	
	rst.Close();
}

⌨️ 快捷键说明

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