?? clientssaleplan.cpp
字號:
yearRatio+=dlg.m_MarRatio;
str.Format("%f",dlg.m_AprPlan);
m_clientSalePlanList.SetItemText(i,10,str);
yearPlan+=dlg.m_AprPlan;
str.Format("%f",dlg.m_AprRatio);
m_clientSalePlanList.SetItemText(i,11,str);
yearRatio+=dlg.m_AprRatio;
str.Format("%f",dlg.m_MayPlan);
m_clientSalePlanList.SetItemText(i,12,str);
yearPlan+=dlg.m_MayPlan;
str.Format("%f",dlg.m_MayRatio);
m_clientSalePlanList.SetItemText(i,13,str);
yearRatio+=dlg.m_MayRatio;
str.Format("%f",dlg.m_JunPlan);
m_clientSalePlanList.SetItemText(i,14,str);
yearPlan+=dlg.m_JunPlan;
str.Format("%f",dlg.m_JunRatio);
m_clientSalePlanList.SetItemText(i,15,str);
yearRatio+=dlg.m_JunRatio;
str.Format("%f",dlg.m_JulPlan);
m_clientSalePlanList.SetItemText(i,16,str);
yearPlan+=dlg.m_JulPlan;
str.Format("%f",dlg.m_JulRatio);
m_clientSalePlanList.SetItemText(i,17,str);
yearRatio+=dlg.m_JulRatio;
str.Format("%f",dlg.m_AugPlan);
m_clientSalePlanList.SetItemText(i,18,str);
yearPlan+=dlg.m_AugPlan;
str.Format("%f",dlg.m_AugRatio);
m_clientSalePlanList.SetItemText(i,19,str);
yearRatio+=dlg.m_AugRatio;
str.Format("%f",dlg.m_SepPlan);
m_clientSalePlanList.SetItemText(i,20,str);
yearPlan+=dlg.m_SepPlan;
str.Format("%f",dlg.m_SepRatio);
m_clientSalePlanList.SetItemText(i,21,str);
yearRatio+=dlg.m_SepRatio;
str.Format("%f",dlg.m_OctPlan);
m_clientSalePlanList.SetItemText(i,22,str);
yearPlan+=dlg.m_OctPlan;
str.Format("%f",dlg.m_OctRatio);
m_clientSalePlanList.SetItemText(i,23,str);
yearRatio+=dlg.m_OctRatio;
str.Format("%f",dlg.m_NovPlan);
m_clientSalePlanList.SetItemText(i,24,str);
yearPlan+=dlg.m_NovPlan;
str.Format("%f",dlg.m_NovRatio);
m_clientSalePlanList.SetItemText(i,25,str);
yearRatio+=dlg.m_NovRatio;
str.Format("%f",dlg.m_DecPlan);
m_clientSalePlanList.SetItemText(i,26,str);
yearPlan+=dlg.m_DecPlan;
str.Format("%f",dlg.m_DecRatio);
m_clientSalePlanList.SetItemText(i,27,str);
yearRatio+=dlg.m_DecRatio;
str.Format("%f",yearPlan);
m_clientSalePlanList.SetItemText(i,2,str);
str.Format("%f",yearRatio);
m_clientSalePlanList.SetItemText(i,3,str);
}
else
{
AfxMessageBox("沒有添加產品銷售計劃!");
}
}
void CClientsSalePlan::OnDelete()
{
CAffirm dlg;
if(dlg.DoModal()!=IDOK)
{
return;
}
_variant_t RecordsAffected;
CString strSQL;
strSQL="delete from salePlan where planID='";
strSQL=strSQL+m_planID+"'";
(((CSaleApp*)AfxGetApp())->m_pConn)->Execute((_bstr_t)strSQL,&RecordsAffected,adCmdText);
m_clientSalePlanList.DeleteAllItems();
UpdateData(false);
AfxMessageBox("報價單已刪除!");
OnNextPage();
}
void CClientsSalePlan::OnModify()
{
if(m_pSalePlanRecordset->adoEOF)
m_pSalePlanRecordset->MovePrevious();
CString str;
str=((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pSalePlanRecordset->GetCollect("checked"));
if(str=="T")
{
AfxMessageBox("已經通過審核,不可以修改!");
return;
}
else
{
SetDlgItemText(IDC_auditing,"審核");
flag=2;
tx_planID->EnableWindow(false);
tx_planYear->EnableWindow(true);
tx_formDate->EnableWindow(false);
tx_remark->EnableWindow(true);
bt_firstPage->EnableWindow(false);
bt_prevPage->EnableWindow(false);
bt_nextPage->EnableWindow(false);
bt_lastPage->EnableWindow(false);
bt_add->EnableWindow(false);
bt_save->EnableWindow(true);
bt_modify->EnableWindow(false);
bt_delete->EnableWindow(false);
bt_addLine->EnableWindow(true);
bt_deleteLine->EnableWindow(true);
}
UpdateData(false);
}
void CClientsSalePlan::OnNew()
{
SetDlgItemText(IDC_auditing,"審核");
bt_checked->EnableWindow(false);
int clientSalePlanID=((CSaleApp*)AfxGetApp())->m_pIDRecordset->GetCollect("clientSalePlanID").intVal;
if(clientSalePlanID<10)
m_planID.Format("clientSalePlan0000%d",clientSalePlanID);
else if(clientSalePlanID<100&&clientSalePlanID>9)
m_planID.Format("clientSalePlan000%d",clientSalePlanID);
else if(clientSalePlanID<1000&&clientSalePlanID>99)
m_planID.Format("clientSalePlan00%d",clientSalePlanID);
CString str;
str.Format("%d",clientSalePlanID+1);
((CSaleApp*)AfxGetApp())->m_pIDRecordset->PutCollect("clientSalePlanID",_variant_t(str));
((CSaleApp*)AfxGetApp())->m_pIDRecordset->Update();
// m_planID = _T("");
m_planYear = _T("");
m_formDate = COleDateTime::GetCurrentTime();
m_remark = _T("");
m_clientSalePlanList.DeleteAllItems();
flag=1;
tx_planID->EnableWindow(false);
tx_formDate->EnableWindow(false);
tx_planYear->EnableWindow(true);
tx_remark->EnableWindow(true);
bt_firstPage->EnableWindow(false);
bt_lastPage->EnableWindow(false);
bt_nextPage->EnableWindow(false);
bt_prevPage->EnableWindow(false);
bt_modify->EnableWindow(false);
bt_addLine->EnableWindow(true);
bt_deleteLine->EnableWindow(true);
bt_save->EnableWindow(true);
bt_cancellation->EnableWindow(true);
UpdateData(false);
}
void CClientsSalePlan::OnLastPage()
{
UpdateData(true);
_RecordsetPtr m_pRecordset;
CString strSQL;
HRESULT hTRes;
m_pSalePlanRecordset->MoveNext();
if (!(m_pSalePlanRecordset->adoEOF))
{
m_planID = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pSalePlanRecordset->GetCollect("planID"));
DATE dt;
COleDateTime da;
dt=m_pSalePlanRecordset->GetCollect("formDate").date;
da=COleDateTime(dt);
m_formDate.SetDate(da.GetYear(),da.GetMonth(),da.GetDay());
m_planYear = ((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pSalePlanRecordset->GetCollect("planYear"));
m_remark=((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pSalePlanRecordset->GetCollect("remark"));
CString checked;
checked=((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pSalePlanRecordset->GetCollect("checked"));
if(checked=="T")
{
bt_modify->EnableWindow(false);
SetDlgItemText(IDC_auditing,"棄審");
}
else
{
bt_modify->EnableWindow(true);
SetDlgItemText(IDC_auditing,"審核");
}
strSQL="select * from clientSalePlanView where planID='";
strSQL=strSQL+((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pSalePlanRecordset->GetCollect("planID"));
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_clientSalePlanList.DeleteAllItems();
while(!(m_pRecordset->adoEOF))
{
m_clientSalePlanList.InsertItem(i,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("clientID")));
m_clientSalePlanList.SetItemText(i,1,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("company")));
m_clientSalePlanList.SetItemText(i,2,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("yearPlan")));
m_clientSalePlanList.SetItemText(i,3,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("yearRatio")));
m_clientSalePlanList.SetItemText(i,4,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("JanPlan")));
m_clientSalePlanList.SetItemText(i,5,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("JanRatio")));
m_clientSalePlanList.SetItemText(i,6,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("FebPlan")));
m_clientSalePlanList.SetItemText(i,7,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("FebRatio")));
m_clientSalePlanList.SetItemText(i,8,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("MarPlan")));
m_clientSalePlanList.SetItemText(i,9,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("MarRatio")));
m_clientSalePlanList.SetItemText(i,10,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("AprPlan")));
m_clientSalePlanList.SetItemText(i,11,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("AprRatio")));
m_clientSalePlanList.SetItemText(i,12,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("MayPlan")));
m_clientSalePlanList.SetItemText(i,13,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("MayRatio")));
m_clientSalePlanList.SetItemText(i,14,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("JunPlan")));
m_clientSalePlanList.SetItemText(i,15,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("JunRatio")));
m_clientSalePlanList.SetItemText(i,16,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("JulPlan")));
m_clientSalePlanList.SetItemText(i,17,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("JulRatio")));
m_clientSalePlanList.SetItemText(i,18,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("AugPlan")));
m_clientSalePlanList.SetItemText(i,19,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("AugRatio")));
m_clientSalePlanList.SetItemText(i,20,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("SepPlan")));
m_clientSalePlanList.SetItemText(i,21,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("SepRatio")));
m_clientSalePlanList.SetItemText(i,22,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("OctPlan")));
m_clientSalePlanList.SetItemText(i,23,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("OctRatio")));
m_clientSalePlanList.SetItemText(i,24,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("NovPlan")));
m_clientSalePlanList.SetItemText(i,25,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("NovRatio")));
m_clientSalePlanList.SetItemText(i,26,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("DecPlan")));
m_clientSalePlanList.SetItemText(i,27,((CSaleApp*)AfxGetApp())->GetStringFromVariant(m_pRecordset->GetCollect("DecRatio")));
if (!(m_pRecordset->adoEOF))
{
m_pRecordset->MoveNext();
i++;
}
}
if(!(m_pSalePlanRecordset->BOF))
{
bt_firstPage->EnableWindow(true);
bt_prevPage->EnableWindow(true);
}
bt_nextPage->EnableWindow(false);
bt_lastPage->EnableWindow(false);
bt_add->EnableWindow(true);
bt_save->EnableWindow(false);
// bt_modify->EnableWindow(true);
bt_delete->EnableWindow(true);
bt_addLine->EnableWindow(false);
bt_deleteLine->EnableWindow(false);
UpdateData(false);
}
void CClientsSalePlan::OnNextPage()
{
UpdateData(true);
_RecordsetPtr m_pRecordset;
CString strSQL;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -