?? dinput.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 + -