// MySalary.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "MySalary.h" #include "MyMdi.H" #include "SetSalary.h" #include "ShowHisSalary.h" #include "SalarySet4.h" #include "SelExpendType.h" #include "SelExportType.h" #include #include #include "StaffWage.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// IMPLEMENT_DYNCREATE(MySalary, MyFormView) MySalary::MySalary() : MyFormView(MySalary::IDD) { m_strStaffName = _T(""); m_rate1 = _T(""); m_rate2 = _T(""); m_strStaffNote = _T(""); m_strBasicWage = _T(""); m_strTotalWage = _T(""); m_rate3 = _T(""); m_rate4 = _T(""); m_rate5 = _T(""); m_strEarlyAchievementMoney = _T(""); m_strSecondarySalesAchievementMoney = _T(""); m_money3 = _T(""); m_money4 = _T(""); m_money5 = _T(""); m_strmoney6 = _T(""); m_bInit = 0; m_bAll = 0; m_year = atoi(g_date.Mid(0, 4)); m_month = atoi(g_date.Mid(5, 2)); m_date2 = GetTmFromStr(g_date); m_date1 = m_date2 - CTimeSpan(30, 0, 0, 0); } MySalary::~MySalary() { } void MySalary::DoDataExchange(CDataExchange* pDX) { MyFormView::DoDataExchange(pDX); DDX_Control(pDX, IDC_LIST11, m_ListTemp); DDX_Control(pDX, IDC_COMBO7, m_comboname); DDX_Control(pDX, IDC_COMBO6, m_combocaltype); DDX_Control(pDX, IDC_LIST8, m_Listdigital); DDX_Control(pDX, IDC_LIST7, m_Listtake); DDX_Control(pDX, IDC_LIST4, m_List4); DDX_Control(pDX, IDC_LIST3, m_List3); DDX_Control(pDX, IDC_LIST1, m_ListBox1); DDX_Control(pDX, IDC_SPIN2, m_spinmonth); DDX_Control(pDX, IDC_SPIN1, m_spinyear); DDX_Control(pDX, IDC_LIST2, m_List1); DDX_Control(pDX, IDC_STATIC1, m_static1); DDX_Text(pDX, IDC_EDITname, m_strStaffName); DDX_Text(pDX, IDC_EDITrate1, m_rate1); DDX_Text(pDX, IDC_EDITrate2, m_rate2); DDX_Text(pDX, IDC_EDITbz, m_strStaffNote); DDX_Text(pDX, IDC_EDITbase, m_strBasicWage); DDX_Text(pDX, IDC_EDITmonth, m_month); DDV_MinMaxUInt(pDX, m_month, 1, 12); DDX_Text(pDX, IDC_EDITsalary, m_strTotalWage); DDX_Text(pDX, IDC_EDITyear, m_year); DDV_MinMaxUInt(pDX, m_year, 1900, 3000); DDX_Text(pDX, IDC_EDITrate3, m_rate3); DDX_Text(pDX, IDC_EDITrate4, m_rate4); DDX_Text(pDX, IDC_EDITrate6, m_rate5); DDX_Text(pDX, IDC_EDITmoney1, m_strEarlyAchievementMoney); DDX_Text(pDX, IDC_EDITmoney2, m_strSecondarySalesAchievementMoney); DDX_Text(pDX, IDC_EDITmoney3, m_money3); DDX_Text(pDX, IDC_EDITmoney4, m_money4); DDX_Text(pDX, IDC_EDITmoney5, m_money5); DDX_Text(pDX, IDC_EDITmoney6, m_strmoney6); DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_date1); DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER2, m_date2); } BEGIN_MESSAGE_MAP(MySalary, MyFormView) ON_BN_CLICKED(IDC_BUTclose, OnBUTclose) ON_LBN_SELCHANGE(IDC_LIST1, OnSelchangeList1) ON_EN_CHANGE(IDC_EDITyear, OnChangeEDITyear) ON_EN_CHANGE(IDC_EDITmonth, OnChangeEDITmonth) ON_BN_CLICKED(IDC_BUTshowall, OnBUTshowall) ON_BN_CLICKED(IDC_BUT1, OnBut1) ON_BN_CLICKED(IDC_BUT2, OnBut2) ON_BN_CLICKED(IDC_BUT3, OnBut3) ON_CBN_SELCHANGE(IDC_COMBO6, OnSelchangeCombo6) ON_BN_CLICKED(IDC_BUT4, OnBut4) ON_BN_CLICKED(IDC_BUTTON4, OnButton4) ON_BN_CLICKED(IDC_BUTTON5, OnButton5) ON_BN_CLICKED(IDC_BUTTON6, OnButton6) ON_CBN_CLOSEUP(IDC_COMBO7, OnCloseupCombo7) ON_BN_CLICKED(IDC_BUTTON14, OnButton14) ON_BN_CLICKED(IDC_BUTTON7, OnButton7) ON_BN_CLICKED(IDC_BUTTON8, OnButton8) ON_NOTIFY(DTN_DATETIMECHANGE, IDC_DATETIMEPICKER1, OnDatetimechangeDatetimepicker1) ON_NOTIFY(DTN_DATETIMECHANGE, IDC_DATETIMEPICKER2, OnDatetimechangeDatetimepicker2) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // MySalary diagnostics #ifdef _DEBUG void MySalary::AssertValid() const { MyFormView::AssertValid(); } void MySalary::Dump(CDumpContext& dc) const { MyFormView::Dump(dc); } #endif //_DEBUG ///////////////////////////////////////////////////////////////////////////// void MySalary::OnInitialUpdate() { MyFormView::OnInitialUpdate(); if (IsHasRights2new(25) == 0) { GetDlgItem(IDC_BUT1)->EnableWindow(0); } CMyMdi Mdi; Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this); m_combocaltype.AddString("计算初修提成"); m_combocaltype.AddString("计算精修提成"); m_combocaltype.AddString("计算设计提成"); CRect rc2; GetWindowRect(rc2); ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE); EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0); m_comboname.RefDroppedWidth(); m_combocaltype.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combocaltype.MoveWindow(rc2); m_static1.SetFont(&g_titlefont); #ifdef CHILD_VERSION m_List1.SetHeadings("金额,100;日期,100;款项类别,100;家长姓名,100;宝宝姓名,100;套系类别,100;付款方式,100"); m_ListTemp.SetHeadings("金额,100;日期,100;款项类别,100;家长姓名,100;宝宝姓名,100;套系类别,100;付款方式,100"); m_List1.LoadColumnInfo(23); m_List3.SetHeadings("姓名,100;总工资,100;基本工资,100;前期业绩,100;后期业绩,100;职务提成,100;部门,100;备注,100"); m_List3.LoadColumnInfo(124); m_List4.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;提成金额,100;部门,100;内容,100;数量,100;单价,100;提成方式,100;套系价格,100;日期,100"); m_List4.LoadColumnInfo(139); m_Listtake.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;套系,100;价格,100;景点,100;日期,100;摄影,100;助理,100;化妆师,100;助理,100;套系类别,100"); #ifdef LKAY_VERSION m_Listdigital.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;套系,100;价格,100;初修,100;日期1,100;精修,100;日期2,100;设计,100;日期3,100;初修,50;精修,50;设计,50;选片二销,50;套系类别,100;P数,50;张数,50" ); #else //m_Listdigital.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;套系,100;价格,100;初修,100;日期1,100;精修,100;日期2,100;设计,100;日期3,100;初修,50;精修,50;设计,50;选片二销,50;套系类别,100"); m_Listdigital.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;套系,100;价格,100;初修,100;日期1,100;精修,100;日期2,100;设计,100;日期3,100;初修,50;精修,50;设计,50;选片二销,50;套系类别,100"); #endif m_Listtake.LoadColumnInfo(210); m_Listdigital.LoadColumnInfo(211); #else m_List1.SetHeadings("金额,100;日期,100;款项类别,100;男宾姓名,100;女宾姓名,100;套系类别,100;付款方式,100"); m_ListTemp.SetHeadings("金额,100;日期,100;款项类别,100;男宾姓名,100;女宾姓名,100;套系类别,100;付款方式,100"); m_List1.LoadColumnInfo(23); m_List3.SetHeadings("姓名,100;总工资,100;基本工资,100;前期业绩,100;后期业绩,100;职务提成,100;部门,100;备注,100"); m_List3.LoadColumnInfo(124); m_List4.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;提成金额,100;部门,100;内容,100;数量,100;单价,100;提成方式,100;套系价格,100;日期,100"); m_List4.LoadColumnInfo(139); m_Listtake.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;套系,100;价格,100;景点,100;日期,100;摄影,100;助理,100;化妆师,100;助理,100;套系类别,100"); m_Listdigital.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;套系,100;价格,100;初修,100;日期1,100;精修,100;日期2,100;设计,100;日期3,100;初修,50;精修,50;设计,50;选片二销,50;套系类别,100"); m_Listtake.LoadColumnInfo(210); m_Listdigital.LoadColumnInfo(211); #endif m_spinyear.SetRange(1900, 3000); m_spinmonth.SetRange(1, 12); BOOL bShowAll = 0; if (g_ncount == 100)bShowAll = 1; g_ncount = 0; GetData(); if (bShowAll == 0) GetDlgItem(IDC_LIST3)->ShowWindow(0); if (IsHasRights2new(25) == 0) { m_ListBox1.EnableWindow(0); m_comboname.EnableWindow(0); GetDlgItem(IDC_BUTshowall)->EnableWindow(0); } else if (bShowAll) { g_ncount = 0; OnBUTshowall(); } } void MySalary::FillGrid(CArray*array) { m_List1.DeleteAllItems2(); int ii = 0; m_List1.m_arLabels.SetSize(array->GetSize(), 1); int count = 0; for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) { m_List1.m_arLabels.ElementAt(count++).Copy(array->ElementAt(ii)); } m_List1.m_arLabels.SetSize(count, 1); ii = count; m_List1.m_LabelCount = ii; m_List1.SetItemCountEx(ii); } void MySalary::FillGridTake(CArray*array) { m_Listtake.DeleteAllItems2(); int ii = 0; m_Listtake.m_arLabels.SetSize(array->GetSize(), 1); int count = 0; for (ii = 0; ii < m_Listtake.m_arLabels.GetSize(); ii++) { m_Listtake.m_arLabels.ElementAt(count++).Copy(array->ElementAt(ii)); } m_Listtake.m_arLabels.SetSize(count, 1); ii = count; m_Listtake.m_LabelCount = ii; m_Listtake.SetItemCountEx(ii); } void MySalary::FillGridDigital(CArray*array) { m_Listdigital.DeleteAllItems2(); int ii = 0; m_Listdigital.m_arLabels.SetSize(array->GetSize(), 1); int count = 0; for (ii = 0; ii < m_Listdigital.m_arLabels.GetSize(); ii++) { m_Listdigital.m_arLabels.ElementAt(count++).Copy(array->ElementAt(ii)); } m_Listdigital.m_arLabels.SetSize(count, 1); ii = count; m_Listdigital.m_LabelCount = ii; m_Listdigital.SetItemCountEx(ii); } void MySalary::OnBUTclose() { GetParent()->SendMessage(WM_CLOSE); } void MySalary::GetData() { m_bInit = 1; g_sendhead.bsql = 0; g_sendhead.code[0] = 34; // renyuan表; g_sendhead.code[1] = 146; // workrate表; g_sendhead.tabcount = 2; CString filter = _T("dimission='在职';"); g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return; DataToArray(&m_AryStaffInfo, &m_Workratearray); int i = 0; m_ListBox1.ResetContent(); for ( i = 0; i < m_AryStaffInfo.GetSize(); i++) { m_ListBox1.AddString(m_AryStaffInfo.ElementAt(i).ElementAt(0)); } CString str; for (i = 0; i < m_ListBox1.GetCount(); i++) { m_ListBox1.GetText(i, str); if (str == g_user.name) { m_ListBox1.SetCurSel(i); m_comboname.AddString(g_user.name); m_comboname.SetCurSel(m_comboname.FindString(0, g_user.name)); OnSelchangeList1(); break; } } } void MySalary::OnChangeEDITyear() { } void MySalary::OnChangeEDITmonth() { } extern float GetSalaryFromRule(float fmoney, CString rule); CString GetRule(CString name) { CString oldrule = g_cominfoarray.ElementAt(0).ElementAt(77); CString header = "$" + name + ":"; CString left, right; int pos = oldrule.Find(header); if (pos != -1) { right = oldrule.Right(oldrule.GetLength() - pos - header.GetLength()); pos = right.Find("$"); if (pos != -1) right = right.Left(pos); right = header + right; return right; } return ""; } #if 0 void MySalary::OnSelchangeList1() { if (m_bInit == 0)return; UpdateData(); GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(0); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(0); if (m_bAll) { m_AryStaffWageInfo.RemoveAll(); FillGrid2(); GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(1); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(1); return; } CString strStaffName; int pos = m_comboname.GetCurSel(); if (pos == -1) { GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(1); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(1); return; } m_comboname.GetWindowText(strStaffName); CString date1(_T("")), date2(_T("")); date1 = m_date1.Format("%Y-%m-%d"); date2 = m_date2.Format("%Y-%m-%d"); m_year = m_date1.GetYear(); int i; int g_nYearposTemp = g_nYearpos; BOOL bLastYear = 0; BOOL bThisYear = 0; #if JEFF_TEST_ON // 2015开始禁用跨年数据; if (m_year >= 2014 && m_year <= atoi(g_date.Left(4)) && g_hisyeararray.GetSize()) { g_nYearpos = -1; bThisYear = 1; } else if (m_year <= 2013 && g_hisyeararray.GetSize()) { g_nYearpos = GetYearPos(m_year); bLastYear = 1; } #else if (m_year == atoi(g_date.Left(4)) && g_hisyeararray.GetSize()) bThisYear = 1; else if (m_year <= atoi(g_date.Left(4)) - 1 && g_hisyeararray.GetSize()) bLastYear = 1; g_nYearpos = GetYearPos(m_year); #endif /////////////// CString filter = "name='" + strStaffName + "' and dimission='在职';date>='" + date1 + "' and date<='" + date2 + "';;date>='" + date1 + "' and date<='" + date2 + "' and renyuan3='" + strStaffName + "';time2>='" + date1 + "' and time2<='" + date2 + "' and status='OK'***date<'" + date1 + "';datetime>='" + date1 + "' and datetime<='" + date2 + "' and name='" + strStaffName + "'"; CString temp; temp = ";[date]>='" + date1 + "' and [date]<='" + date2 + "' and [status]='OK' and ([waiter1]='" + strStaffName + "' or [waiter12]='" + strStaffName + "' or [waiter2]='" + strStaffName + "' or [waiter22]='" + strStaffName + "')"; filter += temp; temp = ";([time8]>='" + date1 + "' and [time8]<='" + date2 + "' and [status4]='OK' and [waiter5]='" + strStaffName + "') or ([time9]>='" + date1 + "' and [time9]<='" + date2 + "' and [status6]='OK' and [waiter7]='" + strStaffName + "') or ([time10]>='" + date1 + "' and [time10]<='" + date2 + "' and [status5]='OK' and [waiter4]='" + strStaffName + "')"; filter += temp; // filter后***的SQL属于case 61里的。 g_sendhead.code[0] = 34; // reyuan; g_sendhead.code[1] = 59; // dindanbukuanview; g_sendhead.code[2] = 60; // dindan; g_sendhead.code[3] = 198; // singleincomemoneyview; g_sendhead.code[4] = 61; // dindan + dindanbukuan; g_sendhead.code[5] = 142; // dindan + mywork; g_sendhead.code[6] = 192; // dindan + dindanjd; g_sendhead.code[7] = 193; // digitalview; g_sendhead.tabcount = 8; g_sendhead.bsql = 0; g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0) { g_nYearpos = g_nYearposTemp; GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(1); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(1); return; } CArrayAryUser; // 人员; CArrayAryReplenishment; // 补款; CArrayAryWaiter; // 服务人员; CArraysingleincomearray; CArraybukuanarray2; CArraytakearray; CArraydigitalarray; DataToArray(&AryUser, &AryReplenishment, &AryWaiter, &singleincomearray, &bukuanarray2, &m_List4array, &takearray, &digitalarray); /////////////////// if (bLastYear)//如果是去年, 则加今年的补款; { g_nYearpos = -1;//今年 filter = "name='" + strStaffName + "' and dimission='在职';date>='" + date1 + "' and date<='" + date2 + "';;date>='" + date1 + "' and date<='" + date2 + "' and renyuan3='" + strStaffName + "';time2>='" + date1 + "' and time2<='" + date2 + "' and status='OK'***date<'" + date1 + "';datetime>='" + date1 + "' and datetime<='" + date2 + "' and name='" + strStaffName + "'"; CString temp; temp = ";[date]>='" + date1 + "' and [date]<='" + date2 + "' and [status]='OK' and ([waiter1]='" + strStaffName + "' or [waiter12]='" + strStaffName + "' or [waiter2]='" + strStaffName + "' or [waiter22]='" + strStaffName + "')"; filter += temp; temp = ";([time8]>='" + date1 + "' and [time8]<='" + date2 + "' and [status4]='OK' and [waiter5]='" + strStaffName + "') or ([time9]>='" + date1 + "' and [time9]<='" + date2 + "' and [status6]='OK' and [waiter7]='" + strStaffName + "') or ([time10]>='" + date1 + "' and [time10]<='" + date2 + "' and [status5]='OK' and [waiter4]='" + strStaffName + "')"; filter += temp; g_sendhead.code[0] = 34; // reyuan; g_sendhead.code[1] = 59; // dindanbukuanview; g_sendhead.code[2] = 60; // dindan; g_sendhead.code[3] = 198; // singleincomemoneyview; g_sendhead.code[4] = 61; // dindan + dindanbukuan; g_sendhead.code[5] = 142; // dindan + mywork; g_sendhead.code[6] = 192; // dindan + dindanjd; g_sendhead.code[7] = 193; // digitalview; g_sendhead.tabcount = 8; g_sendhead.bsql = 0; g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0) { g_nYearpos = g_nYearposTemp; GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(1); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(1); return; } CArrayThisYearbukuanarray; CArrayThisYearwaiterarray; CArrayThisYearsingleincomearray; CArrayThisYearbukuanarray2; CArrayThisYearm_List4array; CArrayThisYeartakearray; CArrayThisYeardigitalarray; DataToArray(&AryUser, &ThisYearbukuanarray, &ThisYearwaiterarray, &ThisYearsingleincomearray, &ThisYearbukuanarray2, &ThisYearm_List4array, &ThisYeartakearray, &ThisYeardigitalarray); int oldsize = AryReplenishment.GetSize(); AryReplenishment.SetSize(oldsize + ThisYearbukuanarray.GetSize()); for (i = oldsize; i < oldsize + ThisYearbukuanarray.GetSize(); i++) { AryReplenishment.ElementAt(i).Copy(ThisYearbukuanarray.ElementAt(i - oldsize)); } oldsize = AryWaiter.GetSize(); AryWaiter.SetSize(oldsize + ThisYearwaiterarray.GetSize()); for (i = oldsize; i < oldsize + ThisYearwaiterarray.GetSize(); i++) { AryWaiter.ElementAt(i).Copy(ThisYearwaiterarray.ElementAt(i - oldsize)); } oldsize = singleincomearray.GetSize(); singleincomearray.SetSize(oldsize + ThisYearsingleincomearray.GetSize()); for (i = oldsize; i < oldsize + ThisYearsingleincomearray.GetSize(); i++) { singleincomearray.ElementAt(i).Copy(ThisYearsingleincomearray.ElementAt(i - oldsize)); } oldsize = bukuanarray2.GetSize(); bukuanarray2.SetSize(oldsize + ThisYearbukuanarray2.GetSize()); for (i = oldsize; i < oldsize + ThisYearbukuanarray2.GetSize(); i++) { bukuanarray2.ElementAt(i).Copy(ThisYearbukuanarray2.ElementAt(i - oldsize)); } oldsize = m_List4array.GetSize(); m_List4array.SetSize(oldsize + ThisYearm_List4array.GetSize()); for (i = oldsize; i < oldsize + ThisYearm_List4array.GetSize(); i++) { m_List4array.ElementAt(i).Copy(ThisYearm_List4array.ElementAt(i - oldsize)); } oldsize = takearray.GetSize(); takearray.SetSize(oldsize + ThisYeartakearray.GetSize()); for (i = oldsize; i < oldsize + ThisYeartakearray.GetSize(); i++) { takearray.ElementAt(i).Copy(ThisYeartakearray.ElementAt(i - oldsize)); } oldsize = digitalarray.GetSize(); digitalarray.SetSize(oldsize + ThisYeardigitalarray.GetSize()); for (i = oldsize; i < oldsize + ThisYeardigitalarray.GetSize(); i++) { digitalarray.ElementAt(i).Copy(ThisYeardigitalarray.ElementAt(i - oldsize)); } } else if (bThisYear)//如果是今年, 则加去年的补款 { g_nYearpos = 0;//去年 filter = "date>='" + date1 + "' and date<='" + date2 + "';;date>='" + date1 + "' and date<='" + date2 + "' and renyuan3='" + strStaffName + "';time2>='" + date1 + "' and time2<='" + date2 + "' and status='OK'***date<'" + date1 + "';datetime>='" + date1 + "' and datetime<='" + date2 + "' and name='" + strStaffName + "'"; CString temp; temp = ";[date]>='" + date1 + "' and [date]<='" + date2 + "' and [status]='OK' and ([waiter1]='" + strStaffName + "' or [waiter12]='" + strStaffName + "' or [waiter2]='" + strStaffName + "' or [waiter22]='" + strStaffName + "')"; filter += temp; temp = ";([time8]>='" + date1 + "' and [time8]<='" + date2 + "' and [status4]='OK' and [waiter5]='" + strStaffName + "') or ([time9]>='" + date1 + "' and [time9]<='" + date2 + "' and [status6]='OK' and [waiter7]='" + strStaffName + "') or ([time10]>='" + date1 + "' and [time10]<='" + date2 + "' and [status5]='OK' and [waiter4]='" + strStaffName + "')"; filter += temp; g_sendhead.code[0] = 59; // dindanbukuanview; g_sendhead.code[1] = 60; // dindan; g_sendhead.code[2] = 198; // singleincomemoneyview; g_sendhead.code[3] = 61; // dindan + bukuan; g_sendhead.code[4] = 142; // mywork; g_sendhead.code[5] = 192; // dindanjd; g_sendhead.code[6] = 193; // digitalview; g_sendhead.tabcount = 7; g_sendhead.bsql = 0; g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0) { g_nYearpos = g_nYearposTemp; GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(1); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(1); return; } CArrayThisYearbukuanarray; CArrayThisYearwaiterarray; CArrayThisYearsingleincomearray; CArrayThisYearbukuanarray2; CArrayThisYearm_List4array; CArrayThisYeartakearray; CArrayThisYeardigitalarray; DataToArray(&ThisYearbukuanarray, &ThisYearwaiterarray, &ThisYearsingleincomearray, &ThisYearbukuanarray2, &ThisYearm_List4array, &ThisYeartakearray, &ThisYeardigitalarray); int oldsize = AryReplenishment.GetSize(); AryReplenishment.SetSize(oldsize + ThisYearbukuanarray.GetSize()); for (i = oldsize; i < oldsize + ThisYearbukuanarray.GetSize(); i++) { AryReplenishment.ElementAt(i).Copy(ThisYearbukuanarray.ElementAt(i - oldsize)); } oldsize = AryWaiter.GetSize(); AryWaiter.SetSize(oldsize + ThisYearwaiterarray.GetSize()); for (i = oldsize; i < oldsize + ThisYearwaiterarray.GetSize(); i++) { AryWaiter.ElementAt(i).Copy(ThisYearwaiterarray.ElementAt(i - oldsize)); } oldsize = singleincomearray.GetSize(); singleincomearray.SetSize(oldsize + ThisYearsingleincomearray.GetSize()); for (i = oldsize; i < oldsize + ThisYearsingleincomearray.GetSize(); i++) { singleincomearray.ElementAt(i).Copy(ThisYearsingleincomearray.ElementAt(i - oldsize)); } oldsize = bukuanarray2.GetSize(); bukuanarray2.SetSize(oldsize + ThisYearbukuanarray2.GetSize()); for (i = oldsize; i < oldsize + ThisYearbukuanarray2.GetSize(); i++) { bukuanarray2.ElementAt(i).Copy(ThisYearbukuanarray2.ElementAt(i - oldsize)); } oldsize = m_List4array.GetSize(); m_List4array.SetSize(oldsize + ThisYearm_List4array.GetSize()); for (i = oldsize; i < oldsize + ThisYearm_List4array.GetSize(); i++) { m_List4array.ElementAt(i).Copy(ThisYearm_List4array.ElementAt(i - oldsize)); } oldsize = takearray.GetSize(); takearray.SetSize(oldsize + ThisYeartakearray.GetSize()); for (i = oldsize; i < oldsize + ThisYeartakearray.GetSize(); i++) { takearray.ElementAt(i).Copy(ThisYeartakearray.ElementAt(i - oldsize)); } oldsize = digitalarray.GetSize(); digitalarray.SetSize(oldsize + ThisYeardigitalarray.GetSize()); for (i = oldsize; i < oldsize + ThisYeardigitalarray.GetSize(); i++) { digitalarray.ElementAt(i).Copy(ThisYeardigitalarray.ElementAt(i - oldsize)); } } g_nYearpos = g_nYearposTemp; // 收款记录:补款+其他收入; CArrayAryReceiptRecords; AryReceiptRecords.SetSize(AryReplenishment.GetSize() * 4 + bukuanarray2.GetSize() * 4 + singleincomearray.GetSize()); // 前期业绩金额; float fEarlyAchievementMoney = 0; float money_photographer_secondarily = 0; float money_化妆或引导二销 = 0; float money_套系升级 = 0; float money_选片二销 = 0; CArraymoneyarray; CStringArray typearray; int typepos; int ii = 0; int arraypos = 0; // 遍历时间范围:(时间1-时间2)内的收款; for ( ii = 0; ii < AryReplenishment.GetSize(); ii++) { // printf("idx=%d, id=%s, money=%s, ren=%s, bz=%s, txtype=%s\n", ii, AryReplenishment.ElementAt(ii).ElementAt(5), AryReplenishment.ElementAt(ii).ElementAt(0), AryReplenishment.ElementAt(ii).ElementAt(6),AryReplenishment.ElementAt(ii).ElementAt(7), AryReplenishment.ElementAt(ii).ElementAt(8)); AryReceiptRecords.ElementAt(arraypos).RemoveAll(); // 前期业绩; if (AryReplenishment.ElementAt(ii).ElementAt(2) == "3" || AryReplenishment.ElementAt(ii).ElementAt(2) == "4")//预约收款/预约补款; { // 是否是摄影师; BOOL bPhotographer = FALSE; // 是否是化妆师; BOOL bMakeupArtist = FALSE; float fscale1 = 0; float fscale2 = 0; // 获取指定订单号的服务人员信息; IsWaiter2(AryReplenishment.ElementAt(ii).ElementAt(5), strStaffName, &AryWaiter, bPhotographer, bMakeupArtist, fscale1, fscale2, 0, date1, date2); // ElementAt(56):工资设置:摄影师也有前期提成; if (bPhotographer && atoi(g_cominfoarray.ElementAt(0).ElementAt(56))) // 摄影师前期提成; { // ElementAt(0):收款金额; temp.Format("%0.2f", atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale1); ConvertToPrice(temp); fEarlyAchievementMoney += atof(temp); typepos = FindArray(&typearray, _T("摄影前期")); if (typepos == -1) { typearray.Add(_T("摄影前期")); moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } AryReceiptRecords.ElementAt(arraypos).Add(temp); // 收款金额; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(1)); // 收款日期; AryReceiptRecords.ElementAt(arraypos).Add(_T("摄影前期")); // 工资类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(3)); // 顾客1姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(4)); // 顾客2姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(8)); // 套系类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(10)); // 套系名称; arraypos++; } // ElementAt(57):工资设置:化妆师、引导师也有前期提成; if (bMakeupArtist && atoi(g_cominfoarray.ElementAt(0).ElementAt(57))) // 化妆师、引导师前期提成; { temp.Format("%0.2f", atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale2); ConvertToPrice(temp); fEarlyAchievementMoney += atof(temp); typepos = FindArray(&typearray, _T("摄影前期")); if (typepos == -1) { typearray.Add(_T("摄影前期")); moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } AryReceiptRecords.ElementAt(arraypos).Add(temp); // 收款金额; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(1)); // 收款日期; AryReceiptRecords.ElementAt(arraypos).Add(_T("化妆前期")); // 工资类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(3)); // 顾客1姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(4)); // 顾客2姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(8)); // 套系类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(10)); // 套系名称; arraypos++; } // 获取指定员工在订单下是否有门市职能; IsWaiter3(AryReplenishment.ElementAt(ii).ElementAt(5), strStaffName, &AryWaiter, bPhotographer, bMakeupArtist, fscale1, fscale2); if (bPhotographer) { temp.Format("%0.2f", atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale1); ConvertToPrice(temp); fEarlyAchievementMoney += atof(temp); typepos = FindArray(&typearray, _T("前期")); if (typepos == -1) { typearray.Add(_T("前期")); moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } AryReceiptRecords.ElementAt(arraypos).Add(temp); // 收款金额; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(1)); // 收款日期; AryReceiptRecords.ElementAt(arraypos).Add(_T("前期收款")); // 工资类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(3)); // 顾客1姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(4)); // 顾客2姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(8)); // 套系类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(10)); // 套系名称; arraypos++; } if (bMakeupArtist) { temp.Format("%0.2f", atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale2); ConvertToPrice(temp); fEarlyAchievementMoney += atof(temp); typepos = FindArray(&typearray, _T("前期")); if (typepos == -1) { typearray.Add(_T("前期")); moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } AryReceiptRecords.ElementAt(arraypos).Add(temp); // 收款金额; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(1)); // 收款日期; AryReceiptRecords.ElementAt(arraypos).Add(_T("前期收款")); // 工资类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(3)); // 顾客1姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(4)); // 顾客2姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(8)); // 套系类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(10)); // 套系名称; arraypos++; } continue; } // ElementAt(7):选片二销(后期业绩); else if (AryReplenishment.ElementAt(ii).ElementAt(7) == _T("选片二销"))//选片补款, 需加摄影师和化妆师; { // 是否是摄影师; BOOL bPhotographer = 0; // 是否是化妆师; BOOL bMakeupArtist = 0; float fscale1 = 0; float fscale2 = 0; // 获取员工在订单下的服务信息; IsWaiter2(AryReplenishment.ElementAt(ii).ElementAt(5), strStaffName, &AryWaiter, bPhotographer, bMakeupArtist, fscale1, fscale2, 0, date1, date2); // ElementAt(41):工资设置:摄影师也有选片二销提成; if (bPhotographer && atoi(g_cominfoarray.ElementAt(0).ElementAt(41))) // 摄影师也有选片二销提成; { temp.Format("%0.2f", atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale1); ConvertToPrice(temp); money_选片二销 += atof(temp); typepos = FindArray(&typearray, _T("摄影选片二销")); if (typepos == -1) { typearray.Add(_T("摄影选片二销")); moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } AryReceiptRecords.ElementAt(arraypos).Add(temp); // 收款金额; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(1)); // 收款日期; AryReceiptRecords.ElementAt(arraypos).Add(_T("摄影选片二销")); // 工资类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(3)); // 顾客1姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(4)); // 顾客2姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(8)); // 套系类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(10)); // 套系名称; arraypos++; } // ElementAt(42):工资设置:化妆师或引导师也有选片二销提成; if (bMakeupArtist && atoi(g_cominfoarray.ElementAt(0).ElementAt(42))) // 化妆师或引导师也有选片二销提成; { temp.Format("%0.2f", atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale2); ConvertToPrice(temp); money_选片二销 += atof(temp); #ifdef CHILD_VERSION typepos = FindArray(&typearray, _T("引导选片二销")); #else typepos = FindArray(&typearray, _T("化妆选片二销")); #endif if (typepos == -1) { #ifdef CHILD_VERSION typearray.Add(_T("引导选片二销")); #else typearray.Add(_T("化妆选片二销")); #endif moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } AryReceiptRecords.ElementAt(arraypos).Add(temp); // 收款金额; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(1)); // 收款日期; #ifdef CHILD_VERSION AryReceiptRecords.ElementAt(arraypos).Add(_T("引导选片二销")); // 工资类型; #else AryReceiptRecords.ElementAt(arraypos).Add(_T("化妆选片二销")); // 工资类型; #endif AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(3)); // 顾客1姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(4)); // 顾客2姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(8)); // 套系类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(10)); // 套系名称; arraypos++; } // 以上统计了摄影师和化妆师的选片二销; // 以下是统计除摄影师与化妆师以外的其他人员的选片二销; // ElementAt(6):员工姓名; if (AryReplenishment.ElementAt(ii).ElementAt(6) != strStaffName) continue; temp.Format("%0.2f", atof(AryReplenishment.ElementAt(ii).ElementAt(0))); ConvertToPrice(temp); money_选片二销 += atof(temp); typepos = FindArray(&typearray, AryReplenishment.ElementAt(ii).ElementAt(7)); if (typepos == -1) { typearray.Add(AryReplenishment.ElementAt(ii).ElementAt(7)); moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } AryReceiptRecords.ElementAt(arraypos).Add(temp); // 收款金额; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(1)); // 收款日期; AryReceiptRecords.ElementAt(arraypos).Add(_T("选片二销")); // 工资类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(3)); // 顾客1姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(4)); // 顾客2姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(8)); // 套系类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(10)); // 套系名称; } // 其他订单二销(后期业绩); else {// 统计除选片二销以外的其他订单二销; if (AryReplenishment.ElementAt(ii).ElementAt(6) != strStaffName) continue; temp.Format("%0.2f", atof(AryReplenishment.ElementAt(ii).ElementAt(0))); ConvertToPrice(temp); typepos = FindArray(&typearray, AryReplenishment.ElementAt(ii).ElementAt(7)); if (typepos == -1) { typearray.Add(AryReplenishment.ElementAt(ii).ElementAt(7)); moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } money_photographer_secondarily += atof(temp); AryReceiptRecords.ElementAt(arraypos).Add(temp); // 收款金额; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(1)); // 收款日期; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(7)); // 工资类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(3)); // 顾客1姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(4)); // 顾客2姓名; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(8)); // 套系类型; AryReceiptRecords.ElementAt(arraypos).Add(AryReplenishment.ElementAt(ii).ElementAt(10)); // 套系名称; } arraypos++; } // 遍历时间范围:时间1 之前的收款; for (ii = 0; ii < bukuanarray2.GetSize(); ii++) { AryReceiptRecords.ElementAt(arraypos).RemoveAll(); // 前期业绩; if (bukuanarray2.ElementAt(ii).ElementAt(2) == "3" || bukuanarray2.ElementAt(ii).ElementAt(2) == "4") { BOOL bPhotographer = 0; BOOL bMakeupArtist = 0; float fscale1 = 0; float fscale2 = 0; IsWaiter2(bukuanarray2.ElementAt(ii).ElementAt(5), strStaffName, &AryWaiter, bPhotographer, bMakeupArtist, fscale1, fscale2, 1, date1, date2); if (bPhotographer && atoi(g_cominfoarray.ElementAt(0).ElementAt(56)))//我是摄影师 { temp.Format("%0.2f", atof(bukuanarray2.ElementAt(ii).ElementAt(0))*fscale1); ConvertToPrice(temp); fEarlyAchievementMoney += atof(temp); typepos = FindArray(&typearray, _T("摄影前期")); if (typepos == -1) { typearray.Add(_T("摄影前期")); moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } AryReceiptRecords.ElementAt(arraypos).Add(temp); AryReceiptRecords.ElementAt(arraypos).Add(bukuanarray2.ElementAt(ii).ElementAt(1)); AryReceiptRecords.ElementAt(arraypos).Add(_T("摄影前期")); AryReceiptRecords.ElementAt(arraypos).Add(bukuanarray2.ElementAt(ii).ElementAt(3)); AryReceiptRecords.ElementAt(arraypos).Add(bukuanarray2.ElementAt(ii).ElementAt(4)); AryReceiptRecords.ElementAt(arraypos).Add(bukuanarray2.ElementAt(ii).ElementAt(8)); AryReceiptRecords.ElementAt(arraypos).Add(bukuanarray2.ElementAt(ii).ElementAt(9)); arraypos++; } if (bMakeupArtist && atoi(g_cominfoarray.ElementAt(0).ElementAt(57)))//我是化妆师 { temp.Format("%0.2f", atof(bukuanarray2.ElementAt(ii).ElementAt(0))*fscale2); ConvertToPrice(temp); fEarlyAchievementMoney += atof(temp); typepos = FindArray(&typearray, _T("摄影前期")); if (typepos == -1) { typearray.Add(_T("摄影前期")); moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } AryReceiptRecords.ElementAt(arraypos).Add(temp); AryReceiptRecords.ElementAt(arraypos).Add(bukuanarray2.ElementAt(ii).ElementAt(1)); AryReceiptRecords.ElementAt(arraypos).Add(_T("化妆前期")); AryReceiptRecords.ElementAt(arraypos).Add(bukuanarray2.ElementAt(ii).ElementAt(3)); AryReceiptRecords.ElementAt(arraypos).Add(bukuanarray2.ElementAt(ii).ElementAt(4)); AryReceiptRecords.ElementAt(arraypos).Add(bukuanarray2.ElementAt(ii).ElementAt(8)); AryReceiptRecords.ElementAt(arraypos).Add(bukuanarray2.ElementAt(ii).ElementAt(9)); arraypos++; } continue; } } // 单笔收入; for (ii = 0; ii < singleincomearray.GetSize(); ii++) { AryReceiptRecords.ElementAt(arraypos).RemoveAll(); temp.Format("%0.2f", atof(singleincomearray.ElementAt(ii).ElementAt(4))); ConvertToPrice(temp); if (singleincomearray.ElementAt(ii).ElementAt(3) == _T("摄影二销")) money_photographer_secondarily += atof(temp); #ifndef CHILD_VERSION else if (singleincomearray.ElementAt(ii).ElementAt(3) == _T("化妆二销")) #else else if (singleincomearray.ElementAt(ii).ElementAt(3) == _T("引导二销")) #endif money_化妆或引导二销 += atof(temp); else if (singleincomearray.ElementAt(ii).ElementAt(3) == _T("套系升级")) money_套系升级 += atof(temp); else if (singleincomearray.ElementAt(ii).ElementAt(3) == _T("选片二销")) money_选片二销 += atof(temp); typepos = FindArray(&typearray, singleincomearray.ElementAt(ii).ElementAt(3)); if (typepos == -1) { typearray.Add(singleincomearray.ElementAt(ii).ElementAt(3)); moneyarray.Add(atof(temp)); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + atof(temp)); } AryReceiptRecords.ElementAt(arraypos).Add(temp); // 收款金额; AryReceiptRecords.ElementAt(arraypos).Add(singleincomearray.ElementAt(ii).ElementAt(5)); // 收款日期; AryReceiptRecords.ElementAt(arraypos).Add(singleincomearray.ElementAt(ii).ElementAt(3)); // 工资类型; AryReceiptRecords.ElementAt(arraypos).Add(singleincomearray.ElementAt(ii).ElementAt(1)); // 顾客1姓名; AryReceiptRecords.ElementAt(arraypos).Add(""); // 顾客2姓名; AryReceiptRecords.ElementAt(arraypos).Add(""); // 套系类型; AryReceiptRecords.ElementAt(arraypos).Add(singleincomearray.ElementAt(ii).ElementAt(7)); // 套系名称; arraypos++; } AryReceiptRecords.SetSize(arraypos); // 填充订单、摄影师前期业绩列表; FillGrid(&AryReceiptRecords); // 填充计件式提成列表; FillGrid4(m_strmoney6); // 填充摄影师与助理的景点列表; FillGridTake(&takearray); // 填充修片与精修与设计列表; FillGridDigital(&digitalarray); if (AryUser.GetSize()) { // 员工姓名; m_strStaffName = AryUser.ElementAt(0).ElementAt(0); // 员工基本工资; m_strBasicWage = AryUser.ElementAt(0).ElementAt(1); // 员工前期方案; CString baseexpendtype = AryUser.ElementAt(0).ElementAt(2); // 员工后期方案; CString baseexpendtype2 = AryUser.ElementAt(0).ElementAt(3); // 员工备注; m_strStaffNote = AryUser.ElementAt(0).ElementAt(4); // 是否有前期业绩; typepos = FindArray(&typearray, _T("前期")); if (typepos == -1) { m_strEarlyAchievementMoney = "0"; fEarlyAchievementMoney = 0; } else {// 获取前期业绩金额; fEarlyAchievementMoney = moneyarray.ElementAt(typepos); } // 是否有摄影前期业绩; float money_photographer_early = 0; typepos = FindArray(&typearray, _T("摄影前期")); if (typepos == -1) { money_photographer_early = 0; } else { money_photographer_early = moneyarray.ElementAt(typepos); } m_strEarlyAchievementMoney.Format("%0.2f", fEarlyAchievementMoney + money_photographer_early); // 合计其他:除去订单前期业绩和摄影前期业绩以外的业绩; money_photographer_secondarily = 0; float realmoney2 = 0; for (int i = 0; i < typearray.GetSize(); i++) { if (_T("前期") == typearray.ElementAt(i))continue; if (_T("摄影前期") == typearray.ElementAt(i))continue; // 排除掉“前期”和“摄影前期”,因为这两项是在财务管理->提成比例中设置的,不需要单独方案; realmoney2 += GetSalaryFromRule(moneyarray.ElementAt(i), GetRule(typearray.ElementAt(i))); money_photographer_secondarily += moneyarray.ElementAt(i); } m_strSecondarySalesAchievementMoney.Format("%0.2f", money_photographer_secondarily); ConvertToPrice(m_strmoney6); m_strTotalWage.Format("%0.2f", atof(m_strBasicWage) + atof(m_strmoney6) + realmoney2 + GetSalaryFromRule(fEarlyAchievementMoney, GetRule(baseexpendtype)) + GetSalaryFromRule(money_photographer_early, GetRule(baseexpendtype2))); ConvertToPrice(m_strTotalWage); } else { m_strStaffName = _T(""); m_strBasicWage = _T(""); m_strStaffNote = _T(""); m_strTotalWage = _T(""); m_strEarlyAchievementMoney = _T(""); m_strSecondarySalesAchievementMoney = _T(""); m_money3 = _T(""); m_money4 = _T(""); m_money5 = _T(""); m_strmoney6 = _T(""); } UpdateData(false); GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(1); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(1); ////////////////////////////// CString totalstr, str, field1, field2, field3, field4, field5, field6, field7, field8, field9, field10, field11, field12; float sum = 0; int waiter1count = 0; int waiter12count = 0; int waiter2count = 0; int waiter22count = 0; for (i = 0; i < m_Listtake.GetItemCount(); i++) { field2 = m_Listtake.GetItemText(i, 3); field3 = m_Listtake.GetItemText(i, 4); sum += atof(field3); field4 = m_Listtake.GetItemText(i, 5); field5 = m_Listtake.GetItemText(i, 6); field6 = m_Listtake.GetItemText(i, 7); field7 = m_Listtake.GetItemText(i, 8); field8 = m_Listtake.GetItemText(i, 9); field9 = m_Listtake.GetItemText(i, 10); if (field6 == strStaffName)waiter1count++; if (field7 == strStaffName)waiter12count++; if (field8 == strStaffName)waiter2count++; if (field9 == strStaffName)waiter22count++; } str = "摄影师与助理\r\n"; totalstr += str; str.Format("摄影: %d\r\n", waiter1count); totalstr += str; str.Format("助理: %d\r\n", waiter12count); totalstr += str; #ifdef CHILD_VERSION str.Format("引导: %d\r\n", waiter2count); totalstr += str; #else str.Format("化妆: %d\r\n", waiter2count); totalstr += str; #endif str.Format("助理: %d\r\n", waiter22count); totalstr += str; str.Format("订单总金额: %0.2f\r\n\r\n", sum); totalstr += str; float sum1 = 0; float sum2 = 0; float sum3 = 0; float sum12 = 0; float sum22 = 0; float sum32 = 0; int sum13 = 0; int sum23 = 0; int sum33 = 0; int sum14 = 0; int sum24 = 0; int sum34 = 0; int count1 = 0; int count2 = 0; int count3 = 0; for (i = 0; i < m_Listdigital.GetItemCount(); i++) { field2 = m_Listdigital.GetItemText(i, 3); field3 = m_Listdigital.GetItemText(i, 4); field4 = m_Listdigital.GetItemText(i, 5); field5 = m_Listdigital.GetItemText(i, 6); field6 = m_Listdigital.GetItemText(i, 7); field7 = m_Listdigital.GetItemText(i, 8); field8 = m_Listdigital.GetItemText(i, 9); field9 = m_Listdigital.GetItemText(i, 10); field10 = m_Listdigital.GetItemText(i, 14); field11 = m_Listdigital.GetItemText(i, 16); field12 = m_Listdigital.GetItemText(i, 17); if (m_Listdigital.GetItemText(i, 11) == "OK" && field4 == strStaffName && field5 >= date1 && field5 <= date2) { sum1 += atof(field3); sum12 += atof(field10); sum13 += atoi(field11); sum14 += atoi(field12); count1++; } if (m_Listdigital.GetItemText(i, 12) == "OK" && field6 == strStaffName && field7 >= date1 && field7 <= date2) { sum2 += atof(field3); sum22 += atof(field10); sum23 += atoi(field11); sum24 += atoi(field12); count2++; } if (m_Listdigital.GetItemText(i, 13) == "OK" && field8 == strStaffName && field9 >= date1 && field9 <= date2) { sum3 += atof(field3); sum32 += atof(field10); sum33 += atoi(field11); sum34 += atoi(field12); count3++; } } str = "修片与精修与设计\r\n"; totalstr += str; #ifdef LKAY_VERSION str.Format ("初修: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\nP数:%d\r\n张数:%d\r\n\r\n", count1, sum1, sum12, sum13, sum14);totalstr+=str; str.Format ("精修: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\nP数:%d\r\n张数:%d\r\n\r\n", count2, sum2, sum22, sum23, sum24);totalstr+=str; str.Format ("设计: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\nP数:%d\r\n张数:%d\r\n\r\n", count3, sum3, sum32, sum33, sum34);totalstr+=str; #else str.Format("初修: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\n\r\n", count1, sum1, sum12); totalstr += str; str.Format("精修: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\n\r\n", count2, sum2, sum22); totalstr += str; str.Format("设计: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\n\r\n", count3, sum3, sum32); totalstr += str; #endif GetDlgItem(IDC_EDITbz2)->SetWindowText(totalstr); } #else void MySalary::OnSelchangeList1() { if (m_bInit == 0)return; UpdateData(); GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(0); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(0); if (m_bAll) { m_AryStaffWageInfo.RemoveAll(); FillGrid2(); GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(1); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(1); return; } CString strStaffName; int pos = m_comboname.GetCurSel(); if (pos == -1) { GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(1); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(1); return; } m_comboname.GetWindowText(strStaffName); CString date1(_T("")), date2(_T("")); date1 = m_date1.Format("%Y-%m-%d"); date2 = m_date2.Format("%Y-%m-%d"); m_year = m_date1.GetYear(); int i; CStaffWage StaffWage; StaffWage.GetStaffWageData(strStaffName, date1, date2); StaffWage.GetEarlyResults(StaffWage.m_AryEarlyResult); // 填充订单、摄影师前期业绩列表; FillGrid(&StaffWage.m_AryEarlyResult); // 填充计件式提成列表; FillGrid4(m_strmoney6, StaffWage.m_AryMyWorkRecord); // 填充摄影师与助理的景点列表; FillGridTake(&StaffWage.m_ArySceneryWorkRecord); // 填充修片与精修与设计列表; FillGridDigital(&StaffWage.m_AryDigitalWorkRecord); if (StaffWage.m_AryStaffDetail.GetSize()) { // 员工姓名; m_strStaffName = StaffWage.m_AryStaffDetail.ElementAt(0).ElementAt(0); // 员工基本工资; m_strBasicWage = StaffWage.m_AryStaffDetail.ElementAt(0).ElementAt(1); // 员工前期方案; CString baseexpendtype = StaffWage.m_AryStaffDetail.ElementAt(0).ElementAt(2); // 员工后期方案; CString baseexpendtype2 = StaffWage.m_AryStaffDetail.ElementAt(0).ElementAt(3); // 员工备注; m_strStaffNote = StaffWage.m_AryStaffDetail.ElementAt(0).ElementAt(4); // 是否有门市前期业绩; int typepos = FindArray(&StaffWage.m_AryWageType, WAGE_EARLY_SALES); if (typepos == -1) { m_strEarlyAchievementMoney = "0"; StaffWage.m_fEaryResultMoney = 0; } else {// 获取门市前期业绩金额; StaffWage.m_fEaryResultMoney = StaffWage.m_AryWageTypeMoney.ElementAt(typepos); } // 是否有摄影前期业绩; float money_photographer_early = 0; typepos = FindArray(&StaffWage.m_AryWageType, WAGE_EARLY_PHOTOGRAPHER); if (typepos == -1) { money_photographer_early = 0; } else { money_photographer_early = StaffWage.m_AryWageTypeMoney.ElementAt(typepos); } // 是否有化妆/引导前期业绩; float money_makeupartist_early = 0; typepos = FindArray(&StaffWage.m_AryWageType, WAGE_EARLY_MAKEUPARTIST); if (typepos == -1) { money_makeupartist_early = 0; } else { money_makeupartist_early = StaffWage.m_AryWageTypeMoney.ElementAt(typepos); } // 前期业绩 = 门市前期 + 摄影前期 + 化妆前期; m_strEarlyAchievementMoney.Format("%0.2f", StaffWage.m_fEaryResultMoney + money_photographer_early + money_makeupartist_early); // 后期二销业绩:除去门市前期业绩、摄影前期业绩和化妆/引导前期业绩以外的后期二销业绩; float money_photographer_secondarily = 0; float realmoney2 = 0; for (int i = 0; i < StaffWage.m_AryWageType.GetSize(); i++) { // if (WAGE_EARLY_SALES == StaffWage.m_AryWageType.ElementAt(i))continue; if (WAGE_EARLY_MAKEUPARTIST == StaffWage.m_AryWageType.ElementAt(i))continue; if (WAGE_EARLY_PHOTOGRAPHER == StaffWage.m_AryWageType.ElementAt(i))continue; // 排除掉“前期”和“摄影前期”,因为这两项是在财务管理->提成比例中设置的,不需要单独方案; realmoney2 += GetSalaryFromRule(StaffWage.m_AryWageTypeMoney.ElementAt(i), GetRule(StaffWage.m_AryWageType.ElementAt(i))); money_photographer_secondarily += StaffWage.m_AryWageTypeMoney.ElementAt(i); } m_strSecondarySalesAchievementMoney.Format("%0.2f", money_photographer_secondarily); ConvertToPrice(m_strmoney6); m_strTotalWage.Format("%0.2f", atof(m_strBasicWage) + // 基本工资; atof(m_strmoney6) + // 计件式工资; realmoney2 + // 后期二销工资; GetSalaryFromRule(StaffWage.m_fEaryResultMoney, GetRule(baseexpendtype)) + // 门市前期工资; GetSalaryFromRule(money_photographer_early + money_makeupartist_early, GetRule(baseexpendtype2))); // 摄影前期+化妆/引导前期; ConvertToPrice(m_strTotalWage); } else { m_strStaffName = _T(""); m_strBasicWage = _T(""); m_strStaffNote = _T(""); m_strTotalWage = _T(""); m_strEarlyAchievementMoney = _T(""); m_strSecondarySalesAchievementMoney = _T(""); m_money3 = _T(""); m_money4 = _T(""); m_money5 = _T(""); m_strmoney6 = _T(""); } UpdateData(false); GetDlgItem(IDC_DATETIMEPICKER1)->EnableWindow(1); GetDlgItem(IDC_DATETIMEPICKER2)->EnableWindow(1); ////////////////////////////// CString totalstr, str, field1, field2, field3, field4, field5, field6, field7, field8, field9, field10, field11, field12; float sum = 0; int waiter1count = 0; int waiter12count = 0; int waiter2count = 0; int waiter22count = 0; for (i = 0; i < m_Listtake.GetItemCount(); i++) { field2 = m_Listtake.GetItemText(i, 3); field3 = m_Listtake.GetItemText(i, 4); sum += atof(field3); field4 = m_Listtake.GetItemText(i, 5); field5 = m_Listtake.GetItemText(i, 6); field6 = m_Listtake.GetItemText(i, 7); field7 = m_Listtake.GetItemText(i, 8); field8 = m_Listtake.GetItemText(i, 9); field9 = m_Listtake.GetItemText(i, 10); if (field6 == strStaffName)waiter1count++; if (field7 == strStaffName)waiter12count++; if (field8 == strStaffName)waiter2count++; if (field9 == strStaffName)waiter22count++; } str = "摄影师与助理\r\n"; totalstr += str; str.Format("摄影: %d\r\n", waiter1count); totalstr += str; str.Format("助理: %d\r\n", waiter12count); totalstr += str; #ifdef CHILD_VERSION str.Format("引导: %d\r\n", waiter2count); totalstr += str; #else str.Format("化妆: %d\r\n", waiter2count); totalstr += str; #endif str.Format("助理: %d\r\n", waiter22count); totalstr += str; str.Format("订单总金额: %0.2f\r\n\r\n", sum); totalstr += str; float sum1 = 0; float sum2 = 0; float sum3 = 0; float sum12 = 0; float sum22 = 0; float sum32 = 0; int sum13 = 0; int sum23 = 0; int sum33 = 0; int sum14 = 0; int sum24 = 0; int sum34 = 0; int count1 = 0; int count2 = 0; int count3 = 0; for (i = 0; i < m_Listdigital.GetItemCount(); i++) { field2 = m_Listdigital.GetItemText(i, 3); field3 = m_Listdigital.GetItemText(i, 4); field4 = m_Listdigital.GetItemText(i, 5); field5 = m_Listdigital.GetItemText(i, 6); field6 = m_Listdigital.GetItemText(i, 7); field7 = m_Listdigital.GetItemText(i, 8); field8 = m_Listdigital.GetItemText(i, 9); field9 = m_Listdigital.GetItemText(i, 10); field10 = m_Listdigital.GetItemText(i, 14); field11 = m_Listdigital.GetItemText(i, 16); field12 = m_Listdigital.GetItemText(i, 17); if (m_Listdigital.GetItemText(i, 11) == "OK" && field4 == strStaffName && field5 >= date1 && field5 <= date2) { sum1 += atof(field3); sum12 += atof(field10); sum13 += atoi(field11); sum14 += atoi(field12); count1++; } if (m_Listdigital.GetItemText(i, 12) == "OK" && field6 == strStaffName && field7 >= date1 && field7 <= date2) { sum2 += atof(field3); sum22 += atof(field10); sum23 += atoi(field11); sum24 += atoi(field12); count2++; } if (m_Listdigital.GetItemText(i, 13) == "OK" && field8 == strStaffName && field9 >= date1 && field9 <= date2) { sum3 += atof(field3); sum32 += atof(field10); sum33 += atoi(field11); sum34 += atoi(field12); count3++; } } str = "修片与精修与设计\r\n"; totalstr += str; #ifdef LKAY_VERSION str.Format ("初修: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\nP数:%d\r\n张数:%d\r\n\r\n", count1, sum1, sum12, sum13, sum14);totalstr+=str; str.Format ("精修: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\nP数:%d\r\n张数:%d\r\n\r\n", count2, sum2, sum22, sum23, sum24);totalstr+=str; str.Format ("设计: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\nP数:%d\r\n张数:%d\r\n\r\n", count3, sum3, sum32, sum33, sum34);totalstr+=str; #else str.Format("初修: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\n\r\n", count1, sum1, sum12); totalstr += str; str.Format("精修: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\n\r\n", count2, sum2, sum22); totalstr += str; str.Format("设计: %d单 \r\n订单金额:%0.2f \r\n选片二销:%0.2f\r\n\r\n", count3, sum3, sum32); totalstr += str; #endif GetDlgItem(IDC_EDITbz2)->SetWindowText(totalstr); } #endif void MySalary::OnBUTshowall() //查看全部 或者 工资报表; { // TODO: Add your control notification handler code here m_bAll = !m_bAll; if (m_bAll) { GetDlgItem(IDC_BUTshowall)->SetWindowText("查看详情"); GetDlgItem(IDC_BUT3)->ShowWindow(SW_SHOW); } else { GetDlgItem(IDC_BUT3)->ShowWindow(SW_HIDE); GetDlgItem(IDC_BUTshowall)->SetWindowText("查看全部"); } GetDlgItem(IDC_BUTshowall)->Invalidate(); GetDlgItem(IDC_STATIC2)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC3)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC4)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC5)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC6)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC7)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC8)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC26)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC27)->ShowWindow(!m_bAll); // GetDlgItem(IDC_BUTTON5)->ShowWindow(!m_bAll); // GetDlgItem(IDC_BUTTON6)->ShowWindow(!m_bAll); GetDlgItem(IDC_BUTTON7)->ShowWindow(!m_bAll); GetDlgItem(IDC_BUTTON8)->ShowWindow(!m_bAll); GetDlgItem(IDC_BUTTON14)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC9)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC12)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC16)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC10)->ShowWindow(!m_bAll); // GetDlgItem(IDC_EDITname)->ShowWindow(!m_bAll); GetDlgItem(IDC_EDITbz)->ShowWindow(!m_bAll); GetDlgItem(IDC_EDITbz2)->ShowWindow(!m_bAll); GetDlgItem(IDC_EDITbase)->ShowWindow(!m_bAll); GetDlgItem(IDC_EDITmoney1)->ShowWindow(!m_bAll); GetDlgItem(IDC_EDITmoney2)->ShowWindow(!m_bAll); GetDlgItem(IDC_EDITsalary)->ShowWindow(!m_bAll); GetDlgItem(IDC_BUTTON4)->ShowWindow(!m_bAll); GetDlgItem(IDC_EDITmoney6)->ShowWindow(!m_bAll); GetDlgItem(IDC_STATIC15)->ShowWindow(!m_bAll); GetDlgItem(IDC_LIST4)->ShowWindow(!m_bAll); // GetDlgItem(IDC_LIST1)->ShowWindow(!m_bAll); GetDlgItem(IDC_LIST2)->ShowWindow(!m_bAll); GetDlgItem(IDC_LIST3)->ShowWindow(m_bAll); GetDlgItem(IDC_LIST7)->ShowWindow(!m_bAll); GetDlgItem(IDC_LIST8)->ShowWindow(!m_bAll); GetDlgItem(IDC_COMBO7)->ShowWindow(!m_bAll); if (m_bAll) FillGrid2(); else { POSITION pos; pos = m_List3.GetFirstSelectedItemPosition(); if (pos) { int iItem = m_List3.GetNextSelectedItem(pos); CString name = m_List3.GetItemText(iItem, 0); CString temp; for (int i = 0; i < m_ListBox1.GetCount(); i++) { m_ListBox1.GetText(i, temp); if (temp == name) { m_ListBox1.SetCurSel(i); m_comboname.AddString(name); m_comboname.SetCurSel(m_comboname.FindString(0, name)); OnSelchangeList1(); break; } } } } } void MySalary::FillGrid2() { if (m_AryStaffWageInfo.GetSize() == 0) GetAllData(); m_List3.DeleteAllItems2(); int ii = 0; m_List3.m_arLabels.SetSize(m_AryStaffWageInfo.GetSize(), 1); int count = 0; for (ii = 0; ii < m_List3.m_arLabels.GetSize(); ii++) { m_List3.m_arLabels.ElementAt(count++).Copy(m_AryStaffWageInfo.ElementAt(ii)); } m_List3.m_arLabels.SetSize(count, 1); ii = count; m_List3.m_LabelCount = ii; m_List3.SetItemCountEx(ii); } #if 0 void MySalary::GetAllData() { if (m_bInit == 0)return; UpdateData(); CString date1, date2, temp; date1 = m_date1.Format("%Y-%m-%d"); date2 = m_date2.Format("%Y-%m-%d"); m_year = m_date1.GetYear(); int i = 0; int g_nYearposTemp = g_nYearpos; BOOL bLastYear = 0; BOOL bThisYear = 0; #if JEFF_TEST_ON // 2015开始禁用跨年数据; if (m_year >= 2014 && m_year <= atoi(g_date.Left(4)) && g_hisyeararray.GetSize()) { g_nYearpos = -1; bThisYear = 1; } else if (m_year <= 2013 && g_hisyeararray.GetSize()) { g_nYearpos = GetYearPos(m_year); bLastYear = 1; } #else if (m_year == atoi(g_date.Left(4)) && g_hisyeararray.GetSize()) bThisYear = 1; else if (m_year <= atoi(g_date.Left(4)) - 1 && g_hisyeararray.GetSize()) bLastYear = 1; g_nYearpos = GetYearPos(m_year); #endif CString filter = "date>='" + date1 + "' and date<='" + date2 + "';;date>='" + date1 + "' and date<='" + date2 + "';time2>='" + date1 + "' and time2<='" + date2 + "' and status='OK'***date<'" + date1 + "';datetime>='" + date1 + "' and datetime<='" + date2 + "'"; g_sendhead.code[0] = 59; // dindanbukuanview g_sendhead.code[1] = 60; // dindan g_sendhead.code[2] = 198; // singleincomemoneyview 其它2销录入表 g_sendhead.code[3] = 61; // TX信息arr g_sendhead.code[4] = 142; // dindan_waiterarr g_sendhead.tabcount = 5; g_sendhead.bsql = 0; g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return; CArrayAryReplenishment; CArrayAryWaiter; CArraysingleincomearray; CArraybukuanarray2; DataToArray(&AryReplenishment, &AryWaiter, &singleincomearray, &bukuanarray2, &m_List4array); /////////////////// if (bLastYear)//如果是去年, 则加今年的补款 { g_nYearpos = -1;//今年 filter = "date>='" + date1 + "' and date<='" + date2 + "';;date>='" + date1 + "' and date<='" + date2 + "';time2>='" + date1 + "' and time2<='" + date2 + "' and status='OK'***date<'" + date1 + "';datetime>='" + date1 + "' and datetime<='" + date2 + "'"; g_sendhead.code[0] = 59; g_sendhead.code[1] = 60; g_sendhead.code[2] = 198; g_sendhead.code[3] = 61; g_sendhead.code[4] = 142; g_sendhead.tabcount = 5; g_sendhead.bsql = 0; g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0) { g_nYearpos = g_nYearposTemp; return; } CArrayLastYearbukuanarray; CArrayLastYearwaiterarray; CArrayLastYearsingleincomearray; CArrayLastYearbukuanarray2; CArrayLastYearm_List4array; DataToArray(&LastYearbukuanarray, &LastYearwaiterarray, &LastYearsingleincomearray, &LastYearbukuanarray2, &LastYearm_List4array); int oldsize = AryReplenishment.GetSize(); AryReplenishment.SetSize(oldsize + LastYearbukuanarray.GetSize()); for (i = oldsize; i < oldsize + LastYearbukuanarray.GetSize(); i++) { AryReplenishment.ElementAt(i).Copy(LastYearbukuanarray.ElementAt(i - oldsize)); } oldsize = bukuanarray2.GetSize(); bukuanarray2.SetSize(oldsize + LastYearbukuanarray2.GetSize()); for (i = oldsize; i < oldsize + LastYearbukuanarray2.GetSize(); i++) { bukuanarray2.ElementAt(i).Copy(LastYearbukuanarray2.ElementAt(i - oldsize)); } oldsize = singleincomearray.GetSize(); singleincomearray.SetSize(oldsize + LastYearsingleincomearray.GetSize()); for (i = oldsize; i < oldsize + LastYearsingleincomearray.GetSize(); i++) { singleincomearray.ElementAt(i).Copy(LastYearsingleincomearray.ElementAt(i - oldsize)); } oldsize = AryWaiter.GetSize(); AryWaiter.SetSize(oldsize + LastYearwaiterarray.GetSize()); for (i = oldsize; i < oldsize + LastYearwaiterarray.GetSize(); i++) { AryWaiter.ElementAt(i).Copy(LastYearwaiterarray.ElementAt(i - oldsize)); } oldsize = m_List4array.GetSize(); m_List4array.SetSize(oldsize + LastYearm_List4array.GetSize()); for (i = oldsize; i < oldsize + LastYearm_List4array.GetSize(); i++) { m_List4array.ElementAt(i).Copy(LastYearm_List4array.ElementAt(i - oldsize)); } } else if (bThisYear)//如果是今年, 则加去年的补款 { g_nYearpos = 0;//去年 filter = "date>='" + date1 + "' and date<='" + date2 + "';;date>='" + date1 + "' and date<='" + date2 + "';time2>='" + date1 + "' and time2<='" + date2 + "' and status='OK'***date<'" + date1 + "';datetime>='" + date1 + "' and datetime<='" + date2 + "'"; g_sendhead.code[0] = 59; g_sendhead.code[1] = 60; g_sendhead.code[2] = 198; g_sendhead.code[3] = 61; g_sendhead.code[4] = 142; g_sendhead.tabcount = 5; g_sendhead.bsql = 0; g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0) { g_nYearpos = g_nYearposTemp; return; } CArrayLastYearbukuanarray; CArrayLastYearwaiterarray; CArrayLastYearsingleincomearray; CArrayLastYearbukuanarray2; CArrayLastYearm_List4array; DataToArray(&LastYearbukuanarray, &LastYearwaiterarray, &LastYearsingleincomearray, &LastYearbukuanarray2, &LastYearm_List4array); int oldsize = AryReplenishment.GetSize(); AryReplenishment.SetSize(oldsize + LastYearbukuanarray.GetSize()); for (i = oldsize; i < oldsize + LastYearbukuanarray.GetSize(); i++) { AryReplenishment.ElementAt(i).Copy(LastYearbukuanarray.ElementAt(i - oldsize)); } oldsize = bukuanarray2.GetSize(); bukuanarray2.SetSize(oldsize + LastYearbukuanarray2.GetSize()); for (i = oldsize; i < oldsize + LastYearbukuanarray2.GetSize(); i++) { bukuanarray2.ElementAt(i).Copy(LastYearbukuanarray2.ElementAt(i - oldsize)); } oldsize = singleincomearray.GetSize(); singleincomearray.SetSize(oldsize + LastYearsingleincomearray.GetSize()); for (i = oldsize; i < oldsize + LastYearsingleincomearray.GetSize(); i++) { singleincomearray.ElementAt(i).Copy(LastYearsingleincomearray.ElementAt(i - oldsize)); } oldsize = AryWaiter.GetSize(); AryWaiter.SetSize(oldsize + LastYearwaiterarray.GetSize()); for (i = oldsize; i < oldsize + LastYearwaiterarray.GetSize(); i++) { AryWaiter.ElementAt(i).Copy(LastYearwaiterarray.ElementAt(i - oldsize)); } oldsize = m_List4array.GetSize(); m_List4array.SetSize(oldsize + LastYearm_List4array.GetSize()); for (i = oldsize; i < oldsize + LastYearm_List4array.GetSize(); i++) { m_List4array.ElementAt(i).Copy(LastYearm_List4array.ElementAt(i - oldsize)); } } g_nYearpos = g_nYearposTemp; int ii = 0; CString m_base, m_rate1, m_rate2, m_rate3, m_rate4, m_rate5, m_money1, m_money2, m_money3, m_money4, m_money5, m_bz; double sum1 = 0; double sum2 = 0; double sum3 = 0; double sum4 = 0; double sum5 = 0; double sum6 = 0; double sum7 = 0; m_AryStaffWageInfo.SetSize(m_AryStaffInfo.GetSize() + 1); int n = 0; for ( n = 0; n < m_AryStaffInfo.GetSize(); n++) { m_AryStaffWageInfo.ElementAt(n).RemoveAll(); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).SetAt(0, m_AryStaffInfo.ElementAt(n).ElementAt(0)); // 员工姓名; CString strStaffName = m_AryStaffInfo.ElementAt(n).ElementAt(0); // 前期业绩金额; float money1 = 0; // 二销业绩; float money2 = 0; // 化妆二销; float money3 = 0; // 套系升级; float money4 = 0; // 选片二销; float money5 = 0; // 计件式提成总和; float money6 = 0; float ftemp; CArraymoneyarray; CStringArray typearray; int typepos; int arraypos = 0; for (ii = 0; ii < AryReplenishment.GetSize(); ii++) { // 前期收款; if (AryReplenishment.ElementAt(ii).ElementAt(2) == "3" || AryReplenishment.ElementAt(ii).ElementAt(2) == "4") { // 是否是摄影师; BOOL bPhotographer = FALSE; // 是否是化妆师; BOOL bMakeupArtist = FALSE; float fscale1 = 0; float fscale2 = 0; IsWaiter2(AryReplenishment.ElementAt(ii).ElementAt(5), strStaffName, &AryWaiter, bPhotographer, bMakeupArtist, fscale1, fscale2, 0, date1, date2); // 1.该员工是否有摄影前期业绩提成; if (bPhotographer && atoi(g_cominfoarray.ElementAt(0).ElementAt(56)))//我是摄影师 { money1 += atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale1; ftemp = atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale1; typepos = FindArray(&typearray, "摄影前期"); if (typepos == -1) { typearray.Add("摄影前期"); moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } // 2.该员工是否有化妆/引导前期业绩提成; if (bMakeupArtist && atoi(g_cominfoarray.ElementAt(0).ElementAt(57)))//我是化妆师 { money1 += atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale2; ftemp = atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale2; typepos = FindArray(&typearray, "摄影前期"); if (typepos == -1) { typearray.Add("摄影前期"); moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } // 该员工是否有门市前期业绩提成; IsWaiter3(AryReplenishment.ElementAt(ii).ElementAt(5), strStaffName, &AryWaiter, bPhotographer, bMakeupArtist, fscale1, fscale2); // 3.该员工是否有主门市前期业绩提成; if (bPhotographer) { money1 += atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale1; ftemp = atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale1; typepos = FindArray(&typearray, "前期"); if (typepos == -1) { typearray.Add("前期"); moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } // 4.该员工是否有副门市前期业绩提成; if (bMakeupArtist) { money1 += atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale2; ftemp = atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale2; typepos = FindArray(&typearray, "前期"); if (typepos == -1) { typearray.Add("前期"); moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } } // 该员工是否有选片二销提成(包含摄影师和化妆师的选片二销提成 ); else if (AryReplenishment.ElementAt(ii).ElementAt(7) == "选片二销")//选片补款, 需加摄影师和化妆师 { BOOL bPhotographer = 0; BOOL bMakeupArtist = 0; float fscale1 = 0; float fscale2 = 0; IsWaiter2(AryReplenishment.ElementAt(ii).ElementAt(5), strStaffName, &AryWaiter, bPhotographer, bMakeupArtist, fscale1, fscale2, 0, date1, date2); // 5.该员工是否有摄影师选片二销提成; if (bPhotographer && atoi(g_cominfoarray.ElementAt(0).ElementAt(41)))//我是摄影师 { money5 += atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale1; ftemp = atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale1; typepos = FindArray(&typearray, "摄影选片二销"); if (typepos == -1) { typearray.Add("摄影选片二销"); moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } // 6.该员工是否有化妆师选片二销提成; if (bMakeupArtist && atoi(g_cominfoarray.ElementAt(0).ElementAt(42)))//我是化妆师 { money5 += atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale2; ftemp = atof(AryReplenishment.ElementAt(ii).ElementAt(0))*fscale2; #ifdef CHILD_VERSION typepos = FindArray(&typearray, "引导选片二销"); #else typepos = FindArray(&typearray, "化妆选片二销"); #endif if (typepos == -1) { #ifdef CHILD_VERSION typearray.Add("引导选片二销"); #else typearray.Add("化妆选片二销"); #endif moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } // 7.该员工是否是选片二销业绩的产生者,若是,再次提成选片二销业绩; if (AryReplenishment.ElementAt(ii).ElementAt(6) == strStaffName) { money5 += atof(AryReplenishment.ElementAt(ii).ElementAt(0)); ftemp = atof(AryReplenishment.ElementAt(ii).ElementAt(0)); typepos = FindArray(&typearray, AryReplenishment.ElementAt(ii).ElementAt(7)); if (typepos == -1) { typearray.Add(AryReplenishment.ElementAt(ii).ElementAt(7)); moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } } // 其他订单二销(后期收款); else { // 8.这笔收款,员工是否还是本次其他订单二销的促成者; if (AryReplenishment.ElementAt(ii).ElementAt(6) != strStaffName) continue; if (AryReplenishment.ElementAt(ii).ElementAt(2) == "5") { money2 += atof(AryReplenishment.ElementAt(ii).ElementAt(0)); } else if (AryReplenishment.ElementAt(ii).ElementAt(2) == "1") { money3 += atof(AryReplenishment.ElementAt(ii).ElementAt(0)); } else if (AryReplenishment.ElementAt(ii).ElementAt(2) == "6") { money4 += atof(AryReplenishment.ElementAt(ii).ElementAt(0)); } else if (AryReplenishment.ElementAt(ii).ElementAt(2) == "2") { money5 += atof(AryReplenishment.ElementAt(ii).ElementAt(0)); } ftemp = atof(AryReplenishment.ElementAt(ii).ElementAt(0)); typepos = FindArray(&typearray, AryReplenishment.ElementAt(ii).ElementAt(7)); if (typepos == -1) { typearray.Add(AryReplenishment.ElementAt(ii).ElementAt(7)); moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } } // 时间1-时间2,这里是时间1之前的收款记录; for (ii = 0; ii < bukuanarray2.GetSize(); ii++) { if (bukuanarray2.ElementAt(ii).ElementAt(2) == "3" || bukuanarray2.ElementAt(ii).ElementAt(2) == "4") { BOOL bPhotographer = 0; BOOL bMakeupArtist = 0; float fscale1 = 0; float fscale2 = 0; IsWaiter2(bukuanarray2.ElementAt(ii).ElementAt(5), strStaffName, &AryWaiter, bPhotographer, bMakeupArtist, fscale1, fscale2, 1, date1, date2); if (bPhotographer && atoi(g_cominfoarray.ElementAt(0).ElementAt(56)))//我是摄影师 { money1 += atof(bukuanarray2.ElementAt(ii).ElementAt(0))*fscale1; ftemp = atof(bukuanarray2.ElementAt(ii).ElementAt(0))*fscale1; typepos = FindArray(&typearray, "摄影前期"); if (typepos == -1) { typearray.Add("摄影前期"); moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } if (bMakeupArtist && atoi(g_cominfoarray.ElementAt(0).ElementAt(57)))//我是化妆师 { money1 += atof(bukuanarray2.ElementAt(ii).ElementAt(0))*fscale2; ftemp = atof(bukuanarray2.ElementAt(ii).ElementAt(0))*fscale2; typepos = FindArray(&typearray, "摄影前期"); if (typepos == -1) { typearray.Add("摄影前期"); moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } } } // 其他收入业绩(散客消费); for (ii = 0; ii < singleincomearray.GetSize(); ii++) { if (singleincomearray.ElementAt(ii).ElementAt(2) != strStaffName)continue; if (singleincomearray.ElementAt(ii).ElementAt(3) == "摄影二销") money2 += atof(singleincomearray.ElementAt(ii).ElementAt(4)); #ifndef CHILD_VERSION else if (singleincomearray.ElementAt(ii).ElementAt(3) == "化妆二销") #else else if (singleincomearray.ElementAt(ii).ElementAt(3) == "引导二销") #endif money3 += atof(singleincomearray.ElementAt(ii).ElementAt(4)); else if (singleincomearray.ElementAt(ii).ElementAt(3) == "套系升级") money4 += atof(singleincomearray.ElementAt(ii).ElementAt(4)); else if (singleincomearray.ElementAt(ii).ElementAt(3) == "选片二销") money5 += atof(singleincomearray.ElementAt(ii).ElementAt(4)); ftemp = atof(singleincomearray.ElementAt(ii).ElementAt(4)); typepos = FindArray(&typearray, singleincomearray.ElementAt(ii).ElementAt(3)); if (typepos == -1) { typearray.Add(singleincomearray.ElementAt(ii).ElementAt(3)); moneyarray.Add(ftemp); } else { moneyarray.SetAt(typepos, moneyarray.ElementAt(typepos) + ftemp); } } // 获取员工的信息; // 该员工的基本工资; m_base = m_AryStaffInfo.ElementAt(n).ElementAt(1); // 该员工的折扣1; m_rate1 = m_AryStaffInfo.ElementAt(n).ElementAt(2); // 该员工的折扣2; m_rate2 = m_AryStaffInfo.ElementAt(n).ElementAt(3); // 备注; m_bz = m_AryStaffInfo.ElementAt(n).ElementAt(4); // 折扣3~5; m_rate3 = m_AryStaffInfo.ElementAt(n).ElementAt(6); m_rate4 = m_AryStaffInfo.ElementAt(n).ElementAt(7); m_rate5 = m_AryStaffInfo.ElementAt(n).ElementAt(8); typepos = FindArray(&typearray, "前期"); if (typepos == -1) { m_money1 = "0"; money1 = 0; } else { money1 = moneyarray.ElementAt(typepos); } float money12 = 0; typepos = FindArray(&typearray, "摄影前期"); if (typepos == -1) { money12 = 0; } else { money12 = moneyarray.ElementAt(typepos); } m_money1.Format("%0.2f", money1 + money12); money2 = 0; float realmoney2 = 0; for (int i = 0; i < typearray.GetSize(); i++) { if ("前期" == typearray.ElementAt(i))continue; if ("摄影前期" == typearray.ElementAt(i))continue; realmoney2 += GetSalaryFromRule(moneyarray.ElementAt(i), GetRule(typearray.ElementAt(i))); money2 += moneyarray.ElementAt(i); } m_money2.Format("%0.2f", money2); // 获取员工计件式提成金额; GetMoney6(strStaffName, money6); temp.Format("%0.2f", atof(m_base) + money6 + realmoney2 + GetSalaryFromRule(money1, GetRule(m_rate1)) + GetSalaryFromRule(money12, GetRule(m_rate2))); ConvertToPrice(temp); // 总工资; m_AryStaffWageInfo.ElementAt(n).SetAt(1, temp); // 基本工资; m_AryStaffWageInfo.ElementAt(n).SetAt(2, m_base); // 前期业绩; m_AryStaffWageInfo.ElementAt(n).SetAt(3, m_money1); // 后期业绩; m_AryStaffWageInfo.ElementAt(n).SetAt(4, m_money2); sum1 += atof(temp); sum2 += atof(m_base); sum3 += money1; sum4 += money2; temp.Format("%0.2f", money6); ConvertToPrice(temp); // 职务提成; m_AryStaffWageInfo.ElementAt(n).SetAt(5, temp); // 备注; m_AryStaffWageInfo.ElementAt(n).SetAt(6, m_AryStaffInfo.ElementAt(n).ElementAt(5)); if (m_bz.GetLength() > 100) m_AryStaffWageInfo.ElementAt(n).SetAt(7, m_bz.Left(100) + ".."); else m_AryStaffWageInfo.ElementAt(n).SetAt(7, m_bz); } ////////////////////////////////////////////////////////////////////////// // 统计所有人工资; temp.Format("%0.2f", sum1); ConvertToPrice(temp); m_AryStaffWageInfo.ElementAt(n).Add("统计:"); m_AryStaffWageInfo.ElementAt(n).Add(temp); temp.Format("%0.2f", sum2); ConvertToPrice(temp); m_AryStaffWageInfo.ElementAt(n).Add(temp); temp.Format("%0.2f", sum3); ConvertToPrice(temp); m_AryStaffWageInfo.ElementAt(n).Add(temp); temp.Format("%0.2f", sum4); ConvertToPrice(temp); m_AryStaffWageInfo.ElementAt(n).Add(temp); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); } #else void MySalary::GetAllData() { if (m_bInit == 0)return; UpdateData(); CString date1, date2, temp; date1 = m_date1.Format("%Y-%m-%d"); date2 = m_date2.Format("%Y-%m-%d"); m_year = m_date1.GetYear(); CStaffWage StaffWage; StaffWage.GetAllStaffWageData(date1, date2); int i = 0; int ii = 0; CString m_base, m_rate1, m_rate2, m_rate3, m_rate4, m_rate5, m_money1, m_money2, m_money3, m_money4, m_money5, m_bz; double sum1 = 0; double sum2 = 0; double sum3 = 0; double sum4 = 0; double sum5 = 0; double sum6 = 0; double sum7 = 0; m_AryStaffWageInfo.SetSize(m_AryStaffInfo.GetSize() + 1); int n = 0; for ( n = 0; n < m_AryStaffInfo.GetSize(); n++) { m_AryStaffWageInfo.ElementAt(n).RemoveAll(); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).SetAt(0, m_AryStaffInfo.ElementAt(n).ElementAt(0)); // 员工姓名; CString strStaffName = m_AryStaffInfo.ElementAt(n).ElementAt(0); // 前期业绩金额; float money1 = 0; // 二销业绩; float money2 = 0; // 化妆二销; float money3 = 0; // 套系升级; float money4 = 0; // 选片二销; float money5 = 0; // 计件式提成总和; float money6 = 0; float ftemp; CArraymoneyarray; CStringArray typearray; int typepos; int arraypos = 0; // 获取员工的信息; // 该员工的基本工资; m_base = m_AryStaffInfo.ElementAt(n).ElementAt(1); // 该员工的门市前期业绩提成百分比; m_rate1 = m_AryStaffInfo.ElementAt(n).ElementAt(2); // 该员工的门摄影/化妆期业绩提成百分比; m_rate2 = m_AryStaffInfo.ElementAt(n).ElementAt(3); // 备注; m_bz = m_AryStaffInfo.ElementAt(n).ElementAt(4); // 其他提成百分比3~5; m_rate3 = m_AryStaffInfo.ElementAt(n).ElementAt(6); m_rate4 = m_AryStaffInfo.ElementAt(n).ElementAt(7); m_rate5 = m_AryStaffInfo.ElementAt(n).ElementAt(8); StaffWage.GetEarlyResults(strStaffName); // 门市前期业绩; FLOAT fSignerWage = StaffWage.GetStaffSignerWage(strStaffName); FLOAT fPhotograhperMakeupArtistWage = StaffWage.GetStaffPhotograhperMakeupArtistWage(strStaffName); FLOAT fLateTotalWage = 0.0; FLOAT fLateWage = StaffWage.GetStaffLateWage(strStaffName, fLateTotalWage); FLOAT fDigitalWage = StaffWage.GetStaffDigitalWage(strStaffName); temp.Format("%0.2f", atof(m_base) + fDigitalWage + fLateWage + GetSalaryFromRule(fSignerWage, GetRule(m_rate1)) + GetSalaryFromRule(fPhotograhperMakeupArtistWage, GetRule(m_rate2))); ConvertToPrice(temp); // 总工资; m_AryStaffWageInfo.ElementAt(n).SetAt(1, temp); // 基本工资; m_AryStaffWageInfo.ElementAt(n).SetAt(2, m_base); // 前期业绩; temp.Format("%0.2f", fSignerWage + fPhotograhperMakeupArtistWage); m_AryStaffWageInfo.ElementAt(n).SetAt(3, temp); // 后期业绩; temp.Format("%0.2f", fLateTotalWage); m_AryStaffWageInfo.ElementAt(n).SetAt(4, temp); sum1 += atof(temp); sum2 += atof(m_base); sum3 += fSignerWage; sum4 += fLateTotalWage; temp.Format("%0.2f", fDigitalWage); ConvertToPrice(temp); // 职务提成; m_AryStaffWageInfo.ElementAt(n).SetAt(5, temp); // 备注; m_AryStaffWageInfo.ElementAt(n).SetAt(6, m_AryStaffInfo.ElementAt(n).ElementAt(5)); if (m_bz.GetLength() > 100) m_AryStaffWageInfo.ElementAt(n).SetAt(7, m_bz.Left(100) + ".."); else m_AryStaffWageInfo.ElementAt(n).SetAt(7, m_bz); } ////////////////////////////////////////////////////////////////////////// // 统计所有人工资; temp.Format("%0.2f", sum1); ConvertToPrice(temp); m_AryStaffWageInfo.ElementAt(n).Add("统计:"); m_AryStaffWageInfo.ElementAt(n).Add(temp); temp.Format("%0.2f", sum2); ConvertToPrice(temp); m_AryStaffWageInfo.ElementAt(n).Add(temp); temp.Format("%0.2f", sum3); ConvertToPrice(temp); m_AryStaffWageInfo.ElementAt(n).Add(temp); temp.Format("%0.2f", sum4); ConvertToPrice(temp); m_AryStaffWageInfo.ElementAt(n).Add(temp); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); m_AryStaffWageInfo.ElementAt(n).Add(""); } #endif void MySalary::FillGrid4(IN CString &sRet, IN CArray &AryMyWork) // 计件式提成 - 填充列表; { sRet = "0"; if (m_Workratearray.GetSize() == 0) { return; } float fsum = 0; int m_data1sy = -1; CString m_data2sy; CString m_data3sy; CString m_data4sy; CString m_data5sy; int m_data1hz = -1; CString m_data2hz; CString m_data3hz; CString m_data4hz; CString m_data5hz; int i = 0; for ( i = 0; i < m_Workratearray.GetSize(); i++) { if ("摄影师" == m_Workratearray.ElementAt(i).ElementAt(0)) { m_data1sy = atoi(m_Workratearray.ElementAt(i).ElementAt(1)); m_data2sy = (m_Workratearray.ElementAt(i).ElementAt(2)); m_data3sy = (m_Workratearray.ElementAt(i).ElementAt(3)); m_data4sy = (m_Workratearray.ElementAt(i).ElementAt(4)); m_data5sy = (m_Workratearray.ElementAt(i).ElementAt(5)); } #ifdef CHILD_VERSION else if ("引导师" == m_Workratearray.ElementAt(i).ElementAt(0)) #else else if ("化妆师" == m_Workratearray.ElementAt(i).ElementAt(0)) #endif { m_data1hz = atoi(m_Workratearray.ElementAt(i).ElementAt(1)); m_data2hz = (m_Workratearray.ElementAt(i).ElementAt(2)); m_data3hz = (m_Workratearray.ElementAt(i).ElementAt(3)); m_data4hz = (m_Workratearray.ElementAt(i).ElementAt(4)); m_data5hz = (m_Workratearray.ElementAt(i).ElementAt(5)); } } m_List4.DeleteAllItems2(); int count = 0; CString str, price; for (i = 0; i < AryMyWork.GetSize(); i++)//14 { if (AryMyWork.ElementAt(i).ElementAt(14) == "摄影师" && m_data1sy != 3) { if (m_data1sy == 0)//按服装套数提 { m_List4.m_arLabels.SetSize(count + 1, 1); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(0)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(1)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(2)); str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(5))*atof(m_data2sy) + atof(AryMyWork.ElementAt(i).ElementAt(6))*atof(m_data3sy)); m_List4.m_arLabels.ElementAt(count).Add(str);//金额 fsum += atof(str); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(14)); str.Format("外景%d,内景%d", atoi(AryMyWork.ElementAt(i).ElementAt(5)), atoi(AryMyWork.ElementAt(i).ElementAt(6))); m_List4.m_arLabels.ElementAt(count).Add(str); str.Format("%d", atoi(AryMyWork.ElementAt(i).ElementAt(5)) + atoi(AryMyWork.ElementAt(i).ElementAt(6))); m_List4.m_arLabels.ElementAt(count).Add(str); str.Format("外景%0.2f,内景%0.2f", atof(m_data2sy), atof(m_data3sy)); m_List4.m_arLabels.ElementAt(count).Add(str); m_List4.m_arLabels.ElementAt(count).Add("按服装套数提成"); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(9)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(4)); count++; } else if (m_data1sy == 1)//按套系金额提成 { if (AryMyWork.ElementAt(i).ElementAt(3) != AryMyWork.ElementAt(i).ElementAt(15) && AryMyWork.ElementAt(i).ElementAt(3) != AryMyWork.ElementAt(i).ElementAt(16) && AryMyWork.ElementAt(i).ElementAt(3) != AryMyWork.ElementAt(i).ElementAt(17) && AryMyWork.ElementAt(i).ElementAt(3) != AryMyWork.ElementAt(i).ElementAt(18)) { continue;//既不是主摄影师,也不是副.. } m_List4.m_arLabels.SetSize(count + 1, 1); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(0)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(1)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(2)); if (AryMyWork.ElementAt(i).ElementAt(3) == AryMyWork.ElementAt(i).ElementAt(15)) str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(9))*atof(m_data4sy)*atof(AryMyWork.ElementAt(i).ElementAt(19)) / 10000.0); else if (AryMyWork.ElementAt(i).ElementAt(3) == AryMyWork.ElementAt(i).ElementAt(16)) str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(9))*atof(m_data4sy)*atof(AryMyWork.ElementAt(i).ElementAt(20)) / 10000.0); else if (AryMyWork.ElementAt(i).ElementAt(3) == AryMyWork.ElementAt(i).ElementAt(17)) str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(9))*atof(m_data4sy)*atof(AryMyWork.ElementAt(i).ElementAt(21)) / 10000.0); else if (AryMyWork.ElementAt(i).ElementAt(3) == AryMyWork.ElementAt(i).ElementAt(18)) str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(9))*atof(m_data4sy)*atof(AryMyWork.ElementAt(i).ElementAt(22)) / 10000.0); m_List4.m_arLabels.ElementAt(count).Add(str);//金额 fsum += atof(str); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(14)); m_List4.m_arLabels.ElementAt(count).Add("不适用"); m_List4.m_arLabels.ElementAt(count).Add("不适用"); str.Format("套系的%d", atoi(m_data4sy)); m_List4.m_arLabels.ElementAt(count).Add(str + "%"); m_List4.m_arLabels.ElementAt(count).Add("按套系金额提成"); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(9)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(4)); count++; } else if (m_data1sy == 2)//按加挑照片提成 { m_List4.m_arLabels.SetSize(count + 1, 1); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(0)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(1)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(2)); str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(31))*atof(m_data5sy)); m_List4.m_arLabels.ElementAt(count).Add(str);//金额 fsum += atof(str); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(14)); m_List4.m_arLabels.ElementAt(count).Add("不适用"); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(31)); str.Format("%0.2f", atof(m_data5sy)); m_List4.m_arLabels.ElementAt(count).Add(str); m_List4.m_arLabels.ElementAt(count).Add("按加挑照片提成"); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(9)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(4)); count++; } } #ifdef CHILD_VERSION else if (AryMyWork.ElementAt(i).ElementAt(14) == "引导师" && m_data1hz != 3) #else else if (AryMyWork.ElementAt(i).ElementAt(14) == "化妆师" && m_data1hz != 3) #endif { if (m_data1hz == 0)//按服装套数提 { m_List4.m_arLabels.SetSize(count + 1, 1); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(0)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(1)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(2)); str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(5))*atof(m_data2hz) + atof(AryMyWork.ElementAt(i).ElementAt(6))*atof(m_data3hz)); m_List4.m_arLabels.ElementAt(count).Add(str);//金额 fsum += atof(str); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(14)); str.Format("外景%d,内景%d", atoi(AryMyWork.ElementAt(i).ElementAt(5)), atoi(AryMyWork.ElementAt(i).ElementAt(6))); m_List4.m_arLabels.ElementAt(count).Add(str); str.Format("%d", atoi(AryMyWork.ElementAt(i).ElementAt(5)) + atoi(AryMyWork.ElementAt(i).ElementAt(6))); m_List4.m_arLabels.ElementAt(count).Add(str); str.Format("外景%0.2f,内景%0.2f", atof(m_data2hz), atof(m_data3hz)); m_List4.m_arLabels.ElementAt(count).Add(str); m_List4.m_arLabels.ElementAt(count).Add("按服装套数提成"); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(9)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(4)); count++; } else if (m_data1hz == 1)//按套系金额提成 { if (AryMyWork.ElementAt(i).ElementAt(3) != AryMyWork.ElementAt(i).ElementAt(23) && AryMyWork.ElementAt(i).ElementAt(3) != AryMyWork.ElementAt(i).ElementAt(24) && AryMyWork.ElementAt(i).ElementAt(3) != AryMyWork.ElementAt(i).ElementAt(25) && AryMyWork.ElementAt(i).ElementAt(3) != AryMyWork.ElementAt(i).ElementAt(26)) { continue;//既不是主化妆师,也不是副.. } m_List4.m_arLabels.SetSize(count + 1, 1); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(0)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(1)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(2)); if (AryMyWork.ElementAt(i).ElementAt(3) == AryMyWork.ElementAt(i).ElementAt(23)) str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(9))*atof(m_data4sy)*atof(AryMyWork.ElementAt(i).ElementAt(27)) / 10000.0); else if (AryMyWork.ElementAt(i).ElementAt(3) == AryMyWork.ElementAt(i).ElementAt(24)) str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(9))*atof(m_data4sy)*atof(AryMyWork.ElementAt(i).ElementAt(28)) / 10000.0); else if (AryMyWork.ElementAt(i).ElementAt(3) == AryMyWork.ElementAt(i).ElementAt(25)) str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(9))*atof(m_data4sy)*atof(AryMyWork.ElementAt(i).ElementAt(29)) / 10000.0); else if (AryMyWork.ElementAt(i).ElementAt(3) == AryMyWork.ElementAt(i).ElementAt(26)) str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(9))*atof(m_data4sy)*atof(AryMyWork.ElementAt(i).ElementAt(30)) / 10000.0); m_List4.m_arLabels.ElementAt(count).Add(str);//金额 fsum += atof(str); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(14)); m_List4.m_arLabels.ElementAt(count).Add("不适用"); m_List4.m_arLabels.ElementAt(count).Add("不适用"); str.Format("套系的%d", atoi(m_data4hz)); m_List4.m_arLabels.ElementAt(count).Add(str + "%"); m_List4.m_arLabels.ElementAt(count).Add("按套系金额提成"); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(9)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(4)); count++; } else if (m_data1hz == 2)//按加挑照片提成 { m_List4.m_arLabels.SetSize(count + 1, 1); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(0)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(1)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(2)); str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(31))*atof(m_data5hz)); m_List4.m_arLabels.ElementAt(count).Add(str);//金额 fsum += atof(str); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(14)); m_List4.m_arLabels.ElementAt(count).Add("不适用"); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(31)); str.Format("%0.2f", atof(m_data5hz)); m_List4.m_arLabels.ElementAt(count).Add(str); m_List4.m_arLabels.ElementAt(count).Add("按加挑照片提成"); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(9)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(4)); count++; } } else if (AryMyWork.ElementAt(i).ElementAt(14) == "数码师") { m_List4.m_arLabels.SetSize(count + 1, 1); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(0)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(1)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(2)); price = GetPrice(AryMyWork.ElementAt(i).ElementAt(6)); str.Format("%0.2f", atof(AryMyWork.ElementAt(i).ElementAt(5))*atof(price)); m_List4.m_arLabels.ElementAt(count).Add(str);//金额 fsum += atof(str); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(14)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(6)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(5)); m_List4.m_arLabels.ElementAt(count).Add(price); m_List4.m_arLabels.ElementAt(count).Add("单价x数量"); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(9)); m_List4.m_arLabels.ElementAt(count).Add(AryMyWork.ElementAt(i).ElementAt(4)); count++; } } m_List4.m_LabelCount = count; m_List4.SetItemCountEx(count); sRet.Format("计件提成(总和:%0.2f)", fsum); SetDlgItemText(IDC_STATIC16, sRet); sRet.Format("%0.2f", fsum); } void MySalary::OnBut1() { } void MySalary::OnBut2() { } void MySalary::OnSelchangeCombo6() { } void MySalary::OnBut4() { // ShowHisSalary dlg; // dlg.DoModal(); } CString MySalary::GetPrice(CString name) { for (int i = 0; i < m_Workratearray.GetSize(); i++) { if ("数码师" == m_Workratearray.ElementAt(i).ElementAt(0) && name == m_Workratearray.ElementAt(i).ElementAt(1)) { return m_Workratearray.ElementAt(i).ElementAt(2); } } return "0"; } void MySalary::GetMoney6(CString strStaffName, float &fRet) // 获取员工计件式提成金额; { fRet = 0; float fsum = 0; int m_data1sy = -1; CString m_data2sy; CString m_data3sy; CString m_data4sy; CString m_data5sy; int m_data1hz = -1; CString m_data2hz; CString m_data3hz; CString m_data4hz; CString m_data5hz; m_List4.DeleteAllItems2(); int count = 0; CString str, price; for (int i = 0; i < m_List4array.GetSize(); i++)//14 { if (m_List4array.ElementAt(i).ElementAt(3) != strStaffName) continue; // 计件式提成,只有mywork类型为数码师,才有提成; if (m_List4array.ElementAt(i).ElementAt(14) == "数码师") { m_List4.m_arLabels.SetSize(count + 1, 1); m_List4.m_arLabels.ElementAt(count).Add(m_List4array.ElementAt(i).ElementAt(0)); m_List4.m_arLabels.ElementAt(count).Add(m_List4array.ElementAt(i).ElementAt(1)); m_List4.m_arLabels.ElementAt(count).Add(m_List4array.ElementAt(i).ElementAt(2)); price = GetPrice(m_List4array.ElementAt(i).ElementAt(6)); str.Format("%0.2f", atof(m_List4array.ElementAt(i).ElementAt(5))*atof(price)); m_List4.m_arLabels.ElementAt(count).Add(str);//金额 fsum += atof(str); m_List4.m_arLabels.ElementAt(count).Add(m_List4array.ElementAt(i).ElementAt(14)); m_List4.m_arLabels.ElementAt(count).Add(m_List4array.ElementAt(i).ElementAt(6)); m_List4.m_arLabels.ElementAt(count).Add(m_List4array.ElementAt(i).ElementAt(5)); m_List4.m_arLabels.ElementAt(count).Add(price); m_List4.m_arLabels.ElementAt(count).Add("单价x数量"); m_List4.m_arLabels.ElementAt(count).Add(m_List4array.ElementAt(i).ElementAt(9)); m_List4.m_arLabels.ElementAt(count).Add(m_List4array.ElementAt(i).ElementAt(4)); count++; } } m_List4.m_LabelCount = count; m_List4.SetItemCountEx(count); fRet = fsum; } void MySalary::OnButton4() { int pos = m_comboname.GetCurSel(); if (pos == -1) { AfxMessageBox("请选择您要导出资料的员工"); return; } CString name; m_comboname.GetWindowText(name); SelExportType dlg; if (dlg.DoModal() != IDOK)return; if (dlg.m_type == 1) { int arraysize = 0; CArrayarray; CStringArray moneytypearray; CString str, field2, field3; float sum = 0; for (int i = 0; i < m_List1.GetItemCount(); i++) { field2 = m_List1.GetItemText(i, 0); sum += atof(field2); field3 = m_List1.GetItemText(i, 2); if (::FindArray(&moneytypearray, field3) == -1) moneytypearray.Add(field3); array.SetSize(arraysize + 1, 1); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 0)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 1)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 2)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 3)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 4)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 5)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 6)); arraysize++; } array.SetSize(arraysize + 1, 1); array.ElementAt(arraysize).Add("总计"); str.Format("%0.2f", sum); array.ElementAt(arraysize).Add(str); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); arraysize++; ////////////////////////////////////////////// array.SetSize(arraysize + 1, 1); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); arraysize++; /////////////////////////////////////////////// ////////////////////////////////////////////// array.SetSize(arraysize + 1, 1); array.ElementAt(arraysize).Add("******"); array.ElementAt(arraysize).Add("******"); array.ElementAt(arraysize).Add("以下为分类统计"); array.ElementAt(arraysize).Add("******"); array.ElementAt(arraysize).Add("******"); array.ElementAt(arraysize).Add("******"); array.ElementAt(arraysize).Add("******"); arraysize++; /////////////////////////////////////////////// array.SetSize(arraysize + 1, 1); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); arraysize++; /////////////////////////////////////////////// for (int aa = 0; aa < moneytypearray.GetSize(); aa++) { sum = 0; for (int i = 0; i < m_List1.GetItemCount(); i++) { field3 = m_List1.GetItemText(i, 2); if (moneytypearray.ElementAt(aa) != field3)continue; field2 = m_List1.GetItemText(i, 0); sum += atof(field2); array.SetSize(arraysize + 1, 1); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 0)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 1)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 2)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 3)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 4)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 5)); array.ElementAt(arraysize).Add(m_List1.GetItemText(i, 6)); arraysize++; } array.SetSize(arraysize + 1, 1); array.ElementAt(arraysize).Add(moneytypearray.ElementAt(aa) + "总计"); str.Format("%0.2f", sum); array.ElementAt(arraysize).Add(str); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); arraysize++; ////////////////////////////////////////////// array.SetSize(arraysize + 1, 1); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); array.ElementAt(arraysize).Add(""); arraysize++; /////////////////////////////////////////////// } m_ListTemp.DeleteAllItems2(); int ii = 0; m_ListTemp.m_arLabels.SetSize(array.GetSize(), 1); int count = 0; for (ii = 0; ii < m_ListTemp.m_arLabels.GetSize(); ii++) { m_ListTemp.m_arLabels.ElementAt(count++).Copy(array.ElementAt(ii)); } m_ListTemp.m_arLabels.SetSize(count, 1); ii = count; m_ListTemp.m_LabelCount = ii; m_ListTemp.SetItemCountEx(ii); ListToXLS(&m_ListTemp, "c:\\" + name + ".xls", 0); return; } CStdioFile fp; fp.Open("c:\\" + name + ".txt", CFile::modeCreate | CFile::modeWrite); CString str, field1, field2, field3, field4, field5, field6, field7, field8, field9, field10; int leng1 = 20; int leng2 = 15; int leng3 = 15; int leng4 = 15; int leng5 = 15; int leng6 = 15; int leng7 = 15; int leng8 = 15; int leng9 = 15; int leng10 = 15; field1 = "收款日期"; field2 = "收款金额"; field3 = "款项类别"; field4 = "客人姓名"; FillLength(field1, leng1); FillLength(field2, leng2); FillLength(field3, leng3); FillLength(field4, leng4); str = field1 + field2 + field3 + field4 + "\n"; fp.WriteString(str); CStringArray moneytypearray; CString m_name1, m_name2; float sum = 0; for (int i = 0; i < m_List1.GetItemCount(); i++) { field4.Empty(); field1 = m_List1.GetItemText(i, 1); field2 = m_List1.GetItemText(i, 0); sum += atof(field2); field3 = m_List1.GetItemText(i, 2); if (::FindArray(&moneytypearray, field3) == -1) moneytypearray.Add(field3); m_name1 = m_List1.GetItemText(i, 3); m_name2 = m_List1.GetItemText(i, 4); if (!m_name1.IsEmpty()) field4 = m_name1 + ","; field4 += m_name2; field4.TrimRight(","); FillLength(field1, leng1); FillLength(field2, leng2); FillLength(field3, leng3); FillLength(field4, leng4); str = field1 + field2 + field3 + field4 + "\n"; fp.WriteString(str); } str = "姓名: " + name; fp.WriteString(str); fp.WriteString("\n"); str = "类别: 订单二销提成\n"; fp.WriteString(str); str.Format("总计: %0.2f", sum); fp.WriteString(str); fp.WriteString("\n\n\n************************以下为分类统计************************"); fp.WriteString("\n\n"); for (int aa = 0; aa < moneytypearray.GetSize(); aa++) { sum = 0; for (int i = 0; i < m_List1.GetItemCount(); i++) { field3 = m_List1.GetItemText(i, 2); if (moneytypearray.ElementAt(aa) != field3)continue; field4.Empty(); field1 = m_List1.GetItemText(i, 1); field2 = m_List1.GetItemText(i, 0); sum += atof(field2); m_name1 = m_List1.GetItemText(i, 3); m_name2 = m_List1.GetItemText(i, 4); if (!m_name1.IsEmpty()) field4 = m_name1 + ","; field4 += m_name2; field4.TrimRight(","); FillLength(field1, leng1); FillLength(field2, leng2); FillLength(field3, leng3); FillLength(field4, leng4); str = field1 + field2 + field3 + field4 + "\n"; fp.WriteString(str); } str = moneytypearray.ElementAt(aa) + "提成\n"; fp.WriteString(str); str.Format("总计: %0.2f", sum); fp.WriteString(str); fp.WriteString("\n\n\n"); } fp.Close(); MessageBox("资料已保存到c:\\" + name + ".txt"); ShellExecute(NULL, _T("open"), _T("c:\\" + name + ".txt"), NULL, NULL, SW_SHOWMAXIMIZED); } void MySalary::OnButton5() { SelExpendType seldlg; seldlg.m_mode = 2; if (seldlg.DoModal() != IDOK)return; SalarySet4 dlg; dlg.m_header = "$" + seldlg.m_sel + ":"; dlg.DoModal(); /* SalarySet4 dlg; dlg.m_header ="$前期:"; dlg.DoModal (); */ } void MySalary::OnButton6() { SelExpendType seldlg; seldlg.m_bSecond = 1; if (seldlg.DoModal() != IDOK)return; SalarySet4 dlg; dlg.m_header = "$" + seldlg.m_sel + ":"; dlg.DoModal(); } void MySalary::OnCloseupCombo7() { OnSelchangeList1(); } void MySalary::OnButton14() { int pos = m_comboname.GetCurSel(); if (pos == -1) { AfxMessageBox("请选择您要导出资料的员工"); return; } CString name; m_comboname.GetWindowText(name); SelExportType dlg; if (dlg.DoModal() != IDOK)return; if (dlg.m_type == 1) { ListToXLS(&m_List4, "c:\\" + name + "(计件).xls", 0); return; } CStdioFile fp; fp.Open("c:\\" + name + "(计件).txt", CFile::modeCreate | CFile::modeWrite); CString str, field1, field2, field3, field4, field5, field6, field7, field8, field9, field10; int leng1 = 20; int leng2 = 15; int leng3 = 15; int leng4 = 15; int leng5 = 15; int leng6 = 15; int leng7 = 15; int leng8 = 15; int leng9 = 15; int leng10 = 15; CString m_name1, m_name2; float sum = 0; { leng1 = 18; leng2 = 15; leng3 = 10; leng4 = 15; leng5 = 10; leng6 = 10; leng7 = 15; leng8 = 15; leng9 = 15; field1 = "客人姓名"; field2 = "提成金额"; field3 = "部门"; field4 = "内容"; field5 = "数量"; field6 = "单价"; field7 = "提成方式"; field8 = "套系金额"; field9 = "日期"; FillLength(field1, leng1); FillLength(field2, leng2); FillLength(field3, leng3); FillLength(field4, leng4); FillLength(field5, leng5); FillLength(field6, leng6); FillLength(field7, leng7); FillLength(field8, leng8); FillLength(field9, leng9); str = field1 + field2 + field3 + field4 + field5 + field6 + field7 + field8 + field9 + "\n"; fp.WriteString(str); for (int i = 0; i < m_List4.GetItemCount(); i++) { field1.Empty(); m_name1 = m_List4.GetItemText(i, 1); m_name2 = m_List4.GetItemText(i, 2); if (!m_name1.IsEmpty()) field1 = m_name1 + ","; field1 += m_name2; field1.TrimRight(","); field2 = m_List4.GetItemText(i, 3); sum += atof(field2); field3 = m_List4.GetItemText(i, 4); field4 = m_List4.GetItemText(i, 5); field5 = m_List4.GetItemText(i, 6); field6 = m_List4.GetItemText(i, 7); field7 = m_List4.GetItemText(i, 8); field8 = m_List4.GetItemText(i, 9); field9 = m_List4.GetItemText(i, 10); FillLength(field1, leng1); FillLength(field2, leng2); FillLength(field3, leng3); FillLength(field4, leng4); FillLength(field5, leng5); FillLength(field6, leng6); FillLength(field7, leng7); FillLength(field8, leng8); FillLength(field9, leng9); str = field1 + field2 + field3 + field4 + field5 + field6 + field7 + field8 + field9 + "\n"; fp.WriteString(str); } fp.WriteString("\n"); str = "姓名: " + name; fp.WriteString(str); fp.WriteString("\n"); str = "类别: 计件提成\n"; fp.WriteString(str); str.Format("总计: %0.2f", sum); fp.WriteString(str); } fp.Close(); MessageBox("资料已保存到c:\\" + name + "(计件).txt"); ShellExecute(NULL, _T("open"), _T("c:\\" + name + "(计件).txt"), NULL, NULL, SW_SHOWMAXIMIZED); } void MySalary::OnButton7() { int pos = m_comboname.GetCurSel(); if (pos == -1) { AfxMessageBox("请选择您要导出资料的员工"); return; } CString name; m_comboname.GetWindowText(name); SelExportType dlg; if (dlg.DoModal() != IDOK)return; if (dlg.m_type == 1) { ListToXLS(&m_Listtake, "c:\\" + name + "(摄影).xls", 0); return; } CStdioFile fp; fp.Open("c:\\" + name + "(摄影).txt", CFile::modeCreate | CFile::modeWrite); CString str, field1, field2, field3, field4, field5, field6, field7, field8, field9, field10; int leng1 = 20; int leng2 = 15; int leng3 = 15; int leng4 = 15; int leng5 = 15; int leng6 = 15; int leng7 = 15; int leng8 = 15; int leng9 = 15; int leng10 = 15; CString m_name1, m_name2; float sum = 0; int waiter1count = 0; int waiter12count = 0; int waiter2count = 0; int waiter22count = 0; { leng1 = 18; leng2 = 20; leng3 = 12; leng4 = 20; leng5 = 15; leng6 = 10; leng7 = 10; leng8 = 10; leng9 = 10; field1 = "客人姓名"; field2 = "套系"; field3 = "套系金额"; field4 = "景点"; field5 = "日期"; field6 = "摄影"; field7 = "助理"; field8 = "化妆"; #ifdef CHILD_VERSION field8 = "引导"; #endif field9 = "助理"; FillLength(field1, leng1); FillLength(field2, leng2); FillLength(field3, leng3); FillLength(field4, leng4); FillLength(field5, leng5); FillLength(field6, leng6); FillLength(field7, leng7); FillLength(field8, leng8); FillLength(field9, leng9); str = field1 + field2 + field3 + field4 + field5 + field6 + field7 + field8 + field9 + "\n"; fp.WriteString(str); for (int i = 0; i < m_Listtake.GetItemCount(); i++) { field1.Empty(); m_name1 = m_Listtake.GetItemText(i, 1); m_name2 = m_Listtake.GetItemText(i, 2); if (!m_name1.IsEmpty()) field1 = m_name1 + ","; field1 += m_name2; field1.TrimRight(","); field2 = m_Listtake.GetItemText(i, 3); field3 = m_Listtake.GetItemText(i, 4); sum += atof(field3); field4 = m_Listtake.GetItemText(i, 5); field5 = m_Listtake.GetItemText(i, 6); field6 = m_Listtake.GetItemText(i, 7); field7 = m_Listtake.GetItemText(i, 8); field8 = m_Listtake.GetItemText(i, 9); field9 = m_Listtake.GetItemText(i, 10); if (field6 == name)waiter1count++; if (field7 == name)waiter12count++; if (field8 == name)waiter2count++; if (field9 == name)waiter22count++; FillLength(field1, leng1); FillLength(field2, leng2); FillLength(field3, leng3); FillLength(field4, leng4); FillLength(field5, leng5); FillLength(field6, leng6); FillLength(field7, leng7); FillLength(field8, leng8); FillLength(field9, leng9); str = field1 + field2 + field3 + field4 + field5 + field6 + field7 + field8 + field9 + "\n"; fp.WriteString(str); } fp.WriteString("\n"); str = "姓名: " + name; fp.WriteString(str); fp.WriteString("\n"); str.Format("摄影: %d\n", waiter1count); fp.WriteString(str); str.Format("助理: %d\n", waiter12count); fp.WriteString(str); #ifdef CHILD_VERSION str.Format("引导: %d\n", waiter2count); fp.WriteString(str); #else str.Format("化妆: %d\n", waiter2count); fp.WriteString(str); #endif str.Format("助理: %d\n", waiter22count); fp.WriteString(str); str.Format("订单总金额: %0.2f", sum); fp.WriteString(str); } fp.Close(); MessageBox("资料已保存到c:\\" + name + "(摄影).txt"); ShellExecute(NULL, _T("open"), _T("c:\\" + name + "(摄影).txt"), NULL, NULL, SW_SHOWMAXIMIZED); } void MySalary::OnButton8() { UpdateData(); int pos = m_comboname.GetCurSel(); if (pos == -1) { AfxMessageBox("请选择您要导出资料的员工"); return; } CString date1, date2; date1 = m_date1.Format("%Y-%m-%d"); date2 = m_date2.Format("%Y-%m-%d"); CString name; m_comboname.GetWindowText(name); SelExportType dlg; if (dlg.DoModal() != IDOK)return; if (dlg.m_type == 1) { ListToXLS(&m_Listdigital, "c:\\" + name + "(数码).xls", 0); return; } CStdioFile fp; fp.Open("c:\\" + name + "(数码).txt", CFile::modeCreate | CFile::modeWrite); CString str, field1, field2, field3, field4, field5, field6, field7, field8, field9, field10; int leng1 = 20; int leng2 = 15; int leng3 = 15; int leng4 = 15; int leng5 = 15; int leng6 = 15; int leng7 = 15; int leng8 = 15; int leng9 = 15; int leng10 = 15; CString m_name1, m_name2; float sum1 = 0; float sum2 = 0; float sum3 = 0; float sum12 = 0; float sum22 = 0; float sum32 = 0; int count1 = 0; int count2 = 0; int count3 = 0; { leng1 = 18; leng2 = 20; leng3 = 12; leng4 = 10; leng5 = 15; leng6 = 10; leng7 = 15; leng8 = 10; leng9 = 15; leng10 = 10; field1 = "客人姓名"; field2 = "套系"; field3 = "套系金额"; field4 = "初修"; field5 = "日期"; field6 = "精修"; field7 = "日期"; field8 = "设计"; field9 = "日期"; field10 = "选片二销"; FillLength(field1, leng1); FillLength(field2, leng2); FillLength(field3, leng3); FillLength(field4, leng4); FillLength(field5, leng5); FillLength(field6, leng6); FillLength(field7, leng7); FillLength(field8, leng8); FillLength(field9, leng9); FillLength(field10, leng10); str = field1 + field2 + field3 + field4 + field5 + field6 + field7 + field8 + field9 + field10 + "\n"; fp.WriteString(str); for (int i = 0; i < m_Listdigital.GetItemCount(); i++) { field1.Empty(); m_name1 = m_Listdigital.GetItemText(i, 1); m_name2 = m_Listdigital.GetItemText(i, 2); if (!m_name1.IsEmpty()) field1 = m_name1 + ","; field1 += m_name2; field1.TrimRight(","); field2 = m_Listdigital.GetItemText(i, 3); field3 = m_Listdigital.GetItemText(i, 4); field4 = m_Listdigital.GetItemText(i, 5); field5 = m_Listdigital.GetItemText(i, 6); field6 = m_Listdigital.GetItemText(i, 7); field7 = m_Listdigital.GetItemText(i, 8); field8 = m_Listdigital.GetItemText(i, 9); field9 = m_Listdigital.GetItemText(i, 10); field10 = m_Listdigital.GetItemText(i, 14); if (m_Listdigital.GetItemText(i, 11) == "OK" && field4 == name && field5 >= date1 && field5 <= date2) { sum1 += atof(field3); sum12 += atof(field10); count1++; } if (m_Listdigital.GetItemText(i, 12) == "OK" && field6 == name && field7 >= date1 && field7 <= date2) { sum2 += atof(field3); sum22 += atof(field10); count2++; } if (m_Listdigital.GetItemText(i, 13) == "OK" && field8 == name && field9 >= date1 && field9 <= date2) { sum3 += atof(field3); sum32 += atof(field10); count3++; } FillLength(field1, leng1); FillLength(field2, leng2); FillLength(field3, leng3); FillLength(field4, leng4); FillLength(field5, leng5); FillLength(field6, leng6); FillLength(field7, leng7); FillLength(field8, leng8); FillLength(field9, leng9); FillLength(field10, leng10); str = field1 + field2 + field3 + field4 + field5 + field6 + field7 + field8 + field9 + field10 + "\n"; fp.WriteString(str); } fp.WriteString("\n"); str = "姓名: " + name; fp.WriteString(str); fp.WriteString("\n"); str.Format("初修: %d单 订单金额:%0.2f 选片二销:%0.2f\n", count1, sum1, sum12); fp.WriteString(str); str.Format("精修: %d单 订单金额:%0.2f 选片二销:%0.2f\n", count2, sum2, sum22); fp.WriteString(str); str.Format("设计: %d单 订单金额:%0.2f 选片二销:%0.2f\n", count3, sum3, sum32); fp.WriteString(str); } fp.Close(); MessageBox("资料已保存到c:\\" + name + "(数码).txt"); ShellExecute(NULL, _T("open"), _T("c:\\" + name + "(数码).txt"), NULL, NULL, SW_SHOWMAXIMIZED); } void MySalary::OnDatetimechangeDatetimepicker1(NMHDR* pNMHDR, LRESULT* pResult) { OnSelchangeList1(); *pResult = 0; } void MySalary::OnDatetimechangeDatetimepicker2(NMHDR* pNMHDR, LRESULT* pResult) { OnSelchangeList1(); *pResult = 0; } CString GetExcelDriver() { char szBuf[2001]; WORD cbBufMax = 2000; WORD cbBufOut; char *pszBuf = szBuf; CString sDriver; if (!SQLGetInstalledDrivers(szBuf, cbBufMax, &cbBufOut)) return ""; do { if (strstr(pszBuf, "Excel") != 0) { sDriver = CString(pszBuf); break; } pszBuf = strchr(pszBuf, '\0') + 1; } while (pszBuf[1] != '\0'); return sDriver; } BOOL MakeSurePathExists(CString &Path, bool FilenameIncluded) { int Pos = 0; while ((Pos = Path.Find('\\', Pos + 1)) != -1) CreateDirectory(Path.Left(Pos), NULL); if (!FilenameIncluded) CreateDirectory(Path, NULL); // return ((!FilenameIncluded)?!_access(Path,0): // !_access(Path.Left(Path.ReverseFind('\\')),0)); return !_access(Path, 0); } BOOL GetDefaultXlsFileName(CString &sExcelFile) { ///默认文件名:yyyymmddhhmmss.xls // prompt the user (with all document templates) CFileDialog dlgFile(FALSE, ".xls", sExcelFile); CString title; CString strFilter; title = "导出"; strFilter = "Excel文件(*.xls)"; strFilter += (TCHAR)'\0'; // next string please strFilter += _T("*.xls"); strFilter += (TCHAR)'\0'; // last string dlgFile.m_ofn.nMaxCustFilter++; dlgFile.m_ofn.nFilterIndex = 1; // append the "*.*" all files filter CString allFilter; VERIFY(allFilter.LoadString(AFX_IDS_ALLFILTER)); strFilter += allFilter; strFilter += (TCHAR)'\0'; // next string please strFilter += _T("*.*"); strFilter += (TCHAR)'\0'; // last string dlgFile.m_ofn.nMaxCustFilter++; dlgFile.m_ofn.lpstrFilter = strFilter; dlgFile.m_ofn.lpstrTitle = title; if (dlgFile.DoModal() == IDCANCEL) return FALSE; // open cancelled sExcelFile = dlgFile.GetFileName(); if (MakeSurePathExists(sExcelFile, true)) { if (!DeleteFile(sExcelFile)) { // 删除xls文件; AfxMessageBox("覆盖文件时出错!"); return FALSE; } } return TRUE; } int FindArrayCount(CStringArray *pArray, CString Str) { int ret = 0; for (int i = 0; i < pArray->GetSize(); i++) { if (pArray->ElementAt(i) == Str) ret++; } return ret; } void ListToXLS(CListCtrl *pList, CString savepath, int nColumn, int nRow) { CString strPath = savepath; #if 0 const int nImportCount = 3500; INT nItemCount = pList->GetItemCount(); if ( nItemCount < 5000) { Import2Excle(pList, savepath, nColumn, nRow); } else { int nTimes = 0; int nStartRow = 0; int nEndRow = 0; savepath.TrimRight(_T(".xls")); TCHAR szExcelpath[MAX_PATH] = {0}; while( true ) { nItemCount -= nImportCount; if ( nItemCount > 0 ) { nTimes++; nEndRow += nImportCount; sprintf(szExcelpath, _T("%s%d.xls"), savepath, nTimes); Import2Excle(pList, szExcelpath, nColumn, nStartRow, -1, nEndRow); nStartRow += nImportCount; } else { sprintf(szExcelpath, _T("%s%d.xls"), savepath, nTimes+1); Import2Excle(pList, szExcelpath, nColumn, nStartRow, -1, -1); break; } } } #else Import2Xls(pList, savepath, nColumn, nRow); #endif strPath = savepath + _T(".dat"); ShellExecute(NULL, _T("open"), _T("xlsworker.exe"), strPath, NULL, SW_SHOW); ///AfxMessageBox(savepath + _T("后台生成,请稍等片刻!")); return; if (pList == NULL)return; CString strTitle = "sheet1"; CString warningStr; CString str, temp; if (pList->GetItemCount()>0) { CDatabase database; CString sDriver; CString sExcelFile; CString sSql; CString tableName = strTitle; CStringArray colarray; // 检索是否安装有Excel驱动 "Microsoft Excel Driver (*.xls)" sDriver = GetExcelDriver(); if (sDriver.IsEmpty()) { // 没有发现Excel驱动 AfxMessageBox("没有安装Excel!\n请先安装Excel软件才能使用导出功能!"); return; } sExcelFile = ""; sExcelFile = savepath; ///默认文件名 if (!GetDefaultXlsFileName(sExcelFile)) return; // 创建进行存取的字符串 sSql.Format("DRIVER={%s};DSN='';FIRSTROWHASNAMES=1;READONLY=FALSE;CREATE_DB=\"%s\";DBQ=%s", sDriver, sExcelFile, sExcelFile); // 创建数据库 (既Excel表格文件) if (database.OpenEx(sSql, CDatabase::noOdbcDialog)) { // 创建表结构 int i; LVCOLUMN columnData; CString columnName; int columnNum = 0; CString strH; CString strV; sSql = ""; strH = ""; columnData.mask = LVCF_TEXT; columnData.cchTextMax = 100; columnData.pszText = columnName.GetBuffer(100); { for (i = nColumn; pList->GetColumn(i, &columnData); i++) { if (i != nColumn) { sSql = sSql + ", "; strH = strH + ", "; } temp = columnData.pszText; temp.Replace("/", ""); temp.Replace("(", ""); temp.Replace(")", ""); int countexist = FindArrayCount(&colarray, temp); if (countexist) { CString ss; ss.Format("%d", countexist + 1); sSql = sSql + " " + temp + ss + " TEXT"; strH = strH + " " + temp + ss + " "; str = temp; str += ss; colarray.Add(str); } else { sSql = sSql + " " + temp + " TEXT"; strH = strH + " " + temp + " "; colarray.Add(temp); } } } columnName.ReleaseBuffer(); columnNum = i; sSql = "CREATE TABLE " + tableName + " ( " + sSql + " ) "; database.ExecuteSQL(sSql); // 插入数据项 int nItemIndex; { for (nItemIndex = 0; nItemIndex < pList->GetItemCount(); nItemIndex++) { strV = ""; for (i = nColumn; i < columnNum; i++) { if (i != nColumn) { strV = strV + ", "; } strV = strV + " '" + pList->GetItemText(nItemIndex, i) + "' "; } sSql = "INSERT INTO " + tableName + " (" + strH + ")" + " VALUES(" + strV + ")"; database.ExecuteSQL(sSql); } } } // 关闭数据库 database.Close(); ShellExecute(NULL, _T("open"), sExcelFile, NULL, NULL, SW_SHOW); } else AfxMessageBox("表中没有数据!"); } //%0.2f void MySalary::OnBut3() // 导出按钮; { ListToXLS(&m_List3, "c:\\工资表.xls", 0); }