AnalyzedOrderStoreOutlayDetailFormMain.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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 AnalyzedOrderStoreOutlayDetailFormMain : LYFZ.Software.UI.DecisionAssistant.AnalyzedOrderStoreOutlayDetailFormMain
  14. {
  15. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  16. List<ModelImagePostionAction> actionList = new List<ModelImagePostionAction>();
  17. public AnalyzedOrderStoreOutlayDetailFormMain()
  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.btnCloseed.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. if (string.IsNullOrEmpty(StrGoFormDateTime))
  100. {
  101. this.panelQueryCompared.Visible = false;
  102. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindGroupStoreName(this.cmbtreevStoreName, StrGroupKeyCode: "stA10", StrKeyCode: "stA23", IsShowAllText: false);
  103. this.dtDataTimeStart.DateValue = SDateTime.Now.ToString("yyyy-MM") + "-01";
  104. this.dtDataTimeEnd.DateValue = Convert.ToDateTime(this.dtDataTimeStart.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
  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.panelQueryCompared.Visible = true;
  152. this.panelEx3.Visible = true;
  153. if (!string.IsNullOrEmpty(this.dtDataTimeStartCompared.DateValue.Trim()) && !string.IsNullOrEmpty(this.dtDateTimeEndCompared.DateValue.Trim()))
  154. { this.PublicFunctionRows(); }
  155. }
  156. else
  157. {
  158. this.panelQueryCompared.Visible = false;
  159. this.panelEx3.Visible = false;
  160. this.PublicFunctionRows();
  161. }
  162. }
  163. /// <summary>
  164. /// 查询
  165. /// </summary>
  166. /// <param name="sender"></param>
  167. /// <param name="e"></param>
  168. void btnQuery_Click(object sender, EventArgs e)
  169. {
  170. this.PublicFunctionRows();
  171. }
  172. /// <summary>
  173. /// 对比查询
  174. /// </summary>
  175. /// <param name="sender"></param>
  176. /// <param name="e"></param>
  177. void btnQueryCompared_Click(object sender, EventArgs e)
  178. {
  179. this.PublicFunctionRows();
  180. }
  181. /// <summary>
  182. /// 另存为
  183. /// </summary>
  184. /// <param name="sender"></param>
  185. /// <param name="e"></param>
  186. void btnSaveAs_Click(object sender, EventArgs e)
  187. {
  188. string StrFilleName = Convert.ToDateTime(this.dtDataTimeStart.DateValue).ToString("yyyy年MM月dd日") + " — " + Convert.ToDateTime(this.dtDataTimeEnd.DateValue).ToString("yyyy年MM月dd日") + " 店面支出详情分析表";
  189. if (this.chkComparedStartUp.Checked)
  190. { StrFilleName = this.dtDataTimeStart.DateValue.Trim() + "—" + this.dtDataTimeEnd.DateValue.Trim() + " 与 " + this.dtDataTimeStartCompared.DateValue.Trim() + "—" + this.dtDateTimeEndCompared.DateValue.Trim() + " 店面支出详情分析表"; }
  191. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.DownloadSaveAs(this.PictImage.Image, StrFilleName: StrFilleName);
  192. }
  193. /// <summary>
  194. /// 关闭
  195. /// </summary>
  196. /// <param name="sender"></param>
  197. /// <param name="e"></param>
  198. void btnCloseed_Click(object sender, EventArgs e)
  199. {
  200. this.Close();
  201. }
  202. /// <summary>
  203. /// 开始时间离开事件
  204. /// </summary>
  205. /// <param name="sender"></param>
  206. /// <param name="e"></param>
  207. void dtDataTimeStart_Leave(object sender, EventArgs e)
  208. {
  209. this.dtDataTimeEnd.DateValue = Convert.ToDateTime(this.dtDataTimeStart.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
  210. }
  211. /// <summary>
  212. /// 对比开始时间离开事件
  213. /// </summary>
  214. /// <param name="sender"></param>
  215. /// <param name="e"></param>
  216. void dtDataTimeStartCompared_Leave(object sender, EventArgs e)
  217. {
  218. this.dtDateTimeEndCompared.DateValue = Convert.ToDateTime(this.dtDataTimeStartCompared.DateValue).AddMonths(1).AddSeconds(-1).ToString("yyyy-MM-dd");
  219. }
  220. /// <summary>
  221. /// 窗体大小发生变化
  222. /// </summary>
  223. /// <param name="sender"></param>
  224. /// <param name="e"></param>
  225. void AnalyzedOrderFinanceOutlayDetailFormMain_Resize(object sender, EventArgs e)
  226. {
  227. switch (this.panelCloseed.Location.Y)
  228. {
  229. case 1: this.flowLayoutPanel1.Height = 35; break;
  230. case 35: this.flowLayoutPanel1.Height = 70; break;
  231. }
  232. if (this.IsFristLoad)
  233. {
  234. this.panelEx2.Width = this.panelEx1.Width - 6;
  235. this.panelEx2.Height = this.panelEx1.Height - 6;
  236. }
  237. }
  238. /// <summary>
  239. /// 创建行
  240. /// </summary>
  241. void PublicFunctionRows()
  242. {
  243. actionList.Clear();
  244. #region 处理数据前判断
  245. if (this.chkComparedStartUp.Checked)
  246. {
  247. if (string.IsNullOrEmpty(this.dtDataTimeStart.DateValue.Trim()) && string.IsNullOrEmpty(this.dtDataTimeEnd.DateValue.Trim()))
  248. { MessageBoxCustom.Show("对比前时间段不能为空"); return; }
  249. if (Convert.ToDateTime(this.dtDataTimeEnd.DateValue) < Convert.ToDateTime(this.dtDataTimeStart.DateValue))
  250. { MessageBoxCustom.Show("对比前开始日期不能大于结束日期"); return; }
  251. if (string.IsNullOrEmpty(this.dtDataTimeStartCompared.DateValue.Trim()) && string.IsNullOrEmpty(this.dtDateTimeEndCompared.DateValue.Trim()))
  252. { MessageBoxCustom.Show("对比后时间段不能为空"); return; }
  253. if (Convert.ToDateTime(this.dtDateTimeEndCompared.DateValue) < Convert.ToDateTime(this.dtDataTimeStartCompared.DateValue))
  254. { MessageBoxCustom.Show("对比后开始日期不能大于结束日期"); return; }
  255. if (Convert.ToDateTime(this.dtDateTimeEndCompared.DateValue.Trim()) > Convert.ToDateTime(this.dtDataTimeStart.DateValue.Trim()))
  256. { MessageBoxCustom.Show("对比后的结束日期不能大于对比前的开始日期"); return; }
  257. }
  258. else
  259. {
  260. if (string.IsNullOrEmpty(this.dtDataTimeStart.DateValue.Trim()) && string.IsNullOrEmpty(this.dtDataTimeEnd.DateValue.Trim()))
  261. { MessageBoxCustom.Show("时间段不能为空"); return; }
  262. if (Convert.ToDateTime(this.dtDataTimeEnd.DateValue) < Convert.ToDateTime(this.dtDataTimeStart.DateValue))
  263. { MessageBoxCustom.Show("开始日期不能大于结束日期"); return; }
  264. }
  265. this.IsFristLoad = true;
  266. this.AnalyzedOrderFinanceOutlayDetailFormMain_Resize(this, null);
  267. this.IsFristLoad = false;
  268. #endregion
  269. this.actionList.Clear();
  270. string StrTimeStrat = this.dtDataTimeStart.DateValue.Trim();
  271. string StrTimeEnd = this.dtDataTimeEnd.DateValue.Trim();
  272. string StrTimeStratDb = this.dtDataTimeStartCompared.DateValue.Trim();
  273. string StrTimeEndDb = this.dtDateTimeEndCompared.DateValue.Trim();
  274. string StrWhere = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Oiae_IEDatetime", StrTimeStrat, StrTimeEnd) + "";
  275. string StrWhere2 = "";
  276. if (string.IsNullOrEmpty(StrGoFormDateTime))
  277. { StrWhere2 += LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetGroupQueryWhere(this.cmbtreevStoreName, "Oiae_DividedShop"); }
  278. else
  279. { StrWhere2 += " And Oiae_DividedShop = '" + this.StrStoreName + "'"; }
  280. 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;";
  281. if (this.chkComparedStartUp.Checked)
  282. {
  283. StrWhere = LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetDateTime("Oiae_IEDatetime", StrTimeStratDb, StrTimeEndDb) + "";
  284. 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. }
  286. DataSet dsData = orbll.GetView_Custom(ExecuteSql);
  287. DataTable dtOrderCount = dsData.Tables["ds"];
  288. DataTable dtOrderCountCompared = dsData.Tables["ds1"];
  289. Bitmap newBmp = null;
  290. if (!this.chkComparedStartUp.Checked)
  291. {
  292. #region 无启用对比
  293. int RowsCountWidth = dtOrderCount.Rows.Count * 120;
  294. if ((this.panelEx2.Width - 6 - 100) > RowsCountWidth)
  295. { RowsCountWidth = this.panelEx2.Width + 100; }
  296. this.PictImage.Size = new System.Drawing.Size(RowsCountWidth, this.panelEx2.Height);
  297. newBmp = new Bitmap(this.PictImage.Width, this.PictImage.Height);
  298. Graphics g = Graphics.FromImage(newBmp);
  299. g.Clear(System.Drawing.Color.White);
  300. Brush b = Brushes.Black;
  301. Pen p = new Pen(Brushes.Black, 1);
  302. Font ft15 = new Font("微软雅黑", 15);
  303. Font ft12b = new Font("微软雅黑", 11);
  304. Font ft11 = new Font("微软雅黑", 10);
  305. int ForTopLoad = 30;
  306. int LeftWidth = 50;
  307. string StrValue = Convert.ToDateTime(this.dtDataTimeStart.DateValue).ToString("yyyy年MM月dd日") + " — " + Convert.ToDateTime(this.dtDataTimeEnd.DateValue).ToString("yyyy年MM月dd日") + " 财务支出详情分析表";
  308. SizeF sizef = g.MeasureString(StrValue, ft15);
  309. int FtHeigth = Convert.ToInt32(sizef.Height);
  310. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  311. Rectangle rec = new Rectangle(newBmp.Width / 2 - FtWidth / 2, ForTopLoad, FtWidth, FtHeigth);
  312. g.DrawString(StrValue, ft15, b, rec);//画消费法规
  313. ForTopLoad = rec.Y + rec.Height;
  314. float WidthRatio = 0;
  315. if (dtOrderCount.Rows.Count > 0)
  316. {
  317. if (float.Parse(dtOrderCount.Rows[0]["金额"].ToString()) > 0)
  318. { WidthRatio = (this.PictImage.Height - rec.Y - rec.Height - 80) / float.Parse(dtOrderCount.Rows[0]["金额"].ToString()); }
  319. }
  320. for (int i = 0; i < dtOrderCount.Rows.Count; i++)
  321. {
  322. float intValue = 0;
  323. if (float.Parse(dtOrderCount.Rows[i]["金额"].ToString()) > 0)
  324. { intValue = WidthRatio * float.Parse(dtOrderCount.Rows[i]["金额"].ToString().Trim()); }
  325. Rectangle rec1 = new Rectangle(LeftWidth, Convert.ToInt32((this.PictImage.Height - 50) - intValue), 20, Convert.ToInt32(intValue));
  326. g.FillRectangle(Brushes.Red, rec1);
  327. SetPostionData("店面支出详情", dtOrderCount.Rows[i]["TypeText"].ToString(), rec1, "", StrTimeStrat, StrTimeEnd);
  328. string StrText = dtOrderCount.Rows[i]["TypeText"].ToString().Trim();
  329. sizef = g.MeasureString(StrText, ft12b);
  330. FtHeigth = Convert.ToInt32(sizef.Height);
  331. FtWidth = Convert.ToInt32(sizef.Width) + 1;
  332. if (FtWidth > 120)
  333. {
  334. FtWidth = 120;
  335. FtHeigth += FtHeigth;
  336. }
  337. Rectangle rec2 = new Rectangle((rec1.X + rec1.Width / 2) - FtWidth / 2, rec1.Y + rec1.Height + 3, FtWidth, FtHeigth);
  338. g.DrawString(StrText, ft12b, b, rec2);
  339. string StrAmount = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtOrderCount.Rows[i]["金额"].ToString().Trim());
  340. sizef = g.MeasureString(StrAmount, ft11);
  341. FtHeigth = Convert.ToInt32(sizef.Height);
  342. FtWidth = Convert.ToInt32(sizef.Width) + 1;
  343. Rectangle rec3 = new Rectangle((rec1.X + rec1.Width / 2) - FtWidth / 2, rec1.Y - FtHeigth, FtWidth, FtHeigth);
  344. g.DrawString(StrAmount, ft11, b, rec3);
  345. LeftWidth += 120;
  346. }
  347. #endregion
  348. }
  349. else
  350. {
  351. #region 启用对比
  352. Hashtable htData = new Hashtable();
  353. float MaxAmount = 0;
  354. for (int i = 0; i < dtOrderCount.Rows.Count; i++)
  355. {
  356. if (float.Parse(dtOrderCount.Rows[i]["金额"].ToString()) > MaxAmount)
  357. { MaxAmount = float.Parse(dtOrderCount.Rows[i]["金额"].ToString()); }
  358. htData[dtOrderCount.Rows[i]["TypeText"].ToString().Trim()] = dtOrderCount.Rows[i]["TypeText"].ToString().Trim();
  359. }
  360. for (int i = 0; i < dtOrderCountCompared.Rows.Count; i++)
  361. {
  362. if (float.Parse(dtOrderCountCompared.Rows[i]["金额"].ToString()) > MaxAmount)
  363. { MaxAmount = float.Parse(dtOrderCountCompared.Rows[i]["金额"].ToString()); }
  364. htData[dtOrderCountCompared.Rows[i]["TypeText"].ToString().Trim()] = dtOrderCountCompared.Rows[i]["TypeText"].ToString().Trim();
  365. }
  366. int RowsCountWidth = dtOrderCount.Rows.Count * 150;
  367. if ((this.panelEx2.Width - 6 - 100) > RowsCountWidth)
  368. { RowsCountWidth = this.panelEx2.Width + 100; }
  369. this.PictImage.Size = new System.Drawing.Size(RowsCountWidth, this.panelEx2.Height);
  370. newBmp = new Bitmap(this.PictImage.Width, this.PictImage.Height);
  371. Graphics g = Graphics.FromImage(newBmp);
  372. g.Clear(System.Drawing.Color.White);
  373. Brush b = Brushes.Black;
  374. Brush br = Brushes.Red;
  375. Brush bb = Brushes.Blue;
  376. Pen p = new Pen(Brushes.Black, 1);
  377. Font ft15 = new Font("微软雅黑", 15);
  378. Font ft12b = new Font("微软雅黑", 11);
  379. Font ft11 = new Font("微软雅黑", 10);
  380. int ForTopLoad = 30;
  381. int LeftWidth = 50;
  382. string StrValue = StrTimeStrat + "—" + StrTimeEnd + " 与 " + StrTimeStratDb + "-" + StrTimeEndDb + " 店面支出详情分析表";
  383. SizeF sizef = g.MeasureString(StrValue, ft15);
  384. int FtHeigth = Convert.ToInt32(sizef.Height);
  385. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  386. Rectangle rec = new Rectangle(newBmp.Width / 2 - FtWidth / 2, ForTopLoad, FtWidth, FtHeigth);
  387. g.DrawString(StrValue, ft15, b, rec);//画消费法规
  388. ForTopLoad = rec.Y + rec.Height;
  389. float WidthRatio = 0;
  390. if (MaxAmount > 0)
  391. { WidthRatio = (this.PictImage.Height - rec.Y - rec.Height - 100) / MaxAmount; }
  392. foreach (DictionaryEntry item in htData)
  393. {
  394. DataRow[] dtRow = dtOrderCount.Select("TypeText = '" + item.Key.ToString().Trim() + "'");
  395. DataRow[] dtRow2 = dtOrderCountCompared.Select("TypeText = '" + item.Key.ToString().Trim() + "'");
  396. string StrText = "";
  397. string StrAmount = "0";
  398. float intValue = 0;
  399. if (dtRow.Length > 0)
  400. {
  401. StrText = dtRow[0]["TypeText"].ToString().Trim();
  402. StrAmount = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtRow[0]["金额"].ToString().Trim());
  403. if (float.Parse(dtRow[0]["金额"].ToString()) > 0)
  404. { intValue = WidthRatio * float.Parse(dtRow[0]["金额"].ToString().Trim()); }
  405. }
  406. string StrAmount2 = "0";
  407. float intValue2 = 0;
  408. if (dtRow2.Length > 0)
  409. {
  410. if (string.IsNullOrEmpty(StrText))
  411. { StrText = dtRow2[0]["TypeText"].ToString().Trim(); }
  412. StrAmount2 = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtRow2[0]["金额"].ToString().Trim());
  413. if (float.Parse(dtRow2[0]["金额"].ToString()) > 0)
  414. { intValue2 = WidthRatio * float.Parse(dtRow2[0]["金额"].ToString().Trim()); }
  415. }
  416. Rectangle recA1 = new Rectangle(LeftWidth, Convert.ToInt32((this.PictImage.Height - 50) - intValue), 20, Convert.ToInt32(intValue));
  417. g.FillRectangle(Brushes.Red, recA1);
  418. SetPostionData("店面支出详情", item.Value.ToString(), recA1, "", StrTimeStrat, StrTimeEnd);
  419. sizef = g.MeasureString(StrText, ft12b);
  420. FtHeigth = Convert.ToInt32(sizef.Height);
  421. FtWidth = Convert.ToInt32(sizef.Width) + 1;
  422. if (FtWidth > 140)
  423. {
  424. FtWidth = 140;
  425. FtHeigth += FtHeigth;
  426. }
  427. Rectangle recA2 = new Rectangle(recA1.X + recA1.Width - FtWidth / 2, recA1.Y + recA1.Height + 3, FtWidth, FtHeigth);
  428. g.DrawString(StrText, ft12b, b, recA2);
  429. if (Convert.ToDecimal(StrAmount) > 0)
  430. {
  431. sizef = g.MeasureString(StrAmount, ft11);
  432. FtHeigth = Convert.ToInt32(sizef.Height);
  433. FtWidth = Convert.ToInt32(sizef.Width) + 1;
  434. Rectangle recA3 = new Rectangle(recA1.X - (FtWidth / 2), recA1.Y - FtHeigth, FtWidth, FtHeigth);
  435. g.DrawString(StrAmount, ft11, br, recA3);
  436. }
  437. Rectangle recB1 = new Rectangle(recA1.X + recA1.Width, recA1.Y + recA1.Height - Convert.ToInt32(intValue2), 20, Convert.ToInt32(intValue2));
  438. g.FillRectangle(Brushes.Blue, recB1);
  439. SetPostionData("店面支出详情", item.Value.ToString(), recB1, "", StrTimeStratDb, StrTimeEndDb);
  440. if (Convert.ToDecimal(StrAmount2) > 0)
  441. {
  442. sizef = g.MeasureString(StrAmount2, ft11);
  443. FtHeigth = Convert.ToInt32(sizef.Height);
  444. FtWidth = Convert.ToInt32(sizef.Width) + 1;
  445. Rectangle recB3 = new Rectangle(recB1.X, recB1.Y - FtHeigth * 2 + 5, FtWidth, FtHeigth);
  446. g.DrawString(StrAmount2, ft11, bb, recB3);
  447. }
  448. LeftWidth += 150;
  449. }
  450. #endregion
  451. }
  452. this.PictImage.Image = newBmp;
  453. }
  454. }
  455. }