StaffWage.cpp 60 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577
  1. #include "stdafx.h"
  2. #include "StaffWage.h"
  3. #include "Global/Global.h"
  4. #include "MainFrm.h"
  5. extern CMainFrame *g_pMainWnd;
  6. #ifdef VC60
  7. #define _tstof atof
  8. #define _tstoi atoi
  9. #endif
  10. CStaffWage::CStaffWage(void)
  11. {
  12. m_strStaffName = _T("");
  13. m_strWageStartDate = _T("");
  14. m_strWageEndofDate = _T("");
  15. m_fEaryResultMoney = 0.0;
  16. }
  17. CStaffWage::~CStaffWage(void)
  18. {
  19. ClearStaffWageData();
  20. }
  21. void CStaffWage::ClearStaffWageData()
  22. {
  23. m_AryStaffDetail.RemoveAll();
  24. m_AryReceiptRecords.RemoveAll();
  25. m_AryOrderDetail.RemoveAll();
  26. m_AryOtherIncomeRecord.RemoveAll();
  27. m_ArySceneryWorkRecord.RemoveAll();
  28. m_AryMyWorkRecord.RemoveAll();
  29. m_AryDigitalWorkRecord.RemoveAll();
  30. m_AryWageType.RemoveAll();
  31. m_AryWageTypeMoney.RemoveAll();
  32. m_fEaryResultMoney = 0.0;
  33. }
  34. BOOL CStaffWage::GetStaffWageData(IN CString strStaffName, IN CString strWageStartDate, IN CString strWageEndofDate)
  35. {
  36. m_strStaffName = strStaffName;
  37. m_strWageStartDate = strWageStartDate;
  38. m_strWageEndofDate = strWageEndofDate;
  39. CString strTemp = _T("");
  40. CString strFilter = _T("");
  41. // 0.case 34:查询员工;
  42. strTemp.Format(_T("name = '%s' and dimission='在职';"), m_strStaffName);
  43. strFilter += strTemp;
  44. // 1.case 242:查询所有收款详情;
  45. strTemp.Format(_T("(Paydate >= '%s' and Paydate <= '%s' ) or (PhotoStatus = 'OK' and PhotogOfPaydate >= '%s' and PhotogOfPaydate <= '%s');"), strWageStartDate, strWageEndofDate, strWageStartDate, strWageEndofDate);
  46. strFilter += strTemp;
  47. // 2.case 243:查询收款订单;
  48. strTemp.Format(
  49. _T("([ren] = '%s' or [ren2] = '%s' or")
  50. _T(" [waiter1] = '%s' or [waiter12] = '%s' or [waiter13] = '%s' or [waiter14] = '%s' or")
  51. _T(" [waiter2] = '%s' or [waiter22] = '%s' or [waiter23] = '%s' or [waiter24] = '%s' or")
  52. _T(" [waiter3] = '%s' or [waiter4] = '%s' or [waiter5] = '%s' or")
  53. _T(" [waiter6] = '%s' or [waiter7] = '%s' or [waiter8] = '%s' or [waiter9] = '%s')")
  54. _T(" and id in (select distinct id from Payroll where (Paydate >= '%s' and Paydate <= '%s') or (PhotoStatus = 'OK' and PhotogOfPaydate >= '%s' and PhotogOfPaydate <= '%s'));"),
  55. m_strStaffName, // 主门市;
  56. m_strStaffName, // 副门市;
  57. m_strStaffName, // 主摄影;
  58. m_strStaffName, // 摄影2;
  59. m_strStaffName, // 摄影3;
  60. m_strStaffName, // 摄影4;
  61. m_strStaffName, // 主化妆;
  62. m_strStaffName, // 化妆2;
  63. m_strStaffName, // 化妆3;
  64. m_strStaffName, // 化妆4;
  65. m_strStaffName, // 选片师;
  66. m_strStaffName, // 设计师;
  67. m_strStaffName, // 初修师;
  68. m_strStaffName, // 接单人;
  69. m_strStaffName, // 精修师;
  70. m_strStaffName, // 看设计人;
  71. m_strStaffName, // ???;
  72. strWageStartDate, strWageEndofDate, strWageStartDate, strWageEndofDate);
  73. strFilter += strTemp;
  74. // 3.case 198:查询其他收入;
  75. strTemp.Format(
  76. _T("[date] >= '%s' and [date] <= '%s' and [renyuan3] = '%s';"),
  77. strWageStartDate, strWageEndofDate, strStaffName);
  78. strFilter += strTemp;
  79. // 4.case 142:查询我的工作-mywork;
  80. strTemp.Format(_T("datetime >= '%s' and datetime <= '%s' and name = '%s';"),strWageStartDate, strWageEndofDate, strStaffName);
  81. strFilter += strTemp;
  82. // 5.case 192:查询摄影师景点工作;
  83. strTemp.Format(_T("[date] >= '%s' and [date] <= '%s' and [status] = 'OK' and ([waiter1] = '%s' or [waiter12] = '%s' or [waiter2] = '%s' or [waiter22] = '%s');"),
  84. strWageStartDate, strWageEndofDate, strStaffName,strStaffName,strStaffName,strStaffName);
  85. strFilter += strTemp;
  86. // 6.case 193:查询数码工作记录;
  87. strTemp.Format(
  88. _T("([time8] >='%s' and [time8]<='%s' and [status4]='OK' and [waiter5]='%s') or ")
  89. _T("([time9] >='%s' and [time9]<='%s' and [status6]='OK' and [waiter7]='%s') or ")
  90. _T("([time10] >='%s' and [time10]<='%s' and [status5]='OK' and [waiter4]='%s');"),
  91. strWageStartDate, strWageEndofDate, strStaffName,
  92. strWageStartDate, strWageEndofDate, strStaffName,
  93. strWageStartDate, strWageEndofDate, strStaffName);
  94. strFilter += strTemp;
  95. g_sendhead.code[0] = 34;
  96. g_sendhead.code[1] = 242;
  97. g_sendhead.code[2] = 243;
  98. g_sendhead.code[3] = 198;
  99. g_sendhead.code[4] = 142;
  100. g_sendhead.code[5] = 192;
  101. g_sendhead.code[6] = 193;
  102. g_sendhead.tabcount = 7;
  103. g_sendhead.bsql = FALSE;
  104. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  105. if ( !g_bSendOK )
  106. return FALSE;
  107. ClearStaffWageData();
  108. DataToArray(&m_AryStaffDetail, &m_AryReceiptRecords, &m_AryOrderDetail, &m_AryOtherIncomeRecord, &m_AryMyWorkRecord, &m_ArySceneryWorkRecord, &m_AryDigitalWorkRecord);
  109. #ifdef _DEBUG
  110. WriteTextLog(_T("-----------------------------某个员工-----------------------------\n"));
  111. int nSize = m_AryReceiptRecords.GetSize();
  112. for (int i = 0; i < nSize; i++ )
  113. {
  114. WriteTextLog(_T("\n"));
  115. for ( int j = 0; j < m_AryReceiptRecords.ElementAt(i).GetSize(); j++ )
  116. {
  117. WriteTextLog(_T("%s"), m_AryReceiptRecords.ElementAt(i).ElementAt(j));
  118. }
  119. }
  120. #endif
  121. return TRUE;
  122. }
  123. /************************************************************************/
  124. /* 函数:[1/3/2017 IT];
  125. /* 描述:摄影师和化妆师的前期业绩;
  126. /* 参数:;
  127. /* [IN] :;
  128. /* [OUT] :;
  129. /* [IN/OUT] :;
  130. /* 返回:void;
  131. /* 注意:;
  132. /* 示例:;
  133. /*
  134. /* 修改:;
  135. /* 日期:;
  136. /* 内容:;
  137. /************************************************************************/
  138. void CStaffWage::GetPhotographerAndMakeupArtistServeRecord(IN CString strStaffName, IN CString strOrderNum, IN BOOL &bPhotographer, IN BOOL &bMakeupArtist, IN FLOAT &fPhotographerPercent, IN FLOAT &fMakeupArtistPercent)
  139. {
  140. bPhotographer = bMakeupArtist = FALSE;
  141. INT nSize = m_AryOrderDetail.GetSize();
  142. for ( int i = 0; i < nSize; i++ )
  143. {
  144. #if 0
  145. // 调试用;
  146. CString strDebug;
  147. strDebug.Format(
  148. _T("订单号:%s\n")
  149. _T("摄影师1:%s\n")
  150. _T("摄影师2:%s\n")
  151. _T("摄影师3:%s\n")
  152. _T("摄影师4:%s\n")
  153. _T("摄影师1折扣:%s\n")
  154. _T("摄影师2折扣:%s\n")
  155. _T("摄影师3折扣:%s\n")
  156. _T("摄影师4折扣:%s\n")
  157. _T("化妆师1:%s\n")
  158. _T("化妆师2:%s\n")
  159. _T("化妆师3:%s\n")
  160. _T("化妆师4:%s\n")
  161. _T("化妆师1折扣:%s\n")
  162. _T("化妆师2折扣:%s\n")
  163. _T("化妆师3折扣:%s\n")
  164. _T("化妆师4折扣:%s\n")
  165. _T("门市1:%s\n")
  166. _T("门市2:%s\n")
  167. _T("门市1折扣:%s\n")
  168. _T("门市2折扣:%s\n")
  169. _T("订单拍照完成日期:%s\n")
  170. _T("订单拍照状态:%s\n"),
  171. m_AryOrderDetail.ElementAt(i).ElementAt(0),
  172. m_AryOrderDetail.ElementAt(i).ElementAt(1),
  173. m_AryOrderDetail.ElementAt(i).ElementAt(2),
  174. m_AryOrderDetail.ElementAt(i).ElementAt(3),
  175. m_AryOrderDetail.ElementAt(i).ElementAt(4),
  176. m_AryOrderDetail.ElementAt(i).ElementAt(5),
  177. m_AryOrderDetail.ElementAt(i).ElementAt(6),
  178. m_AryOrderDetail.ElementAt(i).ElementAt(7),
  179. m_AryOrderDetail.ElementAt(i).ElementAt(8),
  180. m_AryOrderDetail.ElementAt(i).ElementAt(9),
  181. m_AryOrderDetail.ElementAt(i).ElementAt(10),
  182. m_AryOrderDetail.ElementAt(i).ElementAt(11),
  183. m_AryOrderDetail.ElementAt(i).ElementAt(12),
  184. m_AryOrderDetail.ElementAt(i).ElementAt(13),
  185. m_AryOrderDetail.ElementAt(i).ElementAt(14),
  186. m_AryOrderDetail.ElementAt(i).ElementAt(15),
  187. m_AryOrderDetail.ElementAt(i).ElementAt(16),
  188. m_AryOrderDetail.ElementAt(i).ElementAt(17),
  189. m_AryOrderDetail.ElementAt(i).ElementAt(18),
  190. m_AryOrderDetail.ElementAt(i).ElementAt(19),
  191. m_AryOrderDetail.ElementAt(i).ElementAt(20),
  192. m_AryOrderDetail.ElementAt(i).ElementAt(21),
  193. m_AryOrderDetail.ElementAt(i).ElementAt(22)
  194. );
  195. OutputDebugString(strDebug);
  196. #endif
  197. // 是否指定要查询的订单;
  198. if ( m_AryOrderDetail.ElementAt(i).ElementAt(0) == strOrderNum )
  199. {
  200. // 主摄影师、摄影师2~4只能有一个;
  201. if ( strStaffName == m_AryOrderDetail.ElementAt(i).ElementAt(1) )
  202. {// 是否是有主摄影师服务提成;
  203. bPhotographer = TRUE;
  204. // 获取折扣;
  205. fPhotographerPercent = _tstof(m_AryOrderDetail.ElementAt(i).ElementAt(5))/100.0;
  206. if ( fPhotographerPercent == 0.0 )
  207. fPhotographerPercent = 1.0;
  208. }
  209. else if ( strStaffName == m_AryOrderDetail.ElementAt(i).ElementAt(2) )
  210. {// 是否是有摄影师2服务提成;
  211. bPhotographer = TRUE;
  212. // 获取折扣;
  213. fPhotographerPercent = _tstof(m_AryOrderDetail.ElementAt(i).ElementAt(6))/100.0;
  214. if ( fPhotographerPercent == 0.0 )
  215. fPhotographerPercent = 1.0;
  216. }
  217. else if ( strStaffName == m_AryOrderDetail.ElementAt(i).ElementAt(3) )
  218. {// 是否是有摄影师3服务提成;
  219. bPhotographer = TRUE;
  220. // 获取折扣;
  221. fPhotographerPercent = _tstof(m_AryOrderDetail.ElementAt(i).ElementAt(7))/100.0;
  222. if ( fPhotographerPercent == 0.0 )
  223. fPhotographerPercent = 1.0;
  224. }
  225. else if ( strStaffName == m_AryOrderDetail.ElementAt(i).ElementAt(4) )
  226. {// 是否是有摄影师4服务提成;
  227. bPhotographer = TRUE;
  228. // 获取折扣;
  229. fPhotographerPercent = _tstof(m_AryOrderDetail.ElementAt(i).ElementAt(8))/100.0;
  230. if ( fPhotographerPercent == 0.0 )
  231. fPhotographerPercent = 1.0;
  232. }
  233. // 主化妆师、化妆师2~4只能有一个;
  234. if ( strStaffName == m_AryOrderDetail.ElementAt(i).ElementAt(9) )
  235. {// 是否是主化妆师服务记录;
  236. bMakeupArtist = TRUE;
  237. // 获取折扣;
  238. fMakeupArtistPercent = _tstof(m_AryOrderDetail.ElementAt(i).ElementAt(13))/100.0;
  239. if ( fMakeupArtistPercent == 0.0 )
  240. fMakeupArtistPercent = 1.0;
  241. }
  242. else if ( strStaffName == m_AryOrderDetail.ElementAt(i).ElementAt(10) )
  243. {// 是否是有化妆师2服务提成;
  244. bMakeupArtist = TRUE;
  245. // 获取折扣;
  246. fMakeupArtistPercent = _tstof(m_AryOrderDetail.ElementAt(i).ElementAt(14))/100.0;
  247. if ( fMakeupArtistPercent == 0.0 )
  248. fMakeupArtistPercent = 1.0;
  249. }
  250. else if ( strStaffName == m_AryOrderDetail.ElementAt(i).ElementAt(11) )
  251. {// 是否是有化妆师3服务提成;
  252. bMakeupArtist = TRUE;
  253. // 获取折扣;
  254. fMakeupArtistPercent = _tstof(m_AryOrderDetail.ElementAt(i).ElementAt(15))/100.0;
  255. if ( fMakeupArtistPercent == 0.0 )
  256. fMakeupArtistPercent = 1.0;
  257. }
  258. else if ( strStaffName == m_AryOrderDetail.ElementAt(i).ElementAt(12) )
  259. {// 是否是有化妆师4服务提成;
  260. bMakeupArtist = TRUE;
  261. // 获取折扣;
  262. fMakeupArtistPercent = _tstof(m_AryOrderDetail.ElementAt(i).ElementAt(16))/100.0;
  263. if ( fMakeupArtistPercent == 0.0 )
  264. fMakeupArtistPercent = 1.0;
  265. }
  266. break;
  267. }
  268. }
  269. }
  270. /************************************************************************/
  271. /* 函数:[1/3/2017 IT];
  272. /* 描述:主副门市提成;
  273. /* 参数:;
  274. /* [IN] :;
  275. /* [OUT] :;
  276. /* [IN/OUT] :;
  277. /* 返回:void;
  278. /* 注意:;
  279. /* 示例:;
  280. /*
  281. /* 修改:;
  282. /* 日期:;
  283. /* 内容:;
  284. /************************************************************************/
  285. void CStaffWage::GetSalesServerRecord(IN CString strStaffName, IN CString strOrderNum, IN BOOL &bSalesperson1, IN BOOL &bSalesperson2, IN FLOAT &fbSalesperson1Percent, IN FLOAT &fbSalesperson2Percent)
  286. {
  287. bSalesperson1 = bSalesperson2 = FALSE;
  288. INT nSize = m_AryOrderDetail.GetSize();
  289. for ( int i = 0; i < nSize; i++ )
  290. {
  291. // 是否指定要查询的订单;
  292. if ( m_AryOrderDetail.ElementAt(i).ElementAt(0) == strOrderNum )
  293. {
  294. #if 0 // 有误,如果主副门市都存在时;
  295. // 主门市;
  296. if ( m_strStaffName == m_AryOrderDetail.ElementAt(i).ElementAt(17) )
  297. {// 是否是主门市提成;
  298. bSalesperson1 = TRUE;
  299. // 获取折扣;
  300. fbSalesperson1Percent = _tstof(m_AryOrderDetail.ElementAt(i).ElementAt(19))/100.0;
  301. if ( fbSalesperson1Percent == 0.0 )
  302. fbSalesperson1Percent = 1.0;
  303. }
  304. // 副门市;
  305. if ( m_strStaffName == m_AryOrderDetail.ElementAt(i).ElementAt(18) )
  306. {// 是否是副门市提成;
  307. bSalesperson2 = TRUE;
  308. // 获取折扣;
  309. fbSalesperson2Percent = _tstof(m_AryOrderDetail.ElementAt(i).ElementAt(20))/100.0;
  310. if ( fbSalesperson2Percent == 0.0 )
  311. fbSalesperson2Percent = 1.0;
  312. }
  313. #else
  314. // 主门市;
  315. CString strStaff1 = m_AryOrderDetail.ElementAt(i).ElementAt(17);
  316. CString strStaff1Percent = m_AryOrderDetail.ElementAt(i).ElementAt(19);
  317. // 副门市;
  318. CString strStaff2 = m_AryOrderDetail.ElementAt(i).ElementAt(18);
  319. CString strStaff2Percent = m_AryOrderDetail.ElementAt(i).ElementAt(20);
  320. if ( strStaff1.IsEmpty() || strStaff2.IsEmpty() )
  321. {// 没有主或副门市;
  322. if ( !strStaff1.IsEmpty() && strStaffName == strStaff1 )
  323. {
  324. bSalesperson1 = TRUE;
  325. if ( strStaff1Percent.IsEmpty() )
  326. fbSalesperson1Percent = 1.0;
  327. else
  328. fbSalesperson1Percent = _tstof(strStaff1Percent)/100.0;
  329. }
  330. if ( !strStaff2.IsEmpty() && strStaffName == strStaff2 )
  331. {
  332. bSalesperson2 = TRUE;
  333. if ( strStaff2Percent.IsEmpty() )
  334. fbSalesperson2Percent = 1.0;
  335. else
  336. fbSalesperson2Percent = _tstof(strStaff2Percent)/100.0;
  337. }
  338. }
  339. else
  340. {
  341. if (strStaff1Percent.IsEmpty() && strStaff2Percent.IsEmpty())
  342. {// 同时空,各一半;
  343. if ( strStaffName == strStaff1 )
  344. {
  345. bSalesperson1 = TRUE;
  346. fbSalesperson1Percent = 0.5;
  347. }
  348. if ( strStaffName == strStaff2 )
  349. {
  350. bSalesperson2 = TRUE;
  351. fbSalesperson2Percent = 0.5;
  352. }
  353. }
  354. else
  355. {
  356. if ( !strStaff1Percent.IsEmpty() && strStaff2Percent.IsEmpty())
  357. {// 只有主门市;
  358. if ( strStaffName == strStaff1 )
  359. {
  360. bSalesperson1 = TRUE;
  361. fbSalesperson1Percent = 1.0;
  362. }
  363. }
  364. else if ( strStaff1Percent.IsEmpty() && !strStaff2Percent.IsEmpty() )
  365. {// 只有副门市;
  366. if ( strStaffName == strStaff2 )
  367. {
  368. bSalesperson2 = TRUE;
  369. fbSalesperson2Percent = 1.0;
  370. }
  371. }
  372. else
  373. {
  374. if ( strStaffName == strStaff1 )
  375. {
  376. bSalesperson1 = TRUE;
  377. fbSalesperson1Percent = _tstof(strStaff1Percent)/100.0;
  378. }
  379. if ( strStaffName == strStaff2 )
  380. {
  381. bSalesperson2 = TRUE;
  382. fbSalesperson2Percent = _tstof(strStaff2Percent)/100.0;
  383. }
  384. }
  385. }
  386. }
  387. #endif
  388. break;
  389. }
  390. }
  391. }
  392. BOOL CStaffWage::GetEarlyResults(IN CArray<CStringArray, CStringArray>& AryEarlyResult) // 获取前期业绩;
  393. {
  394. INT nSize = m_AryReceiptRecords.GetSize();
  395. if ( nSize == 0 ) // 有些员工是没有业绩的,如财务账号;
  396. return FALSE;
  397. AryEarlyResult.SetSize(nSize + m_AryOtherIncomeRecord.GetSize(), 1);
  398. INT i = 0;
  399. INT nIndex = -1;
  400. INT nArypos = 0;
  401. CString strMoney;
  402. BOOL bPhotographer,bMakeupArtist;
  403. FLOAT fPhotographer, fMakeupArtist;
  404. BOOL bSalesperson1,bSalesperson2;
  405. FLOAT fbSalesperson1Percent, fbSalesperson2Percent;
  406. #ifdef _DEBUG
  407. WriteTextLog(_T("-----------------员工:%s的业绩内容-----------------\n"), m_strStaffName);
  408. #endif
  409. for ( i = 0; i < nSize; i++ )
  410. {
  411. #ifdef _DEBUG
  412. // 调试数据用;
  413. if ( m_AryReceiptRecords.ElementAt(i).ElementAt(0) == _T("20170307-002") /* 订单号 */ || m_AryReceiptRecords.ElementAt(i).ElementAt(1) == _T("苏国平") /*顾客1*/ )
  414. {
  415. OutputDebugString(_T("调试到指定订单\n"));
  416. }
  417. #endif
  418. // 前期业绩;
  419. if ( m_AryReceiptRecords.ElementAt(i).ElementAt(5) == _T("3") || m_AryReceiptRecords.ElementAt(i).ElementAt(5) == _T("4"))
  420. {
  421. fPhotographer = fMakeupArtist = 0.0;
  422. bPhotographer = bMakeupArtist = FALSE;
  423. // 1.这笔收款,员工是否有摄影+化妆服务项;
  424. if ( m_AryReceiptRecords.ElementAt(i).ElementAt(9) == _T("OK") && m_AryReceiptRecords.ElementAt(i).ElementAt(10) >= m_strWageStartDate && m_AryReceiptRecords.ElementAt(i).ElementAt(10) <= m_strWageEndofDate )
  425. {
  426. GetPhotographerAndMakeupArtistServeRecord(m_strStaffName, m_AryReceiptRecords.ElementAt(i).ElementAt(0), bPhotographer, bMakeupArtist, fPhotographer, fMakeupArtist);
  427. // ElementAt(56):工资设置:摄影师也有前期提成;
  428. if ( _tstoi(g_cominfoarray.ElementAt(0).ElementAt(56)) && bPhotographer )
  429. {// 摄影前期;
  430. // 按提成百分比计算;
  431. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fPhotographer);
  432. // 累加前期业绩;
  433. m_fEaryResultMoney += _tstof(strMoney);
  434. // 累加摄影工资类型金额;
  435. if ( (nIndex = FindArray(&m_AryWageType, WAGE_EARLY_PHOTOGRAPHER)) == -1 )
  436. {
  437. m_AryWageType.Add(WAGE_EARLY_PHOTOGRAPHER);
  438. m_AryWageTypeMoney.Add(_tstof(strMoney));
  439. }
  440. else
  441. {
  442. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  443. }
  444. // 保存该类型工资记录;
  445. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  446. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  447. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(10)); // 工资日期;
  448. AryEarlyResult.ElementAt(nArypos).Add(WAGE_EARLY_PHOTOGRAPHER); // 工资类型;
  449. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  450. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  451. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  452. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  453. nArypos++;
  454. #ifdef _DEBUG
  455. WriteTextLog(_T("摄影前期:%s,%s,%s,%s,%s,%s,%s"),
  456. strMoney,
  457. m_AryReceiptRecords.ElementAt(i).ElementAt(10),
  458. WAGE_EARLY_PHOTOGRAPHER,
  459. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  460. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  461. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  462. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  463. #endif
  464. }
  465. // ElementAt(57):工资设置:化妆师也有前期提成;
  466. if ( _tstoi(g_cominfoarray.ElementAt(0).ElementAt(57)) && bMakeupArtist )
  467. {// 化妆前期;
  468. // 按提成百分比计算;
  469. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fMakeupArtist);
  470. // 累加前期业绩;
  471. m_fEaryResultMoney += _tstof(strMoney);
  472. // 累加摄影工资类型金额;
  473. if ( (nIndex = FindArray(&m_AryWageType, WAGE_EARLY_MAKEUPARTIST)) == -1 )
  474. {
  475. m_AryWageType.Add(WAGE_EARLY_MAKEUPARTIST);
  476. m_AryWageTypeMoney.Add(_tstof(strMoney));
  477. }
  478. else
  479. {
  480. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  481. }
  482. // 保存该类型工资记录;
  483. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  484. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  485. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(10)); // 工资日期;
  486. AryEarlyResult.ElementAt(nArypos).Add(WAGE_EARLY_MAKEUPARTIST); // 工资类型;
  487. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  488. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  489. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  490. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  491. nArypos++;
  492. #ifdef _DEBUG
  493. WriteTextLog(_T("化妆前期:%s,%s,%s,%s,%s,%s,%s"),
  494. strMoney,
  495. m_AryReceiptRecords.ElementAt(i).ElementAt(10),
  496. WAGE_EARLY_MAKEUPARTIST,
  497. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  498. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  499. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  500. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  501. #endif
  502. }
  503. }
  504. // 2.这笔收款,员工是否有门市服务项;
  505. if ( m_AryReceiptRecords.ElementAt(i).ElementAt(7) >= m_strWageStartDate && m_AryReceiptRecords.ElementAt(i).ElementAt(7) <= m_strWageEndofDate )
  506. {
  507. bSalesperson1 = bSalesperson2 = 0.0;
  508. fbSalesperson1Percent = fbSalesperson2Percent = FALSE;
  509. GetSalesServerRecord(m_strStaffName, m_AryReceiptRecords.ElementAt(i).ElementAt(0), bSalesperson1, bSalesperson2, fbSalesperson1Percent, fbSalesperson2Percent);
  510. if ( bSalesperson1 )
  511. {// 主门市;
  512. // 按提成百分比计算;
  513. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fbSalesperson1Percent);
  514. // 累加前期业绩;
  515. m_fEaryResultMoney += _tstof(strMoney);
  516. // 累加门市类型金额;
  517. if ( (nIndex = FindArray(&m_AryWageType, WAGE_EARLY_SALES)) == -1 )
  518. {
  519. m_AryWageType.Add(WAGE_EARLY_SALES);
  520. m_AryWageTypeMoney.Add(_tstof(strMoney));
  521. }
  522. else
  523. {
  524. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  525. }
  526. // 保存该类型工资记录;
  527. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  528. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  529. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(7)); // 工资日期;
  530. AryEarlyResult.ElementAt(nArypos).Add(WAGE_EARLY_SALES); // 工资类型;
  531. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  532. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  533. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  534. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  535. nArypos++;
  536. #ifdef _DEBUG
  537. WriteTextLog(_T("主门市:%s,%s,%s,%s,%s,%s,%s"),
  538. strMoney,
  539. m_AryReceiptRecords.ElementAt(i).ElementAt(7),
  540. WAGE_EARLY_SALES,
  541. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  542. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  543. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  544. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  545. #endif
  546. }
  547. if ( bSalesperson2 )
  548. {// 副门市;
  549. // 按提成百分比计算;
  550. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fbSalesperson2Percent);
  551. // 累加前期业绩;
  552. m_fEaryResultMoney += _tstof(strMoney);
  553. // 累加门市类型金额;
  554. if ( (nIndex = FindArray(&m_AryWageType, WAGE_EARLY_SALES)) == -1 )
  555. {
  556. m_AryWageType.Add(WAGE_EARLY_SALES);
  557. m_AryWageTypeMoney.Add(_tstof(strMoney));
  558. }
  559. else
  560. {
  561. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  562. }
  563. // 保存该类型工资记录;
  564. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  565. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  566. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(7)); // 工资日期;
  567. AryEarlyResult.ElementAt(nArypos).Add(WAGE_EARLY_SALES); // 工资类型;
  568. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  569. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  570. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  571. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  572. nArypos++;
  573. #ifdef _DEBUG
  574. WriteTextLog(_T("副门市:%s,%s,%s,%s,%s,%s,%s"),
  575. strMoney,
  576. m_AryReceiptRecords.ElementAt(i).ElementAt(7),
  577. WAGE_EARLY_SALES,
  578. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  579. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  580. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  581. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  582. #endif
  583. }
  584. }
  585. }
  586. // 选片二销;
  587. else if ( m_AryReceiptRecords.ElementAt(i).ElementAt(12) == _T("选片二销") )
  588. {
  589. bPhotographer = bMakeupArtist = FALSE;
  590. fPhotographer = fMakeupArtist = 0.0;
  591. if ( m_AryReceiptRecords.ElementAt(i).ElementAt(9) == _T("OK") && m_AryReceiptRecords.ElementAt(i).ElementAt(10) >= m_strWageStartDate && m_AryReceiptRecords.ElementAt(i).ElementAt(10) <= m_strWageEndofDate )
  592. {
  593. GetPhotographerAndMakeupArtistServeRecord(m_strStaffName, m_AryReceiptRecords.ElementAt(i).ElementAt(0), bPhotographer, bMakeupArtist, fPhotographer, fMakeupArtist);
  594. // ElementAt(41):工资设置:摄影师也有选片二销提成;
  595. if ( _tstoi(g_cominfoarray.ElementAt(0).ElementAt(41)) && bPhotographer )
  596. {
  597. // 按提成百分比计算;
  598. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fPhotographer);
  599. // 累加选片二销业绩;
  600. m_fSelectMoney += _tstof(strMoney);
  601. // 累加摄影也有选片二销工资类型金额;
  602. if ( (nIndex = FindArray(&m_AryWageType, WAGE_SEL_PHOTOGRAPHER)) == -1 )
  603. {
  604. m_AryWageType.Add(WAGE_SEL_PHOTOGRAPHER);
  605. m_AryWageTypeMoney.Add(_tstof(strMoney));
  606. }
  607. else
  608. {
  609. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  610. }
  611. // 保存该类型工资记录;
  612. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  613. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(10)); // 工资日期;
  614. AryEarlyResult.ElementAt(nArypos).Add(WAGE_SEL_PHOTOGRAPHER); // 工资类型;
  615. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  616. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  617. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  618. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  619. nArypos++;
  620. #ifdef _DEBUG
  621. WriteTextLog(_T("摄影师选片二销:%s,%s,%s,%s,%s,%s,%s"),
  622. strMoney,
  623. m_AryReceiptRecords.ElementAt(i).ElementAt(10),
  624. WAGE_SEL_PHOTOGRAPHER,
  625. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  626. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  627. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  628. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  629. #endif
  630. }
  631. // ElementAt(42):工资设置:化妆师或引导师也有选片二销提成;
  632. if ( _tstoi(g_cominfoarray.ElementAt(0).ElementAt(42)) && bMakeupArtist )
  633. {
  634. // 按提成百分比计算;
  635. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fMakeupArtist);
  636. // 累加选片二销业绩;
  637. m_fSelectMoney += _tstof(strMoney);
  638. // 累加化妆也有选片二销工资类型金额;
  639. if ( (nIndex = FindArray(&m_AryWageType, WAGE_SEL_MAKEUPARTIST)) == -1 )
  640. {
  641. m_AryWageType.Add(WAGE_SEL_MAKEUPARTIST);
  642. m_AryWageTypeMoney.Add(_tstof(strMoney));
  643. }
  644. else
  645. {
  646. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  647. }
  648. // 保存该类型工资记录;
  649. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  650. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(10)); // 工资日期;
  651. AryEarlyResult.ElementAt(nArypos).Add(WAGE_SEL_MAKEUPARTIST); // 工资类型;
  652. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  653. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  654. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  655. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  656. nArypos++;
  657. #ifdef _DEBUG
  658. WriteTextLog(_T("化妆师选片二销:%s,%s,%s,%s,%s,%s,%s"),
  659. strMoney,
  660. m_AryReceiptRecords.ElementAt(i).ElementAt(10),
  661. WAGE_SEL_MAKEUPARTIST,
  662. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  663. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  664. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  665. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  666. #endif
  667. }
  668. }
  669. // 这笔收款,员工是否还是本次选片二销的选片师;
  670. if ( m_strStaffName == m_AryReceiptRecords.ElementAt(i).ElementAt(11) && m_AryReceiptRecords.ElementAt(i).ElementAt(7) >= m_strWageStartDate && m_AryReceiptRecords.ElementAt(i).ElementAt(7) <= m_strWageEndofDate )
  671. {
  672. // 按提成百分比计算;
  673. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) );
  674. // 累加选片二销业绩;
  675. m_fSelectMoney += _tstof(strMoney);
  676. // 累加化妆也有选片二销工资类型金额;
  677. if ( (nIndex = FindArray(&m_AryWageType, WAGE_SEL_SALES)) == -1 )
  678. {
  679. m_AryWageType.Add(WAGE_SEL_SALES);
  680. m_AryWageTypeMoney.Add(_tstof(strMoney));
  681. }
  682. else
  683. {
  684. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  685. }
  686. // 保存该类型工资记录;
  687. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  688. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  689. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(7)); // 工资日期;
  690. AryEarlyResult.ElementAt(nArypos).Add(WAGE_SEL_SALES); // 工资类型;
  691. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  692. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  693. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  694. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  695. nArypos++;
  696. #ifdef _DEBUG
  697. WriteTextLog(_T("本身选片二销:%s,%s,%s,%s,%s,%s,%s"),
  698. strMoney,
  699. m_AryReceiptRecords.ElementAt(i).ElementAt(7),
  700. WAGE_SEL_SALES,
  701. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  702. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  703. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  704. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  705. #endif
  706. }
  707. }
  708. // 其他订单二销;
  709. else
  710. {
  711. // 这笔收款,员工是否还是本次其他订单二销的促成者;
  712. if ( m_strStaffName == m_AryReceiptRecords.ElementAt(i).ElementAt(11) && m_AryReceiptRecords.ElementAt(i).ElementAt(7) >= m_strWageStartDate && m_AryReceiptRecords.ElementAt(i).ElementAt(7) <= m_strWageEndofDate )
  713. {
  714. // 获取提成;
  715. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)));
  716. // 累加选片二销业绩;
  717. m_fSelectMoney += _tstof(strMoney);
  718. // 累加化妆也有选片二销工资类型金额;
  719. if ( (nIndex = FindArray(&m_AryWageType, m_AryReceiptRecords.ElementAt(i).ElementAt(12))) == -1 )
  720. {
  721. m_AryWageType.Add(m_AryReceiptRecords.ElementAt(i).ElementAt(12));
  722. m_AryWageTypeMoney.Add(_tstof(strMoney));
  723. }
  724. else
  725. {
  726. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  727. }
  728. // 保存该类型工资记录;
  729. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  730. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  731. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(7)); // 工资日期;
  732. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(12)); // 工资类型;
  733. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  734. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  735. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  736. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  737. nArypos++;
  738. #ifdef _DEBUG
  739. WriteTextLog(_T("其他订单二销:%s,%s,%s,%s,%s,%s,%s"),
  740. strMoney,
  741. m_AryReceiptRecords.ElementAt(i).ElementAt(7),
  742. m_AryReceiptRecords.ElementAt(i).ElementAt(12),
  743. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  744. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  745. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  746. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  747. #endif
  748. }
  749. }
  750. }
  751. // 其他收入业绩(散客消费);
  752. nSize = m_AryOtherIncomeRecord.GetSize();
  753. #ifdef _DEBUG
  754. if ( m_strStaffName == _T("李爱辉"))
  755. for ( i = 0; i < nSize; i++ )
  756. WriteTextLog(_T("散客消费全记录:%s,%s,%s,%s,%s,%s,%s,%s"),
  757. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(0),
  758. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(1),
  759. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(2),
  760. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3),
  761. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(4),
  762. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(5),
  763. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(6),
  764. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(7)
  765. );
  766. #endif
  767. for ( i = 0; i < nSize; i++ )
  768. {
  769. strMoney.Format(_T("%0.2f"), _tstof(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(4)));
  770. //if ( m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3) == WAGE_SEC_PHOTOGRAPHER)
  771. // 累加化妆也有选片二销工资类型金额;
  772. if ( (nIndex = FindArray(&m_AryWageType, m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3))) == -1 )
  773. {
  774. m_AryWageType.Add(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3));
  775. m_AryWageTypeMoney.Add(_tstof(strMoney));
  776. }
  777. else
  778. {
  779. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  780. }
  781. // 保存该类型工资记录;
  782. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  783. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  784. AryEarlyResult.ElementAt(nArypos).Add(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(5)); // 工资日期;
  785. AryEarlyResult.ElementAt(nArypos).Add(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3)); // 工资类型;
  786. AryEarlyResult.ElementAt(nArypos).Add(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  787. AryEarlyResult.ElementAt(nArypos).Add(_T("")); // 顾客2姓名;
  788. AryEarlyResult.ElementAt(nArypos).Add(_T("")); // 套系类型;
  789. AryEarlyResult.ElementAt(nArypos).Add(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(7)); // 付款方式;
  790. nArypos++;
  791. #ifdef _DEBUG
  792. WriteTextLog(_T("散客消费:%s,%s,%s,%s,%s,%s,%s"),
  793. strMoney,
  794. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(5),
  795. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3),
  796. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(1),
  797. _T(""),
  798. _T(""),
  799. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(7));
  800. #endif
  801. }
  802. AryEarlyResult.SetSize(nArypos);
  803. AryEarlyResult.FreeExtra();
  804. return FALSE;
  805. }
  806. #ifndef ALL_STAFF_WAGE
  807. CString CStaffWage::GetRule(CString name)
  808. {
  809. CString oldrule = g_cominfoarray.ElementAt(0).ElementAt(77);
  810. CString header = "$" + name + ":";
  811. CString left, right;
  812. int pos = oldrule.Find(header);
  813. if (pos != -1)
  814. {
  815. right = oldrule.Right(oldrule.GetLength() - pos - header.GetLength());
  816. pos = right.Find("$");
  817. if (pos != -1)
  818. right = right.Left(pos);
  819. right = header + right;
  820. return right;
  821. }
  822. return "";
  823. }
  824. float CStaffWage::GetSalaryFromRule(float fmoney, CString rule)
  825. {
  826. float fresult = 0;
  827. int pos = rule.Find(":");
  828. if (pos == -1)return 0;
  829. rule = rule.Right(rule.GetLength() - pos - 1);
  830. CStringArray rulearray;
  831. pos = rule.Find(";");
  832. while (pos != -1)
  833. {
  834. rulearray.Add(rule.Left(pos));
  835. rule = rule.Right(rule.GetLength() - pos - 1);
  836. pos = rule.Find(";");
  837. }
  838. BOOL check1 = atoi(rule);
  839. if (rulearray.GetSize() == 0)return 0;
  840. CString str, temp;
  841. int money1, money2;
  842. float frate;
  843. if (check1 == 0)
  844. {
  845. for (int i = 0; i < rulearray.GetSize(); i++)
  846. {
  847. temp = rulearray.ElementAt(i);
  848. int pos = temp.Find(" ");
  849. temp = temp.Left(pos);
  850. pos = temp.Find("-");
  851. money1 = atoi(temp.Left(pos));
  852. money2 = atoi(temp.Right(temp.GetLength() - pos - 1));
  853. if ((i == rulearray.GetSize() - 1) || (fmoney >= money1 && fmoney <= money2))
  854. {
  855. temp = rulearray.ElementAt(i);
  856. pos = temp.Find(":");
  857. temp = temp.Right(temp.GetLength() - pos - 1);
  858. temp.TrimRight("%");
  859. frate = atof(temp) / 100.0;
  860. fresult = frate*fmoney;
  861. return fresult;
  862. }
  863. }
  864. }
  865. else//////
  866. {
  867. for (int i = 0; i < rulearray.GetSize(); i++)
  868. {
  869. temp = rulearray.ElementAt(i);
  870. int pos = temp.Find(" ");
  871. temp = temp.Left(pos);
  872. pos = temp.Find("-");
  873. money1 = atoi(temp.Left(pos));
  874. money2 = atoi(temp.Right(temp.GetLength() - pos - 1));
  875. if ((i == rulearray.GetSize() - 1) || (fmoney >= money1 && fmoney <= money2))
  876. {
  877. temp = rulearray.ElementAt(i);
  878. pos = temp.Find(":");
  879. temp = temp.Right(temp.GetLength() - pos - 1);
  880. temp.TrimRight("%");
  881. frate = atof(temp) / 100.0;
  882. float dtmoney = fmoney - money1;
  883. fresult += frate*dtmoney;
  884. if (i == 0)//只有一条规则
  885. {
  886. fresult = frate*fmoney;
  887. return fresult;
  888. }
  889. while (i)
  890. {
  891. i--;
  892. temp = rulearray.ElementAt(i);
  893. pos = temp.Find(" ");
  894. temp = temp.Left(pos);
  895. pos = temp.Find("-");
  896. money1 = atoi(temp.Left(pos));
  897. money2 = atoi(temp.Right(temp.GetLength() - pos - 1));
  898. temp = rulearray.ElementAt(i);
  899. pos = temp.Find(":");
  900. temp = temp.Right(temp.GetLength() - pos - 1);
  901. temp.TrimRight("%");
  902. frate = atof(temp) / 100.0;
  903. dtmoney = money2 - money1;
  904. fresult += frate*dtmoney;
  905. }
  906. return fresult;
  907. }
  908. }
  909. }
  910. return fresult;
  911. }
  912. BOOL CStaffWage::GetAllStaffWageData(IN CString strWageStartDate, IN CString strWageEndofDate)
  913. {
  914. m_strWageStartDate = strWageStartDate;
  915. m_strWageEndofDate = strWageEndofDate;
  916. CString strTemp = _T("");
  917. CString strFilter = _T("");
  918. // case 34:查询员工;
  919. strTemp.Format(_T("dimission='在职';"));
  920. strFilter += strTemp;
  921. // case 242:查询所有收款详情;
  922. strTemp.Format(_T("(Paydate >= '%s' and Paydate <= '%s' ) or (PhotoStatus = 'OK' and PhotogOfPaydate >= '%s' and PhotogOfPaydate <= '%s');"), strWageStartDate, strWageEndofDate, strWageStartDate, strWageEndofDate);
  923. strFilter += strTemp;
  924. // case 243:查询收款订单;
  925. strTemp.Format(_T("id in (select distinct id from Payroll where (Paydate >= '%s' and Paydate <= '%s') or (PhotoStatus = 'OK' and PhotogOfPaydate >= '%s' and PhotogOfPaydate <= '%s'));"),
  926. strWageStartDate,
  927. strWageEndofDate,
  928. strWageStartDate,
  929. strWageEndofDate);
  930. strFilter += strTemp;
  931. // case 198:查询其他收入;
  932. strTemp.Format(_T("[date] >= '%s' and [date] <= '%s';"), strWageStartDate, strWageEndofDate);
  933. strFilter += strTemp;
  934. // case 142:查询我的工作;
  935. strTemp.Format(_T("datetime >= '%s' and datetime <= '%s' ;"),strWageStartDate, strWageEndofDate);
  936. strFilter += strTemp;
  937. // case 192:查询摄影师景点工作;
  938. strTemp.Format(_T("[date] >= '%s' and [date] <= '%s' and [status] = 'OK';"),
  939. strWageStartDate, strWageEndofDate);
  940. strFilter += strTemp;
  941. // case 193:查询数码工作记录;
  942. strTemp.Format(
  943. _T("([time8] >='%s' and [time8]<='%s' and [status4]='OK') or ")
  944. _T("([time9] >='%s' and [time9]<='%s' and [status6]='OK') or ")
  945. _T("([time10] >='%s' and [time10]<='%s' and [status5]='OK');"),
  946. strWageStartDate, strWageEndofDate,
  947. strWageStartDate, strWageEndofDate,
  948. strWageStartDate, strWageEndofDate);
  949. strFilter += strTemp;
  950. // 7. case 146:计件式提成比例;
  951. strFilter += _T(";");
  952. g_sendhead.code[0] = 34;
  953. g_sendhead.code[1] = 242;
  954. g_sendhead.code[2] = 243;
  955. g_sendhead.code[3] = 198;
  956. g_sendhead.code[4] = 142;
  957. g_sendhead.code[5] = 192;
  958. g_sendhead.code[6] = 193;
  959. g_sendhead.code[7] = 146;
  960. g_sendhead.tabcount = 8;
  961. g_sendhead.bsql = FALSE;
  962. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  963. if ( !g_bSendOK )
  964. return FALSE;
  965. ClearStaffWageData();
  966. DataToArray(&m_AryStaffDetail, &m_AryReceiptRecords, &m_AryOrderDetail, &m_AryOtherIncomeRecord, &m_AryMyWorkRecord, &m_ArySceneryWorkRecord, &m_AryDigitalWorkRecord, &m_AryWorkrate);
  967. #ifdef _DEBUG
  968. WriteTextLog(_T("-----------------------------所有员工-----------------------------\n"));
  969. int nSize = m_AryReceiptRecords.GetSize();
  970. for (int i = 0; i < nSize; i++ )
  971. {
  972. WriteTextLog(_T("\n"));
  973. for ( int j = 0; j < m_AryReceiptRecords.ElementAt(i).GetSize(); j++ )
  974. {
  975. WriteTextLog(_T("%s"), m_AryReceiptRecords.ElementAt(i).ElementAt(j));
  976. }
  977. }
  978. #endif
  979. return TRUE;
  980. }
  981. BOOL CStaffWage::GetEarlyResults(IN CString strStaffName, IN CArray<CStringArray, CStringArray>& AryEarlyResult)
  982. {
  983. INT i = 0;
  984. INT nSize = m_AryReceiptRecords.GetSize();
  985. if (nSize == 0 )
  986. return FALSE;
  987. AryEarlyResult.RemoveAll();
  988. AryEarlyResult.SetSize(nSize*20, 1);
  989. INT nIndex = -1;
  990. INT nArypos = 0;
  991. CString strMoney;
  992. BOOL bPhotographer,bMakeupArtist;
  993. FLOAT fPhotographer, fMakeupArtist;
  994. BOOL bSalesperson1,bSalesperson2;
  995. FLOAT fbSalesperson1Percent, fbSalesperson2Percent;
  996. m_AryWageType.RemoveAll();
  997. m_AryWageTypeMoney.RemoveAll();
  998. #ifdef _DEBUG
  999. WriteTextLog(_T("-----------------员工:%s的业绩内容-----------------\n"), strStaffName);
  1000. #endif
  1001. for ( i = 0; i < nSize; i++ )
  1002. {
  1003. // 前期业绩;
  1004. if ( m_AryReceiptRecords.ElementAt(i).ElementAt(5) == _T("3") || m_AryReceiptRecords.ElementAt(i).ElementAt(5) == _T("4"))
  1005. {
  1006. fPhotographer = fMakeupArtist = 0.0;
  1007. bPhotographer = bMakeupArtist = FALSE;
  1008. // 1.这笔收款,员工是否有摄影+化妆服务项;
  1009. if ( m_AryReceiptRecords.ElementAt(i).ElementAt(9) == _T("OK") && m_AryReceiptRecords.ElementAt(i).ElementAt(10) >= m_strWageStartDate && m_AryReceiptRecords.ElementAt(i).ElementAt(10) <= m_strWageEndofDate )
  1010. {
  1011. GetPhotographerAndMakeupArtistServeRecord(strStaffName, m_AryReceiptRecords.ElementAt(i).ElementAt(0), bPhotographer, bMakeupArtist, fPhotographer, fMakeupArtist);
  1012. // ElementAt(56):工资设置:摄影师也有前期提成;
  1013. if ( _tstoi(g_cominfoarray.ElementAt(0).ElementAt(56)) && bPhotographer )
  1014. {// 摄影前期;
  1015. // 按提成百分比计算;
  1016. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fPhotographer);
  1017. // 累加前期业绩;
  1018. m_fEaryResultMoney += _tstof(strMoney);
  1019. // 累加摄影工资类型金额;
  1020. if ( (nIndex = FindArray(&m_AryWageType, WAGE_EARLY_PHOTOGRAPHER)) == -1 )
  1021. {
  1022. m_AryWageType.Add(WAGE_EARLY_PHOTOGRAPHER);
  1023. m_AryWageTypeMoney.Add(_tstof(strMoney));
  1024. }
  1025. else
  1026. {
  1027. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  1028. }
  1029. // 保存该类型工资记录;
  1030. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  1031. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  1032. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(10)); // 工资日期;
  1033. AryEarlyResult.ElementAt(nArypos).Add(WAGE_EARLY_PHOTOGRAPHER); // 工资类型;
  1034. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  1035. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  1036. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  1037. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  1038. nArypos++;
  1039. #ifdef _DEBUG
  1040. WriteTextLog(_T("摄影前期:%s,%s,%s,%s,%s,%s,%s"),
  1041. strMoney,
  1042. m_AryReceiptRecords.ElementAt(i).ElementAt(10),
  1043. WAGE_EARLY_PHOTOGRAPHER,
  1044. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  1045. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  1046. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  1047. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  1048. #endif
  1049. }
  1050. // ElementAt(57):工资设置:化妆师也有前期提成;
  1051. if ( _tstoi(g_cominfoarray.ElementAt(0).ElementAt(57)) && bMakeupArtist )
  1052. {// 化妆前期;
  1053. // 按提成百分比计算;
  1054. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fMakeupArtist);
  1055. // 累加前期业绩;
  1056. m_fEaryResultMoney += _tstof(strMoney);
  1057. // 累加摄影工资类型金额;
  1058. if ( (nIndex = FindArray(&m_AryWageType, WAGE_EARLY_MAKEUPARTIST)) == -1 )
  1059. {
  1060. m_AryWageType.Add(WAGE_EARLY_MAKEUPARTIST);
  1061. m_AryWageTypeMoney.Add(_tstof(strMoney));
  1062. }
  1063. else
  1064. {
  1065. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  1066. }
  1067. // 保存该类型工资记录;
  1068. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  1069. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  1070. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(10)); // 工资日期;
  1071. AryEarlyResult.ElementAt(nArypos).Add(WAGE_EARLY_MAKEUPARTIST); // 工资类型;
  1072. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  1073. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  1074. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  1075. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  1076. nArypos++;
  1077. #ifdef _DEBUG
  1078. WriteTextLog(_T("化妆前期:%s,%s,%s,%s,%s,%s,%s"),
  1079. strMoney,
  1080. m_AryReceiptRecords.ElementAt(i).ElementAt(10),
  1081. WAGE_EARLY_MAKEUPARTIST,
  1082. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  1083. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  1084. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  1085. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  1086. #endif
  1087. }
  1088. }
  1089. // 2.这笔收款,员工是否有门市服务项;
  1090. if ( m_AryReceiptRecords.ElementAt(i).ElementAt(7) >= m_strWageStartDate && m_AryReceiptRecords.ElementAt(i).ElementAt(7) <= m_strWageEndofDate )
  1091. {
  1092. bSalesperson1 = bSalesperson2 = 0.0;
  1093. fbSalesperson1Percent = fbSalesperson2Percent = FALSE;
  1094. GetSalesServerRecord(strStaffName, m_AryReceiptRecords.ElementAt(i).ElementAt(0), bSalesperson1, bSalesperson2, fbSalesperson1Percent, fbSalesperson2Percent);
  1095. if ( bSalesperson1 )
  1096. {// 主门市;
  1097. // 按提成百分比计算;
  1098. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fbSalesperson1Percent);
  1099. // 累加前期业绩;
  1100. m_fEaryResultMoney += _tstof(strMoney);
  1101. // 累加门市类型金额;
  1102. if ( (nIndex = FindArray(&m_AryWageType, WAGE_EARLY_SALES)) == -1 )
  1103. {
  1104. m_AryWageType.Add(WAGE_EARLY_SALES);
  1105. m_AryWageTypeMoney.Add(_tstof(strMoney));
  1106. }
  1107. else
  1108. {
  1109. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  1110. }
  1111. // 保存该类型工资记录;
  1112. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  1113. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  1114. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(7)); // 工资日期;
  1115. AryEarlyResult.ElementAt(nArypos).Add(WAGE_EARLY_SALES); // 工资类型;
  1116. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  1117. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  1118. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  1119. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  1120. nArypos++;
  1121. #ifdef _DEBUG
  1122. WriteTextLog(_T("主门市:%s,%s,%s,%s,%s,%s,%s"),
  1123. strMoney,
  1124. m_AryReceiptRecords.ElementAt(i).ElementAt(7),
  1125. WAGE_EARLY_SALES,
  1126. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  1127. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  1128. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  1129. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  1130. #endif
  1131. }
  1132. if ( bSalesperson2 )
  1133. {// 副门市;
  1134. // 按提成百分比计算;
  1135. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fbSalesperson2Percent);
  1136. // 累加前期业绩;
  1137. m_fEaryResultMoney += _tstof(strMoney);
  1138. // 累加门市类型金额;
  1139. if ( (nIndex = FindArray(&m_AryWageType, WAGE_EARLY_SALES)) == -1 )
  1140. {
  1141. m_AryWageType.Add(WAGE_EARLY_SALES);
  1142. m_AryWageTypeMoney.Add(_tstof(strMoney));
  1143. }
  1144. else
  1145. {
  1146. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  1147. }
  1148. // 保存该类型工资记录;
  1149. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  1150. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  1151. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(7)); // 工资日期;
  1152. AryEarlyResult.ElementAt(nArypos).Add(WAGE_EARLY_SALES); // 工资类型;
  1153. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  1154. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  1155. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  1156. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  1157. nArypos++;
  1158. #ifdef _DEBUG
  1159. WriteTextLog(_T("副门市:%s,%s,%s,%s,%s,%s,%s"),
  1160. strMoney,
  1161. m_AryReceiptRecords.ElementAt(i).ElementAt(7),
  1162. WAGE_EARLY_SALES,
  1163. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  1164. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  1165. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  1166. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  1167. #endif
  1168. }
  1169. }
  1170. }
  1171. // 选片二销;
  1172. else if ( m_AryReceiptRecords.ElementAt(i).ElementAt(12) == _T("选片二销") )
  1173. {
  1174. bPhotographer = bMakeupArtist = FALSE;
  1175. fPhotographer = fMakeupArtist = 0.0;
  1176. if ( m_AryReceiptRecords.ElementAt(i).ElementAt(9) == _T("OK") && m_AryReceiptRecords.ElementAt(i).ElementAt(10) >= m_strWageStartDate && m_AryReceiptRecords.ElementAt(i).ElementAt(10) <= m_strWageEndofDate )
  1177. {
  1178. GetPhotographerAndMakeupArtistServeRecord(strStaffName, m_AryReceiptRecords.ElementAt(i).ElementAt(0), bPhotographer, bMakeupArtist, fPhotographer, fMakeupArtist);
  1179. // ElementAt(41):工资设置:摄影师也有选片二销提成;
  1180. if ( _tstoi(g_cominfoarray.ElementAt(0).ElementAt(41)) && bPhotographer )
  1181. {
  1182. // 按提成百分比计算;
  1183. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fPhotographer);
  1184. // 累加选片二销业绩;
  1185. m_fSelectMoney += _tstof(strMoney);
  1186. // 累加摄影也有选片二销工资类型金额;
  1187. if ( (nIndex = FindArray(&m_AryWageType, WAGE_SEL_PHOTOGRAPHER)) == -1 )
  1188. {
  1189. m_AryWageType.Add(WAGE_SEL_PHOTOGRAPHER);
  1190. m_AryWageTypeMoney.Add(_tstof(strMoney));
  1191. }
  1192. else
  1193. {
  1194. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  1195. }
  1196. // 保存该类型工资记录;
  1197. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  1198. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(10)); // 工资日期;
  1199. AryEarlyResult.ElementAt(nArypos).Add(WAGE_SEL_PHOTOGRAPHER); // 工资类型;
  1200. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  1201. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  1202. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  1203. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  1204. nArypos++;
  1205. #ifdef _DEBUG
  1206. WriteTextLog(_T("摄影师选片二销:%s,%s,%s,%s,%s,%s,%s"),
  1207. strMoney,
  1208. m_AryReceiptRecords.ElementAt(i).ElementAt(10),
  1209. WAGE_SEL_PHOTOGRAPHER,
  1210. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  1211. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  1212. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  1213. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  1214. #endif
  1215. }
  1216. // ElementAt(42):工资设置:化妆师或引导师也有选片二销提成;
  1217. if ( _tstoi(g_cominfoarray.ElementAt(0).ElementAt(42)) && bMakeupArtist )
  1218. {
  1219. // 按提成百分比计算;
  1220. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) * fMakeupArtist);
  1221. // 累加选片二销业绩;
  1222. m_fSelectMoney += _tstof(strMoney);
  1223. // 累加化妆也有选片二销工资类型金额;
  1224. if ( (nIndex = FindArray(&m_AryWageType, WAGE_SEL_MAKEUPARTIST)) == -1 )
  1225. {
  1226. m_AryWageType.Add(WAGE_SEL_MAKEUPARTIST);
  1227. m_AryWageTypeMoney.Add(_tstof(strMoney));
  1228. }
  1229. else
  1230. {
  1231. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  1232. }
  1233. // 保存该类型工资记录;
  1234. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  1235. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(10)); // 工资日期;
  1236. AryEarlyResult.ElementAt(nArypos).Add(WAGE_SEL_MAKEUPARTIST); // 工资类型;
  1237. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  1238. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  1239. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  1240. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  1241. nArypos++;
  1242. #ifdef _DEBUG
  1243. WriteTextLog(_T("化妆师选片二销:%s,%s,%s,%s,%s,%s,%s"),
  1244. strMoney,
  1245. m_AryReceiptRecords.ElementAt(i).ElementAt(10),
  1246. WAGE_SEL_MAKEUPARTIST,
  1247. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  1248. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  1249. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  1250. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  1251. #endif
  1252. }
  1253. }
  1254. // 这笔收款,员工是否还是本次选片二销的选片师;
  1255. if ( strStaffName == m_AryReceiptRecords.ElementAt(i).ElementAt(11) && m_AryReceiptRecords.ElementAt(i).ElementAt(7) >= m_strWageStartDate && m_AryReceiptRecords.ElementAt(i).ElementAt(7) <= m_strWageEndofDate)
  1256. {
  1257. // 按提成百分比计算;
  1258. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)) );
  1259. // 累加选片二销业绩;
  1260. m_fSelectMoney += _tstof(strMoney);
  1261. // 累加化妆也有选片二销工资类型金额;
  1262. if ( (nIndex = FindArray(&m_AryWageType, WAGE_SEL_SALES)) == -1 )
  1263. {
  1264. m_AryWageType.Add(WAGE_SEL_SALES);
  1265. m_AryWageTypeMoney.Add(_tstof(strMoney));
  1266. }
  1267. else
  1268. {
  1269. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  1270. }
  1271. // 保存该类型工资记录;
  1272. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  1273. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  1274. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(7)); // 工资日期;
  1275. AryEarlyResult.ElementAt(nArypos).Add(WAGE_SEL_SALES); // 工资类型;
  1276. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  1277. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  1278. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  1279. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  1280. nArypos++;
  1281. #ifdef _DEBUG
  1282. WriteTextLog(_T("本身选片二销:%s,%s,%s,%s,%s,%s,%s"),
  1283. strMoney,
  1284. m_AryReceiptRecords.ElementAt(i).ElementAt(7),
  1285. WAGE_SEL_SALES,
  1286. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  1287. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  1288. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  1289. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  1290. #endif
  1291. }
  1292. }
  1293. // 其他订单二销;
  1294. else
  1295. {
  1296. // 这笔收款,员工是否还是本次其他订单二销的促成者;
  1297. if ( strStaffName == m_AryReceiptRecords.ElementAt(i).ElementAt(11) && m_AryReceiptRecords.ElementAt(i).ElementAt(7) >= m_strWageStartDate && m_AryReceiptRecords.ElementAt(i).ElementAt(7) <= m_strWageEndofDate)
  1298. {
  1299. // 获取提成;
  1300. strMoney.Format(_T("%0.2f"), _tstof(m_AryReceiptRecords.ElementAt(i).ElementAt(6)));
  1301. // 累加选片二销业绩;
  1302. m_fSelectMoney += _tstof(strMoney);
  1303. // 累加化妆也有选片二销工资类型金额;
  1304. if ( (nIndex = FindArray(&m_AryWageType, m_AryReceiptRecords.ElementAt(i).ElementAt(12))) == -1 )
  1305. {
  1306. m_AryWageType.Add(m_AryReceiptRecords.ElementAt(i).ElementAt(12));
  1307. m_AryWageTypeMoney.Add(_tstof(strMoney));
  1308. }
  1309. else
  1310. {
  1311. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  1312. }
  1313. // 保存该类型工资记录;
  1314. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  1315. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  1316. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(7)); // 工资日期;
  1317. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(12)); // 工资类型;
  1318. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  1319. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(2)); // 顾客2姓名;
  1320. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(3)); // 套系类型;
  1321. AryEarlyResult.ElementAt(nArypos).Add(m_AryReceiptRecords.ElementAt(i).ElementAt(13)); // 付款方式;
  1322. nArypos++;
  1323. #ifdef _DEBUG
  1324. WriteTextLog(_T("其他订单二销:%s,%s,%s,%s,%s,%s,%s"),
  1325. strMoney,
  1326. m_AryReceiptRecords.ElementAt(i).ElementAt(7),
  1327. m_AryReceiptRecords.ElementAt(i).ElementAt(12),
  1328. m_AryReceiptRecords.ElementAt(i).ElementAt(1),
  1329. m_AryReceiptRecords.ElementAt(i).ElementAt(2),
  1330. m_AryReceiptRecords.ElementAt(i).ElementAt(3),
  1331. m_AryReceiptRecords.ElementAt(i).ElementAt(13));
  1332. #endif
  1333. }
  1334. }
  1335. }
  1336. // case 198:其他收入业绩(散客消费);
  1337. nSize = m_AryOtherIncomeRecord.GetSize();
  1338. #ifdef _DEBUG
  1339. if ( strStaffName == _T("李爱辉"))
  1340. for ( i = 0; i < nSize; i++ )
  1341. WriteTextLog(_T("散客消费全记录:%s,%s,%s,%s,%s,%s,%s,%s"),
  1342. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(0),
  1343. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(1),
  1344. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(2),
  1345. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3),
  1346. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(4),
  1347. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(5),
  1348. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(6),
  1349. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(7)
  1350. );
  1351. #endif
  1352. for ( i = 0; i < nSize; i++ )
  1353. {
  1354. // 收款人就是该员工,那这笔收入就是他产生的,计他提成;
  1355. if ( m_AryOtherIncomeRecord.ElementAt(i).ElementAt(2) == strStaffName && m_AryOtherIncomeRecord.ElementAt(i).ElementAt(5) >= m_strWageStartDate && m_AryOtherIncomeRecord.ElementAt(i).ElementAt(5) <= m_strWageEndofDate)
  1356. {
  1357. strMoney.Format(_T("%0.2f"), _tstof(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(4)));
  1358. // 累加化妆也有选片二销工资类型金额;
  1359. if ( (nIndex = FindArray(&m_AryWageType, m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3))) == -1 )
  1360. {
  1361. m_AryWageType.Add(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3));
  1362. m_AryWageTypeMoney.Add(_tstof(strMoney));
  1363. }
  1364. else
  1365. {
  1366. m_AryWageTypeMoney.SetAt(nIndex, m_AryWageTypeMoney.ElementAt(nIndex) + _tstof(strMoney));
  1367. }
  1368. // 保存该类型工资记录;
  1369. AryEarlyResult.ElementAt(nArypos).RemoveAll();
  1370. AryEarlyResult.ElementAt(nArypos).Add(strMoney); // 收款金额;
  1371. AryEarlyResult.ElementAt(nArypos).Add(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(5)); // 工资日期;
  1372. AryEarlyResult.ElementAt(nArypos).Add(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3)); // 工资类型;
  1373. AryEarlyResult.ElementAt(nArypos).Add(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(1)); // 顾客1姓名;
  1374. AryEarlyResult.ElementAt(nArypos).Add(_T("")); // 顾客2姓名;
  1375. AryEarlyResult.ElementAt(nArypos).Add(_T("")); // 套系类型;
  1376. AryEarlyResult.ElementAt(nArypos).Add(m_AryOtherIncomeRecord.ElementAt(i).ElementAt(7)); // 付款方式;
  1377. nArypos++;
  1378. #ifdef _DEBUG
  1379. WriteTextLog(_T("散客消费:%s,%s,%s,%s,%s,%s,%s"),
  1380. strMoney,
  1381. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(5),
  1382. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(3),
  1383. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(1),
  1384. _T(""),
  1385. _T(""),
  1386. m_AryOtherIncomeRecord.ElementAt(i).ElementAt(7));
  1387. #endif
  1388. }
  1389. }
  1390. AryEarlyResult.SetSize(nArypos);
  1391. AryEarlyResult.FreeExtra();
  1392. return FALSE;
  1393. }
  1394. FLOAT CStaffWage::GetStaffSignerWage(IN CString strSaffName)
  1395. {
  1396. FLOAT fStaffEarlyWage = 0.0;
  1397. INT nSize = m_AryWageType.GetSize();
  1398. for ( int i = 0; i < nSize; i++ )
  1399. {
  1400. if ( m_AryWageType.ElementAt(i) == WAGE_EARLY_SALES )
  1401. fStaffEarlyWage += m_AryWageTypeMoney.ElementAt(i);
  1402. }
  1403. return fStaffEarlyWage;
  1404. }
  1405. FLOAT CStaffWage::GetStaffPhotograhperMakeupArtistWage(IN CString strSaffName)
  1406. {
  1407. FLOAT fStaffEarlyWage = 0.0;
  1408. INT nSize = m_AryWageType.GetSize();
  1409. for ( int i = 0; i < nSize; i++ )
  1410. {
  1411. if (m_AryWageType.ElementAt(i) == WAGE_EARLY_MAKEUPARTIST || // 化妆前期;
  1412. m_AryWageType.ElementAt(i) == WAGE_EARLY_PHOTOGRAPHER ) // 摄影前期;
  1413. fStaffEarlyWage += m_AryWageTypeMoney.ElementAt(i);
  1414. }
  1415. return fStaffEarlyWage;
  1416. }
  1417. FLOAT CStaffWage::GetStaffLateWage(IN CString strStaffName, OUT FLOAT &fTotalMoney)
  1418. {
  1419. FLOAT fStaffLateWage = 0.0;
  1420. INT nSize = m_AryWageType.GetSize();
  1421. for ( int i = 0; i < nSize; i++ )
  1422. {
  1423. if ( m_AryWageType.ElementAt(i) == WAGE_EARLY_SALES ) continue; // 门市前期;
  1424. if ( m_AryWageType.ElementAt(i) == WAGE_EARLY_MAKEUPARTIST ) continue; // 化妆前期;
  1425. if( m_AryWageType.ElementAt(i) == WAGE_EARLY_PHOTOGRAPHER ) continue; // 摄影前期;
  1426. fTotalMoney += m_AryWageTypeMoney.ElementAt(i);
  1427. fStaffLateWage += GetSalaryFromRule(m_AryWageTypeMoney.ElementAt(i), GetRule(m_AryWageType.ElementAt(i)));
  1428. }
  1429. return fStaffLateWage;
  1430. }
  1431. FLOAT CStaffWage::GetStaffDigitalWage(IN CString strStaffName)
  1432. {
  1433. FLOAT fDigitalWage = 0.0;
  1434. CString strUnitPrice; // 单价;
  1435. CString strTotalMoney; // 总价;
  1436. BOOL bIsDigital = FALSE;
  1437. INT nSize = m_AryMyWorkRecord.GetSize();
  1438. for ( int i = 0; i < nSize; i++ )
  1439. {
  1440. bIsDigital = FALSE;
  1441. if ( m_AryMyWorkRecord.ElementAt(i).ElementAt(3) == strStaffName )
  1442. {
  1443. for ( int n = 0; n < m_AryWorkrate.GetSize(); n++ )
  1444. {
  1445. if ( _T("数码师") == m_AryWorkrate.ElementAt(n).ElementAt(0) &&
  1446. m_AryMyWorkRecord.ElementAt(i).ElementAt(6) == m_AryWorkrate.ElementAt(n).ElementAt(1))
  1447. {
  1448. strUnitPrice = m_AryWorkrate.ElementAt(n).ElementAt(2);
  1449. bIsDigital = TRUE;
  1450. break;
  1451. }
  1452. }
  1453. if ( !bIsDigital )
  1454. strUnitPrice = _T("0");
  1455. // ElementAt(5):数量;
  1456. strTotalMoney.Format(_T("%0.2f"), _tstof(m_AryMyWorkRecord.ElementAt(i).ElementAt(5))*_tstof(strUnitPrice));
  1457. fDigitalWage += _tstof(strTotalMoney);
  1458. }
  1459. }
  1460. return fDigitalWage;
  1461. }
  1462. FLOAT CStaffWage::GetStaffTotalWage(IN CString strStaffName)
  1463. {
  1464. // 员工总工资;
  1465. FLOAT fStaffTotalWage = 0.0;
  1466. return fStaffTotalWage;
  1467. }
  1468. #endif