Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

551 lines
20 KiB

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using System.Runtime.InteropServices;
  7. using System.Reflection;
  8. namespace OCAReports
  9. {
  10. /// <summary>
  11. /// Summary description for frmExport.
  12. /// </summary>
  13. public class frmExport : System.Windows.Forms.Form
  14. {
  15. private System.Windows.Forms.CheckedListBox checkedListBox1;
  16. private System.Windows.Forms.Button cmdExcel;
  17. private System.Windows.Forms.Button cmdDone;
  18. private System.Windows.Forms.CheckBox chk3DCharts;
  19. /// <summary>
  20. /// Required designer variable.
  21. /// </summary>
  22. private System.ComponentModel.Container components = null;
  23. public frmExport()
  24. {
  25. //
  26. // Required for Windows Form Designer support
  27. //
  28. InitializeComponent();
  29. //
  30. // TODO: Add any constructor code after InitializeComponent call
  31. //
  32. }
  33. /// <summary>
  34. /// Clean up any resources being used.
  35. /// </summary>
  36. protected override void Dispose( bool disposing )
  37. {
  38. if( disposing )
  39. {
  40. if(components != null)
  41. {
  42. components.Dispose();
  43. }
  44. }
  45. base.Dispose( disposing );
  46. }
  47. #region Windows Form Designer generated code
  48. /// <summary>
  49. /// Required method for Designer support - do not modify
  50. /// the contents of this method with the code editor.
  51. /// </summary>
  52. private void InitializeComponent()
  53. {
  54. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmExport));
  55. this.checkedListBox1 = new System.Windows.Forms.CheckedListBox();
  56. this.cmdExcel = new System.Windows.Forms.Button();
  57. this.cmdDone = new System.Windows.Forms.Button();
  58. this.chk3DCharts = new System.Windows.Forms.CheckBox();
  59. this.SuspendLayout();
  60. //
  61. // checkedListBox1
  62. //
  63. this.checkedListBox1.Location = new System.Drawing.Point(8, 8);
  64. this.checkedListBox1.Name = "checkedListBox1";
  65. this.checkedListBox1.Size = new System.Drawing.Size(344, 229);
  66. this.checkedListBox1.TabIndex = 0;
  67. //
  68. // cmdExcel
  69. //
  70. this.cmdExcel.Location = new System.Drawing.Point(368, 56);
  71. this.cmdExcel.Name = "cmdExcel";
  72. this.cmdExcel.TabIndex = 1;
  73. this.cmdExcel.Text = "To Excel";
  74. this.cmdExcel.Click += new System.EventHandler(this.cmdExcel_Click);
  75. //
  76. // cmdDone
  77. //
  78. this.cmdDone.Location = new System.Drawing.Point(368, 16);
  79. this.cmdDone.Name = "cmdDone";
  80. this.cmdDone.TabIndex = 2;
  81. this.cmdDone.Text = "&Done";
  82. this.cmdDone.Click += new System.EventHandler(this.cmdDone_Click);
  83. //
  84. // chk3DCharts
  85. //
  86. this.chk3DCharts.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
  87. this.chk3DCharts.Location = new System.Drawing.Point(360, 216);
  88. this.chk3DCharts.Name = "chk3DCharts";
  89. this.chk3DCharts.Size = new System.Drawing.Size(88, 16);
  90. this.chk3DCharts.TabIndex = 3;
  91. this.chk3DCharts.Text = "3D Charts";
  92. //
  93. // frmExport
  94. //
  95. this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  96. this.ClientSize = new System.Drawing.Size(456, 254);
  97. this.Controls.AddRange(new System.Windows.Forms.Control[] {
  98. this.chk3DCharts,
  99. this.cmdDone,
  100. this.cmdExcel,
  101. this.checkedListBox1});
  102. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  103. this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
  104. this.MaximizeBox = false;
  105. this.MinimizeBox = false;
  106. this.Name = "frmExport";
  107. this.Text = "Export to Excel";
  108. this.Load += new System.EventHandler(this.frmExport_Load);
  109. this.ResumeLayout(false);
  110. }
  111. #endregion
  112. #region ########################Global Variables######################################
  113. /*************************************************************************************
  114. * module: frmAnonCust.cs - Global varibles and objects
  115. *
  116. * author: Tim Ragain
  117. * date: Feb 6, 2002
  118. *
  119. * Purpose: All global threads and variables are declared.
  120. *
  121. *************************************************************************************/
  122. public const string cFRMWEEKLY = "Executive Summary Weekly Report";
  123. #endregion
  124. private void frmExport_Load(object sender, System.EventArgs e)
  125. {
  126. int x = 0;
  127. for(x = 0;x < this.Owner.MdiChildren.Length; x++)
  128. {
  129. checkedListBox1.Items.Add(this.Owner.MdiChildren[x].Text, CheckState.Checked);
  130. }
  131. }
  132. private void cmdExcel_Click(object sender, System.EventArgs e)
  133. {
  134. object oBlank = "";
  135. object oType = 1;
  136. int x = 0, y = 0, z = 0;
  137. int iWeeklyCount = 0, iWeeklyTitle = 65, iWeeklyFiles = 1 ;
  138. int iAnonCustCount = 0, iAnonCustTitle = 65, iAnonCustFiles = 1; //65 - 90
  139. int iAutoManCount = 0, iAutoManTitle = 65, iAutoManFiles = 1;
  140. int iSolutionStatusCount = 0, iSolutionStatusTitle = 65, iSolutionStatusFiles = 1;
  141. char cTitle, cChart, cTitleEnd;
  142. long lAvgWatson = 0, lAvgArchive = 0, lAvgDaily = 0;
  143. long lAvgAnon = 0, lAvgCustomer = 0;
  144. long lAvgMan = 0, lAvgAuto = 0, lAvgNull = 0;
  145. long lAvgSpecific = 0, lAvgGeneral = 0, lAvgStopCode = 0, lAvgNoSolution = 0;
  146. frmWeekly oWeekly;
  147. frmAnonCust oAnonCust;
  148. frmAutoMan oAutoMan;
  149. frmSolutionStatus oSolutionStatus;
  150. if(this.Owner.MdiChildren.Length < 1)
  151. {
  152. MessageBox.Show("There are no reports to generate an Excel spreadsheet", "Generate required reports!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  153. return;
  154. }
  155. Excel.Application oApp = new Excel.Application();
  156. Excel.Workbooks oBooks;
  157. Excel.Workbook oBook;
  158. Excel.Worksheet oWorkSheet = new Excel.Worksheet();
  159. Excel.Sheets oSheets;
  160. Excel.Range oRange, oRangeTitle;
  161. Excel.ChartObjects oChartObjects;
  162. Excel.ChartObject oChartObject;
  163. Excel.Chart oChart;
  164. Excel.SeriesCollection oSeries;
  165. Excel.Legend oLegend;
  166. object oRow = "B5", oCol = "H5";
  167. oApp.Visible = true;
  168. oBooks = (Excel.Workbooks) oApp.Workbooks;
  169. oBook = oApp.Workbooks.Add(oBlank);
  170. oBook = (Excel.Workbook) oBooks.get_Item(1);
  171. oSheets = oBook.Worksheets;
  172. oWorkSheet = (Excel.Worksheet) oBook.Worksheets["Sheet1"];
  173. oWorkSheet.Name = "OCA Reports";
  174. y = 0;
  175. foreach(Form oForm in this.Owner.MdiChildren)
  176. {
  177. oChart = null;
  178. if(this.Owner.MdiChildren[y].Name == "frmSolutionStatus")
  179. {
  180. for(z = 0;z < checkedListBox1.CheckedItems.Count;z++)
  181. {
  182. if(checkedListBox1.CheckedItems[z].ToString() == oForm.Text)
  183. {
  184. oSolutionStatus = (frmSolutionStatus) oForm;
  185. oWorkSheet.Cells[105, iSolutionStatusFiles] = oSolutionStatus.Text;
  186. cTitle = (char)iSolutionStatusTitle;
  187. cTitleEnd = (char)(iSolutionStatusTitle + 4);
  188. cChart = (char)(iSolutionStatusTitle + 3);
  189. oRangeTitle = oWorkSheet.get_Range(cTitle + "105", cTitle + "106");
  190. oRangeTitle.Font.Bold = true;
  191. oRangeTitle.ColumnWidth = 10;
  192. oRangeTitle = oWorkSheet.get_Range(cTitle + "106", cTitleEnd + "106");
  193. oRangeTitle.Font.Bold = true;
  194. oRangeTitle.ColumnWidth = 10;
  195. oRangeTitle = oWorkSheet.get_Range(cTitle + "114", cTitle + "114");
  196. oRangeTitle.Font.Bold = true;
  197. oRangeTitle.ColumnWidth = 10;
  198. oWorkSheet.Cells[106, iSolutionStatusFiles] = "Date";
  199. oWorkSheet.Cells[106, iSolutionStatusFiles + 1] = "S-Bucket";
  200. oWorkSheet.Cells[106, iSolutionStatusFiles + 2] = "G-Bucket";
  201. oWorkSheet.Cells[106, iSolutionStatusFiles + 3] = "Stop Code";
  202. oWorkSheet.Cells[106, iSolutionStatusFiles + 4] = "No Solution";
  203. oWorkSheet.Cells[114, iSolutionStatusFiles + 0] = "Average";
  204. lAvgSpecific = 0;
  205. lAvgGeneral = 0;
  206. lAvgStopCode = 0;
  207. lAvgNoSolution = 0;
  208. for(x = 0; x < 7; x++)
  209. {
  210. oWorkSheet.Cells[x + 107, iSolutionStatusFiles + 0] = oSolutionStatus.lDate[x];
  211. oWorkSheet.Cells[x + 107, iSolutionStatusFiles + 1] = oSolutionStatus.lSpecific[x];
  212. lAvgSpecific = lAvgSpecific + oSolutionStatus.lSpecific[x];
  213. oWorkSheet.Cells[x + 107, iSolutionStatusFiles + 2] = oSolutionStatus.lGeneral[x];
  214. lAvgGeneral = lAvgGeneral + oSolutionStatus.lGeneral[x];
  215. oWorkSheet.Cells[x + 107, iSolutionStatusFiles + 3] = oSolutionStatus.lStopCode[x];
  216. lAvgStopCode = lAvgStopCode + oSolutionStatus.lStopCode[x];
  217. oWorkSheet.Cells[x + 107, iSolutionStatusFiles + 4] = oSolutionStatus.lNoSolution[x];
  218. lAvgNoSolution = lAvgNoSolution + oSolutionStatus.lNoSolution[x];
  219. }
  220. oWorkSheet.Cells[114, iSolutionStatusFiles + 1] = lAvgSpecific / 7;
  221. oWorkSheet.Cells[114, iSolutionStatusFiles + 2] = lAvgGeneral / 7;
  222. oWorkSheet.Cells[114, iSolutionStatusFiles + 3] = lAvgStopCode / 7;
  223. oWorkSheet.Cells[114, iSolutionStatusFiles + 4] = lAvgNoSolution / 7;
  224. oRange = (Excel.Range) oWorkSheet.Cells[64, 2];
  225. oChartObjects = (Excel.ChartObjects) oWorkSheet.ChartObjects(Missing.Value);
  226. oChartObject = oChartObjects.Add(10, 90, 370, 300);
  227. if(chk3DCharts.Checked == true)
  228. {
  229. oChartObject.Chart.Type = (int) Excel.XlChartType.xl3DColumn;
  230. }
  231. else
  232. {
  233. oChartObject.Chart.Type = (int) 3;//Excel.XlChartType.xl3DColumn;
  234. }
  235. oChart = oChartObject.Chart;
  236. oWorkSheet.Shapes.Item(oWorkSheet.Shapes.Count).Top = 1475;
  237. if(iSolutionStatusCount > 0)
  238. {
  239. oWorkSheet.Shapes.Item(y + 1).Left = 400 * iSolutionStatusCount;
  240. }
  241. oRange = oWorkSheet.get_Range(cTitle + "106:" + cTitle + "113", cChart + "106:" + cChart + "113");
  242. oChart.SetSourceData(oRange, Excel.XlRowCol.xlColumns);
  243. oSeries = (Excel.SeriesCollection) oChart.SeriesCollection(Missing.Value);
  244. oChart.HasLegend = true;
  245. oLegend = oChart.Legend;
  246. oChart.HasTitle = true;
  247. oChart.ChartTitle.Text = oSolutionStatus.Text;
  248. iSolutionStatusTitle += 8;
  249. iSolutionStatusFiles += 8;
  250. iSolutionStatusCount++;
  251. z = checkedListBox1.Items.Count;
  252. }
  253. }
  254. }
  255. if(this.Owner.MdiChildren[y].Name == "frmAutoMan")
  256. {
  257. oAutoMan = (frmAutoMan) oForm;
  258. for(z = 0;z < checkedListBox1.CheckedItems.Count;z++)
  259. {
  260. if(checkedListBox1.CheckedItems[z].ToString() == oForm.Text)
  261. {
  262. oWorkSheet.Cells[70, iAutoManFiles] = oAutoMan.Text;
  263. cTitle = (char)iAutoManTitle;
  264. cTitleEnd = (char)(iAutoManTitle + 3);
  265. cChart = (char)(iAutoManTitle + 2);
  266. oRangeTitle = oWorkSheet.get_Range(cTitle + "70", cTitle + "71");
  267. oRangeTitle.Font.Bold = true;
  268. oRangeTitle.ColumnWidth = 10;
  269. oRangeTitle = oWorkSheet.get_Range(cTitle + "71", cTitleEnd + "71");
  270. oRangeTitle.Font.Bold = true;
  271. oRangeTitle.ColumnWidth = 10;
  272. oRangeTitle = oWorkSheet.get_Range(cTitle + "79", cTitle + "79");
  273. oRangeTitle.Font.Bold = true;
  274. oRangeTitle.ColumnWidth = 10;
  275. oWorkSheet.Cells[71, iAutoManFiles + 0] = "Date";
  276. oWorkSheet.Cells[71, iAutoManFiles + 1] = "Manual";
  277. oWorkSheet.Cells[71, iAutoManFiles + 2] = "Auto";
  278. oWorkSheet.Cells[79, iAutoManFiles + 0] = "Average";
  279. if(oAutoMan.chkDatabaseCount.Checked == true)
  280. {
  281. oWorkSheet.Cells[71, iAutoManFiles + 3] = "Null Uploads";
  282. }
  283. lAvgMan = 0;
  284. lAvgAuto = 0;
  285. lAvgNull = 0;
  286. for(x = 0; x < 7; x++)
  287. {
  288. oWorkSheet.Cells[x + 72, iAutoManFiles + 0] = oAutoMan.lDate[x];
  289. oWorkSheet.Cells[x + 72, iAutoManFiles + 1] = oAutoMan.lManualUploads[x];
  290. lAvgMan = lAvgMan + oAutoMan.lManualUploads[x];
  291. oWorkSheet.Cells[x + 72, iAutoManFiles + 2] = oAutoMan.lAutoUploads[x];
  292. lAvgAuto = lAvgAuto + oAutoMan.lAutoUploads[x];
  293. if(oAutoMan.chkDatabaseCount.Checked == true)
  294. {
  295. oWorkSheet.Cells[x + 72, iAutoManFiles + 3] = oAutoMan.lNullUploads[x];
  296. lAvgNull = lAvgNull + oAutoMan.lNullUploads[x];
  297. }
  298. }
  299. oWorkSheet.Cells[79, iAutoManFiles + 1] = lAvgMan / 7;
  300. oWorkSheet.Cells[79, iAutoManFiles + 2] = lAvgAuto / 7;
  301. if(oAutoMan.chkDatabaseCount.Checked == true)
  302. {
  303. oWorkSheet.Cells[79, iAnonCustFiles + 3] = lAvgNull / 7;
  304. }
  305. oRange = (Excel.Range) oWorkSheet.Cells[72, 2];
  306. oChartObjects = (Excel.ChartObjects) oWorkSheet.ChartObjects(Missing.Value);
  307. oChartObject = oChartObjects.Add(10, 90, 370, 300);
  308. if(chk3DCharts.Checked == true)
  309. {
  310. oChartObject.Chart.Type = (int) Excel.XlChartType.xl3DColumn;
  311. }
  312. else
  313. {
  314. oChartObject.Chart.Type = (int) 3;//Excel.XlChartType.xl3DColumn;
  315. }
  316. oChart = oChartObject.Chart;
  317. oWorkSheet.Shapes.Item(oWorkSheet.Shapes.Count).Top = 1020;
  318. if(iAutoManCount > 0)
  319. {
  320. oWorkSheet.Shapes.Item(y + 1).Left = 400 * iAutoManCount;
  321. }
  322. if(oAutoMan.chkDatabaseCount.Checked == true)
  323. {
  324. oRange = oWorkSheet.get_Range(cTitle + "71:" + cTitle + "78", cChart + "71:" + cChart + "78");
  325. }
  326. else
  327. {
  328. oRange = oWorkSheet.get_Range(cTitle + "71:" + cTitle + "78", cChart + "71:" + cChart + "78");
  329. }
  330. oChart.SetSourceData(oRange, Excel.XlRowCol.xlColumns);
  331. oSeries = (Excel.SeriesCollection) oChart.SeriesCollection(Missing.Value);
  332. oChart.HasLegend = true;
  333. oLegend = oChart.Legend;
  334. oChart.HasTitle = true;
  335. oChart.ChartTitle.Text = oAutoMan.Text;
  336. iAutoManTitle += 8;
  337. iAutoManFiles += 8;
  338. iAutoManCount++;
  339. z = checkedListBox1.Items.Count;
  340. }
  341. }
  342. }
  343. if(this.Owner.MdiChildren[y].Name == "frmAnonCust")
  344. {
  345. oAnonCust = (frmAnonCust) oForm;
  346. for(z = 0;z < checkedListBox1.CheckedItems.Count;z++)
  347. {
  348. if(checkedListBox1.CheckedItems[z].ToString() == oForm.Text)
  349. {
  350. oWorkSheet.Cells[36, iAnonCustFiles] = oAnonCust.Text;
  351. cTitle = (char)iAnonCustTitle;
  352. cTitleEnd = (char)(iAnonCustTitle + 3);
  353. cChart = (char)(iAnonCustTitle + 2);
  354. oRangeTitle = oWorkSheet.get_Range(cTitle + "36", cTitle + "37");
  355. oRangeTitle.Font.Bold = true;
  356. oRangeTitle.ColumnWidth = 10;
  357. oRangeTitle = oWorkSheet.get_Range(cTitle + "37", cTitleEnd + "37");
  358. oRangeTitle.Font.Bold = true;
  359. oRangeTitle.ColumnWidth = 10;
  360. oRangeTitle = oWorkSheet.get_Range(cTitle + "45", cTitle + "45");
  361. oRangeTitle.Font.Bold = true;
  362. oRangeTitle.ColumnWidth = 10;
  363. oWorkSheet.Cells[37, iAnonCustFiles + 0] = "Date";
  364. oWorkSheet.Cells[37, iAnonCustFiles + 1] = "Customer";
  365. oWorkSheet.Cells[37, iAnonCustFiles + 2] = "Anonymous";
  366. oWorkSheet.Cells[45, iAnonCustFiles + 0] = "Average";
  367. lAvgAnon = 0;
  368. lAvgCustomer = 0;
  369. for(x = 0; x < 7; x++)
  370. {
  371. oWorkSheet.Cells[x + 38, 0 + iAnonCustFiles] = oAnonCust.lDate[x];
  372. oWorkSheet.Cells[x + 38, 1 + iAnonCustFiles] = oAnonCust.lCustomer[x];
  373. lAvgCustomer = lAvgCustomer + oAnonCust.lCustomer[x];
  374. oWorkSheet.Cells[x + 38, 2 + iAnonCustFiles] = oAnonCust.lAnonymous[x];
  375. lAvgAnon = lAvgAnon + oAnonCust.lAnonymous[x];
  376. }
  377. oWorkSheet.Cells[45, iAnonCustFiles + 1] = lAvgCustomer / 7;
  378. oWorkSheet.Cells[45, iAnonCustFiles + 2] = lAvgAnon / 7;
  379. oRange = (Excel.Range) oWorkSheet.Cells[36, 2];
  380. oChartObjects = (Excel.ChartObjects) oWorkSheet.ChartObjects(Missing.Value);
  381. oChartObject = oChartObjects.Add(10, 90, 370, 300);
  382. if(chk3DCharts.Checked == true)
  383. {
  384. oChartObject.Chart.Type = (int) Excel.XlChartType.xl3DColumn;
  385. }
  386. else
  387. {
  388. oChartObject.Chart.Type = (int) 3;//Excel.XlChartType.xl3DColumn;
  389. }
  390. oChart = oChartObject.Chart;
  391. oWorkSheet.Shapes.Item(oWorkSheet.Shapes.Count).Top = 575;
  392. if(iAnonCustCount > 0)
  393. {
  394. oWorkSheet.Shapes.Item(y + 1).Left = 400 * iAnonCustCount;
  395. }
  396. oRange = oWorkSheet.get_Range(cTitle + "37:" + cTitle + "44", cChart + "37:" + cChart + "44");
  397. oChart.SetSourceData(oRange, Excel.XlRowCol.xlColumns);
  398. oSeries = (Excel.SeriesCollection) oChart.SeriesCollection(Missing.Value);
  399. oChart.HasLegend = true;
  400. oLegend = oChart.Legend;
  401. oChart.HasTitle = true;
  402. oChart.ChartTitle.Text = oAnonCust.Text;
  403. iAnonCustTitle += 8;
  404. iAnonCustFiles += 8;
  405. iAnonCustCount++;
  406. z = checkedListBox1.Items.Count;
  407. }
  408. }
  409. }
  410. if(this.Owner.MdiChildren[y].Name == "frmWeekly")
  411. {
  412. oWeekly = (frmWeekly) oForm;
  413. //checkedListBox1.Items.Add(this.Owner.MdiChildren[x].Text, CheckState.Checked);
  414. for(z = 0;z < checkedListBox1.CheckedItems.Count;z++)
  415. {
  416. if(checkedListBox1.CheckedItems[z].ToString() == oForm.Text)
  417. {
  418. oWorkSheet.Cells[1, iWeeklyFiles] = oWeekly.Text;
  419. oWorkSheet.Cells[2, iWeeklyFiles] = "Date";
  420. cTitle = (char)iWeeklyTitle;
  421. cTitleEnd = (char)(iWeeklyTitle + 6);
  422. cChart = (char)(iWeeklyTitle + 3);
  423. oRangeTitle = oWorkSheet.get_Range(cTitle + "1", cTitle + "2");
  424. oRangeTitle.Font.Bold = true;
  425. oRangeTitle.ColumnWidth = 10;
  426. oRangeTitle = oWorkSheet.get_Range(cTitle + "2", cTitleEnd + "2");
  427. oRangeTitle.Font.Bold = true;
  428. oRangeTitle.ColumnWidth = 10;
  429. oRangeTitle = oWorkSheet.get_Range(cTitle + "10", cTitle + "10");
  430. oRangeTitle.Font.Bold = true;
  431. oRangeTitle.ColumnWidth = 10;
  432. oWorkSheet.Cells[2, iWeeklyFiles + 1] = "Archive";
  433. oWorkSheet.Cells[2, iWeeklyFiles + 2] = "Watson";
  434. oWorkSheet.Cells[2, iWeeklyFiles + 3] = "Database";
  435. oWorkSheet.Cells[2, iWeeklyFiles + 4] = "W - A";
  436. oWorkSheet.Cells[2, iWeeklyFiles + 5] = "A - DB";
  437. oWorkSheet.Cells[10, iWeeklyFiles + 0] = "Average";
  438. lAvgArchive = 0;
  439. lAvgWatson = 0;
  440. lAvgDaily = 0;
  441. for(x = 0; x < 7; x++)
  442. {
  443. oWorkSheet.Cells[x + 3, 0 + iWeeklyFiles] = oWeekly.lDate[x];
  444. oWorkSheet.Cells[x + 3, 1 + iWeeklyFiles] = oWeekly.lArchive[x];
  445. lAvgArchive = lAvgArchive + oWeekly.lArchive[x];
  446. oWorkSheet.Cells[x + 3, 2 + iWeeklyFiles] = oWeekly.lWatson[x];
  447. lAvgWatson = lAvgWatson + oWeekly.lWatson[x];
  448. oWorkSheet.Cells[x + 3, 3 + iWeeklyFiles] = oWeekly.lCount[x];
  449. lAvgDaily = lAvgDaily + oWeekly.lCount[x];
  450. oWorkSheet.Cells[x + 3, 4 + iWeeklyFiles] = oWeekly.lWatson[x] - oWeekly.lArchive[x];
  451. oWorkSheet.Cells[x + 3, 5 + iWeeklyFiles] = oWeekly.lArchive[x] - oWeekly.lCount[x];
  452. }
  453. oWorkSheet.Cells[10, iWeeklyFiles + 1] = lAvgArchive / 7;
  454. oWorkSheet.Cells[10, iWeeklyFiles + 2] = lAvgWatson / 7;
  455. oWorkSheet.Cells[10, iWeeklyFiles + 3] = lAvgDaily / 7;
  456. oRange = (Excel.Range) oWorkSheet.Cells[2, 2];
  457. oChartObjects = (Excel.ChartObjects) oWorkSheet.ChartObjects(Missing.Value);
  458. oChartObject = oChartObjects.Add(10, 90, 370, 300);
  459. if(chk3DCharts.Checked == true)
  460. {
  461. oChartObject.Chart.Type = (int) Excel.XlChartType.xl3DColumn;
  462. }
  463. else
  464. {
  465. oChartObject.Chart.Type = (int) 3;//Excel.XlChartType.xl3DColumn;
  466. }
  467. oChart = oChartObject.Chart;
  468. oWorkSheet.Shapes.Item(oWorkSheet.Shapes.Count).Top = 135;
  469. if(iWeeklyCount > 0)
  470. {
  471. oWorkSheet.Shapes.Item(y + 1).Left = 400 * iWeeklyCount;
  472. }
  473. oRange = oWorkSheet.get_Range(cTitle + "2:" + cTitle + "9", cChart + "2:" + cChart + "9");
  474. oChart.SetSourceData(oRange, Excel.XlRowCol.xlColumns);
  475. oSeries = (Excel.SeriesCollection) oChart.SeriesCollection(Missing.Value);
  476. oChart.HasLegend = true;
  477. oLegend = oChart.Legend;
  478. oChart.HasTitle = true;
  479. oChart.ChartTitle.Text = oWeekly.Text;
  480. iWeeklyTitle += 8;
  481. iWeeklyFiles += 8;
  482. iWeeklyCount++;
  483. z = checkedListBox1.Items.Count;
  484. }
  485. }
  486. }
  487. y++;
  488. }
  489. cmdDone.Focus();
  490. }
  491. private void cmdDone_Click(object sender, System.EventArgs e)
  492. {
  493. this.Close();
  494. }
  495. }
  496. }