AnalyzedOrderFinanceOutlayDetailFormMain.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. using LYFZ.Model;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. namespace LYFZ.Software.MainBusiness.DecisionAssistant
  12. {
  13. public partial class AnalyzedOrderFinanceOutlayDetailFormMain : LYFZ.Software.UI.DecisionAssistant.AnalyzedOrderFinanceOutlayDetailFormMain
  14. {
  15. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  16. List<ModelImagePostionAction> actionList = new List<ModelImagePostionAction>();
  17. public AnalyzedOrderFinanceOutlayDetailFormMain()
  18. {
  19. this.Load += AnalyzedOrderFinanceOutlayDetailFormMain_Load;
  20. this.Shown += AnalyzedOrderFinanceOutlayDetailFormMain_Shown;
  21. this.chkComparedStartUp.Click += chkComparedStartUp_Click;
  22. this.btnQuery.Click += btnQuery_Click;
  23. this.btnQueryCompared.Click += btnQueryCompared_Click;
  24. this.btnSaveAs.Click += btnSaveAs_Click;
  25. this.btnColseed.Click += btnCloseed_Click;
  26. this.dtDataTimeStart.Leave += dtDataTimeStart_Leave;
  27. this.dtDataTimeStartCompared.Leave += dtDataTimeStartCompared_Leave;
  28. this.Resize += AnalyzedOrderFinanceOutlayDetailFormMain_Resize;
  29. this.PictImage.MouseDoubleClick += PictImage_MouseDoubleClick;
  30. }
  31. void PictImage_MouseDoubleClick(object sender, MouseEventArgs e)
  32. {
  33. ModelImagePostionAction action = actionList.Find(p => p.MouseX <= e.Location.X && e.Location.X <= (p.MouseX + p.MouseWidth)
  34. &&
  35. p.MouseY <= e.Location.Y && e.Location.Y <= (p.MouseY + p.MouseHeight));
  36. if (action != null)
  37. {
  38. LYFZ.Software.MainBusiness.DecisionAssistant.SetSmallForm.AnalyzedOrderDetailSmallForm detailForm = new SetSmallForm.AnalyzedOrderDetailSmallForm();
  39. detailForm.BindDataGridView(action);
  40. detailForm.ShowDialog();
  41. //MessageBox.Show("内容!");
  42. }
  43. }
  44. void SetPostionData(string ordType, string columType, Rectangle rectangle, string where, string startTime, string endTime)
  45. {
  46. ModelImagePostionAction actionModel = null;
  47. string SqlSelect = @"
  48. select
  49. oiae_type as 类型,oiae_projectname as 支出内容,oiae_money 支出金额,tb_erpUser.User_Name 取款人,Oiae_IEDatetime as 创建时间
  50. from
  51. tb_ErpOtherIncomeAndExpenses left join tb_erpUser on Oiae_ThePayer = tb_erpUser.User_EmployeeID";
  52. //string SqlSelect = @"";
  53. string sqlWhere = " Oiae_Type = '财务支出' " +
  54. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Oiae_IEDatetime",startTime, endTime);
  55. if (string.IsNullOrEmpty(StrGoFormDateTime))
  56. {
  57. sqlWhere += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupQueryWhere(this.cmbtreevStoreName, "Oiae_DividedShop");
  58. }
  59. else
  60. {
  61. sqlWhere += " And Oiae_DividedShop = '" + this.StrStoreName + "'";
  62. }
  63. sqlWhere += " and oiae_projectname = '" + columType + "' ";
  64. actionModel = new ModelImagePostionAction()
  65. {
  66. OrdType = ordType,
  67. ColumType = columType,
  68. MouseX = rectangle.X,
  69. MouseY = rectangle.Y,
  70. MouseWidth = rectangle.Width,
  71. MouseHeight = rectangle.Height,
  72. SqlData = SqlSelect + " where " + sqlWhere
  73. };
  74. actionModel.OrdTitle = this.UcNavigationTool.LabTitle;
  75. if (actionModel != null)
  76. {
  77. actionList.Add(actionModel);
  78. }
  79. }
  80. /// <summary>
  81. /// 跳转过来的日期
  82. /// </summary>
  83. public string StrGoFormDateTime = "";
  84. /// <summary>
  85. /// 跳转过来分店编号
  86. /// </summary>
  87. public string StrStoreName = "";
  88. /// <summary>
  89. /// 是否首次加载
  90. /// </summary>
  91. bool IsFristLoad = true;
  92. /// <summary>
  93. /// 窗体加载事件
  94. /// </summary>
  95. /// <param name="sender"></param>
  96. /// <param name="e"></param>
  97. void AnalyzedOrderFinanceOutlayDetailFormMain_Load(object sender, EventArgs e)
  98. {
  99. this.panelQueryCompared.Visible = false;
  100. if (string.IsNullOrEmpty(StrGoFormDateTime))
  101. {
  102. this.dtDataTimeStart.DateValue = SDateTime.Now.ToString("yyyy-MM") + "-01";
  103. this.dtDataTimeEnd.DateValue = Convert.ToDateTime(this.dtDataTimeStart.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
  104. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindGroupStoreName(this.cmbtreevStoreName, StrGroupKeyCode: "stA10", StrKeyCode: "stA21", IsShowAllText: false);
  105. }
  106. else
  107. {
  108. this.panelStoreName.Visible = false;
  109. string[] StrArray = StrGoFormDateTime.Split('|');
  110. this.dtDataTimeStart.DateValue = StrArray[0].Trim() + "-01";
  111. this.dtDataTimeEnd.DateValue = Convert.ToDateTime(this.dtDataTimeStart.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
  112. if (StrArray.Length > 1)
  113. {
  114. this.dtDataTimeStartCompared.DateValue = StrArray[1].Trim() + "-01";
  115. this.dtDateTimeEndCompared.DateValue = Convert.ToDateTime(this.dtDataTimeStartCompared.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
  116. this.panelEx3.Visible = true;
  117. this.panelQueryCompared.Visible = true;
  118. this.chkComparedStartUp.Checked = true;
  119. }
  120. else
  121. {
  122. this.dtDataTimeStartCompared.DateValue = Convert.ToDateTime(this.dtDataTimeStart.DateValue).AddYears(-1).ToString("yyyy-MM-dd");
  123. this.dtDateTimeEndCompared.DateValue = Convert.ToDateTime(this.dtDataTimeStartCompared.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
  124. }
  125. }
  126. }
  127. /// <summary>
  128. /// 窗体加载事件
  129. /// </summary>
  130. /// <param name="sender"></param>
  131. /// <param name="e"></param>
  132. void AnalyzedOrderFinanceOutlayDetailFormMain_Shown(object sender, EventArgs e)
  133. {
  134. bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(VersionControl.VersionFunctionEnum.决策助手财务支出详情);
  135. if (!b)
  136. {
  137. this.Close();
  138. return;
  139. }
  140. this.PublicFunctionRows();
  141. }
  142. /// <summary>
  143. /// 启用对比
  144. /// </summary>
  145. /// <param name="sender"></param>
  146. /// <param name="e"></param>
  147. void chkComparedStartUp_Click(object sender, EventArgs e)
  148. {
  149. if (this.chkComparedStartUp.Checked)
  150. {
  151. this.panelCloseed.Visible = false;
  152. this.panelSaveAs.Visible = false;
  153. this.panelQueryCompared.Visible = true;
  154. this.panelEx3.Visible = true;
  155. this.panelSaveAs.Visible = true;
  156. this.panelCloseed.Visible = true;
  157. if (!string.IsNullOrEmpty(this.dtDataTimeStartCompared.DateValue.Trim()) && !string.IsNullOrEmpty(this.dtDateTimeEndCompared.DateValue.Trim()))
  158. { this.PublicFunctionRows(); }
  159. }
  160. else
  161. {
  162. this.panelQueryCompared.Visible = false;
  163. this.panelEx3.Visible = false;
  164. this.PublicFunctionRows();
  165. }
  166. }
  167. /// <summary>
  168. /// 查询
  169. /// </summary>
  170. /// <param name="sender"></param>
  171. /// <param name="e"></param>
  172. void btnQuery_Click(object sender, EventArgs e)
  173. {
  174. this.PublicFunctionRows();
  175. }
  176. /// <summary>
  177. /// 对比查询
  178. /// </summary>
  179. /// <param name="sender"></param>
  180. /// <param name="e"></param>
  181. void btnQueryCompared_Click(object sender, EventArgs e)
  182. {
  183. this.PublicFunctionRows();
  184. }
  185. /// <summary>
  186. /// 另存为
  187. /// </summary>
  188. /// <param name="sender"></param>
  189. /// <param name="e"></param>
  190. void btnSaveAs_Click(object sender, EventArgs e)
  191. {
  192. string StrFilleName = Convert.ToDateTime(this.dtDataTimeStart.DateValue).ToString("yyyy年MM月dd日") + " — " + Convert.ToDateTime(this.dtDataTimeEnd.DateValue).ToString("yyyy年MM月dd日") + " 财务支出详情分析表";
  193. if (this.chkComparedStartUp.Checked)
  194. { StrFilleName = this.dtDataTimeStart.DateValue.Trim() + "—" + this.dtDataTimeEnd.DateValue.Trim() + " 与 " + this.dtDataTimeStartCompared.DateValue.Trim() + "—" + this.dtDateTimeEndCompared.DateValue.Trim() + " 财务支出详情分析表"; }
  195. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.DownloadSaveAs(this.PictImage.Image, StrFilleName: StrFilleName);
  196. }
  197. /// <summary>
  198. /// 关闭
  199. /// </summary>
  200. /// <param name="sender"></param>
  201. /// <param name="e"></param>
  202. void btnCloseed_Click(object sender, EventArgs e)
  203. {
  204. this.Close();
  205. }
  206. /// <summary>
  207. /// 开始时间离开事件
  208. /// </summary>
  209. /// <param name="sender"></param>
  210. /// <param name="e"></param>
  211. void dtDataTimeStart_Leave(object sender, EventArgs e)
  212. {
  213. this.dtDataTimeEnd.DateValue = Convert.ToDateTime(this.dtDataTimeStart.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
  214. }
  215. /// <summary>
  216. /// 对比开始时间离开事件
  217. /// </summary>
  218. /// <param name="sender"></param>
  219. /// <param name="e"></param>
  220. void dtDataTimeStartCompared_Leave(object sender, EventArgs e)
  221. {
  222. this.dtDateTimeEndCompared.DateValue = Convert.ToDateTime(this.dtDataTimeStartCompared.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
  223. }
  224. /// <summary>
  225. /// 窗体大小发生变化
  226. /// </summary>
  227. /// <param name="sender"></param>
  228. /// <param name="e"></param>
  229. void AnalyzedOrderFinanceOutlayDetailFormMain_Resize(object sender, EventArgs e)
  230. {
  231. switch (this.panelCloseed.Location.Y)
  232. {
  233. case 1: this.flowLayoutPanel1.Height = 35; break;
  234. case 35: this.flowLayoutPanel1.Height = 70; break;
  235. }
  236. if (this.IsFristLoad)
  237. {
  238. this.panelEx2.Width = this.panelEx1.Width - 6;
  239. this.panelEx2.Height = this.panelEx1.Height - 6;
  240. }
  241. }
  242. /// <summary>
  243. /// 创建行
  244. /// </summary>
  245. void PublicFunctionRows()
  246. {
  247. actionList.Clear();
  248. #region 处理数据前判断
  249. if (this.chkComparedStartUp.Checked)
  250. {
  251. if (string.IsNullOrEmpty(this.dtDataTimeStart.DateValue.Trim()) && string.IsNullOrEmpty(this.dtDataTimeEnd.DateValue.Trim()))
  252. { MessageBoxCustom.Show("对比前时间段不能为空"); return; }
  253. if (Convert.ToDateTime(this.dtDataTimeEnd.DateValue) < Convert.ToDateTime(this.dtDataTimeStart.DateValue))
  254. { MessageBoxCustom.Show("对比前开始日期不能大于结束日期"); return; }
  255. if (string.IsNullOrEmpty(this.dtDataTimeStartCompared.DateValue.Trim()) && string.IsNullOrEmpty(this.dtDateTimeEndCompared.DateValue.Trim()))
  256. { MessageBoxCustom.Show("对比后时间段不能为空"); return; }
  257. if (Convert.ToDateTime(this.dtDateTimeEndCompared.DateValue) < Convert.ToDateTime(this.dtDataTimeStartCompared.DateValue))
  258. { MessageBoxCustom.Show("对比后开始日期不能大于结束日期"); return; }
  259. if (Convert.ToDateTime(this.dtDateTimeEndCompared.DateValue.Trim()) > Convert.ToDateTime(this.dtDataTimeStart.DateValue.Trim()))
  260. { MessageBoxCustom.Show("对比后的结束日期不能大于对比前的开始日期"); return; }
  261. }
  262. else
  263. {
  264. if (string.IsNullOrEmpty(this.dtDataTimeStart.DateValue.Trim()) && string.IsNullOrEmpty(this.dtDataTimeEnd.DateValue.Trim()))
  265. { MessageBoxCustom.Show("时间段不能为空"); return; }
  266. if (Convert.ToDateTime(this.dtDataTimeEnd.DateValue) < Convert.ToDateTime(this.dtDataTimeStart.DateValue))
  267. { MessageBoxCustom.Show("开始日期不能大于结束日期"); return; }
  268. }
  269. this.IsFristLoad = true;
  270. this.AnalyzedOrderFinanceOutlayDetailFormMain_Resize(this, null);
  271. this.IsFristLoad = false;
  272. #endregion
  273. this.actionList.Clear();
  274. string StrTimeStrat = this.dtDataTimeStart.DateValue.Trim();
  275. string StrTimeEnd = this.dtDataTimeEnd.DateValue.Trim();
  276. string StrTimeStratDb = this.dtDataTimeStartCompared.DateValue.Trim();
  277. string StrTimeEndDb = this.dtDateTimeEndCompared.DateValue.Trim();
  278. string StrWhere = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Oiae_IEDatetime", StrTimeStrat, StrTimeEnd);
  279. string StrWhere2 = "";
  280. if (string.IsNullOrEmpty(StrGoFormDateTime))
  281. { StrWhere2 += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupQueryWhere(this.cmbtreevStoreName, "Oiae_DividedShop"); }
  282. else
  283. { StrWhere2 += " And Oiae_DividedShop = '" + this.StrStoreName + "'"; }
  284. string ExecuteSql = "select Sum(Oiae_Money) AS 金额,Oiae_ProjectName AS TypeText from tb_ErpOtherIncomeAndExpenses where Oiae_Type = '财务支出' " + StrWhere + StrWhere2 + " Group By Oiae_ProjectName Order By Sum(Oiae_Money) DESC;";
  285. if (this.chkComparedStartUp.Checked)
  286. {
  287. StrWhere = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Oiae_IEDatetime", StrTimeStratDb, StrTimeEndDb) + "";
  288. ExecuteSql += "select Sum(Oiae_Money) AS 金额,Oiae_ProjectName AS TypeText from tb_ErpOtherIncomeAndExpenses where Oiae_Type = '财务支出' " + StrWhere + StrWhere2 + " Group By Oiae_ProjectName Order By Sum(Oiae_Money) DESC;";
  289. }
  290. DataSet dsData = orbll.GetView_Custom(ExecuteSql);
  291. DataTable dtOrderCount = dsData.Tables["ds"];
  292. DataTable dtOrderCountCompared = dsData.Tables["ds1"];
  293. Bitmap newBmp = null;
  294. if (!this.chkComparedStartUp.Checked)
  295. {
  296. #region 无启用对比
  297. int RowsCountWidth = dtOrderCount.Rows.Count * 120;
  298. if ((this.panelEx2.Width - 6 - 100) > RowsCountWidth)
  299. { RowsCountWidth = this.panelEx2.Width + 100; }
  300. this.PictImage.Size = new System.Drawing.Size(RowsCountWidth, this.panelEx2.Height);
  301. newBmp = new Bitmap(this.PictImage.Width, this.PictImage.Height);
  302. Graphics g = Graphics.FromImage(newBmp);
  303. g.Clear(System.Drawing.Color.White);
  304. Brush b = Brushes.Black;
  305. Pen p = new Pen(Brushes.Black, 1);
  306. Font ft15 = new Font("微软雅黑", 15);
  307. Font ft12b = new Font("微软雅黑", 11);
  308. Font ft11 = new Font("微软雅黑", 10);
  309. int ForTopLoad = 30;
  310. int LeftWidth = 50;
  311. string StrValue = Convert.ToDateTime(this.dtDataTimeStart.DateValue).ToString("yyyy年MM月dd日") + " — " + Convert.ToDateTime(this.dtDataTimeEnd.DateValue).ToString("yyyy年MM月dd日") + " 财务支出详情分析表";
  312. SizeF sizef = g.MeasureString(StrValue, ft15);
  313. int FtHeigth = Convert.ToInt32(sizef.Height);
  314. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  315. Rectangle rec = new Rectangle(newBmp.Width / 2 - FtWidth / 2, ForTopLoad, FtWidth, FtHeigth);
  316. g.DrawString(StrValue, ft15, b, rec);//画消费法规
  317. ForTopLoad = rec.Y + rec.Height;
  318. float WidthRatio = 0;
  319. if (dtOrderCount.Rows.Count > 0)
  320. {
  321. if (float.Parse(dtOrderCount.Rows[0]["金额"].ToString()) > 0)
  322. { WidthRatio = (this.PictImage.Height - rec.Y - rec.Height - 80) / float.Parse(dtOrderCount.Rows[0]["金额"].ToString()); }
  323. }
  324. for (int i = 0; i < dtOrderCount.Rows.Count; i++)
  325. {
  326. float intValue = 0;
  327. if (float.Parse(dtOrderCount.Rows[i]["金额"].ToString()) > 0)
  328. { intValue = WidthRatio * float.Parse(dtOrderCount.Rows[i]["金额"].ToString().Trim()); }
  329. Rectangle rec1 = new Rectangle(LeftWidth, Convert.ToInt32((this.PictImage.Height - 50) - intValue), 20, Convert.ToInt32(intValue));
  330. g.FillRectangle(Brushes.Red, rec1);
  331. SetPostionData("财务支出详情", dtOrderCount.Rows[i]["TypeText"].ToString(), rec1, "", StrTimeStrat, StrTimeEnd);
  332. string StrText = dtOrderCount.Rows[i]["TypeText"].ToString().Trim();
  333. sizef = g.MeasureString(StrText, ft12b);
  334. FtHeigth = Convert.ToInt32(sizef.Height);
  335. FtWidth = Convert.ToInt32(sizef.Width) + 1;
  336. if (FtWidth > 120)
  337. {
  338. FtWidth = 120;
  339. FtHeigth += FtHeigth;
  340. }
  341. Rectangle rec2 = new Rectangle((rec1.X + rec1.Width / 2) - FtWidth / 2, rec1.Y + rec1.Height + 3, FtWidth, FtHeigth);
  342. g.DrawString(StrText, ft12b, b, rec2);
  343. string StrAmount = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtOrderCount.Rows[i]["金额"].ToString().Trim());
  344. sizef = g.MeasureString(StrAmount, ft11);
  345. FtHeigth = Convert.ToInt32(sizef.Height);
  346. FtWidth = Convert.ToInt32(sizef.Width) + 1;
  347. Rectangle rec3 = new Rectangle((rec1.X + rec1.Width / 2) - FtWidth / 2, rec1.Y - FtHeigth, FtWidth, FtHeigth);
  348. g.DrawString(StrAmount, ft11, b, rec3);
  349. LeftWidth += 120;
  350. }
  351. #endregion
  352. }
  353. else
  354. {
  355. #region 启用对比
  356. Hashtable htData = new Hashtable();
  357. float MaxAmount = 0;
  358. for (int i = 0; i < dtOrderCount.Rows.Count; i++)
  359. {
  360. if (float.Parse(dtOrderCount.Rows[i]["金额"].ToString()) > MaxAmount)
  361. { MaxAmount = float.Parse(dtOrderCount.Rows[i]["金额"].ToString()); }
  362. htData[dtOrderCount.Rows[i]["TypeText"].ToString().Trim()] = dtOrderCount.Rows[i]["TypeText"].ToString().Trim();
  363. }
  364. for (int i = 0; i < dtOrderCountCompared.Rows.Count; i++)
  365. {
  366. if (float.Parse(dtOrderCountCompared.Rows[i]["金额"].ToString()) > MaxAmount)
  367. { MaxAmount = float.Parse(dtOrderCountCompared.Rows[i]["金额"].ToString()); }
  368. htData[dtOrderCountCompared.Rows[i]["TypeText"].ToString().Trim()] = dtOrderCountCompared.Rows[i]["TypeText"].ToString().Trim();
  369. }
  370. int RowsCountWidth = dtOrderCount.Rows.Count * 150;
  371. if ((this.panelEx2.Width - 6 - 100) > RowsCountWidth)
  372. { RowsCountWidth = this.panelEx2.Width + 100; }
  373. this.PictImage.Size = new System.Drawing.Size(RowsCountWidth, this.panelEx2.Height);
  374. newBmp = new Bitmap(this.PictImage.Width, this.PictImage.Height);
  375. Graphics g = Graphics.FromImage(newBmp);
  376. g.Clear(System.Drawing.Color.White);
  377. Brush b = Brushes.Black;
  378. Brush br = Brushes.Red;
  379. Brush bb = Brushes.Blue;
  380. Pen p = new Pen(Brushes.Black, 1);
  381. Font ft15 = new Font("微软雅黑", 15);
  382. Font ft12b = new Font("微软雅黑", 11);
  383. Font ft11 = new Font("微软雅黑", 10);
  384. int ForTopLoad = 30;
  385. int LeftWidth = 50;
  386. string StrValue = StrTimeStrat + "—" + StrTimeEnd + " 与 " + StrTimeStratDb + "-" + StrTimeEndDb + " 财务支出详情分析表";
  387. SizeF sizef = g.MeasureString(StrValue, ft15);
  388. int FtHeigth = Convert.ToInt32(sizef.Height);
  389. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  390. Rectangle rec = new Rectangle(newBmp.Width / 2 - FtWidth / 2, ForTopLoad, FtWidth, FtHeigth);
  391. g.DrawString(StrValue, ft15, b, rec);//画消费法规
  392. ForTopLoad = rec.Y + rec.Height;
  393. float WidthRatio = 0;
  394. if (MaxAmount > 0)
  395. { WidthRatio = (this.PictImage.Height - rec.Y - rec.Height - 100) / MaxAmount; }
  396. foreach (DictionaryEntry item in htData)
  397. {
  398. DataRow[] dtRow = dtOrderCount.Select("TypeText = '" + item.Key.ToString().Trim() + "'");
  399. DataRow[] dtRow2 = dtOrderCountCompared.Select("TypeText = '" + item.Key.ToString().Trim() + "'");
  400. string StrText = "";
  401. string StrAmount = "0";
  402. float intValue = 0;
  403. if (dtRow.Length > 0)
  404. {
  405. StrText = dtRow[0]["TypeText"].ToString().Trim();
  406. StrAmount = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtRow[0]["金额"].ToString().Trim());
  407. if (float.Parse(dtRow[0]["金额"].ToString()) > 0)
  408. { intValue = WidthRatio * float.Parse(dtRow[0]["金额"].ToString().Trim()); }
  409. }
  410. string StrAmount2 = "0";
  411. float intValue2 = 0;
  412. if (dtRow2.Length > 0)
  413. {
  414. if (string.IsNullOrEmpty(StrText))
  415. { StrText = dtRow2[0]["TypeText"].ToString().Trim(); }
  416. StrAmount2 = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtRow2[0]["金额"].ToString().Trim());
  417. if (float.Parse(dtRow2[0]["金额"].ToString()) > 0)
  418. { intValue2 = WidthRatio * float.Parse(dtRow2[0]["金额"].ToString().Trim()); }
  419. }
  420. Rectangle recA1 = new Rectangle(LeftWidth, Convert.ToInt32((this.PictImage.Height - 50) - intValue), 20, Convert.ToInt32(intValue));
  421. g.FillRectangle(Brushes.Red, recA1);
  422. SetPostionData("财务支出详情", item.Value.ToString(), recA1, "", StrTimeStrat, StrTimeEnd);
  423. sizef = g.MeasureString(StrText, ft12b);
  424. FtHeigth = Convert.ToInt32(sizef.Height);
  425. FtWidth = Convert.ToInt32(sizef.Width) + 1;
  426. if (FtWidth > 140)
  427. {
  428. FtWidth = 140;
  429. FtHeigth += FtHeigth;
  430. }
  431. Rectangle recA2 = new Rectangle(recA1.X + recA1.Width - FtWidth / 2, recA1.Y + recA1.Height + 3, FtWidth, FtHeigth);
  432. g.DrawString(StrText, ft12b, b, recA2);
  433. if (Convert.ToDecimal(StrAmount) > 0)
  434. {
  435. sizef = g.MeasureString(StrAmount, ft11);
  436. FtHeigth = Convert.ToInt32(sizef.Height);
  437. FtWidth = Convert.ToInt32(sizef.Width) + 1;
  438. Rectangle recA3 = new Rectangle(recA1.X - (FtWidth / 2), recA1.Y - FtHeigth, FtWidth, FtHeigth);
  439. g.DrawString(StrAmount, ft11, br, recA3);
  440. }
  441. Rectangle recB1 = new Rectangle(recA1.X + recA1.Width, recA1.Y + recA1.Height - Convert.ToInt32(intValue2), 20, Convert.ToInt32(intValue2));
  442. g.FillRectangle(Brushes.Blue, recB1);
  443. SetPostionData("财务支出详情", item.Value.ToString(), recB1, "", StrTimeStratDb, StrTimeEndDb);
  444. if (Convert.ToDecimal(StrAmount2) > 0)
  445. {
  446. sizef = g.MeasureString(StrAmount2, ft11);
  447. FtHeigth = Convert.ToInt32(sizef.Height);
  448. FtWidth = Convert.ToInt32(sizef.Width) + 1;
  449. Rectangle recB3 = new Rectangle(recB1.X, recB1.Y - FtHeigth * 2 + 5, FtWidth, FtHeigth);
  450. g.DrawString(StrAmount2, ft11, bb, recB3);
  451. }
  452. LeftWidth += 150;
  453. }
  454. #endregion
  455. }
  456. this.PictImage.Image = newBmp;
  457. }
  458. }
  459. }