DinDanForm.cpp 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181
  1. // DinDanForm.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "DinDanForm.h"
  6. #include "MyMdi.H"
  7. #include "VcPlot.h"
  8. #include "VcAxis.h"
  9. #include "VcValueScale.h"
  10. #include "VcSeriesCollection.h"
  11. #include "VcSeries.h"
  12. #include "VcPen.h"
  13. #include "VcCategoryScale.h"
  14. #include "VcColor.h"
  15. #include "VcDataGrid.h"
  16. #include "VcBackdrop.h"
  17. #include "VcFill.h"
  18. #include "VcBrush.h"
  19. #include "VcDataPoints.h"
  20. #include "VcDataPoint.h"
  21. #include "VcDataPointLabel.h"
  22. #include "VcAxisTitle.h"
  23. #include "ShowMschart.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // DinDanForm IDC_RADIO25
  31. IMPLEMENT_DYNCREATE(DinDanForm, MyFormView)
  32. DinDanForm::DinDanForm()
  33. : MyFormView(DinDanForm::IDD)
  34. {
  35. //{{AFX_DATA_INIT(DinDanForm)
  36. m_year = atoi(g_date.Mid(0, 4));
  37. m_month = atoi(g_date.Mid(5, 2));
  38. m_day = atoi(g_date.Mid(8, 2));
  39. m_radio1 = 0;
  40. m_radio2 = 1;
  41. m_bInit = 0;
  42. m_taoxipos = 0;
  43. m_check1 = FALSE;
  44. m_pchild = NULL;
  45. //}}AFX_DATA_INIT
  46. }
  47. DinDanForm::~DinDanForm()
  48. {
  49. if (m_pchild)
  50. {
  51. m_pchild->DestroyWindow();
  52. delete m_pchild;
  53. m_pchild = NULL;
  54. }
  55. }
  56. void DinDanForm::DoDataExchange(CDataExchange* pDX)
  57. {
  58. MyFormView::DoDataExchange(pDX);
  59. //{{AFX_DATA_MAP(DinDanForm)
  60. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  61. DDX_Control(pDX, IDC_SPIN3, m_spinday);
  62. DDX_Control(pDX, IDC_SPIN2, m_spinmonth);
  63. DDX_Control(pDX, IDC_SPIN1, m_spinyear);
  64. DDX_Control(pDX, IDC_STATIC1, m_static1);
  65. DDX_Text(pDX, IDC_EDITyear, m_year);
  66. DDV_MinMaxUInt(pDX, m_year, 1900, 3000);
  67. DDX_Text(pDX, IDC_EDITmonth, m_month);
  68. DDV_MinMaxUInt(pDX, m_month, 1, 12);
  69. DDX_Text(pDX, IDC_EDITday, m_day);
  70. DDV_MinMaxUInt(pDX, m_day, 1, 31);
  71. DDX_Radio(pDX, IDC_RADIO3, m_radio1);
  72. DDX_Control(pDX, IDC_MSCHART3, m_Chart3);
  73. DDX_Radio(pDX, IDC_RADIO6, m_radio2);
  74. DDX_Check(pDX, IDC_CHECK1, m_check1);
  75. //}}AFX_DATA_MAP
  76. }
  77. BEGIN_MESSAGE_MAP(DinDanForm, MyFormView)
  78. //{{AFX_MSG_MAP(DinDanForm)
  79. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  80. ON_EN_CHANGE(IDC_EDITyear, OnChangeEDITyear)
  81. ON_EN_CHANGE(IDC_EDITmonth, OnChangeEDITmonth)
  82. ON_EN_CHANGE(IDC_EDITday, OnChangeEDITday)
  83. ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
  84. ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
  85. ON_BN_CLICKED(IDC_RADIO6, OnRadio6)
  86. ON_BN_CLICKED(IDC_RADIO7, OnRadio7)
  87. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  88. ON_BN_CLICKED(IDC_RADIO8, OnRadio8)
  89. ON_BN_CLICKED(IDC_RADIO10, OnRadio10)
  90. ON_BN_CLICKED(IDC_RADIO11, OnRadio11)
  91. ON_BN_CLICKED(IDC_RADIO12, OnRadio12)
  92. ON_BN_CLICKED(IDC_RADIO13, OnRadio13)
  93. ON_BN_CLICKED(IDC_RADIO24, OnRadio24)
  94. ON_BN_CLICKED(IDC_RADIO25, OnRadio25)
  95. ON_BN_CLICKED(IDC_CHECK1, OnCheck1)
  96. //}}AFX_MSG_MAP
  97. END_MESSAGE_MAP()
  98. /////////////////////////////////////////////////////////////////////////////
  99. // DinDanForm diagnostics
  100. #ifdef _DEBUG
  101. void DinDanForm::AssertValid() const
  102. {
  103. MyFormView::AssertValid();
  104. }
  105. void DinDanForm::Dump(CDumpContext& dc) const
  106. {
  107. MyFormView::Dump(dc);
  108. }
  109. #endif //_DEBUG
  110. /////////////////////////////////////////////////////////////////////////////
  111. // DinDanForm message handlers
  112. void DinDanForm::OnInitialUpdate()
  113. {
  114. MyFormView::OnInitialUpdate();
  115. // TODO: Add your specialized code here and/or call the base class
  116. if (!m_pchild)
  117. {
  118. m_pchild = new DinDanForm2;
  119. m_pchild->m_parent = (DWORD)this;
  120. m_pchild->m_pfilterarray = &m_filterarray;
  121. m_pchild->m_pfilterarray2 = &m_filterarray2;
  122. m_pchild->Create(IDD_DLGDinDanForm2, g_pMainWnd);
  123. }
  124. CRect rc;
  125. rc = g_rc;
  126. rc.left = 0;
  127. rc.right = g_rc.left;
  128. m_pchild->MoveWindow(rc);
  129. m_pchild->Init();
  130. m_pchild->ModeChange(m_radio1);
  131. // m_pchild->ShowWindow (SW_SHOW);
  132. #ifndef LKAY_VERSION
  133. GetDlgItem(IDC_RADIO11)->ShowWindow(0);
  134. #endif
  135. CMyMdi Mdi;
  136. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  137. // Here we create the outbar control using the splitter as its parent
  138. // and setting its id to the first pane.
  139. CRect rc2;
  140. GetWindowRect(rc2);
  141. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  142. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  143. m_static1.SetFont(&g_titlefont);
  144. m_spinyear.SetRange(1900, 3000);
  145. m_spinmonth.SetRange(1, 12);
  146. m_spinday.SetRange(1, 31);
  147. VARIANT var;
  148. ///////////////////////////
  149. m_Chart3.GetBackdrop().GetFill().SetStyle(1);
  150. m_Chart3.GetBackdrop().GetFill().GetBrush().GetFillColor().Set(255, 255, 255);
  151. m_Chart3.SetShowLegend(TRUE);
  152. m_Chart3.SetChartType(1);
  153. // 栈模式
  154. m_Chart3.SetStacking(FALSE);
  155. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1); // 不自动标注Y轴刻度
  156. m_Chart3.GetPlot().GetAxis(0, var).GetCategoryScale().SetAuto(0); // 不自动标注X轴刻度
  157. m_Chart3.GetPlot().GetAxis(0, var).GetCategoryScale().SetDivisionsPerLabel(1);// 每刻度一个标注
  158. m_Chart3.GetPlot().GetAxis(0, var).GetCategoryScale().SetDivisionsPerTick(1); // 每刻度一个刻度线
  159. m_Chart3.SetColumnCount(6);
  160. m_Chart3.SetColumn(1);
  161. m_Chart3.SetColumnLabel((LPCTSTR)"全部");
  162. m_Chart3.SetColumn(2);
  163. m_Chart3.SetColumnLabel((LPCTSTR)"婚纱照");
  164. m_Chart3.SetColumn(3);
  165. m_Chart3.SetColumnLabel((LPCTSTR)"写真照");
  166. m_Chart3.SetColumn(4);
  167. m_Chart3.SetColumnLabel((LPCTSTR)"宝宝照");
  168. m_Chart3.SetColumn(5);
  169. m_Chart3.SetColumnLabel((LPCTSTR)"全家福");
  170. m_Chart3.SetColumn(6);
  171. m_Chart3.SetColumnLabel((LPCTSTR)"情侣照");
  172. m_Chart3.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(255, 0, 0);
  173. m_Chart3.GetPlot().GetSeriesCollection().GetItem(2).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(0, 255, 0);
  174. m_Chart3.GetPlot().GetSeriesCollection().GetItem(3).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(0, 0, 255);
  175. m_Chart3.GetPlot().GetSeriesCollection().GetItem(4).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(0, 255, 255);
  176. m_Chart3.GetPlot().GetSeriesCollection().GetItem(5).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(255, 255, 0);
  177. m_Chart3.GetPlot().GetSeriesCollection().GetItem(6).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(255, 0, 255);
  178. // 线宽(对点线图有效)
  179. m_Chart3.GetPlot().GetSeriesCollection().GetItem(1).GetPen().SetWidth(30);
  180. m_Chart3.GetPlot().GetSeriesCollection().GetItem(2).GetPen().SetWidth(30);
  181. m_Chart3.GetPlot().GetSeriesCollection().GetItem(3).GetPen().SetWidth(30);
  182. m_Chart3.GetPlot().GetSeriesCollection().GetItem(4).GetPen().SetWidth(30);
  183. m_Chart3.GetPlot().GetSeriesCollection().GetItem(5).GetPen().SetWidth(30);
  184. m_Chart3.GetPlot().GetSeriesCollection().GetItem(6).GetPen().SetWidth(30);
  185. // 数据点类型显示数据值的模式(对柱柱状图和点线图有效)
  186. // 0: 不显示 1: 显示在柱状图外
  187. // 2: 显示在柱状图内上方 3: 显示在柱状图内中间 4: 显示在柱状图内下方
  188. m_Chart3.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  189. m_Chart3.GetPlot().GetSeriesCollection().GetItem(2).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  190. m_Chart3.GetPlot().GetSeriesCollection().GetItem(3).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  191. m_Chart3.GetPlot().GetSeriesCollection().GetItem(4).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  192. m_Chart3.GetPlot().GetSeriesCollection().GetItem(5).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  193. m_Chart3.GetPlot().GetSeriesCollection().GetItem(6).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  194. ////////////////
  195. GetDlgItem(IDC_STATIC2)->GetWindowRect(rc2);
  196. ScreenToClient(rc2);
  197. m_Chart3.MoveWindow(rc2);
  198. m_combo1.GetWindowRect(rc2);
  199. ScreenToClient(rc2);
  200. rc2.bottom += 300;
  201. m_combo1.MoveWindow(rc2);
  202. m_bInit = 1;
  203. DateChange();
  204. }
  205. void DinDanForm::FillGrid()
  206. {
  207. }
  208. void DinDanForm::OnBUTclose()
  209. {
  210. // TODO: Add your control notification handler code here
  211. GetParent()->SendMessage(WM_CLOSE);
  212. }
  213. void DinDanForm::OnChangeEDITyear()
  214. {
  215. // TODO: If this is a RICHEDIT control, the control will not
  216. // send this notification unless you override the MyFormView::OnInitDialog()
  217. // function and call CRichEditCtrl().SetEventMask()
  218. // with the ENM_CHANGE flag ORed into the mask.
  219. DateChange();
  220. // TODO: Add your control notification handler code here
  221. }
  222. void DinDanForm::OnChangeEDITmonth()
  223. {
  224. // TODO: If this is a RICHEDIT control, the control will not
  225. // send this notification unless you override the MyFormView::OnInitDialog()
  226. // function and call CRichEditCtrl().SetEventMask()
  227. // with the ENM_CHANGE flag ORed into the mask.
  228. // DateChange();
  229. // TODO: Add your control notification handler code here
  230. }
  231. void DinDanForm::OnChangeEDITday()
  232. {
  233. // TODO: If this is a RICHEDIT control, the control will not
  234. // send this notification unless you override the MyFormView::OnInitDialog()
  235. // function and call CRichEditCtrl().SetEventMask()
  236. // with the ENM_CHANGE flag ORed into the mask.
  237. // DateChange();
  238. // TODO: Add your control notification handler code here
  239. }
  240. void DinDanForm::OnRadio3()
  241. {
  242. // TODO: Add your control notification handler code here
  243. m_filterarray.RemoveAll();
  244. KindChange();
  245. // UpdateData();
  246. GetDlgItem(IDC_RADIO6)->ShowWindow(m_radio1 == 0 || m_radio1 == 7 || m_radio1 == 8);
  247. GetDlgItem(IDC_RADIO7)->ShowWindow(m_radio1 == 0 || m_radio1 == 7 || m_radio1 == 8);
  248. GetDlgItem(IDC_CHECK1)->ShowWindow(m_radio1 == 7 || m_radio1 == 1);
  249. GetDlgItem(IDC_RADIO12)->ShowWindow(m_radio1 == 4 || m_radio1 == 5 || m_radio1 == 6);
  250. GetDlgItem(IDC_RADIO13)->ShowWindow(m_radio1 == 4 || m_radio1 == 5 || m_radio1 == 6);
  251. if (m_radio1 == 4 || m_radio1 == 5 || m_radio1 == 6)
  252. GetDlgItem(IDC_COMBO1)->ShowWindow(0);
  253. else
  254. GetDlgItem(IDC_COMBO1)->ShowWindow(1);
  255. m_pchild->ModeChange(m_radio1);
  256. }
  257. void DinDanForm::OnRadio4()
  258. {
  259. // TODO: Add your control notification handler code here
  260. OnRadio3();
  261. }
  262. void DinDanForm::DateChange()
  263. {
  264. if (m_bInit == 0)
  265. return;
  266. m_spinyear.EnableWindow(0);
  267. m_spinmonth.EnableWindow(0);
  268. m_spinday.EnableWindow(0);
  269. UpdateData();
  270. int i;
  271. int g_nYearposTemp = g_nYearpos;
  272. BOOL bLastYear = 0;
  273. BOOL bThisYear = 0;
  274. #if JEFF_TEST_ON // 2015开始禁用跨年数据;
  275. int g_nYearposPre = -1;
  276. if (m_year >= 2014 && m_year <= atoi(g_date.Left(4)) && g_hisyeararray.GetSize())
  277. {
  278. g_nYearpos = -1;
  279. bThisYear = 1;
  280. if (m_year == 2014)
  281. {
  282. g_nYearposPre = GetYearPos(m_year - 1);
  283. }
  284. }
  285. else if (m_year <= 2013 && g_hisyeararray.GetSize())
  286. {
  287. g_nYearpos = GetYearPos(m_year);
  288. if (g_nYearpos != -1)
  289. g_nYearposPre = GetYearPos(m_year - 1);
  290. bLastYear = 1;
  291. }
  292. #else
  293. if (m_year == atoi(g_date.Left(4)) && g_hisyeararray.GetSize())
  294. bThisYear = 1;
  295. else if (m_year <= atoi(g_date.Left(4)) - 1 && g_hisyeararray.GetSize())
  296. bLastYear = 1;
  297. g_nYearpos = GetYearPos(m_year);
  298. #endif
  299. g_sendhead.bsql = 0;
  300. g_sendhead.code[0] = 172;
  301. g_sendhead.code[1] = 59;
  302. g_sendhead.tabcount = 2;
  303. CString sql, strdate, strdate2;
  304. strdate.Format("%04d-%02d-%02d", m_year, 1, 1);
  305. strdate2.Format("%04d-%02d-%02d", m_year, 12, 31);
  306. CRect rc;
  307. m_static1.GetWindowRect(rc);
  308. ScreenToClient(rc);
  309. InvalidateRect(rc);
  310. m_static1.SetWindowText(strdate.Left(4) + "订单图表");
  311. sql.Format("time1>='" + strdate + "' and time1<='" + strdate2 + "';[date]>='" + strdate + "' and [date]<='" + strdate2 + "'");
  312. g_pMainWnd->ProcessChatMessageRequest2(sql);
  313. if (g_bSendOK == 0)
  314. {
  315. g_nYearpos = g_nYearposTemp;
  316. m_spinyear.EnableWindow(1);
  317. m_spinmonth.EnableWindow(1);
  318. m_spinday.EnableWindow(1);
  319. return;
  320. }
  321. DataToArray(&m_dindanarray, &m_moneyarray);
  322. if (bLastYear)//如果是去年, 则加今年的补款
  323. {
  324. g_nYearpos = -1;//今年
  325. g_sendhead.bsql = 0;
  326. g_sendhead.code[0] = 172;
  327. g_sendhead.code[1] = 59;
  328. g_sendhead.tabcount = 2;
  329. CString sql, strdate, strdate2;
  330. strdate.Format("%04d-%02d-%02d", m_year, 1, 1);
  331. strdate2.Format("%04d-%02d-%02d", m_year, 12, 31);
  332. sql.Format("time1>='" + strdate + "' and time1<='" + strdate2 + "';[date]>='" + strdate + "' and [date]<='" + strdate2 + "'");
  333. g_pMainWnd->ProcessChatMessageRequest2(sql);
  334. if (g_bSendOK == 0)
  335. {
  336. g_nYearpos = g_nYearposTemp;
  337. m_spinyear.EnableWindow(1);
  338. m_spinmonth.EnableWindow(1);
  339. m_spinday.EnableWindow(1);
  340. return;
  341. }
  342. CArray<CStringArray, CStringArray>ThisYearm_dindanarray;
  343. CArray<CStringArray, CStringArray>ThisYearm_moneyarray;
  344. DataToArray(&ThisYearm_dindanarray, &ThisYearm_moneyarray);
  345. int oldsize = m_dindanarray.GetSize();
  346. int newsize = ThisYearm_dindanarray.GetSize();
  347. m_dindanarray.SetSize(oldsize + ThisYearm_dindanarray.GetSize());
  348. for (i = oldsize; i < oldsize + ThisYearm_dindanarray.GetSize(); i++)
  349. {
  350. m_dindanarray.ElementAt(i).Copy(ThisYearm_dindanarray.ElementAt(i - oldsize));
  351. }
  352. oldsize = m_moneyarray.GetSize();
  353. newsize = ThisYearm_moneyarray.GetSize();
  354. m_moneyarray.SetSize(oldsize + ThisYearm_moneyarray.GetSize());
  355. for (i = oldsize; i < oldsize + ThisYearm_moneyarray.GetSize(); i++)
  356. {
  357. m_moneyarray.ElementAt(i).Copy(ThisYearm_moneyarray.ElementAt(i - oldsize));
  358. }
  359. }
  360. else if (bThisYear)//如果是今年, 则加去年的补款
  361. {
  362. g_nYearpos = 0;//去年
  363. g_sendhead.bsql = 0;
  364. g_sendhead.code[0] = 172;
  365. g_sendhead.code[1] = 59;
  366. g_sendhead.tabcount = 2;
  367. CString sql, strdate, strdate2;
  368. strdate.Format("%04d-%02d-%02d", m_year, 1, 1);
  369. strdate2.Format("%04d-%02d-%02d", m_year, 12, 31);
  370. sql.Format("time1>='" + strdate + "' and time1<='" + strdate2 + "';[date]>='" + strdate + "' and [date]<='" + strdate2 + "'");
  371. g_pMainWnd->ProcessChatMessageRequest2(sql);
  372. if (g_bSendOK == 0)
  373. {
  374. g_nYearpos = g_nYearposTemp;
  375. m_spinyear.EnableWindow(1);
  376. m_spinmonth.EnableWindow(1);
  377. m_spinday.EnableWindow(1);
  378. return;
  379. }
  380. CArray<CStringArray, CStringArray>ThisYearm_dindanarray;
  381. CArray<CStringArray, CStringArray>ThisYearm_moneyarray;
  382. DataToArray(&ThisYearm_dindanarray, &ThisYearm_moneyarray);
  383. int oldsize = m_dindanarray.GetSize();
  384. int newsize = ThisYearm_dindanarray.GetSize();
  385. m_dindanarray.SetSize(oldsize + ThisYearm_dindanarray.GetSize());
  386. for (i = oldsize; i < oldsize + ThisYearm_dindanarray.GetSize(); i++)
  387. {
  388. m_dindanarray.ElementAt(i).Copy(ThisYearm_dindanarray.ElementAt(i - oldsize));
  389. }
  390. oldsize = m_moneyarray.GetSize();
  391. newsize = ThisYearm_moneyarray.GetSize();
  392. m_moneyarray.SetSize(oldsize + ThisYearm_moneyarray.GetSize());
  393. for (i = oldsize; i < oldsize + ThisYearm_moneyarray.GetSize(); i++)
  394. {
  395. m_moneyarray.ElementAt(i).Copy(ThisYearm_moneyarray.ElementAt(i - oldsize));
  396. }
  397. }
  398. g_nYearpos = g_nYearposTemp;
  399. m_filterarray.RemoveAll();
  400. KindChange();
  401. m_spinyear.EnableWindow(1);
  402. m_spinmonth.EnableWindow(1);
  403. m_spinday.EnableWindow(1);
  404. CStringArray m_typearray;
  405. CStringArray m_txnamearray;
  406. for (i = 0; i < m_dindanarray.GetSize(); i++)
  407. {
  408. if (::FindArray(&m_typearray, m_dindanarray.ElementAt(i).ElementAt(0)) == -1)
  409. m_typearray.Add(m_dindanarray.ElementAt(i).ElementAt(0));
  410. if (::FindArray(&m_txnamearray, m_dindanarray.ElementAt(i).ElementAt(7)) == -1)
  411. m_txnamearray.Add(m_dindanarray.ElementAt(i).ElementAt(7));
  412. }
  413. m_combo1.ResetContent();
  414. m_combo1.AddString("---全部---");
  415. m_combo1.AddString("---按套系类别---");
  416. for (i = 0; i < m_typearray.GetSize(); i++)
  417. {
  418. m_combo1.AddString(m_typearray.ElementAt(i));
  419. }
  420. m_taoxipos = m_combo1.GetCount();
  421. m_combo1.AddString("---按套系名称---");
  422. for (i = 0; i < m_txnamearray.GetSize(); i++)
  423. {
  424. m_combo1.AddString(m_txnamearray.ElementAt(i));
  425. }
  426. }
  427. void DinDanForm::KindChange2()
  428. {
  429. // UpdateData();
  430. int i;
  431. if (m_filterarray.GetSize() == 0)
  432. {
  433. CStringArray m_typearray;
  434. m_typearray.Add("应付");
  435. m_typearray.Add("前期");
  436. m_typearray.Add("后期");
  437. m_typearray.Add("已付");
  438. m_typearray.Add("欠款");
  439. m_pchild->TypeChange(&m_typearray);
  440. return;
  441. }
  442. m_Chart3.SetColumnCount(m_filterarray.GetSize());
  443. VARIANT var;
  444. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  445. COLORREF col[10] = { \
  446. RGB(0, 0, 255), \
  447. RGB(0, 255, 255), \
  448. RGB(255, 0, 255), \
  449. RGB(0, 255, 0), \
  450. RGB(255, 0, 0), \
  451. RGB(255, 255, 0), \
  452. RGB(127, 0, 0), \
  453. RGB(0, 127, 0), \
  454. RGB(0, 0, 127), \
  455. RGB(127, 127, 0)
  456. };
  457. for (i = 0; i < m_filterarray.GetSize(); i++)
  458. {
  459. m_Chart3.SetColumn(i + 1);
  460. m_Chart3.SetColumnLabel((LPCTSTR)m_filterarray.ElementAt(i));
  461. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  462. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  463. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  464. }
  465. float dindandata1[5][12] = { 0 };
  466. float dindandatacot[12] = { 0 };
  467. for (i = 0; i < 5; i++)
  468. {
  469. for (int j = 0; j < 12; j++)
  470. {
  471. dindandata1[i][j] = 0;
  472. }
  473. }
  474. CString stryear[12] = { "1月", \
  475. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  476. CString type;
  477. int selpos = m_combo1.GetCurSel();
  478. if (selpos != -1)
  479. m_combo1.GetLBText(selpos, type);
  480. if (selpos == -1 || type.IsEmpty() || type == "---全部---" || type == "---按套系类别---" || type == "---按套系名称---")
  481. {
  482. for (i = 0; i < m_dindanarray.GetSize(); i++)
  483. {
  484. dindandatacot[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += 1.0;
  485. dindandata1[0][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[0][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(2));
  486. dindandata1[1][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[1][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(3));
  487. dindandata1[2][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[2][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(4));
  488. dindandata1[3][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[3][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(5));
  489. dindandata1[4][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[4][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(6));
  490. }
  491. }
  492. else if (selpos > m_taoxipos)
  493. {
  494. for (i = 0; i < m_dindanarray.GetSize(); i++)
  495. {
  496. if (m_dindanarray.ElementAt(i).ElementAt(7) != type)continue;
  497. dindandatacot[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += 1.0;
  498. dindandata1[0][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[0][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(2));
  499. dindandata1[1][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[1][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(3));
  500. dindandata1[2][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[2][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(4));
  501. dindandata1[3][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[3][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(5));
  502. dindandata1[4][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[4][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(6));
  503. }
  504. }
  505. else
  506. {
  507. for (i = 0; i < m_dindanarray.GetSize(); i++)
  508. {
  509. if (m_dindanarray.ElementAt(i).ElementAt(0) != type)continue;
  510. dindandatacot[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += 1.0;
  511. dindandata1[0][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[0][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(2));
  512. dindandata1[1][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[1][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(3));
  513. dindandata1[2][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[2][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(4));
  514. dindandata1[3][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[3][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(5));
  515. dindandata1[4][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[4][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_dindanarray.ElementAt(i).ElementAt(6));
  516. }
  517. }
  518. int nRowCount = 12;// VARIANT var;
  519. m_Chart3.SetRowCount(nRowCount);
  520. float ftemp;
  521. for (int row = 1; row <= nRowCount; ++row)
  522. {
  523. m_Chart3.SetRow(row);
  524. m_Chart3.SetRowLabel(stryear[row - 1]);
  525. for (int j = 0; j < m_filterarray.GetSize(); j++)
  526. {
  527. if (m_check1)
  528. m_Chart3.GetDataGrid().SetData(row, j + 1, (int)(dindandata1[j][row - 1] / dindandatacot[row - 1]), 0);
  529. else
  530. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  531. }
  532. }
  533. m_Chart3.Refresh();
  534. }
  535. void DinDanForm::KindChange3()
  536. {
  537. m_Chart3.SetColumnCount(1);
  538. m_Chart3.SetColumn(1);
  539. m_Chart3.SetColumnLabel((LPCTSTR)"平均折扣");
  540. m_Chart3.GetPlot().GetSeriesCollection().GetItem(1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(255, 0, 0);
  541. VARIANT var;
  542. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(0);
  543. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetMaximum(10);
  544. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetMinimum(0);
  545. float dindandata[12] = { 0 };
  546. int count[12] = { 0 };
  547. CString stryear[12] = { "1月", \
  548. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  549. CString str;
  550. int i;
  551. CString type;
  552. int selpos = m_combo1.GetCurSel();
  553. if (selpos != -1)
  554. m_combo1.GetLBText(selpos, type);
  555. if (selpos == -1 || type.IsEmpty() || type == "---全部---" || type == "---按套系类别---" || type == "---按套系名称---")
  556. {
  557. for (i = 0; i < m_dindanarray.GetSize(); i++)
  558. {
  559. if (atof(m_dindanarray.ElementAt(i).ElementAt(8)) > 0)
  560. {
  561. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_dindanarray.ElementAt(i).ElementAt(8));
  562. count[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  563. }
  564. }
  565. }
  566. else if (selpos > m_taoxipos)
  567. {
  568. for (i = 0; i < m_dindanarray.GetSize(); i++)
  569. {
  570. if (m_dindanarray.ElementAt(i).ElementAt(7) != type)continue;
  571. if (atof(m_dindanarray.ElementAt(i).ElementAt(8)) > 0)
  572. {
  573. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_dindanarray.ElementAt(i).ElementAt(8));
  574. count[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  575. }
  576. }
  577. }
  578. else
  579. {
  580. for (i = 0; i < m_dindanarray.GetSize(); i++)
  581. {
  582. if (m_dindanarray.ElementAt(i).ElementAt(0) != type)continue;
  583. if (atof(m_dindanarray.ElementAt(i).ElementAt(8)) > 0)
  584. {
  585. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_dindanarray.ElementAt(i).ElementAt(8));
  586. count[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  587. }
  588. }
  589. }
  590. /* for(int i=0; i<m_dindanarray.GetSize (); i++)
  591. {
  592. if(atof(m_dindanarray.ElementAt (i).ElementAt (8))>0)
  593. {
  594. dindandata[atoi(m_dindanarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(m_dindanarray.ElementAt (i).ElementAt (8));
  595. count[atoi(m_dindanarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]++;
  596. }
  597. }*/
  598. for (i = 0; i < 12; i++)
  599. {
  600. if (count[i])
  601. {
  602. str.Format("%0.1f", dindandata[i] / count[i]);
  603. dindandata[i] = atof(str);
  604. }
  605. }
  606. int nRowCount = 12;// VARIANT var;
  607. m_Chart3.SetRowCount(nRowCount);
  608. float ftemp;
  609. for (int row = 1; row <= nRowCount; ++row)
  610. {
  611. m_Chart3.SetRow(row);
  612. m_Chart3.SetRowLabel(stryear[row - 1]);
  613. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  614. }
  615. m_Chart3.Refresh();
  616. }
  617. void DinDanForm::KindChange4()
  618. {
  619. m_Chart3.SetColumnCount(2);
  620. COLORREF col[10] = { \
  621. RGB(255, 0, 0), \
  622. RGB(0, 255, 0), \
  623. RGB(255, 0, 255), \
  624. RGB(0, 255, 0), \
  625. RGB(255, 0, 0), \
  626. RGB(255, 255, 0), \
  627. RGB(127, 0, 0), \
  628. RGB(0, 127, 0), \
  629. RGB(0, 0, 127), \
  630. RGB(127, 127, 0)
  631. };
  632. CStringArray m_typearray;
  633. m_typearray.Add("选片率=选片/拍摄");
  634. m_typearray.Add("平均加选(张)");
  635. for (int i = 0; i < 2; i++)
  636. {
  637. m_Chart3.SetColumn(i + 1);
  638. m_Chart3.SetColumnLabel((LPCTSTR)m_typearray.ElementAt(i));
  639. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  640. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  641. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  642. }
  643. VARIANT var;
  644. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(0);
  645. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetMaximum(100);
  646. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetMinimum(0);
  647. float dindandata[12] = { 0 };
  648. float dindandata2[12] = { 0 };
  649. float choosezs[12] = { 0 };
  650. int count[12] = { 0 };
  651. CString stryear[12] = { "1月", \
  652. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  653. CString str;
  654. CString type;
  655. int selpos = m_combo1.GetCurSel();
  656. if (selpos != -1)
  657. m_combo1.GetLBText(selpos, type);
  658. if (selpos == -1 || type.IsEmpty() || type == "---全部---" || type == "---按套系类别---" || type == "---按套系名称---")
  659. {
  660. for (i = 0; i < m_dindanarray.GetSize(); i++)
  661. {
  662. if (m_dindanarray.ElementAt(i).ElementAt(12) == "OK")
  663. {
  664. if (atof(m_dindanarray.ElementAt(i).ElementAt(10)) > (atof(m_dindanarray.ElementAt(i).ElementAt(9)) + atof(m_dindanarray.ElementAt(i).ElementAt(11))))
  665. {
  666. choosezs[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_dindanarray.ElementAt(i).ElementAt(11));
  667. str.Format("%f", 100.0*(atof(m_dindanarray.ElementAt(i).ElementAt(9)) + atof(m_dindanarray.ElementAt(i).ElementAt(11))) / atof(m_dindanarray.ElementAt(i).ElementAt(10)));
  668. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(str);
  669. count[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  670. }
  671. }
  672. }
  673. }
  674. else if (selpos > m_taoxipos)
  675. {
  676. for (i = 0; i < m_dindanarray.GetSize(); i++)
  677. {
  678. if (m_dindanarray.ElementAt(i).ElementAt(7) != type)continue;
  679. if (m_dindanarray.ElementAt(i).ElementAt(12) == "OK")
  680. {
  681. if (atof(m_dindanarray.ElementAt(i).ElementAt(10)) > (atof(m_dindanarray.ElementAt(i).ElementAt(9)) + atof(m_dindanarray.ElementAt(i).ElementAt(11))))
  682. {
  683. choosezs[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_dindanarray.ElementAt(i).ElementAt(11));
  684. str.Format("%f", 100.0*(atof(m_dindanarray.ElementAt(i).ElementAt(9)) + atof(m_dindanarray.ElementAt(i).ElementAt(11))) / atof(m_dindanarray.ElementAt(i).ElementAt(10)));
  685. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(str);
  686. count[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  687. }
  688. }
  689. }
  690. }
  691. else
  692. {
  693. for (i = 0; i < m_dindanarray.GetSize(); i++)
  694. {
  695. if (m_dindanarray.ElementAt(i).ElementAt(0) != type)continue;
  696. if (m_dindanarray.ElementAt(i).ElementAt(12) == "OK")
  697. {
  698. if (atof(m_dindanarray.ElementAt(i).ElementAt(10)) > (atof(m_dindanarray.ElementAt(i).ElementAt(9)) + atof(m_dindanarray.ElementAt(i).ElementAt(11))))
  699. {
  700. choosezs[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_dindanarray.ElementAt(i).ElementAt(11));
  701. str.Format("%f", 100.0*(atof(m_dindanarray.ElementAt(i).ElementAt(9)) + atof(m_dindanarray.ElementAt(i).ElementAt(11))) / atof(m_dindanarray.ElementAt(i).ElementAt(10)));
  702. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(str);
  703. count[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  704. }
  705. }
  706. }
  707. }
  708. /* for( i=0; i<m_dindanarray.GetSize (); i++)
  709. {
  710. if(m_dindanarray.ElementAt (i).ElementAt (12)=="OK")
  711. {
  712. if(atof(m_dindanarray.ElementAt (i).ElementAt (10))>(atof(m_dindanarray.ElementAt (i).ElementAt (9))+atof(m_dindanarray.ElementAt (i).ElementAt (11))))
  713. {
  714. choosezs[atoi(m_dindanarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(m_dindanarray.ElementAt (i).ElementAt (11));
  715. str.Format ("%f", 100.0*(atof(m_dindanarray.ElementAt (i).ElementAt (9))+atof(m_dindanarray.ElementAt (i).ElementAt (11)))/atof(m_dindanarray.ElementAt (i).ElementAt (10)) );
  716. dindandata[atoi(m_dindanarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(str);
  717. count[atoi(m_dindanarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]++;
  718. }
  719. }
  720. }*/
  721. for (i = 0; i < 12; i++)
  722. {
  723. if (count[i])
  724. {
  725. str.Format("%0.1f", dindandata[i] / count[i]);
  726. dindandata[i] = atof(str);
  727. str.Format("%0.1f", choosezs[i] / count[i]);
  728. dindandata2[i] = atof(str);
  729. }
  730. }
  731. int nRowCount = 12;// VARIANT var;
  732. m_Chart3.SetRowCount(nRowCount);
  733. float ftemp;
  734. for (int row = 1; row <= nRowCount; ++row)
  735. {
  736. m_Chart3.SetRow(row);
  737. m_Chart3.SetRowLabel(stryear[row - 1]);
  738. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  739. m_Chart3.GetDataGrid().SetData(row, 2, dindandata2[row - 1], 0);
  740. }
  741. m_Chart3.Refresh();
  742. }
  743. extern void SortArray(BOOL bAscending, CStringArray &datearray, CArray<int, int>&valuearray);
  744. void DinDanForm::KindChange()
  745. {
  746. UpdateData();
  747. if (m_radio1 == 1)
  748. {
  749. KindChange2();
  750. return;
  751. }
  752. else if (m_radio1 == 2)
  753. {
  754. KindChange3();
  755. return;
  756. }
  757. else if (m_radio1 == 3)
  758. {
  759. KindChange4();
  760. return;
  761. }
  762. else if (m_radio1 == 4)
  763. {
  764. KindChange5();
  765. return;
  766. }
  767. else if (m_radio1 == 5)
  768. {
  769. KindChange6();
  770. return;
  771. }
  772. else if (m_radio1 == 6)
  773. {
  774. KindChange7();
  775. return;
  776. }
  777. else if (m_radio1 == 7)
  778. {//MessageBox("fd");
  779. KindChange8();
  780. return;
  781. }
  782. else if (m_radio1 == 8)
  783. { //MessageBox("fd2");
  784. KindChange9();
  785. return;
  786. }
  787. int i;
  788. if (m_filterarray.GetSize() == 0)
  789. {
  790. CStringArray m_typearray;
  791. CArray<int, int>sortarray;
  792. for (int i = 0; i < m_dindanarray.GetSize(); i++)
  793. {
  794. if (::FindArray(&m_typearray, m_dindanarray.ElementAt(i).ElementAt(0)) == -1)
  795. {
  796. m_typearray.Add(m_dindanarray.ElementAt(i).ElementAt(0));
  797. sortarray.Add(0);
  798. }
  799. }
  800. for (i = 0; i < m_dindanarray.GetSize(); i++)
  801. {
  802. for (int j = 0; j < m_typearray.GetSize(); j++)
  803. {
  804. if (m_dindanarray.ElementAt(i).ElementAt(0) == m_typearray.ElementAt(j))
  805. {
  806. sortarray.SetAt(j, sortarray.ElementAt(j) + 1);
  807. }
  808. }
  809. }
  810. SortArray(1, m_typearray, sortarray);
  811. m_pchild->TypeChange(&m_typearray);
  812. return;
  813. }
  814. if (m_filterarray.GetSize() == 0)return;
  815. while (m_filterarray.GetSize()>10)
  816. m_filterarray.RemoveAt(m_filterarray.GetSize() - 1);
  817. int typecount = m_filterarray.GetSize();
  818. if (m_radio2)
  819. m_Chart3.SetColumnCount(typecount);
  820. else
  821. m_Chart3.SetColumnCount(1);
  822. VARIANT var;
  823. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  824. COLORREF col[10] = { \
  825. RGB(255, 0, 0), \
  826. RGB(0, 255, 0), \
  827. RGB(0, 0, 255), \
  828. RGB(255, 255, 0), \
  829. RGB(0, 255, 255), \
  830. RGB(255, 0, 255), \
  831. RGB(127, 0, 0), \
  832. RGB(0, 127, 0), \
  833. RGB(0, 0, 127), \
  834. RGB(127, 127, 0)
  835. };
  836. if (m_radio2)
  837. {
  838. for (i = 0; i < m_filterarray.GetSize(); i++)
  839. {
  840. m_Chart3.SetColumn(i + 1);
  841. m_Chart3.SetColumnLabel((LPCTSTR)m_filterarray.ElementAt(i));
  842. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  843. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  844. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  845. }
  846. }
  847. else
  848. {
  849. m_Chart3.SetColumn(1);
  850. m_Chart3.SetColumnLabel((LPCTSTR)"全部");
  851. }
  852. int dindandata[12] = { 0 };
  853. int dindandata1[10][12] = { 0 };
  854. for (i = 0; i < 10; i++)
  855. {
  856. for (int j = 0; j < 12; j++)
  857. {
  858. dindandata1[i][j] = 0;
  859. }
  860. }
  861. CString stryear[12] = { "1月", \
  862. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  863. ////////////
  864. CString type;
  865. int selpos = m_combo1.GetCurSel();
  866. if (selpos != -1)
  867. m_combo1.GetLBText(selpos, type);
  868. if (selpos == -1 || type.IsEmpty() || type == "---全部---" || type == "---按套系类别---" || type == "---按套系名称---")
  869. {
  870. for (i = 0; i < m_dindanarray.GetSize(); i++)
  871. {
  872. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  873. for (int j = 0; j < m_filterarray.GetSize(); j++)
  874. {
  875. if (m_dindanarray.ElementAt(i).ElementAt(0) == m_filterarray.ElementAt(j))
  876. {
  877. dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1;
  878. break;
  879. }
  880. }
  881. }
  882. }
  883. else if (selpos > m_taoxipos)
  884. {
  885. for (i = 0; i < m_dindanarray.GetSize(); i++)
  886. {
  887. if (m_dindanarray.ElementAt(i).ElementAt(7) != type)continue;
  888. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  889. for (int j = 0; j < m_filterarray.GetSize(); j++)
  890. {
  891. if (m_dindanarray.ElementAt(i).ElementAt(0) == m_filterarray.ElementAt(j))
  892. {
  893. dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1;
  894. break;
  895. }
  896. }
  897. }
  898. }
  899. else
  900. {
  901. for (i = 0; i < m_dindanarray.GetSize(); i++)
  902. {
  903. if (m_dindanarray.ElementAt(i).ElementAt(0) != type)continue;
  904. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  905. for (int j = 0; j < m_filterarray.GetSize(); j++)
  906. {
  907. if (m_dindanarray.ElementAt(i).ElementAt(0) == m_filterarray.ElementAt(j))
  908. {
  909. dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1;
  910. break;
  911. }
  912. }
  913. }
  914. }
  915. /////////////
  916. int nRowCount = 12;// VARIANT var;
  917. m_Chart3.SetRowCount(nRowCount);
  918. float ftemp;
  919. for (int row = 1; row <= nRowCount; ++row)
  920. {
  921. m_Chart3.SetRow(row);
  922. m_Chart3.SetRowLabel(stryear[row - 1]);
  923. if (m_radio2)
  924. {
  925. for (int j = 0; j < m_filterarray.GetSize(); j++)
  926. {
  927. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  928. }
  929. }
  930. else
  931. {
  932. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  933. }
  934. }
  935. m_Chart3.Refresh();
  936. }
  937. BEGIN_EVENTSINK_MAP(DinDanForm, MyFormView)
  938. //{{AFX_EVENTSINK_MAP(DinDanForm)
  939. ON_EVENT(DinDanForm, IDC_MSCHART3, -601 /* DblClick */, OnDblClickMschart3, VTS_NONE)
  940. //}}AFX_EVENTSINK_MAP
  941. END_EVENTSINK_MAP()
  942. extern BOOL g_bShowMsChart;
  943. extern HWND g_hShowChartWnd;
  944. void DinDanForm::OnDblClickMschart3()
  945. {
  946. // TODO: Add your control notification handler code here
  947. if (g_bShowMsChart)
  948. {
  949. ::SendMessage(g_hShowChartWnd, WM_CLOSE, 0, 0);
  950. return;
  951. }
  952. g_bShowMsChart = 1;
  953. CRect rc;
  954. m_Chart3.GetWindowRect(rc);
  955. ScreenToClient(rc);
  956. ShowMschart dlg;
  957. dlg.m_pParent = this;
  958. dlg.m_pChart = &m_Chart3;
  959. dlg.DoModal();
  960. m_Chart3.MoveWindow(rc);
  961. g_bShowMsChart = 0;
  962. }
  963. void DinDanForm::OnRadio6()
  964. {
  965. // TODO: Add your control notification handler code here
  966. m_filterarray.RemoveAll();
  967. KindChange();
  968. }
  969. void DinDanForm::OnRadio7()
  970. {
  971. // TODO: Add your control notification handler code here
  972. OnRadio6();
  973. }
  974. void DinDanForm::OnSelchangeCombo1()
  975. {
  976. // TODO: Add your control notification handler code here
  977. OnRadio6();
  978. }
  979. void DinDanForm::OnRadio8()
  980. {
  981. // TODO: Add your control notification handler code here
  982. OnRadio3();
  983. }
  984. void DinDanForm::OnRadio10()
  985. {
  986. // TODO: Add your control notification handler code here
  987. OnRadio3();
  988. }
  989. void DinDanForm::OnRadio11()
  990. {
  991. // TODO: Add your control notification handler code here
  992. OnRadio3();
  993. }
  994. void DinDanForm::OnRadio12()
  995. {
  996. // TODO: Add your control notification handler code here
  997. OnRadio3();
  998. }
  999. void DinDanForm::OnRadio13()
  1000. {
  1001. // TODO: Add your control notification handler code here
  1002. OnRadio3();
  1003. }
  1004. void DinDanForm::KindChange5()
  1005. {
  1006. m_Chart3.SetColumnCount(2);
  1007. COLORREF col[10] = { \
  1008. RGB(255, 0, 0), \
  1009. RGB(0, 255, 0), \
  1010. RGB(255, 0, 255), \
  1011. RGB(0, 255, 0), \
  1012. RGB(255, 0, 0), \
  1013. RGB(255, 255, 0), \
  1014. RGB(127, 0, 0), \
  1015. RGB(0, 127, 0), \
  1016. RGB(0, 0, 127), \
  1017. RGB(127, 127, 0)
  1018. };
  1019. CStringArray m_typearray;
  1020. m_typearray.Add("订单总数");
  1021. m_typearray.Add("正式订单");
  1022. for (int i = 0; i < 2; i++)
  1023. {
  1024. m_Chart3.SetColumn(i + 1);
  1025. m_Chart3.SetColumnLabel((LPCTSTR)m_typearray.ElementAt(i));
  1026. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1027. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  1028. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1029. }
  1030. VARIANT var;
  1031. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(0);
  1032. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetMaximum(100);
  1033. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetMinimum(0);
  1034. float dindandata[12] = { 0 };
  1035. float dindandata2[12] = { 0 };
  1036. CString stryear[12] = { "1月", \
  1037. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  1038. CString str;
  1039. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1040. {
  1041. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  1042. if (m_dindanarray.ElementAt(i).ElementAt(13) != "意向客户")
  1043. {
  1044. dindandata2[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  1045. }
  1046. }
  1047. int nRowCount = 12;// VARIANT var;
  1048. m_Chart3.SetRowCount(nRowCount);
  1049. float ftemp;
  1050. for (int row = 1; row <= nRowCount; ++row)
  1051. {
  1052. m_Chart3.SetRow(row);
  1053. m_Chart3.SetRowLabel(stryear[row - 1]);
  1054. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  1055. m_Chart3.GetDataGrid().SetData(row, 2, dindandata2[row - 1], 0);
  1056. }
  1057. m_Chart3.Refresh();
  1058. }
  1059. void DinDanForm::KindChange6()
  1060. {
  1061. CStringArray m_typearray;
  1062. for (int i = 0; i < m_dindanarray.GetSize(); i++)
  1063. {
  1064. if (m_dindanarray.ElementAt(i).ElementAt(14) == "")continue;
  1065. if (::FindArray(&m_typearray, m_dindanarray.ElementAt(i).ElementAt(14)) == -1)
  1066. m_typearray.Add(m_dindanarray.ElementAt(i).ElementAt(14));
  1067. }
  1068. if (m_typearray.GetSize() == 0)return;
  1069. while (m_typearray.GetSize()>10)
  1070. m_typearray.RemoveAt(m_typearray.GetSize() - 1);
  1071. int typecount = m_typearray.GetSize();
  1072. m_Chart3.SetColumnCount(typecount);
  1073. VARIANT var;
  1074. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  1075. COLORREF col[10] = { \
  1076. RGB(255, 0, 0), \
  1077. RGB(0, 255, 0), \
  1078. RGB(0, 0, 255), \
  1079. RGB(255, 255, 0), \
  1080. RGB(0, 255, 255), \
  1081. RGB(255, 0, 255), \
  1082. RGB(127, 0, 0), \
  1083. RGB(0, 127, 0), \
  1084. RGB(0, 0, 127), \
  1085. RGB(127, 127, 0)
  1086. };
  1087. for (i = 0; i < m_typearray.GetSize(); i++)
  1088. {
  1089. m_Chart3.SetColumn(i + 1);
  1090. m_Chart3.SetColumnLabel((LPCTSTR)m_typearray.ElementAt(i));
  1091. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1092. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  1093. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1094. }
  1095. int dindandata1[10][12] = { 0 };
  1096. for (i = 0; i < 10; i++)
  1097. {
  1098. for (int j = 0; j < 12; j++)
  1099. {
  1100. dindandata1[i][j] = 0;
  1101. }
  1102. }
  1103. CString stryear[12] = { "1月", \
  1104. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  1105. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1106. {
  1107. for (int j = 0; j < m_typearray.GetSize(); j++)
  1108. {
  1109. if (m_dindanarray.ElementAt(i).ElementAt(14) == m_typearray.ElementAt(j))
  1110. {
  1111. dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1;
  1112. break;
  1113. }
  1114. }
  1115. }
  1116. /////////////
  1117. int nRowCount = 12;// VARIANT var;
  1118. m_Chart3.SetRowCount(nRowCount);
  1119. float ftemp;
  1120. for (int row = 1; row <= nRowCount; ++row)
  1121. {
  1122. m_Chart3.SetRow(row);
  1123. m_Chart3.SetRowLabel(stryear[row - 1]);
  1124. for (int j = 0; j < m_typearray.GetSize(); j++)
  1125. {
  1126. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  1127. }
  1128. }
  1129. m_Chart3.Refresh();
  1130. }
  1131. void DinDanForm::KindChange7()
  1132. {
  1133. CStringArray m_typearray;
  1134. for (int i = 0; i < m_dindanarray.GetSize(); i++)
  1135. {
  1136. if (m_dindanarray.ElementAt(i).ElementAt(15) == "")continue;
  1137. if (::FindArray(&m_typearray, m_dindanarray.ElementAt(i).ElementAt(15)) == -1)
  1138. m_typearray.Add(m_dindanarray.ElementAt(i).ElementAt(15));
  1139. }
  1140. if (m_typearray.GetSize() == 0)return;
  1141. while (m_typearray.GetSize()>10)
  1142. m_typearray.RemoveAt(m_typearray.GetSize() - 1);
  1143. int typecount = m_typearray.GetSize();
  1144. m_Chart3.SetColumnCount(typecount);
  1145. VARIANT var;
  1146. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  1147. COLORREF col[10] = { \
  1148. RGB(255, 0, 0), \
  1149. RGB(0, 255, 0), \
  1150. RGB(0, 0, 255), \
  1151. RGB(255, 255, 0), \
  1152. RGB(0, 255, 255), \
  1153. RGB(255, 0, 255), \
  1154. RGB(127, 0, 0), \
  1155. RGB(0, 127, 0), \
  1156. RGB(0, 0, 127), \
  1157. RGB(127, 127, 0)
  1158. };
  1159. for (i = 0; i < m_typearray.GetSize(); i++)
  1160. {
  1161. m_Chart3.SetColumn(i + 1);
  1162. m_Chart3.SetColumnLabel((LPCTSTR)m_typearray.ElementAt(i));
  1163. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1164. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  1165. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1166. }
  1167. int dindandata1[10][12] = { 0 };
  1168. for (i = 0; i < 10; i++)
  1169. {
  1170. for (int j = 0; j < 12; j++)
  1171. {
  1172. dindandata1[i][j] = 0;
  1173. }
  1174. }
  1175. CString stryear[12] = { "1月", \
  1176. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  1177. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1178. {
  1179. for (int j = 0; j < m_typearray.GetSize(); j++)
  1180. {
  1181. if (m_dindanarray.ElementAt(i).ElementAt(15) == m_typearray.ElementAt(j))
  1182. {
  1183. dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1;
  1184. break;
  1185. }
  1186. }
  1187. }
  1188. /////////////
  1189. int nRowCount = 12;// VARIANT var;
  1190. m_Chart3.SetRowCount(nRowCount);
  1191. float ftemp;
  1192. for (int row = 1; row <= nRowCount; ++row)
  1193. {
  1194. m_Chart3.SetRow(row);
  1195. m_Chart3.SetRowLabel(stryear[row - 1]);
  1196. for (int j = 0; j < m_typearray.GetSize(); j++)
  1197. {
  1198. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  1199. }
  1200. }
  1201. m_Chart3.Refresh();
  1202. }
  1203. void DinDanForm::OnRadio24()
  1204. {
  1205. // TODO: Add your control notification handler code here
  1206. OnRadio3();
  1207. }
  1208. void DinDanForm::OnRadio25()
  1209. {
  1210. // TODO: Add your control notification handler code here
  1211. OnRadio3();
  1212. }
  1213. void DinDanForm::KindChange8()
  1214. {
  1215. int i;
  1216. if (m_pchild->m_List2.GetCount() == 0)
  1217. {
  1218. CStringArray m_typearray;
  1219. CArray<int, int>sortarray;
  1220. for (int i = 0; i < m_moneyarray.GetSize(); i++)
  1221. {
  1222. // if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1223. if (::FindArray(&m_typearray, m_moneyarray.ElementAt(i).ElementAt(7)) == -1)
  1224. {
  1225. m_typearray.Add(m_moneyarray.ElementAt(i).ElementAt(7));
  1226. sortarray.Add(0);
  1227. }
  1228. }
  1229. for (i = 0; i < m_moneyarray.GetSize(); i++)
  1230. {
  1231. // if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1232. for (int j = 0; j < m_typearray.GetSize(); j++)
  1233. {
  1234. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_typearray.ElementAt(j))
  1235. {
  1236. sortarray.SetAt(j, sortarray.ElementAt(j) + atoi(m_moneyarray.ElementAt(i).ElementAt(0)));
  1237. }
  1238. }
  1239. }
  1240. SortArray(1, m_typearray, sortarray);
  1241. m_typearray.InsertAt(0, "全部(二销)");
  1242. m_typearray.InsertAt(0, "全部(前期)");
  1243. m_typearray.InsertAt(0, "全部(前期+二销)");
  1244. m_pchild->TypeChange2(&m_typearray);
  1245. }
  1246. if (m_filterarray.GetSize() == 0)
  1247. {
  1248. CStringArray m_typearray;
  1249. CArray<int, int>sortarray; CArray<int, int>sortarray2;
  1250. for (int i = 0; i < m_moneyarray.GetSize(); i++)
  1251. {
  1252. BOOL bOK = 0;
  1253. for (int j = 0; j < m_filterarray2.GetSize(); j++)
  1254. {
  1255. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_filterarray2.ElementAt(j))
  1256. {
  1257. bOK = 1;
  1258. break;
  1259. }
  1260. if ("全部(前期+二销)" == m_filterarray2.ElementAt(j))
  1261. {
  1262. bOK = 1;
  1263. break;
  1264. }
  1265. if ("全部(前期)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) == "预约收款")
  1266. {
  1267. bOK = 1;
  1268. break;
  1269. }
  1270. if ("全部(前期)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) == "预约补款")
  1271. {
  1272. bOK = 1;
  1273. break;
  1274. }
  1275. if ("全部(二销)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) != "预约收款" && m_moneyarray.ElementAt(i).ElementAt(7) != "预约补款")
  1276. {
  1277. bOK = 1;
  1278. break;
  1279. }
  1280. }
  1281. if (bOK == 0)continue;
  1282. if (::FindArray(&m_typearray, m_moneyarray.ElementAt(i).ElementAt(6)) == -1)
  1283. {
  1284. m_typearray.Add(m_moneyarray.ElementAt(i).ElementAt(6));
  1285. sortarray.Add(0); sortarray2.Add(0);
  1286. }
  1287. }
  1288. for (i = 0; i < m_moneyarray.GetSize(); i++)
  1289. {
  1290. BOOL bOK = 0;
  1291. for (int j = 0; j < m_filterarray2.GetSize(); j++)
  1292. {
  1293. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_filterarray2.ElementAt(j))
  1294. {
  1295. bOK = 1;
  1296. break;
  1297. }
  1298. if ("全部(前期+二销)" == m_filterarray2.ElementAt(j))
  1299. {
  1300. bOK = 1;
  1301. break;
  1302. }
  1303. if ("全部(前期)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) == "预约收款")
  1304. {
  1305. bOK = 1;
  1306. break;
  1307. }
  1308. if ("全部(前期)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) == "预约补款")
  1309. {
  1310. bOK = 1;
  1311. break;
  1312. }
  1313. if ("全部(二销)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) != "预约收款" && m_moneyarray.ElementAt(i).ElementAt(7) != "预约补款")
  1314. {
  1315. bOK = 1;
  1316. break;
  1317. }
  1318. }
  1319. if (bOK == 0)continue;
  1320. for (j = 0; j < m_typearray.GetSize(); j++)
  1321. {
  1322. if (m_moneyarray.ElementAt(i).ElementAt(6) == m_typearray.ElementAt(j))
  1323. {
  1324. sortarray.SetAt(j, sortarray.ElementAt(j) + atoi(m_moneyarray.ElementAt(i).ElementAt(0)));
  1325. sortarray2.SetAt(j, sortarray2.ElementAt(j) + 1);
  1326. }
  1327. }
  1328. }
  1329. if (m_check1)//均值
  1330. {
  1331. for (int j = 0; j < sortarray.GetSize(); j++)
  1332. {
  1333. if (sortarray2.ElementAt(j))
  1334. {
  1335. sortarray.SetAt(j, sortarray.ElementAt(j) / sortarray2.ElementAt(j));
  1336. }
  1337. }
  1338. }
  1339. SortArray(1, m_typearray, sortarray);
  1340. m_pchild->TypeChange(&m_typearray);
  1341. return;
  1342. }
  1343. if (m_filterarray.GetSize() == 0)return;
  1344. while (m_filterarray.GetSize()>10)
  1345. m_filterarray.RemoveAt(m_filterarray.GetSize() - 1);
  1346. int typecount = m_filterarray.GetSize();
  1347. if (m_radio2)
  1348. m_Chart3.SetColumnCount(typecount);
  1349. else
  1350. m_Chart3.SetColumnCount(1);
  1351. VARIANT var;
  1352. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  1353. COLORREF col[10] = { \
  1354. RGB(255, 0, 0), \
  1355. RGB(0, 255, 0), \
  1356. RGB(0, 0, 255), \
  1357. RGB(255, 255, 0), \
  1358. RGB(0, 255, 255), \
  1359. RGB(255, 0, 255), \
  1360. RGB(127, 0, 0), \
  1361. RGB(0, 127, 0), \
  1362. RGB(0, 0, 127), \
  1363. RGB(127, 127, 0)
  1364. };
  1365. if (m_radio2)
  1366. {
  1367. for (i = 0; i < m_filterarray.GetSize(); i++)
  1368. {
  1369. m_Chart3.SetColumn(i + 1);
  1370. m_Chart3.SetColumnLabel((LPCTSTR)m_filterarray.ElementAt(i));
  1371. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1372. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  1373. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1374. }
  1375. }
  1376. else
  1377. {
  1378. m_Chart3.SetColumn(1);
  1379. m_Chart3.SetColumnLabel((LPCTSTR)"全部");
  1380. }
  1381. float dindandata[12] = { 0 };
  1382. float dindandatacot[12] = { 0 };
  1383. float dindandata1[10][12] = { 0 };
  1384. float dindandatacot2[10][12] = { 0 };
  1385. for (i = 0; i < 10; i++)
  1386. {
  1387. for (int j = 0; j < 12; j++)
  1388. {
  1389. dindandata1[i][j] = 0; dindandatacot2[i][j] = 0;
  1390. }
  1391. }
  1392. CString stryear[12] = { "1月", \
  1393. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  1394. ////////////
  1395. CString type;
  1396. int selpos = m_combo1.GetCurSel();
  1397. if (selpos != -1)
  1398. m_combo1.GetLBText(selpos, type);
  1399. if (selpos == -1 || type.IsEmpty() || type == "---全部---" || type == "---按套系类别---" || type == "---按套系名称---")
  1400. {
  1401. for (i = 0; i < m_moneyarray.GetSize(); i++)
  1402. {
  1403. // if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1404. BOOL bOK = 0;
  1405. for (int j = 0; j < m_filterarray2.GetSize(); j++)
  1406. {
  1407. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_filterarray2.ElementAt(j))
  1408. {
  1409. bOK = 1;
  1410. break;
  1411. }
  1412. if ("全部(前期+二销)" == m_filterarray2.ElementAt(j))
  1413. {
  1414. bOK = 1;
  1415. break;
  1416. }
  1417. if ("全部(前期)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) == "预约收款")
  1418. {
  1419. bOK = 1;
  1420. break;
  1421. }
  1422. if ("全部(前期)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) == "预约补款")
  1423. {
  1424. bOK = 1;
  1425. break;
  1426. }
  1427. if ("全部(二销)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) != "预约收款" && m_moneyarray.ElementAt(i).ElementAt(7) != "预约补款")
  1428. {
  1429. bOK = 1;
  1430. break;
  1431. }
  1432. }
  1433. if (bOK == 0)continue;
  1434. dindandata[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_moneyarray.ElementAt(i).ElementAt(0));
  1435. dindandatacot[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += 1.0;
  1436. for (j = 0; j < m_filterarray.GetSize(); j++)
  1437. {
  1438. if (m_moneyarray.ElementAt(i).ElementAt(6) == m_filterarray.ElementAt(j))
  1439. {
  1440. dindandata1[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_moneyarray.ElementAt(i).ElementAt(0));
  1441. dindandatacot2[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandatacot2[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1.0;
  1442. break;
  1443. }
  1444. }
  1445. }
  1446. }
  1447. else if (selpos > m_taoxipos)
  1448. {
  1449. for (i = 0; i < m_moneyarray.GetSize(); i++)
  1450. {
  1451. // if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1452. BOOL bOK = 0;
  1453. for (int j = 0; j < m_filterarray2.GetSize(); j++)
  1454. {
  1455. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_filterarray2.ElementAt(j))
  1456. {
  1457. bOK = 1;
  1458. break;
  1459. }
  1460. if ("全部(前期+二销)" == m_filterarray2.ElementAt(j))
  1461. {
  1462. bOK = 1;
  1463. break;
  1464. }
  1465. if ("全部(前期)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) == "预约收款")
  1466. {
  1467. bOK = 1;
  1468. break;
  1469. }
  1470. if ("全部(前期)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) == "预约补款")
  1471. {
  1472. bOK = 1;
  1473. break;
  1474. }
  1475. if ("全部(二销)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) != "预约收款" && m_moneyarray.ElementAt(i).ElementAt(7) != "预约补款")
  1476. {
  1477. bOK = 1;
  1478. break;
  1479. }
  1480. }
  1481. if (bOK == 0)continue;
  1482. if (m_moneyarray.ElementAt(i).ElementAt(9) != type)continue;
  1483. dindandata[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_moneyarray.ElementAt(i).ElementAt(0));
  1484. dindandatacot[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += 1.0;
  1485. for (j = 0; j < m_filterarray.GetSize(); j++)
  1486. {
  1487. if (m_moneyarray.ElementAt(i).ElementAt(6) == m_filterarray.ElementAt(j))
  1488. {
  1489. dindandata1[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_moneyarray.ElementAt(i).ElementAt(0));
  1490. dindandatacot2[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandatacot2[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1.0;
  1491. break;
  1492. }
  1493. }
  1494. }
  1495. }
  1496. else
  1497. {
  1498. for (i = 0; i < m_moneyarray.GetSize(); i++)
  1499. {
  1500. // if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1501. BOOL bOK = 0;
  1502. for (int j = 0; j < m_filterarray2.GetSize(); j++)
  1503. {
  1504. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_filterarray2.ElementAt(j))
  1505. {
  1506. bOK = 1;
  1507. break;
  1508. }
  1509. if ("全部(前期+二销)" == m_filterarray2.ElementAt(j))
  1510. {
  1511. bOK = 1;
  1512. break;
  1513. }
  1514. if ("全部(前期)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) == "预约收款")
  1515. {
  1516. bOK = 1;
  1517. break;
  1518. }
  1519. if ("全部(前期)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) == "预约补款")
  1520. {
  1521. bOK = 1;
  1522. break;
  1523. }
  1524. if ("全部(二销)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) != "预约收款" && m_moneyarray.ElementAt(i).ElementAt(7) != "预约补款")
  1525. {
  1526. bOK = 1;
  1527. break;
  1528. }
  1529. }
  1530. if (bOK == 0)continue;
  1531. if (m_moneyarray.ElementAt(i).ElementAt(8) != type)continue;
  1532. dindandata[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_moneyarray.ElementAt(i).ElementAt(0));
  1533. dindandatacot[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += 1.0;
  1534. for (j = 0; j < m_filterarray.GetSize(); j++)
  1535. {
  1536. if (m_moneyarray.ElementAt(i).ElementAt(6) == m_filterarray.ElementAt(j))
  1537. {
  1538. dindandata1[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + atof(m_moneyarray.ElementAt(i).ElementAt(0));
  1539. dindandatacot2[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandatacot2[j][atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1.0;
  1540. break;
  1541. }
  1542. }
  1543. }
  1544. }
  1545. /////////////
  1546. int nRowCount = 12;// VARIANT var;
  1547. m_Chart3.SetRowCount(nRowCount);
  1548. float ftemp;
  1549. for (int row = 1; row <= nRowCount; ++row)
  1550. {
  1551. m_Chart3.SetRow(row);
  1552. m_Chart3.SetRowLabel(stryear[row - 1]);
  1553. if (m_check1)//均值
  1554. {
  1555. if (m_radio2)
  1556. {
  1557. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1558. {
  1559. if (dindandatacot2[j][row - 1] < 1.0)
  1560. m_Chart3.GetDataGrid().SetData(row, j + 1, 0, 0);
  1561. else
  1562. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1] / dindandatacot2[j][row - 1], 0);
  1563. }
  1564. }
  1565. else
  1566. {
  1567. if (dindandatacot[row - 1] < 1.0)
  1568. m_Chart3.GetDataGrid().SetData(row, 1, 0, 0);
  1569. else
  1570. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1] / dindandatacot[row - 1], 0);
  1571. }
  1572. }
  1573. else
  1574. {
  1575. if (m_radio2)
  1576. {
  1577. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1578. {
  1579. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  1580. }
  1581. }
  1582. else
  1583. {
  1584. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  1585. }
  1586. }
  1587. }
  1588. m_Chart3.Refresh();
  1589. }
  1590. /*
  1591. void DinDanForm::KindChange8()
  1592. {
  1593. int i;
  1594. if(m_filterarray.GetSize ()==0)
  1595. {
  1596. CStringArray m_typearray;
  1597. CArray<int,int>sortarray;
  1598. for(int i=0; i<m_moneyarray.GetSize (); i++)
  1599. {
  1600. if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1601. if(::FindArray (&m_typearray, m_moneyarray.ElementAt (i).ElementAt (6))==-1)
  1602. {
  1603. m_typearray.Add(m_moneyarray.ElementAt (i).ElementAt (6));
  1604. sortarray.Add(0);
  1605. }
  1606. }
  1607. for( i=0; i<m_moneyarray.GetSize (); i++)
  1608. {
  1609. if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1610. for(int j=0; j<m_typearray.GetSize (); j++)
  1611. {
  1612. if(m_moneyarray.ElementAt (i).ElementAt (6)==m_typearray.ElementAt (j))
  1613. {
  1614. sortarray.SetAt(j, sortarray.ElementAt(j)+atoi(m_moneyarray.ElementAt (i).ElementAt (0)));
  1615. }
  1616. }
  1617. }
  1618. SortArray(1, m_typearray, sortarray);
  1619. m_pchild->TypeChange(&m_typearray);
  1620. return;
  1621. }
  1622. if(m_filterarray.GetSize ()==0)return;
  1623. while(m_filterarray.GetSize ()>10)
  1624. m_filterarray.RemoveAt (m_filterarray.GetSize ()-1);
  1625. int typecount=m_filterarray.GetSize ();
  1626. if(m_radio2)
  1627. m_Chart3.SetColumnCount(typecount);
  1628. else
  1629. m_Chart3.SetColumnCount(1);
  1630. VARIANT var;
  1631. m_Chart3.GetPlot().GetAxis(1,var).GetValueScale().SetAuto(1);
  1632. COLORREF col[10]={\
  1633. RGB(255,0,0),\
  1634. RGB(0,255,0),\
  1635. RGB(0,0,255),\
  1636. RGB(255,255,0),\
  1637. RGB(0,255,255),\
  1638. RGB(255,0,255),\
  1639. RGB(127,0,0),\
  1640. RGB(0,127,0),\
  1641. RGB(0,0,127),\
  1642. RGB(127,127,0)
  1643. };
  1644. if(m_radio2)
  1645. {
  1646. for( i=0; i<m_filterarray.GetSize (); i++)
  1647. {
  1648. m_Chart3.SetColumn(i+1);
  1649. m_Chart3.SetColumnLabel((LPCTSTR)m_filterarray.ElementAt (i));
  1650. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i+1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1651. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i+1).GetPen().SetWidth(30);
  1652. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i+1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1653. }
  1654. }
  1655. else
  1656. {
  1657. m_Chart3.SetColumn(1);
  1658. m_Chart3.SetColumnLabel((LPCTSTR)"全部");
  1659. }
  1660. float dindandata[12]={0};
  1661. float dindandatacot[12]={0};
  1662. float dindandata1[10][12]={0};
  1663. float dindandatacot2[10][12]={0};
  1664. for(i=0; i<10; i++)
  1665. {
  1666. for(int j=0; j<12; j++)
  1667. {
  1668. dindandata1[i][j]=0;dindandatacot2[i][j]=0;
  1669. }
  1670. }
  1671. CString stryear[12]={"1月",\
  1672. "2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
  1673. ////////////
  1674. CString type;
  1675. int selpos=m_combo1.GetCurSel ();
  1676. if(selpos!=-1)
  1677. m_combo1.GetLBText (selpos, type);
  1678. if(selpos==-1 || type.IsEmpty () || type=="---全部---" || type=="---按套系类别---" || type=="---按套系名称---")
  1679. {
  1680. for( i=0; i<m_moneyarray.GetSize (); i++)
  1681. {
  1682. if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1683. dindandata[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(m_moneyarray.ElementAt (i).ElementAt (0));
  1684. dindandatacot[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=1.0;
  1685. for(int j=0; j<m_filterarray.GetSize (); j++)
  1686. {
  1687. if(m_moneyarray.ElementAt (i).ElementAt (6)==m_filterarray.ElementAt (j))
  1688. {
  1689. dindandata1[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]=dindandata1[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+atof(m_moneyarray.ElementAt (i).ElementAt (0));
  1690. dindandatacot2[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]=dindandatacot2[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+1.0;
  1691. break;
  1692. }
  1693. }
  1694. }
  1695. }
  1696. else if(selpos>m_taoxipos)
  1697. {
  1698. for( i=0; i<m_moneyarray.GetSize (); i++)
  1699. {
  1700. if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1701. if(m_moneyarray.ElementAt (i).ElementAt (9)!=type)continue;
  1702. dindandata[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(m_moneyarray.ElementAt (i).ElementAt (0));
  1703. dindandatacot[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=1.0;
  1704. for(int j=0; j<m_filterarray.GetSize (); j++)
  1705. {
  1706. if(m_moneyarray.ElementAt (i).ElementAt (6)==m_filterarray.ElementAt (j))
  1707. {
  1708. dindandata1[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]=dindandata1[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+atof(m_moneyarray.ElementAt (i).ElementAt (0));
  1709. dindandatacot2[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]=dindandatacot2[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+1.0;
  1710. break;
  1711. }
  1712. }
  1713. }
  1714. }
  1715. else
  1716. {
  1717. for( i=0; i<m_moneyarray.GetSize (); i++)
  1718. {
  1719. if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1720. if(m_moneyarray.ElementAt (i).ElementAt (8)!=type)continue;
  1721. dindandata[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(m_moneyarray.ElementAt (i).ElementAt (0));
  1722. dindandatacot[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=1.0;
  1723. for(int j=0; j<m_filterarray.GetSize (); j++)
  1724. {
  1725. if(m_moneyarray.ElementAt (i).ElementAt (6)==m_filterarray.ElementAt (j))
  1726. {
  1727. dindandata1[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]=dindandata1[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+atof(m_moneyarray.ElementAt (i).ElementAt (0));
  1728. dindandatacot2[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]=dindandatacot2[j][atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+1.0;
  1729. break;
  1730. }
  1731. }
  1732. }
  1733. }
  1734. /////////////
  1735. int nRowCount=12;// VARIANT var;
  1736. m_Chart3.SetRowCount(nRowCount);
  1737. float ftemp;
  1738. for(int row = 1; row <= nRowCount; ++row)
  1739. {
  1740. m_Chart3.SetRow(row);
  1741. m_Chart3.SetRowLabel(stryear[row-1]);
  1742. if(m_check1)//均值
  1743. {
  1744. if(m_radio2)
  1745. {
  1746. for(int j=0; j<m_filterarray.GetSize (); j++)
  1747. {
  1748. if(dindandatacot2[j][row-1]<1.0)
  1749. m_Chart3.GetDataGrid().SetData(row, j+1, 0 , 0);
  1750. else
  1751. m_Chart3.GetDataGrid().SetData(row, j+1, dindandata1[j][row-1]/dindandatacot2[j][row-1] , 0);
  1752. }
  1753. }
  1754. else
  1755. {
  1756. if(dindandatacot[row-1]<1.0)
  1757. m_Chart3.GetDataGrid().SetData(row, 1, 0 , 0);
  1758. else
  1759. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row-1]/dindandatacot[row-1] , 0);
  1760. }
  1761. }
  1762. else
  1763. {
  1764. if(m_radio2)
  1765. {
  1766. for(int j=0; j<m_filterarray.GetSize (); j++)
  1767. {
  1768. m_Chart3.GetDataGrid().SetData(row, j+1, dindandata1[j][row-1] , 0);
  1769. }
  1770. }
  1771. else
  1772. {
  1773. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row-1] , 0);
  1774. }
  1775. }
  1776. }
  1777. m_Chart3.Refresh();
  1778. }
  1779. */
  1780. void DinDanForm::KindChange9()
  1781. {
  1782. int i;
  1783. if (m_filterarray.GetSize() == 0)
  1784. {
  1785. CStringArray m_typearray;
  1786. CArray<int, int>sortarray;
  1787. for (int i = 0; i < m_dindanarray.GetSize(); i++)
  1788. {
  1789. if (::FindArray(&m_typearray, m_dindanarray.ElementAt(i).ElementAt(14)) == -1)
  1790. {
  1791. m_typearray.Add(m_dindanarray.ElementAt(i).ElementAt(14));
  1792. sortarray.Add(0);
  1793. }
  1794. }
  1795. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1796. {
  1797. for (int j = 0; j < m_typearray.GetSize(); j++)
  1798. {
  1799. if (m_dindanarray.ElementAt(i).ElementAt(14) == m_typearray.ElementAt(j))
  1800. {
  1801. sortarray.SetAt(j, sortarray.ElementAt(j) + 1);
  1802. }
  1803. }
  1804. }
  1805. SortArray(1, m_typearray, sortarray);
  1806. m_pchild->TypeChange(&m_typearray);
  1807. return;
  1808. }
  1809. if (m_filterarray.GetSize() == 0)return;
  1810. while (m_filterarray.GetSize()>10)
  1811. m_filterarray.RemoveAt(m_filterarray.GetSize() - 1);
  1812. int typecount = m_filterarray.GetSize();
  1813. if (m_radio2)
  1814. m_Chart3.SetColumnCount(typecount);
  1815. else
  1816. m_Chart3.SetColumnCount(1);
  1817. VARIANT var;
  1818. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  1819. COLORREF col[10] = { \
  1820. RGB(255, 0, 0), \
  1821. RGB(0, 255, 0), \
  1822. RGB(0, 0, 255), \
  1823. RGB(255, 255, 0), \
  1824. RGB(0, 255, 255), \
  1825. RGB(255, 0, 255), \
  1826. RGB(127, 0, 0), \
  1827. RGB(0, 127, 0), \
  1828. RGB(0, 0, 127), \
  1829. RGB(127, 127, 0)
  1830. };
  1831. if (m_radio2)
  1832. {
  1833. for (i = 0; i < m_filterarray.GetSize(); i++)
  1834. {
  1835. m_Chart3.SetColumn(i + 1);
  1836. m_Chart3.SetColumnLabel((LPCTSTR)m_filterarray.ElementAt(i));
  1837. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1838. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  1839. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1840. }
  1841. }
  1842. else
  1843. {
  1844. m_Chart3.SetColumn(1);
  1845. m_Chart3.SetColumnLabel((LPCTSTR)"全部");
  1846. }
  1847. int dindandata[12] = { 0 };
  1848. int dindandata1[10][12] = { 0 };
  1849. for (i = 0; i < 10; i++)
  1850. {
  1851. for (int j = 0; j < 12; j++)
  1852. {
  1853. dindandata1[i][j] = 0;
  1854. }
  1855. }
  1856. CString stryear[12] = { "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  1857. ////////////
  1858. CString type;
  1859. int selpos = m_combo1.GetCurSel();
  1860. if (selpos != -1)
  1861. m_combo1.GetLBText(selpos, type);
  1862. if (selpos == -1 || type.IsEmpty() || type == "---全部---" || type == "---按套系类别---" || type == "---按套系名称---")
  1863. {
  1864. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1865. {
  1866. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  1867. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1868. {
  1869. if (m_dindanarray.ElementAt(i).ElementAt(14) == m_filterarray.ElementAt(j))
  1870. {
  1871. dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1;
  1872. break;
  1873. }
  1874. }
  1875. }
  1876. }
  1877. else if (selpos > m_taoxipos)
  1878. {
  1879. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1880. {
  1881. if (m_dindanarray.ElementAt(i).ElementAt(7) != type)continue;
  1882. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  1883. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1884. {
  1885. if (m_dindanarray.ElementAt(i).ElementAt(14) == m_filterarray.ElementAt(j))
  1886. {
  1887. dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1;
  1888. break;
  1889. }
  1890. }
  1891. }
  1892. }
  1893. else
  1894. {
  1895. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1896. {
  1897. if (m_dindanarray.ElementAt(i).ElementAt(0) != type)continue;
  1898. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  1899. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1900. {
  1901. if (m_dindanarray.ElementAt(i).ElementAt(14) == m_filterarray.ElementAt(j))
  1902. {
  1903. dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] = dindandata1[j][atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] + 1;
  1904. break;
  1905. }
  1906. }
  1907. }
  1908. }
  1909. /////////////
  1910. int nRowCount = 12;// VARIANT var;
  1911. m_Chart3.SetRowCount(nRowCount);
  1912. float ftemp;
  1913. for (int row = 1; row <= nRowCount; ++row)
  1914. {
  1915. m_Chart3.SetRow(row);
  1916. m_Chart3.SetRowLabel(stryear[row - 1]);
  1917. if (m_radio2)
  1918. {
  1919. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1920. {
  1921. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  1922. }
  1923. }
  1924. else
  1925. {
  1926. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  1927. }
  1928. }
  1929. m_Chart3.Refresh();
  1930. }
  1931. void DinDanForm::OnCheck1()
  1932. {
  1933. // TODO: Add your control notification handler code here
  1934. m_filterarray.RemoveAll();
  1935. KindChange();
  1936. }