📄 consignmentinvoice.cpp
字号:
{
m_storeHouseCombo.AddString(((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pStoreHouseRecordset->GetCollect("storeHouseID")));
m_pStoreHouseRecordset->MoveNext();
}
}
}
m_pStoreHouseRecordset->Close();
strSQL="select * from transportCompany";
_RecordsetPtr m_pTransportCompanyRecordset;
hTRes = m_pTransportCompanyRecordset.CreateInstance(_T("ADODB.Recordset"));
if (SUCCEEDED(hTRes))
{
hTRes = m_pTransportCompanyRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CSaleApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
if(SUCCEEDED(hTRes))
{
TRACE(_T("连接成功!\n"));
while(!(m_pTransportCompanyRecordset->adoEOF))
{
m_transportCompanyCombo.AddString(((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pTransportCompanyRecordset->GetCollect("transportCompanyID")));
m_pTransportCompanyRecordset->MoveNext();
}
}
}
m_pTransportCompanyRecordset->Close();
flag=1;
m_consignmentFormList.DeleteAllItems();
int consignmentFormID=((CSaleApp*)AfxGetApp())->m_pIDRecordset->GetCollect("consignmentFormID").intVal;
if(consignmentFormID<10)
m_consignmentFormID.Format("consignmentForm0000%d",consignmentFormID);
else if(consignmentFormID<100&&consignmentFormID>9)
m_consignmentFormID.Format("consignmentForm000%d",consignmentFormID);
else if(consignmentFormID<1000&&consignmentFormID>99)
m_consignmentFormID.Format("consignmentForm00%d",consignmentFormID);
CString str;
str.Format("%d",consignmentFormID+1);
((CSaleApp*)AfxGetApp())->m_pIDRecordset->PutCollect("consignmentFormID",_variant_t(str));
((CSaleApp*)AfxGetApp())->m_pIDRecordset->Update();
// m_consignmentFormID = _T("");
m_orderFormID = _T("");
m_formDate = COleDateTime::GetCurrentTime();
m_transportType = _T("");
m_transportCompany = _T("");
m_clientName = _T("");
m_payCondition = _T("");
m_seller = _T("");
m_saleType = _T("");
m_department = _T("");
m_consignmentAddress = _T("");
m_storeHouse = _T("");
m_remark = _T("");
tx_consignmentFormID->EnableWindow(false);
tx_orderFormID->EnableWindow(true);
tx_formDate->EnableWindow(true);
tx_transportType->EnableWindow(true);
tx_transportCompany->EnableWindow(true);
tx_clientName->EnableWindow(true);
tx_payCondition->EnableWindow(true);
tx_seller->EnableWindow(true);
tx_saleType->EnableWindow(true);
tx_department->EnableWindow(true);
tx_consignmentAddress->EnableWindow(true);
tx_storeHouse->EnableWindow(true);
tx_remark->EnableWindow(true);
bt_firstPage->EnableWindow(false);
bt_lastPage->EnableWindow(false);
bt_nextPage->EnableWindow(false);
bt_prevPage->EnableWindow(false);
bt_add->EnableWindow(false);
bt_save->EnableWindow(true);
bt_addLine->EnableWindow(true);
bt_deleteLine->EnableWindow(true);
bt_modify->EnableWindow(false);
bt_cancellation->EnableWindow(true);
SetDlgItemText(IDC_auditing,"审核");
UpdateData(false);
}
void CConsignmentInvoice::OnLastPage()
{
UpdateData(true);
_RecordsetPtr m_pRecordset;
CString strSQL;
HRESULT hTRes;
m_pConsignmentFormRecordset->MoveLast();
if (!(m_pConsignmentFormRecordset->adoEOF))
{
m_consignmentFormID = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("consignmentFormID"));
m_orderFormID = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("orderFormID"));
DATE dt;
COleDateTime da;
dt=m_pConsignmentFormRecordset->GetCollect("formDate").date;
da=COleDateTime(dt);
m_formDate.SetDate(da.GetYear(),da.GetMonth(),da.GetDay());
m_transportType = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("transportType"));
m_transportCompany = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("transportCompany"));
m_clientName = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("clientName"));
m_payCondition = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("payCondition"));
m_seller = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("seller"));
m_saleType = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("saleType"));
m_department = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("department"));
m_consignmentAddress = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("consignmentAddress"));
m_storeHouse = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("storeHouse"));
m_remark = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("remark"));
CString checked;
checked=((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("checked"));
if(checked=="T")
{
SetDlgItemText(IDC_auditing,"弃审");
bt_modify->EnableWindow(false);
}
else
{
bt_modify->EnableWindow(true);
SetDlgItemText(IDC_auditing,"审核");
}
strSQL="select * from consignmentFormView1 where consignmentFormID='";
strSQL=strSQL+((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("consignmentFormID"));
strSQL+="'";
}
//---------------------------------------
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CSaleApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
// m_pRecordset->MoveFirst();
int i=0;
m_consignmentFormList.DeleteAllItems();
while(!(m_pRecordset->adoEOF))
{
m_consignmentFormList.InsertItem(i,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("commidityID")));
m_consignmentFormList.SetItemText(i,1,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("num")));
m_consignmentFormList.SetItemText(i,2,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("price")));
if (!(m_pRecordset->adoEOF))
{
m_pRecordset->MoveNext();
i++;
}
}
bt_firstPage->EnableWindow(true);
bt_prevPage->EnableWindow(true);
bt_nextPage->EnableWindow(false);
bt_lastPage->EnableWindow(false);
UpdateData(false);
}
void CConsignmentInvoice::OnNextPage()
{
UpdateData(true);
_RecordsetPtr m_pRecordset;
CString strSQL;
HRESULT hTRes;
try
{
m_pConsignmentFormRecordset->MoveNext();
if (!(m_pConsignmentFormRecordset->adoEOF))
{
m_consignmentFormID = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("consignmentFormID"));
m_orderFormID = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("orderFormID"));
DATE dt;
COleDateTime da;
dt=m_pConsignmentFormRecordset->GetCollect("formDate").date;
da=COleDateTime(dt);
m_formDate.SetDate(da.GetYear(),da.GetMonth(),da.GetDay());
m_transportType = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("transportType"));
m_transportCompany = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("transportCompany"));
m_clientName = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("clientName"));
m_payCondition = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("payCondition"));
m_seller = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("seller"));
m_saleType = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("saleType"));
m_department = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("department"));
m_consignmentAddress = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("consignmentAddress"));
m_storeHouse = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("storeHouse"));
m_remark = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("remark"));
CString checked;
checked=((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("checked"));
if(checked=="T")
{
SetDlgItemText(IDC_auditing,"弃审");
bt_modify->EnableWindow(false);
}
else
{
bt_modify->EnableWindow(true);
SetDlgItemText(IDC_auditing,"审核");
}
strSQL="select * from consignmentFormView1 where consignmentFormID='";
strSQL=strSQL+((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("consignmentFormID"));
strSQL+="'";
}
//---------------------------------------
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CSaleApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
// m_pRecordset->MoveFirst();
int i=0;
m_consignmentFormList.DeleteAllItems();
while(!(m_pRecordset->adoEOF))
{
m_consignmentFormList.InsertItem(i,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("commidityID")));
m_consignmentFormList.SetItemText(i,1,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("commodityName")));
m_consignmentFormList.SetItemText(i,2,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("standardPrice")));
m_consignmentFormList.SetItemText(i,3,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("num")));
m_consignmentFormList.SetItemText(i,4,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("truePrice")));
if (!(m_pRecordset->adoEOF))
{
m_pRecordset->MoveNext();
i++;
}
}
}
catch(_com_error e)///捕捉异常
{
bt_lastPage->EnableWindow(false);
bt_nextPage->EnableWindow(false);
m_pConsignmentFormRecordset->MovePrevious();
AfxMessageBox("已经到达纪录集的尾部!");
}
bt_firstPage->EnableWindow(true);
bt_prevPage->EnableWindow(true);
UpdateData(false);
}
void CConsignmentInvoice::OnPrevPage()
{
UpdateData(true);
_RecordsetPtr m_pRecordset;
CString strSQL;
HRESULT hTRes;
try
{
m_pConsignmentFormRecordset->MovePrevious();
if (!(m_pConsignmentFormRecordset->adoEOF))
{
m_consignmentFormID = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("consignmentFormID"));
m_orderFormID = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("orderFormID"));
DATE dt;
COleDateTime da;
dt=m_pConsignmentFormRecordset->GetCollect("formDate").date;
da=COleDateTime(dt);
m_formDate.SetDate(da.GetYear(),da.GetMonth(),da.GetDay());
m_transportType = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("transportType"));
m_transportCompany = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("transportCompany"));
m_clientName = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("clientName"));
m_payCondition = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("payCondition"));
m_seller = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("seller"));
m_saleType = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("saleType"));
m_department = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("department"));
m_consignmentAddress = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("consignmentAddress"));
m_storeHouse = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("storeHouse"));
m_remark = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("remark"));
CString checked;
checked=((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("checked"));
if(checked=="T")
{
SetDlgItemText(IDC_auditing,"弃审");
bt_modify->EnableWindow(false);
}
else
{
bt_modify->EnableWindow(true);
SetDlgItemText(IDC_auditing,"审核");
}
strSQL="select * from consignmentFormView1 where consignmentFormID='";
strSQL=strSQL+((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("consignmentFormID"));
strSQL+="'";
}
//---------------------------------------
hTRes = m_pRecordset.CreateInstance(_T("ADODB.Recordset"));
hTRes = m_pRecordset->Open((LPTSTR)strSQL.GetBuffer(130),
((CSaleApp*)AfxGetApp())->m_pConn.GetInterfacePtr(),
adOpenDynamic,adLockPessimistic,adCmdText);
// m_pRecordset->MoveFirst();
int i=0;
m_consignmentFormList.DeleteAllItems();
while(!(m_pRecordset->adoEOF))
{
m_consignmentFormList.InsertItem(i,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("commidityID")));
m_consignmentFormList.SetItemText(i,1,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("commodityName")));
m_consignmentFormList.SetItemText(i,2,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("standardPrice")));
m_consignmentFormList.SetItemText(i,3,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("num")));
m_consignmentFormList.SetItemText(i,4,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("truePrice")));
if (!(m_pRecordset->adoEOF))
{
m_pRecordset->MoveNext();
i++;
}
}
}
catch(_com_error e)///捕捉异常
{
bt_firstPage->EnableWindow(false);
bt_prevPage->EnableWindow(false);
m_pConsignmentFormRecordset->MoveNext();
AfxMessageBox("已经到达纪录集的首部!");
}
bt_lastPage->EnableWindow(true);
bt_nextPage->EnableWindow(true);
UpdateData(false);
}
void CConsignmentInvoice::OnFirstPage()
{
UpdateData(true);
_RecordsetPtr m_pRecordset;
CString strSQL;
HRESULT hTRes;
m_pConsignmentFormRecordset->MoveFirst();
if (!(m_pConsignmentFormRecordset->adoEOF))
{
m_consignmentFormID = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("consignmentFormID"));
m_orderFormID = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("orderFormID"));
DATE dt;
COleDateTime da;
dt=m_pConsignmentFormRecordset->GetCollect("formDate").date;
da=COleDateTime(dt);
m_formDate.SetDate(da.GetYear(),da.GetMonth(),da.GetDay());
m_transportType = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("transportType"));
m_transportCompany = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("transportCompany"));
m_clientName = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("clientName"));
m_payCondition = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("payCondition"));
m_seller = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("seller"));
m_saleType = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pConsignmentFormRecordset->GetCollect("saleType"));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -