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

📄 doutput.cpp

📁 物流管理系统是我买的一本书上的一个系统。斑竹看看行吗?
💻 CPP
字号:
// DOutPut.cpp: implementation of the CDOutPut class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "MyProject.h"
#include "DOutPut.h"
#include "ExternDllHeader.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

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

CDOutPut::CDOutPut()
{

}

CDOutPut::~CDOutPut()
{

}

void CDOutPut::Init()
{
	this->SetCaption("出库登记");
	this->SetManTitle("经 手 人:");
	this->SetNoteIDTitle("出库票号:");
	this->SetStoreTitle("提货仓库:");
	this->SetOperationTitle("销售票号:");
	this->SetGridHeader("扫描码 , 商品名称 , 规格 , 产地 , 计量单位 , 出库数量 , 出库单价 , 合计金额"); 
	this->SetHeadersWidth("70 , 100 , 60 , 100 , 74 , 74 , 74 , 76");
	RxRecordset rst;
	CString sSQL;
	sSQL.Format("SELECT a.销售票号, b.全称 AS 客户名称, a.开票日期, a.合计数量, a.合计金额, d.姓名 AS 经手人,c.用户名 AS 操作员 FROM 销售记录表 a INNER JOIN 往来单位信息表 b ON a.客户编号 = b.编号 INNER JOIN 操作员信息表 c ON a.操作员 = c.操作员编号 INNER JOIN 员工信息表 d ON a.经手人 = d.编号 WHERE a.提货否=0 ");
	rst.Open(sSQL,adCmdText);
	m_EdtOperation.Initialize(this->GetParent());
	m_EdtOperation.StartUpAssciation=true;//启动联想输入
	m_EdtOperation.SetRecordset(rst);//设置数据源
	m_EdtOperation.SetSelectField("销售票号");
	
	rst.Open("员工信息表");
	m_EdtMan.Initialize(this->GetParent());
	m_EdtMan.SetRecordset(rst);//设置数据源
	m_EdtMan.SetSelectField("姓名");

	rst.Open("仓库信息表");
	m_EdtStore.StartUpAssciation=true;
	m_EdtStore.Initialize(this->GetParent());
	m_EdtStore.SetRecordset(rst);//设置数据源
	m_EdtStore.SetSelectField("仓库名称");

	m_Grid.m_Edit.PopHide=true;
	m_Grid.m_Edit.Initialize(this->GetParent());
	m_Grid.m_Edit.SetRecordset(rst);//设置数据源
	m_Grid.m_Edit.SetSelectField("仓库名称");
}

void CDOutPut::OnSetfocusEdtman()
{
	CString sSQL,sID,sNumber,sMoney,sBigMoney;
	this->m_EdtOperation.GetWindowText(sID);
	sSQL.Format("SELECT 条形码,名称 AS 商品名称,规格,产地,计量单位,销售数量,合计金额/销售数量 AS 销售单价, 合计金额 FROM 销售明细表 a INNER JOIN 商品信息表 b ON a.商品条形码=b.条形码 WHERE 销售票号='%s'",sID); 
	m_Grid.DeleteAllItems();
	m_Grid.DeleAllCols();
	m_Grid.SetDataBase(sSQL,adCmdText);
	sSQL.Format("SELECT * FROM 销售记录表 WHERE 销售票号='%s'",sID); 
	RxRecordset rst;
	rst.Open(sSQL,adCmdText);
	sNumber=rst.GetFieldValue("合计数量");
	sMoney=rst.GetFieldValue("合计金额");
	this->m_StaSumNumber.SetWindowText(sNumber);
	this->m_StaTotal.SetWindowText(sMoney);
	sBigMoney=MoneyToChineseCode(sMoney);
	this->m_StaBigTotal.SetWindowText(sBigMoney);
	this->m_Grid.m_bReadOnly=true;
}

void CDOutPut::OnButEnrol()
{
	
	this->m_EdtMan.IsShowing=true;
	this->m_EdtMan.SetWindowText("");
	this->m_EdtMan.IsShowing=false;
	this->m_EdtOperation.IsShowing=true;
	this->m_EdtOperation.SetWindowText("");
	this->m_EdtOperation.IsShowing=false;
	this->m_EdtStore.IsShowing=true;
	this->m_EdtStore.SetWindowText("");
	this->m_EdtStore.IsShowing=false;
	this->m_StaBigTotal.SetWindowText("零元");
	this->m_StaTotal.SetWindowText("0");
	this->m_StaSumNumber.SetWindowText("0");

	this->m_Grid.DeleteAllItems();
	CString sNewID;
	sNewID=ado.AutoNumber("出库记录表","出库票号","CK",3);
	this->m_StaIDValue.SetWindowText(sNewID);
	this->m_StaIDValue.Invalidate();
	this->Enabled(true);
	this->m_EdtOperation.SetFocus();

}

void CDOutPut::OnButSave()
{
	if(MessageBox("确定要保存吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
		return;
	//取出编辑文本的值
	CString sID,sSellID,sStore,sMan,sTotal,sNumber,sTime;
	this->m_StaIDValue.GetWindowText(sID);
	this->m_EdtOperation.GetWindowText(sSellID);
	this->m_EdtStore.GetWindowText(sStore);
	sStore=ado.FieldToOtherField("仓库信息表","仓库名称",sStore,"编号",1);
	this->m_EdtMan.GetWindowText(sMan);
	sMan=ado.FieldToOtherField("员工信息表","姓名",sMan,"编号",1);
	if(sSellID.IsEmpty()==true)
	{
		MessageBox("请输入销售票号!","系统提示",MB_OK|MB_ICONSTOP);
		m_EdtOperation.SetFocus();
		return;
	}
	if(sStore.IsEmpty()==true)
	{
		MessageBox("请输入出货仓库!","系统提示",MB_OK|MB_ICONSTOP);
		m_EdtStore.SetFocus();
		return;
	}
	if(sMan.IsEmpty()==true)
	{
		MessageBox("请输入经手人!","系统提示",MB_OK|MB_ICONSTOP);
		m_EdtMan.SetFocus();
		return;
	}
	
	
	this->m_StaSumNumber.GetWindowText(sNumber);
	this->m_StaTotal.GetWindowText(sTotal);
	this->m_StaDateValue.GetWindowText(sTime);
	CString sOPID;
	sOPID=ado.FieldToOtherField("操作员信息表","用户名",OP,"操作员编号",1);
	//存入记录表
	CString sSQL,sCode,sSpec,sMessage;
	sSQL.Format("INSERT INTO 出库记录表 VALUES('%s','%s',%s,'%s',%s,%s,0)",sID,sTime,sStore,sSellID,sMan,sOPID);
	RxRecordset rst;
	rst.Open(sSQL,adCmdText);
	int c=m_Grid.GetRows();
	for(int i=0;i<m_Grid.GetRows();i++)
	{
		sCode=m_Grid.GetItemText(i,0);
		sNumber=m_Grid.GetItemText(i,5);
		sSpec=m_Grid.GetItemText(i,6);
		if(sNumber.IsEmpty()==true)
		{
			sMessage.Format("第 %d 行第 6 列 '入库数量'字段不允许为空!",i+1);
			MessageBox(sMessage,"系统提示",MB_OK|MB_ICONSTOP);
			return;
		}
		//存入出库明细表
		sSQL.Format("INSERT INTO 出库明细表 VALUES('%s','%s',%s,%s)",sID,sCode,sNumber,sSpec);
		rst.Open(sSQL,adCmdText);
	}
		//更新销售记录表
	sSQL.Format("UPDATE 销售记录表  SET 提货否=1  WHERE 销售票号='%s'",sSellID );
	rst.Open(sSQL,adCmdText);
	


	this->Enabled(false);
}


void CDOutPut::OnRclickGrid(NMHDR *pNMHDR, LRESULT *pResult)
{

}

⌨️ 快捷键说明

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