📄 inputauditing.cpp
字号:
// InPutAuditing.cpp: implementation of the CInPutAuditing class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "MyProject.h"
#include "InPutAuditing.h"
#include <math.h>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CInPutAuditing::CInPutAuditing()
{
}
CInPutAuditing::~CInPutAuditing()
{
}
void CInPutAuditing::Init()
{
CString sSQL;
this->SetWindowText("入库审核");
RxRecordset rst;
//初始化表格
sSQL.Format("SELECT b.条形码,b.名称,b.规格,b.产地,b.计量单位, a.入库数量,a.入库单价 FROM 入库明细表 a inner join 商品信息表 b on a.商品条型码=b.条形码");
m_Grid.SetDataBase(sSQL,adCmdText);
m_Grid.DeleteAllItems();
//初始化文本框
sSQL.Format("SELECT a.入库票号, b.全称 AS 供应商,a.入库日期, a.合计数量, a.合计金额,c.用户名 AS 操作员, d.姓名 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_EdtNoteID.Initialize(this->GetParent());
m_EdtNoteID.SetRecordset(rst);
m_EdtNoteID.SetSelectField("入库票号");
}
void CInPutAuditing::OnButcheck()
{
if(MessageBox("确定审核通过吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
return;
CString sNumber,sCode,sStore,sSQL,sRow,sNum;
CString sID;
int nRow,nNum,nMem1,nMem2;
RxRecordset rst;
this->m_EdtNoteID.GetWindowText(sID);
sSQL.Format("SELECT * FROM 入库记录表 WHERE 入库票号='%s'",sID);
rst.Open(sSQL,adCmdText);
sStore=rst.GetFieldValue("入库仓库");
sSQL.Format("SELECT * FROM 仓库信息表 WHERE 编号=%s",sStore);
rst.Open(sSQL,adCmdText);
sRow=rst.GetFieldValue("仓库排数");
sNum=rst.GetFieldValue("每排号数");
for(int i=0;i<m_Grid.GetItemCount();i++)
{
sCode=m_Grid.GetItemText(i,0);
sNumber=m_Grid.GetItemText(i,5);
//修改库存
sSQL.Format("SELECT * FROM 库存信息表 WHERE 商品条形码='%s' AND 仓库编号=%s",sCode,sStore);
rst.Open(sSQL,adCmdText);
if(rst.GetRecordCount()<1)
{
//取得空闲货位
nRow=Autoplace(sStore,true);
nNum=Autoplace(sStore,false);
sSQL.Format("INSERT INTO 库存信息表 VALUES('%s','%s',%d,%d,%d,10,100)",sCode,sStore,atoi(sNumber),nRow,nNum);
}
else
sSQL.Format("UPDATE 库存信息表 SET 库存数量=库存数量+%s WHERE 商品条形码='%s' AND 仓库编号=%s", sNumber,sCode,sStore);
rst.Open(sSQL,adCmdText);
}
//更新入库信息表
sSQL.Format("UPDATE 入库记录表 SET 审核否=1 WHERE 入库票号='%s'",sID);
rst.Open(sSQL,adCmdText);
//记录审核信息
CString sMan,sOPID;
this->m_EdtMan.GetWindowText(sMan);
sMan=ado.FieldToOtherField("员工信息表","姓名",sMan,"编号",1);
sOPID=ado.FieldToOtherField("操作员信息表","用户名",OP,"操作员编号",1);
sSQL.Format("INSERT INTO 入库审核表 VALUES('%s',1,%s,%s)",sID,sMan,sOPID);
rst.Open(sSQL,adCmdText);
//刷新文本框
MessageBox("审核成功!","系统提示",MB_OK|MB_ICONINFORMATION);
this->m_ButCheck.EnableWindow(false);
sSQL.Format("SELECT a.入库票号,a.入库日期,b.全称 as 供应商,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_EdtNoteID.SetRecordset(rst);
m_EdtNoteID.IsShowing=true;
m_EdtNoteID.SetWindowText("");
m_EdtNoteID.IsShowing=false;
m_EdtNoteID.SetFocus();
}
void CInPutAuditing::OnButdiscard()
{
if(MessageBox("确定审核作废吗?","系统提示",MB_OKCANCEL|MB_ICONQUESTION)!=1)
return;
RxRecordset rst;
CString sID,sMan,sOPID,sSQL;
m_EdtNoteID.GetWindowText(sID);
m_EdtMan.GetWindowText(sMan);
sMan=ado.FieldToOtherField("员工信息表","姓名",sMan,"编号",1);
sOPID=ado.FieldToOtherField("操作员信息表","用户名",OP,"操作员编号",1);
//记录审核信息
sSQL.Format("INSERT INTO 入库审核表 VALUES('%s',0,%s,%s)",sID,sMan,sOPID);
rst.Open(sSQL,adCmdText);
//删除入库信息
sSQL.Format("DELETE 入库记录表 WHERE 入库票号='%s'",sID);
rst.Open(sSQL,adCmdText);
m_Grid.DeleteAllItems();
this->m_EdtNoteID.SetFocus();
}
void CInPutAuditing::OnButfind()
{
CString sSQL,sNoteID;
m_EdtNoteID.GetWindowText(sNoteID);
sSQL.Format("SELECT b.条形码,b.名称,b.规格,b.产地,b.计量单位, a.入库数量,a.入库单价 FROM 入库明细表 a inner join 商品信息表 b on a.商品条型码=b.条形码 WHERE 入库票号='%s'",sNoteID);
RxRecordset rst;
rst.Open(sSQL,adCmdText);
m_Grid.AddCellValue(rst);
if(m_Grid.GetItemCount()>0)
this->m_ButCheck.EnableWindow(true);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -