DinDanForm.cpp 64 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157
  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. int i = 0;
  636. for ( i = 0; i < 2; i++)
  637. {
  638. m_Chart3.SetColumn(i + 1);
  639. m_Chart3.SetColumnLabel((LPCTSTR)m_typearray.ElementAt(i));
  640. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  641. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  642. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  643. }
  644. VARIANT var;
  645. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(0);
  646. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetMaximum(100);
  647. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetMinimum(0);
  648. float dindandata[12] = { 0 };
  649. float dindandata2[12] = { 0 };
  650. float choosezs[12] = { 0 };
  651. int count[12] = { 0 };
  652. CString stryear[12] = { "1月", \
  653. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  654. CString str;
  655. CString type;
  656. int selpos = m_combo1.GetCurSel();
  657. if (selpos != -1)
  658. m_combo1.GetLBText(selpos, type);
  659. if (selpos == -1 || type.IsEmpty() || type == "---全部---" || type == "---按套系类别---" || type == "---按套系名称---")
  660. {
  661. for (i = 0; i < m_dindanarray.GetSize(); i++)
  662. {
  663. if (m_dindanarray.ElementAt(i).ElementAt(12) == "OK")
  664. {
  665. if (atof(m_dindanarray.ElementAt(i).ElementAt(10)) > (atof(m_dindanarray.ElementAt(i).ElementAt(9)) + atof(m_dindanarray.ElementAt(i).ElementAt(11))))
  666. {
  667. choosezs[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_dindanarray.ElementAt(i).ElementAt(11));
  668. 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)));
  669. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(str);
  670. count[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  671. }
  672. }
  673. }
  674. }
  675. else if (selpos > m_taoxipos)
  676. {
  677. for (i = 0; i < m_dindanarray.GetSize(); i++)
  678. {
  679. if (m_dindanarray.ElementAt(i).ElementAt(7) != type)continue;
  680. if (m_dindanarray.ElementAt(i).ElementAt(12) == "OK")
  681. {
  682. if (atof(m_dindanarray.ElementAt(i).ElementAt(10)) > (atof(m_dindanarray.ElementAt(i).ElementAt(9)) + atof(m_dindanarray.ElementAt(i).ElementAt(11))))
  683. {
  684. choosezs[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_dindanarray.ElementAt(i).ElementAt(11));
  685. 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)));
  686. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(str);
  687. count[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  688. }
  689. }
  690. }
  691. }
  692. else
  693. {
  694. for (i = 0; i < m_dindanarray.GetSize(); i++)
  695. {
  696. if (m_dindanarray.ElementAt(i).ElementAt(0) != type)continue;
  697. if (m_dindanarray.ElementAt(i).ElementAt(12) == "OK")
  698. {
  699. if (atof(m_dindanarray.ElementAt(i).ElementAt(10)) > (atof(m_dindanarray.ElementAt(i).ElementAt(9)) + atof(m_dindanarray.ElementAt(i).ElementAt(11))))
  700. {
  701. choosezs[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_dindanarray.ElementAt(i).ElementAt(11));
  702. 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)));
  703. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(str);
  704. count[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  705. }
  706. }
  707. }
  708. }
  709. /* for( i=0; i<m_dindanarray.GetSize (); i++)
  710. {
  711. if(m_dindanarray.ElementAt (i).ElementAt (12)=="OK")
  712. {
  713. if(atof(m_dindanarray.ElementAt (i).ElementAt (10))>(atof(m_dindanarray.ElementAt (i).ElementAt (9))+atof(m_dindanarray.ElementAt (i).ElementAt (11))))
  714. {
  715. choosezs[atoi(m_dindanarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(m_dindanarray.ElementAt (i).ElementAt (11));
  716. 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)) );
  717. dindandata[atoi(m_dindanarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(str);
  718. count[atoi(m_dindanarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]++;
  719. }
  720. }
  721. }*/
  722. for (i = 0; i < 12; i++)
  723. {
  724. if (count[i])
  725. {
  726. str.Format("%0.1f", dindandata[i] / count[i]);
  727. dindandata[i] = atof(str);
  728. str.Format("%0.1f", choosezs[i] / count[i]);
  729. dindandata2[i] = atof(str);
  730. }
  731. }
  732. int nRowCount = 12;// VARIANT var;
  733. m_Chart3.SetRowCount(nRowCount);
  734. float ftemp;
  735. for (int row = 1; row <= nRowCount; ++row)
  736. {
  737. m_Chart3.SetRow(row);
  738. m_Chart3.SetRowLabel(stryear[row - 1]);
  739. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  740. m_Chart3.GetDataGrid().SetData(row, 2, dindandata2[row - 1], 0);
  741. }
  742. m_Chart3.Refresh();
  743. }
  744. extern void SortArray(BOOL bAscending, CStringArray &datearray, CArray<int, int>&valuearray);
  745. void DinDanForm::KindChange()
  746. {
  747. UpdateData();
  748. if (m_radio1 == 1)
  749. {
  750. KindChange2();
  751. return;
  752. }
  753. else if (m_radio1 == 2)
  754. {
  755. KindChange3();
  756. return;
  757. }
  758. else if (m_radio1 == 3)
  759. {
  760. KindChange4();
  761. return;
  762. }
  763. else if (m_radio1 == 4)
  764. {
  765. KindChange5();
  766. return;
  767. }
  768. else if (m_radio1 == 5)
  769. {
  770. KindChange6();
  771. return;
  772. }
  773. else if (m_radio1 == 6)
  774. {
  775. KindChange7();
  776. return;
  777. }
  778. else if (m_radio1 == 7)
  779. {//MessageBox("fd");
  780. KindChange8();
  781. return;
  782. }
  783. else if (m_radio1 == 8)
  784. { //MessageBox("fd2");
  785. KindChange9();
  786. return;
  787. }
  788. int i = 0;
  789. if (m_filterarray.GetSize() == 0)
  790. {
  791. CStringArray m_typearray;
  792. CArray<int, int>sortarray;
  793. for ( i = 0; i < m_dindanarray.GetSize(); i++)
  794. {
  795. if (::FindArray(&m_typearray, m_dindanarray.ElementAt(i).ElementAt(0)) == -1)
  796. {
  797. m_typearray.Add(m_dindanarray.ElementAt(i).ElementAt(0));
  798. sortarray.Add(0);
  799. }
  800. }
  801. for (i = 0; i < m_dindanarray.GetSize(); i++)
  802. {
  803. for (int j = 0; j < m_typearray.GetSize(); j++)
  804. {
  805. if (m_dindanarray.ElementAt(i).ElementAt(0) == m_typearray.ElementAt(j))
  806. {
  807. sortarray.SetAt(j, sortarray.ElementAt(j) + 1);
  808. }
  809. }
  810. }
  811. SortArray(1, m_typearray, sortarray);
  812. m_pchild->TypeChange(&m_typearray);
  813. return;
  814. }
  815. if (m_filterarray.GetSize() == 0)return;
  816. while (m_filterarray.GetSize()>10)
  817. m_filterarray.RemoveAt(m_filterarray.GetSize() - 1);
  818. int typecount = m_filterarray.GetSize();
  819. if (m_radio2)
  820. m_Chart3.SetColumnCount(typecount);
  821. else
  822. m_Chart3.SetColumnCount(1);
  823. VARIANT var;
  824. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  825. COLORREF col[10] = { \
  826. RGB(255, 0, 0), \
  827. RGB(0, 255, 0), \
  828. RGB(0, 0, 255), \
  829. RGB(255, 255, 0), \
  830. RGB(0, 255, 255), \
  831. RGB(255, 0, 255), \
  832. RGB(127, 0, 0), \
  833. RGB(0, 127, 0), \
  834. RGB(0, 0, 127), \
  835. RGB(127, 127, 0)
  836. };
  837. if (m_radio2)
  838. {
  839. for (i = 0; i < m_filterarray.GetSize(); i++)
  840. {
  841. m_Chart3.SetColumn(i + 1);
  842. m_Chart3.SetColumnLabel((LPCTSTR)m_filterarray.ElementAt(i));
  843. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  844. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  845. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  846. }
  847. }
  848. else
  849. {
  850. m_Chart3.SetColumn(1);
  851. m_Chart3.SetColumnLabel((LPCTSTR)"全部");
  852. }
  853. int dindandata[12] = { 0 };
  854. int dindandata1[10][12] = { 0 };
  855. for (i = 0; i < 10; i++)
  856. {
  857. for (int j = 0; j < 12; j++)
  858. {
  859. dindandata1[i][j] = 0;
  860. }
  861. }
  862. CString stryear[12] = { "1月", \
  863. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  864. ////////////
  865. CString type;
  866. int selpos = m_combo1.GetCurSel();
  867. if (selpos != -1)
  868. m_combo1.GetLBText(selpos, type);
  869. if (selpos == -1 || type.IsEmpty() || type == "---全部---" || type == "---按套系类别---" || type == "---按套系名称---")
  870. {
  871. for (i = 0; i < m_dindanarray.GetSize(); i++)
  872. {
  873. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  874. for (int j = 0; j < m_filterarray.GetSize(); j++)
  875. {
  876. if (m_dindanarray.ElementAt(i).ElementAt(0) == m_filterarray.ElementAt(j))
  877. {
  878. 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;
  879. break;
  880. }
  881. }
  882. }
  883. }
  884. else if (selpos > m_taoxipos)
  885. {
  886. for (i = 0; i < m_dindanarray.GetSize(); i++)
  887. {
  888. if (m_dindanarray.ElementAt(i).ElementAt(7) != type)continue;
  889. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  890. for (int j = 0; j < m_filterarray.GetSize(); j++)
  891. {
  892. if (m_dindanarray.ElementAt(i).ElementAt(0) == m_filterarray.ElementAt(j))
  893. {
  894. 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;
  895. break;
  896. }
  897. }
  898. }
  899. }
  900. else
  901. {
  902. for (i = 0; i < m_dindanarray.GetSize(); i++)
  903. {
  904. if (m_dindanarray.ElementAt(i).ElementAt(0) != type)continue;
  905. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  906. for (int j = 0; j < m_filterarray.GetSize(); j++)
  907. {
  908. if (m_dindanarray.ElementAt(i).ElementAt(0) == m_filterarray.ElementAt(j))
  909. {
  910. 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;
  911. break;
  912. }
  913. }
  914. }
  915. }
  916. /////////////
  917. int nRowCount = 12;// VARIANT var;
  918. m_Chart3.SetRowCount(nRowCount);
  919. float ftemp;
  920. for (int row = 1; row <= nRowCount; ++row)
  921. {
  922. m_Chart3.SetRow(row);
  923. m_Chart3.SetRowLabel(stryear[row - 1]);
  924. if (m_radio2)
  925. {
  926. for (int j = 0; j < m_filterarray.GetSize(); j++)
  927. {
  928. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  929. }
  930. }
  931. else
  932. {
  933. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  934. }
  935. }
  936. m_Chart3.Refresh();
  937. }
  938. BEGIN_EVENTSINK_MAP(DinDanForm, MyFormView)
  939. //{{AFX_EVENTSINK_MAP(DinDanForm)
  940. ON_EVENT(DinDanForm, IDC_MSCHART3, -601 /* DblClick */, OnDblClickMschart3, VTS_NONE)
  941. //}}AFX_EVENTSINK_MAP
  942. END_EVENTSINK_MAP()
  943. extern BOOL g_bShowMsChart;
  944. extern HWND g_hShowChartWnd;
  945. void DinDanForm::OnDblClickMschart3()
  946. {
  947. // TODO: Add your control notification handler code here
  948. if (g_bShowMsChart)
  949. {
  950. ::SendMessage(g_hShowChartWnd, WM_CLOSE, 0, 0);
  951. return;
  952. }
  953. g_bShowMsChart = 1;
  954. CRect rc;
  955. m_Chart3.GetWindowRect(rc);
  956. ScreenToClient(rc);
  957. ShowMschart dlg;
  958. dlg.m_pParent = this;
  959. dlg.m_pChart = &m_Chart3;
  960. dlg.DoModal();
  961. m_Chart3.MoveWindow(rc);
  962. g_bShowMsChart = 0;
  963. }
  964. void DinDanForm::OnRadio6()
  965. {
  966. // TODO: Add your control notification handler code here
  967. m_filterarray.RemoveAll();
  968. KindChange();
  969. }
  970. void DinDanForm::OnRadio7()
  971. {
  972. // TODO: Add your control notification handler code here
  973. OnRadio6();
  974. }
  975. void DinDanForm::OnSelchangeCombo1()
  976. {
  977. // TODO: Add your control notification handler code here
  978. OnRadio6();
  979. }
  980. void DinDanForm::OnRadio8()
  981. {
  982. // TODO: Add your control notification handler code here
  983. OnRadio3();
  984. }
  985. void DinDanForm::OnRadio10()
  986. {
  987. // TODO: Add your control notification handler code here
  988. OnRadio3();
  989. }
  990. void DinDanForm::OnRadio11()
  991. {
  992. // TODO: Add your control notification handler code here
  993. OnRadio3();
  994. }
  995. void DinDanForm::OnRadio12()
  996. {
  997. // TODO: Add your control notification handler code here
  998. OnRadio3();
  999. }
  1000. void DinDanForm::OnRadio13()
  1001. {
  1002. // TODO: Add your control notification handler code here
  1003. OnRadio3();
  1004. }
  1005. void DinDanForm::KindChange5()
  1006. {
  1007. m_Chart3.SetColumnCount(2);
  1008. COLORREF col[10] = { \
  1009. RGB(255, 0, 0), \
  1010. RGB(0, 255, 0), \
  1011. RGB(255, 0, 255), \
  1012. RGB(0, 255, 0), \
  1013. RGB(255, 0, 0), \
  1014. RGB(255, 255, 0), \
  1015. RGB(127, 0, 0), \
  1016. RGB(0, 127, 0), \
  1017. RGB(0, 0, 127), \
  1018. RGB(127, 127, 0)
  1019. };
  1020. CStringArray m_typearray;
  1021. m_typearray.Add("订单总数");
  1022. m_typearray.Add("正式订单");
  1023. int i = 0;
  1024. for ( i = 0; i < 2; i++)
  1025. {
  1026. m_Chart3.SetColumn(i + 1);
  1027. m_Chart3.SetColumnLabel((LPCTSTR)m_typearray.ElementAt(i));
  1028. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1029. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  1030. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1031. }
  1032. VARIANT var;
  1033. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(0);
  1034. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetMaximum(100);
  1035. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetMinimum(0);
  1036. float dindandata[12] = { 0 };
  1037. float dindandata2[12] = { 0 };
  1038. CString stryear[12] = { "1月", \
  1039. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  1040. CString str;
  1041. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1042. {
  1043. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  1044. if (m_dindanarray.ElementAt(i).ElementAt(13) != "意向客户")
  1045. {
  1046. dindandata2[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  1047. }
  1048. }
  1049. int nRowCount = 12;// VARIANT var;
  1050. m_Chart3.SetRowCount(nRowCount);
  1051. float ftemp;
  1052. for (int row = 1; row <= nRowCount; ++row)
  1053. {
  1054. m_Chart3.SetRow(row);
  1055. m_Chart3.SetRowLabel(stryear[row - 1]);
  1056. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  1057. m_Chart3.GetDataGrid().SetData(row, 2, dindandata2[row - 1], 0);
  1058. }
  1059. m_Chart3.Refresh();
  1060. }
  1061. void DinDanForm::KindChange6()
  1062. {
  1063. int i = 0;
  1064. CStringArray m_typearray;
  1065. for ( i = 0; i < m_dindanarray.GetSize(); i++)
  1066. {
  1067. if (m_dindanarray.ElementAt(i).ElementAt(14) == "")continue;
  1068. if (::FindArray(&m_typearray, m_dindanarray.ElementAt(i).ElementAt(14)) == -1)
  1069. m_typearray.Add(m_dindanarray.ElementAt(i).ElementAt(14));
  1070. }
  1071. if (m_typearray.GetSize() == 0)return;
  1072. while (m_typearray.GetSize()>10)
  1073. m_typearray.RemoveAt(m_typearray.GetSize() - 1);
  1074. int typecount = m_typearray.GetSize();
  1075. m_Chart3.SetColumnCount(typecount);
  1076. VARIANT var;
  1077. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  1078. COLORREF col[10] = { \
  1079. RGB(255, 0, 0), \
  1080. RGB(0, 255, 0), \
  1081. RGB(0, 0, 255), \
  1082. RGB(255, 255, 0), \
  1083. RGB(0, 255, 255), \
  1084. RGB(255, 0, 255), \
  1085. RGB(127, 0, 0), \
  1086. RGB(0, 127, 0), \
  1087. RGB(0, 0, 127), \
  1088. RGB(127, 127, 0)
  1089. };
  1090. for (i = 0; i < m_typearray.GetSize(); i++)
  1091. {
  1092. m_Chart3.SetColumn(i + 1);
  1093. m_Chart3.SetColumnLabel((LPCTSTR)m_typearray.ElementAt(i));
  1094. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1095. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  1096. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1097. }
  1098. int dindandata1[10][12] = { 0 };
  1099. for (i = 0; i < 10; i++)
  1100. {
  1101. for (int j = 0; j < 12; j++)
  1102. {
  1103. dindandata1[i][j] = 0;
  1104. }
  1105. }
  1106. CString stryear[12] = { "1月", \
  1107. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  1108. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1109. {
  1110. for (int j = 0; j < m_typearray.GetSize(); j++)
  1111. {
  1112. if (m_dindanarray.ElementAt(i).ElementAt(14) == m_typearray.ElementAt(j))
  1113. {
  1114. 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;
  1115. break;
  1116. }
  1117. }
  1118. }
  1119. /////////////
  1120. int nRowCount = 12;// VARIANT var;
  1121. m_Chart3.SetRowCount(nRowCount);
  1122. float ftemp;
  1123. for (int row = 1; row <= nRowCount; ++row)
  1124. {
  1125. m_Chart3.SetRow(row);
  1126. m_Chart3.SetRowLabel(stryear[row - 1]);
  1127. for (int j = 0; j < m_typearray.GetSize(); j++)
  1128. {
  1129. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  1130. }
  1131. }
  1132. m_Chart3.Refresh();
  1133. }
  1134. void DinDanForm::KindChange7()
  1135. {
  1136. int i = 0;
  1137. CStringArray m_typearray;
  1138. for ( i = 0; i < m_dindanarray.GetSize(); i++)
  1139. {
  1140. if (m_dindanarray.ElementAt(i).ElementAt(15) == "")continue;
  1141. if (::FindArray(&m_typearray, m_dindanarray.ElementAt(i).ElementAt(15)) == -1)
  1142. m_typearray.Add(m_dindanarray.ElementAt(i).ElementAt(15));
  1143. }
  1144. if (m_typearray.GetSize() == 0)return;
  1145. while (m_typearray.GetSize()>10)
  1146. m_typearray.RemoveAt(m_typearray.GetSize() - 1);
  1147. int typecount = m_typearray.GetSize();
  1148. m_Chart3.SetColumnCount(typecount);
  1149. VARIANT var;
  1150. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  1151. COLORREF col[10] = { \
  1152. RGB(255, 0, 0), \
  1153. RGB(0, 255, 0), \
  1154. RGB(0, 0, 255), \
  1155. RGB(255, 255, 0), \
  1156. RGB(0, 255, 255), \
  1157. RGB(255, 0, 255), \
  1158. RGB(127, 0, 0), \
  1159. RGB(0, 127, 0), \
  1160. RGB(0, 0, 127), \
  1161. RGB(127, 127, 0)
  1162. };
  1163. for (i = 0; i < m_typearray.GetSize(); i++)
  1164. {
  1165. m_Chart3.SetColumn(i + 1);
  1166. m_Chart3.SetColumnLabel((LPCTSTR)m_typearray.ElementAt(i));
  1167. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1168. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  1169. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1170. }
  1171. int dindandata1[10][12] = { 0 };
  1172. for (i = 0; i < 10; i++)
  1173. {
  1174. for (int j = 0; j < 12; j++)
  1175. {
  1176. dindandata1[i][j] = 0;
  1177. }
  1178. }
  1179. CString stryear[12] = { "1月", \
  1180. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  1181. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1182. {
  1183. for (int j = 0; j < m_typearray.GetSize(); j++)
  1184. {
  1185. if (m_dindanarray.ElementAt(i).ElementAt(15) == m_typearray.ElementAt(j))
  1186. {
  1187. 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;
  1188. break;
  1189. }
  1190. }
  1191. }
  1192. /////////////
  1193. int nRowCount = 12;// VARIANT var;
  1194. m_Chart3.SetRowCount(nRowCount);
  1195. float ftemp;
  1196. for (int row = 1; row <= nRowCount; ++row)
  1197. {
  1198. m_Chart3.SetRow(row);
  1199. m_Chart3.SetRowLabel(stryear[row - 1]);
  1200. for (int j = 0; j < m_typearray.GetSize(); j++)
  1201. {
  1202. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  1203. }
  1204. }
  1205. m_Chart3.Refresh();
  1206. }
  1207. void DinDanForm::OnRadio24()
  1208. {
  1209. // TODO: Add your control notification handler code here
  1210. OnRadio3();
  1211. }
  1212. void DinDanForm::OnRadio25()
  1213. {
  1214. // TODO: Add your control notification handler code here
  1215. OnRadio3();
  1216. }
  1217. void DinDanForm::KindChange8()
  1218. {
  1219. int i = 0;
  1220. int j = 0;
  1221. if (m_pchild->m_List2.GetCount() == 0)
  1222. {
  1223. CStringArray m_typearray;
  1224. CArray<int, int>sortarray;
  1225. for ( i = 0; i < m_moneyarray.GetSize(); i++)
  1226. {
  1227. // if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1228. if (::FindArray(&m_typearray, m_moneyarray.ElementAt(i).ElementAt(7)) == -1)
  1229. {
  1230. m_typearray.Add(m_moneyarray.ElementAt(i).ElementAt(7));
  1231. sortarray.Add(0);
  1232. }
  1233. }
  1234. for (i = 0; i < m_moneyarray.GetSize(); i++)
  1235. {
  1236. // if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1237. for ( j = 0; j < m_typearray.GetSize(); j++)
  1238. {
  1239. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_typearray.ElementAt(j))
  1240. {
  1241. sortarray.SetAt(j, sortarray.ElementAt(j) + atoi(m_moneyarray.ElementAt(i).ElementAt(0)));
  1242. }
  1243. }
  1244. }
  1245. SortArray(1, m_typearray, sortarray);
  1246. m_typearray.InsertAt(0, "全部(二销)");
  1247. m_typearray.InsertAt(0, "全部(前期)");
  1248. m_typearray.InsertAt(0, "全部(前期+二销)");
  1249. m_pchild->TypeChange2(&m_typearray);
  1250. }
  1251. if (m_filterarray.GetSize() == 0)
  1252. {
  1253. CStringArray m_typearray;
  1254. CArray<int, int>sortarray; CArray<int, int>sortarray2;
  1255. for ( i = 0; i < m_moneyarray.GetSize(); i++)
  1256. {
  1257. BOOL bOK = 0;
  1258. for ( j = 0; j < m_filterarray2.GetSize(); j++)
  1259. {
  1260. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_filterarray2.ElementAt(j))
  1261. {
  1262. bOK = 1;
  1263. break;
  1264. }
  1265. if ("全部(前期+二销)" == m_filterarray2.ElementAt(j))
  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) == "预约补款")
  1276. {
  1277. bOK = 1;
  1278. break;
  1279. }
  1280. if ("全部(二销)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) != "预约收款" && m_moneyarray.ElementAt(i).ElementAt(7) != "预约补款")
  1281. {
  1282. bOK = 1;
  1283. break;
  1284. }
  1285. }
  1286. if (bOK == 0)continue;
  1287. if (::FindArray(&m_typearray, m_moneyarray.ElementAt(i).ElementAt(6)) == -1)
  1288. {
  1289. m_typearray.Add(m_moneyarray.ElementAt(i).ElementAt(6));
  1290. sortarray.Add(0); sortarray2.Add(0);
  1291. }
  1292. }
  1293. for (i = 0; i < m_moneyarray.GetSize(); i++)
  1294. {
  1295. BOOL bOK = 0;
  1296. for ( j = 0; j < m_filterarray2.GetSize(); j++)
  1297. {
  1298. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_filterarray2.ElementAt(j))
  1299. {
  1300. bOK = 1;
  1301. break;
  1302. }
  1303. if ("全部(前期+二销)" == m_filterarray2.ElementAt(j))
  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) == "预约补款")
  1314. {
  1315. bOK = 1;
  1316. break;
  1317. }
  1318. if ("全部(二销)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) != "预约收款" && m_moneyarray.ElementAt(i).ElementAt(7) != "预约补款")
  1319. {
  1320. bOK = 1;
  1321. break;
  1322. }
  1323. }
  1324. if (bOK == 0)continue;
  1325. for (j = 0; j < m_typearray.GetSize(); j++)
  1326. {
  1327. if (m_moneyarray.ElementAt(i).ElementAt(6) == m_typearray.ElementAt(j))
  1328. {
  1329. sortarray.SetAt(j, sortarray.ElementAt(j) + atoi(m_moneyarray.ElementAt(i).ElementAt(0)));
  1330. sortarray2.SetAt(j, sortarray2.ElementAt(j) + 1);
  1331. }
  1332. }
  1333. }
  1334. if (m_check1)//均值
  1335. {
  1336. for ( j = 0; j < sortarray.GetSize(); j++)
  1337. {
  1338. if (sortarray2.ElementAt(j))
  1339. {
  1340. sortarray.SetAt(j, sortarray.ElementAt(j) / sortarray2.ElementAt(j));
  1341. }
  1342. }
  1343. }
  1344. SortArray(1, m_typearray, sortarray);
  1345. m_pchild->TypeChange(&m_typearray);
  1346. return;
  1347. }
  1348. if (m_filterarray.GetSize() == 0)return;
  1349. while (m_filterarray.GetSize()>10)
  1350. m_filterarray.RemoveAt(m_filterarray.GetSize() - 1);
  1351. int typecount = m_filterarray.GetSize();
  1352. if (m_radio2)
  1353. m_Chart3.SetColumnCount(typecount);
  1354. else
  1355. m_Chart3.SetColumnCount(1);
  1356. VARIANT var;
  1357. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  1358. COLORREF col[10] = { \
  1359. RGB(255, 0, 0), \
  1360. RGB(0, 255, 0), \
  1361. RGB(0, 0, 255), \
  1362. RGB(255, 255, 0), \
  1363. RGB(0, 255, 255), \
  1364. RGB(255, 0, 255), \
  1365. RGB(127, 0, 0), \
  1366. RGB(0, 127, 0), \
  1367. RGB(0, 0, 127), \
  1368. RGB(127, 127, 0)
  1369. };
  1370. if (m_radio2)
  1371. {
  1372. for (i = 0; i < m_filterarray.GetSize(); i++)
  1373. {
  1374. m_Chart3.SetColumn(i + 1);
  1375. m_Chart3.SetColumnLabel((LPCTSTR)m_filterarray.ElementAt(i));
  1376. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1377. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  1378. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1379. }
  1380. }
  1381. else
  1382. {
  1383. m_Chart3.SetColumn(1);
  1384. m_Chart3.SetColumnLabel((LPCTSTR)"全部");
  1385. }
  1386. float dindandata[12] = { 0 };
  1387. float dindandatacot[12] = { 0 };
  1388. float dindandata1[10][12] = { 0 };
  1389. float dindandatacot2[10][12] = { 0 };
  1390. for (i = 0; i < 10; i++)
  1391. {
  1392. for ( j = 0; j < 12; j++)
  1393. {
  1394. dindandata1[i][j] = 0; dindandatacot2[i][j] = 0;
  1395. }
  1396. }
  1397. CString stryear[12] = { "1月", \
  1398. "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  1399. ////////////
  1400. CString type;
  1401. int selpos = m_combo1.GetCurSel();
  1402. if (selpos != -1)
  1403. m_combo1.GetLBText(selpos, type);
  1404. if (selpos == -1 || type.IsEmpty() || type == "---全部---" || type == "---按套系类别---" || type == "---按套系名称---")
  1405. {
  1406. for (i = 0; i < m_moneyarray.GetSize(); i++)
  1407. {
  1408. // if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1409. BOOL bOK = 0;
  1410. for ( j = 0; j < m_filterarray2.GetSize(); j++)
  1411. {
  1412. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_filterarray2.ElementAt(j))
  1413. {
  1414. bOK = 1;
  1415. break;
  1416. }
  1417. if ("全部(前期+二销)" == m_filterarray2.ElementAt(j))
  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) == "预约补款")
  1428. {
  1429. bOK = 1;
  1430. break;
  1431. }
  1432. if ("全部(二销)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) != "预约收款" && m_moneyarray.ElementAt(i).ElementAt(7) != "预约补款")
  1433. {
  1434. bOK = 1;
  1435. break;
  1436. }
  1437. }
  1438. if (bOK == 0)continue;
  1439. dindandata[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_moneyarray.ElementAt(i).ElementAt(0));
  1440. dindandatacot[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += 1.0;
  1441. for (j = 0; j < m_filterarray.GetSize(); j++)
  1442. {
  1443. if (m_moneyarray.ElementAt(i).ElementAt(6) == m_filterarray.ElementAt(j))
  1444. {
  1445. 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));
  1446. 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;
  1447. break;
  1448. }
  1449. }
  1450. }
  1451. }
  1452. else if (selpos > m_taoxipos)
  1453. {
  1454. for (i = 0; i < m_moneyarray.GetSize(); i++)
  1455. {
  1456. // if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1457. BOOL bOK = 0;
  1458. for ( j = 0; j < m_filterarray2.GetSize(); j++)
  1459. {
  1460. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_filterarray2.ElementAt(j))
  1461. {
  1462. bOK = 1;
  1463. break;
  1464. }
  1465. if ("全部(前期+二销)" == m_filterarray2.ElementAt(j))
  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) == "预约补款")
  1476. {
  1477. bOK = 1;
  1478. break;
  1479. }
  1480. if ("全部(二销)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) != "预约收款" && m_moneyarray.ElementAt(i).ElementAt(7) != "预约补款")
  1481. {
  1482. bOK = 1;
  1483. break;
  1484. }
  1485. }
  1486. if (bOK == 0)continue;
  1487. if (m_moneyarray.ElementAt(i).ElementAt(9) != type)continue;
  1488. dindandata[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_moneyarray.ElementAt(i).ElementAt(0));
  1489. dindandatacot[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += 1.0;
  1490. for (j = 0; j < m_filterarray.GetSize(); j++)
  1491. {
  1492. if (m_moneyarray.ElementAt(i).ElementAt(6) == m_filterarray.ElementAt(j))
  1493. {
  1494. 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));
  1495. 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;
  1496. break;
  1497. }
  1498. }
  1499. }
  1500. }
  1501. else
  1502. {
  1503. for (i = 0; i < m_moneyarray.GetSize(); i++)
  1504. {
  1505. // if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1506. BOOL bOK = 0;
  1507. for ( j = 0; j < m_filterarray2.GetSize(); j++)
  1508. {
  1509. if (m_moneyarray.ElementAt(i).ElementAt(7) == m_filterarray2.ElementAt(j))
  1510. {
  1511. bOK = 1;
  1512. break;
  1513. }
  1514. if ("全部(前期+二销)" == m_filterarray2.ElementAt(j))
  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) == "预约补款")
  1525. {
  1526. bOK = 1;
  1527. break;
  1528. }
  1529. if ("全部(二销)" == m_filterarray2.ElementAt(j) && m_moneyarray.ElementAt(i).ElementAt(7) != "预约收款" && m_moneyarray.ElementAt(i).ElementAt(7) != "预约补款")
  1530. {
  1531. bOK = 1;
  1532. break;
  1533. }
  1534. }
  1535. if (bOK == 0)continue;
  1536. if (m_moneyarray.ElementAt(i).ElementAt(8) != type)continue;
  1537. dindandata[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += atof(m_moneyarray.ElementAt(i).ElementAt(0));
  1538. dindandatacot[atoi(m_moneyarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1] += 1.0;
  1539. for (j = 0; j < m_filterarray.GetSize(); j++)
  1540. {
  1541. if (m_moneyarray.ElementAt(i).ElementAt(6) == m_filterarray.ElementAt(j))
  1542. {
  1543. 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));
  1544. 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;
  1545. break;
  1546. }
  1547. }
  1548. }
  1549. }
  1550. /////////////
  1551. int nRowCount = 12;// VARIANT var;
  1552. m_Chart3.SetRowCount(nRowCount);
  1553. float ftemp;
  1554. for (int row = 1; row <= nRowCount; ++row)
  1555. {
  1556. m_Chart3.SetRow(row);
  1557. m_Chart3.SetRowLabel(stryear[row - 1]);
  1558. if (m_check1)//均值
  1559. {
  1560. if (m_radio2)
  1561. {
  1562. for ( j = 0; j < m_filterarray.GetSize(); j++)
  1563. {
  1564. if (dindandatacot2[j][row - 1] < 1.0)
  1565. m_Chart3.GetDataGrid().SetData(row, j + 1, 0, 0);
  1566. else
  1567. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1] / dindandatacot2[j][row - 1], 0);
  1568. }
  1569. }
  1570. else
  1571. {
  1572. if (dindandatacot[row - 1] < 1.0)
  1573. m_Chart3.GetDataGrid().SetData(row, 1, 0, 0);
  1574. else
  1575. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1] / dindandatacot[row - 1], 0);
  1576. }
  1577. }
  1578. else
  1579. {
  1580. if (m_radio2)
  1581. {
  1582. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1583. {
  1584. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  1585. }
  1586. }
  1587. else
  1588. {
  1589. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  1590. }
  1591. }
  1592. }
  1593. m_Chart3.Refresh();
  1594. }
  1595. /*
  1596. void DinDanForm::KindChange8()
  1597. {
  1598. int i;
  1599. if(m_filterarray.GetSize ()==0)
  1600. {
  1601. CStringArray m_typearray;
  1602. CArray<int,int>sortarray;
  1603. for(int i=0; i<m_moneyarray.GetSize (); i++)
  1604. {
  1605. if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1606. if(::FindArray (&m_typearray, m_moneyarray.ElementAt (i).ElementAt (6))==-1)
  1607. {
  1608. m_typearray.Add(m_moneyarray.ElementAt (i).ElementAt (6));
  1609. sortarray.Add(0);
  1610. }
  1611. }
  1612. for( i=0; i<m_moneyarray.GetSize (); i++)
  1613. {
  1614. if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1615. for(int j=0; j<m_typearray.GetSize (); j++)
  1616. {
  1617. if(m_moneyarray.ElementAt (i).ElementAt (6)==m_typearray.ElementAt (j))
  1618. {
  1619. sortarray.SetAt(j, sortarray.ElementAt(j)+atoi(m_moneyarray.ElementAt (i).ElementAt (0)));
  1620. }
  1621. }
  1622. }
  1623. SortArray(1, m_typearray, sortarray);
  1624. m_pchild->TypeChange(&m_typearray);
  1625. return;
  1626. }
  1627. if(m_filterarray.GetSize ()==0)return;
  1628. while(m_filterarray.GetSize ()>10)
  1629. m_filterarray.RemoveAt (m_filterarray.GetSize ()-1);
  1630. int typecount=m_filterarray.GetSize ();
  1631. if(m_radio2)
  1632. m_Chart3.SetColumnCount(typecount);
  1633. else
  1634. m_Chart3.SetColumnCount(1);
  1635. VARIANT var;
  1636. m_Chart3.GetPlot().GetAxis(1,var).GetValueScale().SetAuto(1);
  1637. COLORREF col[10]={\
  1638. RGB(255,0,0),\
  1639. RGB(0,255,0),\
  1640. RGB(0,0,255),\
  1641. RGB(255,255,0),\
  1642. RGB(0,255,255),\
  1643. RGB(255,0,255),\
  1644. RGB(127,0,0),\
  1645. RGB(0,127,0),\
  1646. RGB(0,0,127),\
  1647. RGB(127,127,0)
  1648. };
  1649. if(m_radio2)
  1650. {
  1651. for( i=0; i<m_filterarray.GetSize (); i++)
  1652. {
  1653. m_Chart3.SetColumn(i+1);
  1654. m_Chart3.SetColumnLabel((LPCTSTR)m_filterarray.ElementAt (i));
  1655. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i+1).GetDataPoints ().GetItem(-1).GetBrush ().GetFillColor ().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1656. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i+1).GetPen().SetWidth(30);
  1657. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i+1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1658. }
  1659. }
  1660. else
  1661. {
  1662. m_Chart3.SetColumn(1);
  1663. m_Chart3.SetColumnLabel((LPCTSTR)"全部");
  1664. }
  1665. float dindandata[12]={0};
  1666. float dindandatacot[12]={0};
  1667. float dindandata1[10][12]={0};
  1668. float dindandatacot2[10][12]={0};
  1669. for(i=0; i<10; i++)
  1670. {
  1671. for(int j=0; j<12; j++)
  1672. {
  1673. dindandata1[i][j]=0;dindandatacot2[i][j]=0;
  1674. }
  1675. }
  1676. CString stryear[12]={"1月",\
  1677. "2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"};
  1678. ////////////
  1679. CString type;
  1680. int selpos=m_combo1.GetCurSel ();
  1681. if(selpos!=-1)
  1682. m_combo1.GetLBText (selpos, type);
  1683. if(selpos==-1 || type.IsEmpty () || type=="---全部---" || type=="---按套系类别---" || type=="---按套系名称---")
  1684. {
  1685. for( i=0; i<m_moneyarray.GetSize (); i++)
  1686. {
  1687. if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1688. dindandata[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(m_moneyarray.ElementAt (i).ElementAt (0));
  1689. dindandatacot[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=1.0;
  1690. for(int j=0; j<m_filterarray.GetSize (); j++)
  1691. {
  1692. if(m_moneyarray.ElementAt (i).ElementAt (6)==m_filterarray.ElementAt (j))
  1693. {
  1694. 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));
  1695. 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;
  1696. break;
  1697. }
  1698. }
  1699. }
  1700. }
  1701. else if(selpos>m_taoxipos)
  1702. {
  1703. for( i=0; i<m_moneyarray.GetSize (); i++)
  1704. {
  1705. if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1706. if(m_moneyarray.ElementAt (i).ElementAt (9)!=type)continue;
  1707. dindandata[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(m_moneyarray.ElementAt (i).ElementAt (0));
  1708. dindandatacot[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=1.0;
  1709. for(int j=0; j<m_filterarray.GetSize (); j++)
  1710. {
  1711. if(m_moneyarray.ElementAt (i).ElementAt (6)==m_filterarray.ElementAt (j))
  1712. {
  1713. 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));
  1714. 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;
  1715. break;
  1716. }
  1717. }
  1718. }
  1719. }
  1720. else
  1721. {
  1722. for( i=0; i<m_moneyarray.GetSize (); i++)
  1723. {
  1724. if(m_moneyarray.ElementAt (i).ElementAt (7)!="选片二销")continue;
  1725. if(m_moneyarray.ElementAt (i).ElementAt (8)!=type)continue;
  1726. dindandata[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=atof(m_moneyarray.ElementAt (i).ElementAt (0));
  1727. dindandatacot[atoi(m_moneyarray.ElementAt (i).ElementAt (1).Mid (5, 2))-1]+=1.0;
  1728. for(int j=0; j<m_filterarray.GetSize (); j++)
  1729. {
  1730. if(m_moneyarray.ElementAt (i).ElementAt (6)==m_filterarray.ElementAt (j))
  1731. {
  1732. 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));
  1733. 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;
  1734. break;
  1735. }
  1736. }
  1737. }
  1738. }
  1739. /////////////
  1740. int nRowCount=12;// VARIANT var;
  1741. m_Chart3.SetRowCount(nRowCount);
  1742. float ftemp;
  1743. for(int row = 1; row <= nRowCount; ++row)
  1744. {
  1745. m_Chart3.SetRow(row);
  1746. m_Chart3.SetRowLabel(stryear[row-1]);
  1747. if(m_check1)//均值
  1748. {
  1749. if(m_radio2)
  1750. {
  1751. for(int j=0; j<m_filterarray.GetSize (); j++)
  1752. {
  1753. if(dindandatacot2[j][row-1]<1.0)
  1754. m_Chart3.GetDataGrid().SetData(row, j+1, 0 , 0);
  1755. else
  1756. m_Chart3.GetDataGrid().SetData(row, j+1, dindandata1[j][row-1]/dindandatacot2[j][row-1] , 0);
  1757. }
  1758. }
  1759. else
  1760. {
  1761. if(dindandatacot[row-1]<1.0)
  1762. m_Chart3.GetDataGrid().SetData(row, 1, 0 , 0);
  1763. else
  1764. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row-1]/dindandatacot[row-1] , 0);
  1765. }
  1766. }
  1767. else
  1768. {
  1769. if(m_radio2)
  1770. {
  1771. for(int j=0; j<m_filterarray.GetSize (); j++)
  1772. {
  1773. m_Chart3.GetDataGrid().SetData(row, j+1, dindandata1[j][row-1] , 0);
  1774. }
  1775. }
  1776. else
  1777. {
  1778. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row-1] , 0);
  1779. }
  1780. }
  1781. }
  1782. m_Chart3.Refresh();
  1783. }
  1784. */
  1785. void DinDanForm::KindChange9()
  1786. {
  1787. int i = 0;
  1788. if (m_filterarray.GetSize() == 0)
  1789. {
  1790. CStringArray m_typearray;
  1791. CArray<int, int>sortarray;
  1792. for ( i = 0; i < m_dindanarray.GetSize(); i++)
  1793. {
  1794. if (::FindArray(&m_typearray, m_dindanarray.ElementAt(i).ElementAt(14)) == -1)
  1795. {
  1796. m_typearray.Add(m_dindanarray.ElementAt(i).ElementAt(14));
  1797. sortarray.Add(0);
  1798. }
  1799. }
  1800. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1801. {
  1802. for (int j = 0; j < m_typearray.GetSize(); j++)
  1803. {
  1804. if (m_dindanarray.ElementAt(i).ElementAt(14) == m_typearray.ElementAt(j))
  1805. {
  1806. sortarray.SetAt(j, sortarray.ElementAt(j) + 1);
  1807. }
  1808. }
  1809. }
  1810. SortArray(1, m_typearray, sortarray);
  1811. m_pchild->TypeChange(&m_typearray);
  1812. return;
  1813. }
  1814. if (m_filterarray.GetSize() == 0)return;
  1815. while (m_filterarray.GetSize()>10)
  1816. m_filterarray.RemoveAt(m_filterarray.GetSize() - 1);
  1817. int typecount = m_filterarray.GetSize();
  1818. if (m_radio2)
  1819. m_Chart3.SetColumnCount(typecount);
  1820. else
  1821. m_Chart3.SetColumnCount(1);
  1822. VARIANT var;
  1823. m_Chart3.GetPlot().GetAxis(1, var).GetValueScale().SetAuto(1);
  1824. COLORREF col[10] = { \
  1825. RGB(255, 0, 0), \
  1826. RGB(0, 255, 0), \
  1827. RGB(0, 0, 255), \
  1828. RGB(255, 255, 0), \
  1829. RGB(0, 255, 255), \
  1830. RGB(255, 0, 255), \
  1831. RGB(127, 0, 0), \
  1832. RGB(0, 127, 0), \
  1833. RGB(0, 0, 127), \
  1834. RGB(127, 127, 0)
  1835. };
  1836. if (m_radio2)
  1837. {
  1838. for (i = 0; i < m_filterarray.GetSize(); i++)
  1839. {
  1840. m_Chart3.SetColumn(i + 1);
  1841. m_Chart3.SetColumnLabel((LPCTSTR)m_filterarray.ElementAt(i));
  1842. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetBrush().GetFillColor().Set(GetRValue(col[i]), GetGValue(col[i]), GetBValue(col[i]));
  1843. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetPen().SetWidth(30);
  1844. m_Chart3.GetPlot().GetSeriesCollection().GetItem(i + 1).GetDataPoints().GetItem(-1).GetDataPointLabel().SetLocationType(1);
  1845. }
  1846. }
  1847. else
  1848. {
  1849. m_Chart3.SetColumn(1);
  1850. m_Chart3.SetColumnLabel((LPCTSTR)"全部");
  1851. }
  1852. int dindandata[12] = { 0 };
  1853. int dindandata1[10][12] = { 0 };
  1854. for (i = 0; i < 10; i++)
  1855. {
  1856. for (int j = 0; j < 12; j++)
  1857. {
  1858. dindandata1[i][j] = 0;
  1859. }
  1860. }
  1861. CString stryear[12] = { "1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月" };
  1862. ////////////
  1863. CString type;
  1864. int selpos = m_combo1.GetCurSel();
  1865. if (selpos != -1)
  1866. m_combo1.GetLBText(selpos, type);
  1867. if (selpos == -1 || type.IsEmpty() || type == "---全部---" || type == "---按套系类别---" || type == "---按套系名称---")
  1868. {
  1869. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1870. {
  1871. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  1872. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1873. {
  1874. if (m_dindanarray.ElementAt(i).ElementAt(14) == m_filterarray.ElementAt(j))
  1875. {
  1876. 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;
  1877. break;
  1878. }
  1879. }
  1880. }
  1881. }
  1882. else if (selpos > m_taoxipos)
  1883. {
  1884. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1885. {
  1886. if (m_dindanarray.ElementAt(i).ElementAt(7) != type)continue;
  1887. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  1888. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1889. {
  1890. if (m_dindanarray.ElementAt(i).ElementAt(14) == m_filterarray.ElementAt(j))
  1891. {
  1892. 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;
  1893. break;
  1894. }
  1895. }
  1896. }
  1897. }
  1898. else
  1899. {
  1900. for (i = 0; i < m_dindanarray.GetSize(); i++)
  1901. {
  1902. if (m_dindanarray.ElementAt(i).ElementAt(0) != type)continue;
  1903. dindandata[atoi(m_dindanarray.ElementAt(i).ElementAt(1).Mid(5, 2)) - 1]++;
  1904. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1905. {
  1906. if (m_dindanarray.ElementAt(i).ElementAt(14) == m_filterarray.ElementAt(j))
  1907. {
  1908. 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;
  1909. break;
  1910. }
  1911. }
  1912. }
  1913. }
  1914. /////////////
  1915. int nRowCount = 12;// VARIANT var;
  1916. m_Chart3.SetRowCount(nRowCount);
  1917. float ftemp;
  1918. for (int row = 1; row <= nRowCount; ++row)
  1919. {
  1920. m_Chart3.SetRow(row);
  1921. m_Chart3.SetRowLabel(stryear[row - 1]);
  1922. if (m_radio2)
  1923. {
  1924. for (int j = 0; j < m_filterarray.GetSize(); j++)
  1925. {
  1926. m_Chart3.GetDataGrid().SetData(row, j + 1, dindandata1[j][row - 1], 0);
  1927. }
  1928. }
  1929. else
  1930. {
  1931. m_Chart3.GetDataGrid().SetData(row, 1, dindandata[row - 1], 0);
  1932. }
  1933. }
  1934. m_Chart3.Refresh();
  1935. }
  1936. void DinDanForm::OnCheck1()
  1937. {
  1938. // TODO: Add your control notification handler code here
  1939. m_filterarray.RemoveAll();
  1940. KindChange();
  1941. }