商店管理系统源代码(一) (四)

2014-11-24 03:04:34 · 作者: · 浏览: 12
n handler code here
CCommodityClassify classifyDlg;
classifyDlg.DoModal();
}


void CSalesManagementSystemDlg::OnCommodityinfo()
{
// TODO: Add your control notification handler code here
CCommodityInfo infoDlg;
infoDlg.DoModal();
}


void CSalesManagementSystemDlg::OnClientinfo()
{
// TODO: Add your control notification handler code here
CDlgClient dlgClient;
dlgClient.DoModal();
}


void CSalesManagementSystemDlg::OnProviderinfo()
{
// TODO: Add your control notification handler code here
CDlgProvider dlgProvider;
dlgProvider.DoModal();
}


void CSalesManagementSystemDlg::OnImport()
{
// TODO: Add your control notification handler code here
CDlgImport dlgImport;
dlgImport.m_strBiller = strName;
dlgImport.m_strProvider = "";
dlgImport.DoModal();
}


void CSalesManagementSystemDlg::OnStockcheck()
{
// TODO: Add your control notification handler code here
CDlgReport dlgReport;
CString strSQL;


strSQL = "SELECT CommodityInfo.*, StoreInfo.stockprice, StoreInfo.saleprice, StoreInfo.num ";
strSQL = strSQL + "FROM CommodityInfo INNER JOIN StoreInfo ON CommodityInfo.barcode = StoreInfo.barcode";
dlgReport.strTitle = "商品库存统计报表";
dlgReport.strSQL = strSQL;
dlgReport.DoModal();
}


void CSalesManagementSystemDlg::OnSalebill()
{
// TODO: Add your control notification handler code here
CSalesBill dlgSaleBill;
dlgSaleBill.m_strBiller = strName;
dlgSaleBill.DoModal();
}


void CSalesManagementSystemDlg::OnAlarm()
{
// TODO: Add your control notification handler code here
CDlgReport dlgReport;
CString strSQL;


strSQL = "SELECT CommodityInfo.*, StoreInfo.stockprice, StoreInfo.saleprice, StoreInfo.num ";
strSQL = strSQL + "FROM CommodityInfo INNER JOIN StoreInfo ON CommodityInfo.barcode = StoreInfo.barcode ";
strSQL = strSQL + "WHERE StoreInfo.num < CommodityInfo.minnum";
dlgReport.strTitle = "商品过少统计报表";
dlgReport.strSQL = strSQL;
dlgReport.DoModal();
}


void CSalesManagementSystemDlg::OnDailyincomereport()
{
// TODO: Add your command handler code here
CDlgReport dlgReport;
CString strSQL;

strSQL = "SELECT * FROM SaleBill";
dlgReport.strTitle = "营业收入日报表";
dlgReport.strSQL = strSQL;
dlgReport.DoModal();
}


void CSalesManagementSystemDlg::OnCommodityinforeport()
{
// TODO: Add your command handler code here
CDlgReport dlgReport;
CString strSQL;


strSQL = "SELECT * FROM CommodityInfo";
dlgReport.strTitle = "商品信息明细报表";
dlgReport.strSQL =strSQL;
dlgReport.DoModal();
}


void CSalesManagementSystemDlg::OnCopy()
{
// TODO: Add your command handler code here
CADOConn adoMain;
CString strDataPath;
CString strBackupPath;
CMyTime myTime;


strDataPath = adoMain.GetAppPath() + "\\data\\ShopSale.mdb";
strBackupPath = adoMain.GetAppPath() + "\\data\\BackUp\\" + myTime.GetSimpleString() + ".mdb";
if (CopyFile(strDataPath, strBackupPath, FALSE))
{
MessageBox("备份成功", "提示", MB_OK | MB_ICONINFORMATION);
}
else
{
MessageBox("备份失败", "提示", MB_OK | MB_ICONWARNING);
}
}


void CSalesManagementSystemDlg::OnDelete()
{
// TODO: Add your command handler code here
CADOConn adoMain;
CString strSql;
CString str[6]={"StockBill", "StockCommodity", "SaleBill", "SaleCommodity"};


if (MessageBox("确定数据清理吗 此操作将删除进货/销售有关记录!", "提示", MB_OKCANCEL | MB_ICONQUESTION) != IDOK)
{
return;
}
OnCopy();


for(int i = 0; i < 4; i++)
{
strSql = "DELETE FROM " + str[i];
adoMain.ExecuteSQL(strSql);
}

MessageBox("数据清理完毕!", "提示", MB_OK | MB_ICONINFORMATION);
adoMain.ExitConnect();
}


void CSalesManagementSystemDlg::OnRestore()
{
// TODO: Add your command handler code here
CString strDataPath;
CADOConn adoMain;
CFileDialog fileDlg(TRUE, "mdb", adoMain.GetAppPath() + "\\data\\BackUp\\*.mdb", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "数据库文件(*.mdb)|*.mdb||");

strDataPath = adoMain.GetAppPath() + "\\data\\ShopSale.mdb";
if (fileDlg.DoModal() == IDOK)
{
if(MessageBox("确定恢复吗 ", "", MB_OKCANCEL | MB_ICONQUESTION) !=