TeamCompetitionFormMain.cs 104 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575
  1. using LYFZ.ComponentLibrary;
  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.MarketingAllPerson
  12. {
  13. public partial class TeamCompetitionFormMain : LYFZ.Software.UI.MarketingAllPerson.TeamCompetitionFormMain
  14. {
  15. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  16. public TeamCompetitionFormMain()
  17. {
  18. this.Load += TeamCompetitionFormMain_Load;
  19. this.Shown += TeamCompetitionFormMain_Shown;
  20. this.cmbtreevActivityName.ComboBoxTree_NodeMouseClick += cmbtreevActivityName_ComboBoxTree_NodeMouseClick;
  21. this.cmbtreevMaxTeamName.ComboBoxTree_NodeMouseClick += cmbtreevMaxTeamName_ComboBoxTree_NodeMouseClick;
  22. this.cmbtreevMinTeamName.ComboBoxTree_NodeMouseClick += cmbtreevMinTeamName_ComboBoxTree_NodeMouseClick;
  23. this.chkYejiOrderBy.Click += chkYejiOrderBy_Click;
  24. this.btnNewActivity.Click += btnNewActivity_Click;
  25. this.btnSaveAs.Click += btnSaveAs_Click;
  26. this.btnClose.Click += btnClose_Click;
  27. this.pictImage.Click += pictImage_Click;
  28. this.Resize += TeamCompetitionFormMain_Resize;
  29. }
  30. /// <summary>
  31. /// 主门市比重
  32. /// </summary>
  33. decimal MinStoreProportion = 0;
  34. /// <summary>
  35. /// 副门市比重
  36. /// </summary>
  37. decimal ViceStoreProportion = 0;
  38. /// <summary>
  39. /// 窗体加载事件
  40. /// </summary>
  41. /// <param name="sender"></param>
  42. /// <param name="e"></param>
  43. void TeamCompetitionFormMain_Load(object sender, EventArgs e)
  44. {
  45. DataTable dtProportion = orbll.GetView_Custom("tb_ErpCommissionPercentage", StrWhere: "Cp_ProportionType = 1", ShowColumnName: "Cp_ProportionCode,Cp_Proportion").Tables[0];
  46. for (int i = 0; i < dtProportion.Rows.Count; i++)
  47. {
  48. switch (dtProportion.Rows[i]["Cp_ProportionCode"].ToString().Trim())
  49. {
  50. case "MainStoreProportion": MinStoreProportion = Convert.ToDecimal(dtProportion.Rows[i]["Cp_Proportion"]); break;
  51. case "DeputyStoreProportion": ViceStoreProportion = Convert.ToDecimal(dtProportion.Rows[i]["Cp_Proportion"]); break;
  52. }
  53. }
  54. }
  55. /// <summary>
  56. /// 窗体加载事件
  57. /// </summary>
  58. /// <param name="sender"></param>
  59. /// <param name="e"></param>
  60. void TeamCompetitionFormMain_Shown(object sender, EventArgs e)
  61. {
  62. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamActivityName(this.cmbtreevActivityName);
  63. this.PublicFunctionRows();
  64. bool b = LYFZ.Software.MainBusiness.VersionControl.StaticVersion.UIFunctionVersion(VersionControl.VersionFunctionEnum.全员营销);
  65. if (!b)
  66. {
  67. this.Close();
  68. }
  69. }
  70. /// <summary>
  71. /// 活动名称选择事件
  72. /// </summary>
  73. /// <param name="sender"></param>
  74. /// <param name="e"></param>
  75. void cmbtreevActivityName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  76. {
  77. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamMaxTaskName(this.cmbtreevMaxTeamName, this.cmbtreevActivityName.Tag.ToString().Trim(), IsFirstNodeNull: true);
  78. this.PublicFunctionRows();
  79. }
  80. /// <summary>
  81. /// 大队名称选择事件
  82. /// </summary>
  83. /// <param name="sender"></param>
  84. /// <param name="e"></param>
  85. void cmbtreevMaxTeamName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  86. {
  87. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamMinTaskName(this.cmbtreevMinTeamName, this.cmbtreevActivityName.Tag.ToString().Trim(), this.cmbtreevMaxTeamName.Tag.ToString().Trim(), IsFirstNodeNull: true);
  88. this.PublicFunctionRows();
  89. }
  90. /// <summary>
  91. /// 小组名称选择事件
  92. /// </summary>
  93. /// <param name="sender"></param>
  94. /// <param name="e"></param>
  95. void cmbtreevMinTeamName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  96. {
  97. this.PublicFunctionRows();
  98. }
  99. /// <summary>
  100. /// 按业绩排序
  101. /// </summary>
  102. /// <param name="sender"></param>
  103. /// <param name="e"></param>
  104. void chkYejiOrderBy_Click(object sender, EventArgs e)
  105. {
  106. this.PublicFunctionRows();
  107. }
  108. /// <summary>
  109. /// 新建活动
  110. /// </summary>
  111. /// <param name="sender"></param>
  112. /// <param name="e"></param>
  113. void btnNewActivity_Click(object sender, EventArgs e)
  114. {
  115. LYFZ.Software.MainBusiness.MarketingAllPerson.SetSmallForm.AddTeamPersonSmallForm frm = new SetSmallForm.AddTeamPersonSmallForm();
  116. frm.StartPosition = FormStartPosition.Manual;
  117. frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  118. frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  119. frm.ShowDialog();
  120. if (frm.IsSaveed)
  121. { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_TeamActivityName(this.cmbtreevActivityName); }
  122. }
  123. /// <summary>
  124. /// 另存为
  125. /// </summary>
  126. /// <param name="sender"></param>
  127. /// <param name="e"></param>
  128. void btnSaveAs_Click(object sender, EventArgs e)
  129. {
  130. string StrFilleName = "";
  131. if (!string.IsNullOrEmpty(this.cmbtreevMinTeamName.Text.Trim()))
  132. { StrFilleName += this.cmbtreevMinTeamName.Text.Trim() + "组PK图"; }
  133. else if (!string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()))
  134. { StrFilleName += this.cmbtreevMaxTeamName.Text.Trim() + "队PK图"; }
  135. else if (!string.IsNullOrEmpty(this.cmbtreevActivityName.Text.Trim()))
  136. { StrFilleName += this.cmbtreevActivityName.Text.Trim() + "PK图"; }
  137. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.DownloadSaveAs(this.pictImage.Image, StrFilleName: StrFilleName);
  138. }
  139. /// <summary>
  140. /// 关闭
  141. /// </summary>
  142. /// <param name="sender"></param>
  143. /// <param name="e"></param>
  144. void btnClose_Click(object sender, EventArgs e)
  145. {
  146. this.Close();
  147. }
  148. /// <summary>
  149. /// 图片点击获取焦点
  150. /// </summary>
  151. /// <param name="sender"></param>
  152. /// <param name="e"></param>
  153. void pictImage_Click(object sender, EventArgs e)
  154. {
  155. this.pictImage.Focus();
  156. }
  157. /// <summary>
  158. /// 窗体大小发生变事件
  159. /// </summary>
  160. /// <param name="sender"></param>
  161. /// <param name="e"></param>
  162. void TeamCompetitionFormMain_Resize(object sender, EventArgs e)
  163. {
  164. //this.panelEx3.Height = this.panelEx1.Height - this.panelEx2.Height - 6;
  165. }
  166. /// <summary>
  167. /// 绘制数据
  168. /// </summary>
  169. void PublicFunctionRows()
  170. {
  171. if (!string.IsNullOrEmpty(this.cmbtreevActivityName.Text.Trim()) && this.cmbtreevActivityName.Tag != null && !string.IsNullOrEmpty(this.cmbtreevActivityName.Tag.ToString().Trim()))
  172. {
  173. string StrTasNumber = this.cmbtreevActivityName.Tag.ToString().Trim();
  174. DataTable dtActive = orbll.GetView_Custom("tb_ErpTeamActiveSet", StrWhere: "Tas_Number = '" + StrTasNumber + "'", ShowColumnName: "Tas_DateTimeStart,Tas_DateTimeEnd,Tas_BaodiTask,Tas_TargetTask,Tas_SprintTask").Tables[0];
  175. if (dtActive.Rows.Count > 0)
  176. {
  177. DataTable dtOpenSingle = OpenOrderPersonGroupDataTable(OpenOrderPersonDataTable(Convert.ToDateTime(dtActive.Rows[0]["Tas_DateTimeStart"]), Convert.ToDateTime(dtActive.Rows[0]["Tas_DateTimeEnd"])));
  178. string StrWhere = "Where Tps_TasNumber = '" + StrTasNumber + "'";
  179. if (this.cmbtreevMaxTeamName.Tag != null && !string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Tag.ToString()))
  180. { StrWhere += " And Tps_TmxtNumber = '" + this.cmbtreevMaxTeamName.StrGetName.Trim() + "'"; }
  181. if (this.cmbtreevMinTeamName.Tag != null && !string.IsNullOrEmpty(this.cmbtreevMinTeamName.Tag.ToString()))
  182. { StrWhere += " And Tps_TmitNumber = '" + this.cmbtreevMinTeamName.StrGetName.Trim() + "'"; }
  183. string ExecuteSql = "select Tps_TmxtNumber,Tps_TmitNumber,Tps_UserNumber,Tmxn_Name,Tmin_Name,User_Name,Tps_BaodiTask,Tps_TargetTask,Tps_SprintTask from tb_ErpTeamPersonSet Left Join tb_ErpUser on User_EmployeeID = Tps_UserNumber Left Join tb_ErpTeamMaxNameSet on Tmxn_Number = Tps_TmxnNumber Left Join tb_ErpTeamMinNameSet on Tmin_Number = Tps_TminNumber " + StrWhere + ";";
  184. ExecuteSql += "select Tmxt_TasNumber,Tmxt_Number,Tmxn_Name,Tmxt_BaodiTask,Tmxt_TargetTask,Tmxt_SprintTask from tb_ErpTeamMaxTaskSet Left Join tb_ErpTeamMaxNameSet on Tmxn_Number = Tmxt_TmxnNumber where Tmxt_TasNumber = '" + StrTasNumber + "';";
  185. ExecuteSql += "select Tmit_TmxtNumber,Tmit_Number,Tmin_Name,Tmit_BaodiTask,Tmit_TargetTask,Tmit_SprintTask from tb_ErpTeamMinTaskSet Left Join tb_ErpTeamMinNameSet on Tmin_Number = Tmit_TminNumber where Tmit_TasNumber = '" + StrTasNumber + "';";
  186. DataSet dsData = orbll.GetView_Custom(ExecuteSql);
  187. DataTable dtTeamPerson = TeamPersonRankedDataTable(dsData.Tables["ds"], dtOpenSingle);
  188. DataTable dtTeamMax = dsData.Tables["ds1"];
  189. DataTable dtTeamMin = dsData.Tables["ds2"];
  190. #region 绘标题
  191. int TopAdd = 5;
  192. int LeftWidth = 0;
  193. int RowHeight = 30;
  194. Hashtable htColumnWidth = this.GetColumnWidth();
  195. int newBmpWidth = 0;
  196. for (int i = 0; i < dtTeamPerson.Columns.Count; i++)
  197. {
  198. switch (dtTeamPerson.Columns[i].ColumnName.Trim())
  199. {
  200. case "大队编号":
  201. case "小组编号":
  202. break;
  203. default:
  204. if (!this.chkYejiOrderBy.Checked)
  205. {
  206. if (dtTeamPerson.Columns[i].ColumnName.Trim() == "大队名称")
  207. {
  208. if (!string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()) || !string.IsNullOrEmpty(this.cmbtreevMinTeamName.Text.Trim()))
  209. { break; }
  210. }
  211. if (dtTeamPerson.Columns[i].ColumnName.Trim() == "小组名称")
  212. {
  213. if (!string.IsNullOrEmpty(this.cmbtreevMinTeamName.Text.Trim()))
  214. { break; }
  215. }
  216. }
  217. newBmpWidth += Convert.ToInt32(htColumnWidth[dtTeamPerson.Columns[i].ColumnName.Trim()].ToString());
  218. break;
  219. }
  220. }
  221. int newBmpHeight = RowHeight * dtTeamPerson.Rows.Count + 50;
  222. if (!this.chkYejiOrderBy.Checked)
  223. {
  224. if (string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()))
  225. { newBmpHeight += RowHeight * dtTeamMax.Rows.Count; }
  226. if (string.IsNullOrEmpty(this.cmbtreevMinTeamName.Text.Trim()))
  227. { newBmpHeight += RowHeight * dtTeamMin.Rows.Count; }
  228. }
  229. if (newBmpHeight < (this.panelEx3.Height - 23))
  230. { newBmpHeight = (this.panelEx3.Height - 23); }
  231. Bitmap newBmp = new Bitmap(newBmpWidth + LeftWidth * 2 + 10, newBmpHeight);
  232. Graphics g = Graphics.FromImage(newBmp);
  233. g.Clear(System.Drawing.Color.White);
  234. Brush b = Brushes.Black;
  235. Pen p = new Pen(Brushes.Black, 1);
  236. Font ft11b = new Font("微软雅黑", 11);
  237. Font ft11 = new Font("微软雅黑", 11, FontStyle.Italic);
  238. Font ft15 = new Font("微软雅黑", 15);
  239. int TableWidth = newBmp.Width - LeftWidth * 2 - 10;
  240. Rectangle rec1 = new Rectangle(LeftWidth, 0, TableWidth, RowHeight);
  241. g.FillRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.backColortitle, rec1);//画标题矩形
  242. Rectangle rec = new Rectangle(LeftWidth, 0, TableWidth, RowHeight);
  243. g.DrawRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, rec);
  244. int intForTitleLeft = rec1.X;
  245. for (int i = 0; i < dtTeamPerson.Columns.Count; i++)
  246. {
  247. switch (dtTeamPerson.Columns[i].ColumnName.Trim())
  248. {
  249. case "大队编号":
  250. case "小组编号":
  251. break;
  252. default:
  253. if (!this.chkYejiOrderBy.Checked)
  254. {
  255. if (dtTeamPerson.Columns[i].ColumnName.Trim() == "大队名称")
  256. {
  257. if (!string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()) || !string.IsNullOrEmpty(this.cmbtreevMinTeamName.Text.Trim()))
  258. { break; }
  259. }
  260. if (dtTeamPerson.Columns[i].ColumnName.Trim() == "小组名称")
  261. {
  262. if (!string.IsNullOrEmpty(this.cmbtreevMinTeamName.Text.Trim()))
  263. { break; }
  264. }
  265. }
  266. int IntColumnWidth = Convert.ToInt32(htColumnWidth[dtTeamPerson.Columns[i].ColumnName.Trim()].ToString().Trim());
  267. SizeF sizef = g.MeasureString(dtTeamPerson.Columns[i].ColumnName.Trim(), ft11b);
  268. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  269. int FtHeigth = Convert.ToInt32(sizef.Height);
  270. Rectangle rec1_1 = new Rectangle(intForTitleLeft + IntColumnWidth / 2 - FtWidth / 2, rec1.Y + TopAdd, IntColumnWidth, FtHeigth);
  271. g.DrawString(dtTeamPerson.Columns[i].ColumnName.Trim(), ft11b, Brushes.White, rec1_1);
  272. if (i < dtTeamPerson.Columns.Count - 1)
  273. {
  274. Point p11_1 = new Point(intForTitleLeft + IntColumnWidth, rec1.Y);
  275. Point p11_2 = new Point(intForTitleLeft + IntColumnWidth, rec1.Y + rec1.Height);
  276. g.DrawLine(new Pen(Brushes.Lavender, 1), p11_1, p11_2);
  277. }
  278. intForTitleLeft += IntColumnWidth;
  279. break;
  280. }
  281. }
  282. int intForRowTop = rec1.Y;
  283. #endregion
  284. if (!this.chkYejiOrderBy.Checked)
  285. {
  286. if (string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()) && string.IsNullOrEmpty(this.cmbtreevMinTeamName.Text.Trim()))
  287. {
  288. #region 只选择活动名称
  289. DataTable dtTeamMaxGroupBy = this.GetTeamMaxGroupBy(dtTeamMax, dtTeamPerson);
  290. DataTable dtTeamMinGroupBy = this.GetTeamMinGroupBy(dtTeamMin, dtTeamPerson);
  291. DataRow[] dtRowMaxGroupBy = dtTeamMaxGroupBy.Select("", "完成任务 DESC");
  292. for (int i = 0; i < dtRowMaxGroupBy.Length; i++)
  293. {
  294. #region 绘制大队
  295. intForRowTop += RowHeight;
  296. Rectangle recMax = new Rectangle(rec1.X, intForRowTop, TableWidth, RowHeight);
  297. g.DrawRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, recMax);
  298. Rectangle recMaxBackColor = new Rectangle(recMax.X + 1, recMax.Y + 1, recMax.Width - 1, recMax.Height - 1);
  299. g.FillRectangle(Brushes.LightSalmon, recMaxBackColor);
  300. int intMaxGroupRowLeft = recMax.X;
  301. for (int j = 0; j < dtTeamPerson.Columns.Count; j++)
  302. {
  303. switch (dtTeamPerson.Columns[j].ColumnName.Trim())
  304. {
  305. case "大队编号":
  306. case "小组编号":
  307. break;
  308. default:
  309. int IntColumnWidth = Convert.ToInt32(htColumnWidth[dtTeamPerson.Columns[j].ColumnName.Trim()].ToString().Trim());
  310. if (dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("保底完成情况") != -1 || dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("目标完成情况") != -1 || dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("冲刺完成情况") != -1)
  311. {
  312. Rectangle recA = new Rectangle(intMaxGroupRowLeft + TopAdd, recMax.Y + (RowHeight - 20) / 2, 150, 20);
  313. g.DrawRectangle(new Pen(Brushes.LightSkyBlue, 1), recA);
  314. decimal decValue = Convert.ToDecimal(dtRowMaxGroupBy[i][dtTeamPerson.Columns[j].ColumnName.Trim()]);
  315. int recBWidth = Convert.ToInt32(recA.Width * decValue / 100);
  316. if (recBWidth > (recA.Width - 1))
  317. { recBWidth = recA.Width - 1; }
  318. Rectangle recB = new Rectangle(recA.X + 1, recA.Y + 1, recBWidth, recA.Height - 1);
  319. g.FillRectangle(Brushes.LightSlateGray, recB);
  320. string StrValue = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(decValue) + "%";
  321. SizeF sizef = g.MeasureString(StrValue, ft11b);
  322. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  323. Rectangle recC = new Rectangle(recA.X + recA.Width + TopAdd, intForRowTop + TopAdd, FtWidth, RowHeight);
  324. g.DrawString(StrValue, ft11b, b, recC);
  325. }
  326. else
  327. {
  328. string StrStringValue = dtRowMaxGroupBy[i][dtTeamPerson.Columns[j].ColumnName.Trim()].ToString().Trim();
  329. int WidthLeft = intMaxGroupRowLeft;
  330. if (dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("任务") != -1 || dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("业绩") != -1 || dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("均价") != -1)
  331. {
  332. StrStringValue = Convert.ToDecimal(StrStringValue).ToString("0.00");
  333. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  334. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  335. WidthLeft = intMaxGroupRowLeft + IntColumnWidth - FtWidth - TopAdd;
  336. }
  337. else if (dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("单数") != -1)
  338. {
  339. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  340. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  341. WidthLeft = intMaxGroupRowLeft + IntColumnWidth / 2 - FtWidth / 2;
  342. }
  343. else
  344. {
  345. WidthLeft = intMaxGroupRowLeft + TopAdd;
  346. }
  347. Rectangle rec1_1 = new Rectangle(WidthLeft, intForRowTop + TopAdd, IntColumnWidth, RowHeight);
  348. g.DrawString(StrStringValue, ft11b, b, rec1_1);
  349. }
  350. Point p11_1 = new Point(intMaxGroupRowLeft + IntColumnWidth, intForRowTop);
  351. Point p11_2 = new Point(intMaxGroupRowLeft + IntColumnWidth, intForRowTop + recMax.Height);
  352. g.DrawLine(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, p11_1, p11_2);
  353. intMaxGroupRowLeft += IntColumnWidth;
  354. break;
  355. }
  356. }
  357. #endregion
  358. DataRow[] dtMinGroupBy = dtTeamMinGroupBy.Select("大队编号 = '" + dtRowMaxGroupBy[i]["大队编号"].ToString().Trim() + "'", "完成任务 DESC");
  359. for (int j = 0; j < dtMinGroupBy.Length; j++)
  360. {
  361. #region 绘制小组
  362. intForRowTop += RowHeight;
  363. Rectangle recMin = new Rectangle(rec1.X, intForRowTop, TableWidth, RowHeight);
  364. g.DrawRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, recMin);
  365. int MaxTeamWidth = Convert.ToInt32(htColumnWidth["大队名称"]);
  366. Rectangle recMinBackColor = new Rectangle(recMin.X + MaxTeamWidth + 1, recMin.Y + 1, recMin.Width - MaxTeamWidth - 1, recMin.Height - 1);
  367. g.FillRectangle(Brushes.Wheat, recMinBackColor);
  368. int intMinGroupRowLeft = recMin.X;
  369. for (int k = 0; k < dtTeamPerson.Columns.Count; k++)
  370. {
  371. switch (dtTeamPerson.Columns[k].ColumnName.Trim())
  372. {
  373. case "大队编号":
  374. case "小组编号":
  375. break;
  376. default:
  377. int IntColumnWidth = Convert.ToInt32(htColumnWidth[dtTeamPerson.Columns[k].ColumnName.Trim()].ToString().Trim());
  378. if (dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("保底完成情况") != -1 || dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("目标完成情况") != -1 || dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("冲刺完成情况") != -1)
  379. {
  380. Rectangle recA = new Rectangle(intMinGroupRowLeft + TopAdd, recMin.Y + (RowHeight - 20) / 2, 150, 20);
  381. g.DrawRectangle(new Pen(Brushes.LightSkyBlue, 1), recA);
  382. decimal decValue = Convert.ToDecimal(dtMinGroupBy[j][dtTeamPerson.Columns[k].ColumnName.Trim()]);
  383. int recBWidth = Convert.ToInt32(recA.Width * decValue / 100);
  384. if (recBWidth > (recA.Width - 1))
  385. { recBWidth = recA.Width - 1; }
  386. Rectangle recB = new Rectangle(recA.X + 1, recA.Y + 1, recBWidth, recA.Height - 1);
  387. g.FillRectangle(Brushes.LightSlateGray, recB);
  388. string StrValue = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(decValue) + "%";
  389. SizeF sizef = g.MeasureString(StrValue, ft11b);
  390. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  391. Rectangle recC = new Rectangle(recA.X + recA.Width + TopAdd, intForRowTop + TopAdd, FtWidth, RowHeight);
  392. g.DrawString(StrValue, ft11b, b, recC);
  393. }
  394. else
  395. {
  396. string StrStringValue = dtMinGroupBy[j][dtTeamPerson.Columns[k].ColumnName.Trim()].ToString().Trim();
  397. int WidthLeft = intMinGroupRowLeft;
  398. if (dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("任务") != -1 || dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("业绩") != -1 || dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("均价") != -1)
  399. {
  400. StrStringValue = Convert.ToDecimal(StrStringValue).ToString("0.00");
  401. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  402. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  403. WidthLeft = intMinGroupRowLeft + IntColumnWidth - FtWidth - TopAdd;
  404. }
  405. else if (dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("单数") != -1)
  406. {
  407. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  408. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  409. WidthLeft = intMinGroupRowLeft + IntColumnWidth / 2 - FtWidth / 2;
  410. }
  411. else
  412. {
  413. WidthLeft = intMinGroupRowLeft + TopAdd;
  414. }
  415. Rectangle rec1_1 = new Rectangle(WidthLeft, intForRowTop + TopAdd, IntColumnWidth, RowHeight);
  416. g.DrawString(StrStringValue, ft11b, b, rec1_1);
  417. }
  418. Point p11_1 = new Point(intMinGroupRowLeft + IntColumnWidth, intForRowTop);
  419. Point p11_2 = new Point(intMinGroupRowLeft + IntColumnWidth, intForRowTop + recMin.Height);
  420. g.DrawLine(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, p11_1, p11_2);
  421. intMinGroupRowLeft += IntColumnWidth;
  422. break;
  423. }
  424. }
  425. #endregion
  426. DataRow[] dtRowTeamPerson = dtTeamPerson.Select("大队编号 = '" + dtRowMaxGroupBy[i]["大队编号"].ToString().Trim() + "' And 小组编号 = '" + dtMinGroupBy[j]["小组编号"].ToString().Trim() + "'", "完成任务 DESC");
  427. for (int k = 0; k < dtRowTeamPerson.Length; k++)
  428. {
  429. #region 绘制组员
  430. intForRowTop += RowHeight;
  431. Rectangle recGroup = new Rectangle(rec1.X, intForRowTop, TableWidth, RowHeight);
  432. g.DrawRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, recGroup);
  433. int intGroupRowLeft = recGroup.X;
  434. for (int l = 0; l < dtTeamPerson.Columns.Count; l++)
  435. {
  436. switch (dtTeamPerson.Columns[l].ColumnName.Trim())
  437. {
  438. case "大队编号":
  439. case "小组编号":
  440. break;
  441. default:
  442. int IntColumnWidth = Convert.ToInt32(htColumnWidth[dtTeamPerson.Columns[l].ColumnName.Trim()].ToString().Trim());
  443. if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("保底完成情况") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("目标完成情况") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("冲刺完成情况") != -1)
  444. {
  445. Rectangle recA = new Rectangle(intGroupRowLeft + TopAdd, recGroup.Y + (RowHeight - 20) / 2, 150, 20);
  446. g.DrawRectangle(new Pen(Brushes.LightSkyBlue, 1), recA);
  447. decimal decValue = Convert.ToDecimal(dtRowTeamPerson[k][dtTeamPerson.Columns[l].ColumnName.Trim()]);
  448. int recBWidth = Convert.ToInt32(recA.Width * decValue / 100);
  449. if (recBWidth > (recA.Width - 1))
  450. { recBWidth = recA.Width - 1; }
  451. Rectangle recB = new Rectangle(recA.X + 1, recA.Y + 1, recBWidth, recA.Height - 1);
  452. g.FillRectangle(Brushes.LightSlateGray, recB);
  453. string StrValue = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(decValue) + "%";
  454. SizeF sizef = g.MeasureString(StrValue, ft11b);
  455. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  456. Rectangle recC = new Rectangle(recA.X + recA.Width + TopAdd, intForRowTop + TopAdd, FtWidth, RowHeight);
  457. g.DrawString(StrValue, ft11b, b, recC);
  458. }
  459. else
  460. {
  461. string StrStringValue = dtRowTeamPerson[k][dtTeamPerson.Columns[l].ColumnName.Trim()].ToString().Trim();
  462. int WidthLeft = intGroupRowLeft;
  463. if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("任务") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("业绩") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("均价") != -1)
  464. {
  465. StrStringValue = Convert.ToDecimal(StrStringValue).ToString("0.00");
  466. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  467. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  468. WidthLeft = intGroupRowLeft + IntColumnWidth - FtWidth - TopAdd;
  469. }
  470. else if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("单数") != -1)
  471. {
  472. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  473. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  474. WidthLeft = intGroupRowLeft + IntColumnWidth / 2 - FtWidth / 2;
  475. }
  476. else
  477. {
  478. WidthLeft = intGroupRowLeft + TopAdd;
  479. }
  480. if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("大队名称") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("小组名称") != -1)
  481. {
  482. StrStringValue = "";
  483. }
  484. Rectangle rec1_1 = new Rectangle(WidthLeft, intForRowTop + TopAdd, IntColumnWidth, RowHeight);
  485. g.DrawString(StrStringValue, ft11b, b, rec1_1);
  486. }
  487. Point p11_1 = new Point(intGroupRowLeft + IntColumnWidth, intForRowTop);
  488. Point p11_2 = new Point(intGroupRowLeft + IntColumnWidth, intForRowTop + recGroup.Height);
  489. g.DrawLine(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, p11_1, p11_2);
  490. intGroupRowLeft += IntColumnWidth;
  491. break;
  492. }
  493. }
  494. #endregion
  495. }
  496. }
  497. }
  498. #endregion
  499. }
  500. else if (!string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()) && string.IsNullOrEmpty(this.cmbtreevMinTeamName.Text.Trim()))
  501. {
  502. #region 只选择活动名称和大队名称
  503. DataTable dtTeamMinGroupBy = this.GetTeamMinGroupBy(dtTeamMin, dtTeamPerson);
  504. DataRow[] dtMinGroupBy = dtTeamMinGroupBy.Select("大队编号 = '" + this.cmbtreevMaxTeamName.StrGetName.ToString().Trim() + "'", "完成任务 DESC");
  505. for (int j = 0; j < dtMinGroupBy.Length; j++)
  506. {
  507. #region 绘制小组
  508. intForRowTop += RowHeight;
  509. Rectangle recMin = new Rectangle(rec1.X, intForRowTop, TableWidth, RowHeight);
  510. g.DrawRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, recMin);
  511. Rectangle recMinBackColor = new Rectangle(recMin.X + 1, recMin.Y + 1, recMin.Width - 1, recMin.Height - 1);
  512. g.FillRectangle(Brushes.Wheat, recMinBackColor);
  513. int intMinGroupRowLeft = recMin.X;
  514. for (int k = 0; k < dtTeamPerson.Columns.Count; k++)
  515. {
  516. switch (dtTeamPerson.Columns[k].ColumnName.Trim())
  517. {
  518. case "大队编号":
  519. case "小组编号":
  520. case "大队名称":
  521. break;
  522. default:
  523. int IntColumnWidth = Convert.ToInt32(htColumnWidth[dtTeamPerson.Columns[k].ColumnName.Trim()].ToString().Trim());
  524. if (dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("保底完成情况") != -1 || dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("目标完成情况") != -1 || dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("冲刺完成情况") != -1)
  525. {
  526. Rectangle recA = new Rectangle(intMinGroupRowLeft + TopAdd, recMin.Y + (RowHeight - 20) / 2, 150, 20);
  527. g.DrawRectangle(new Pen(Brushes.LightSkyBlue, 1), recA);
  528. decimal decValue = Convert.ToDecimal(dtMinGroupBy[j][dtTeamPerson.Columns[k].ColumnName.Trim()]);
  529. int recBWidth = Convert.ToInt32(recA.Width * decValue / 100);
  530. if (recBWidth > (recA.Width - 1))
  531. { recBWidth = recA.Width - 1; }
  532. Rectangle recB = new Rectangle(recA.X + 1, recA.Y + 1, recBWidth, recA.Height - 1);
  533. g.FillRectangle(Brushes.LightSlateGray, recB);
  534. string StrValue = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(decValue) + "%";
  535. SizeF sizef = g.MeasureString(StrValue, ft11b);
  536. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  537. Rectangle recC = new Rectangle(recA.X + recA.Width + TopAdd, intForRowTop + TopAdd, FtWidth, RowHeight);
  538. g.DrawString(StrValue, ft11b, b, recC);
  539. }
  540. else
  541. {
  542. string StrStringValue = dtMinGroupBy[j][dtTeamPerson.Columns[k].ColumnName.Trim()].ToString().Trim();
  543. int WidthLeft = intMinGroupRowLeft;
  544. if (dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("任务") != -1 || dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("业绩") != -1 || dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("均价") != -1)
  545. {
  546. StrStringValue = Convert.ToDecimal(StrStringValue).ToString("0.00");
  547. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  548. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  549. WidthLeft = intMinGroupRowLeft + IntColumnWidth - FtWidth - TopAdd;
  550. }
  551. else if (dtTeamPerson.Columns[k].ColumnName.Trim().IndexOf("单数") != -1)
  552. {
  553. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  554. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  555. WidthLeft = intMinGroupRowLeft + IntColumnWidth / 2 - FtWidth / 2;
  556. }
  557. else
  558. { WidthLeft = intMinGroupRowLeft + TopAdd; }
  559. Rectangle rec1_1 = new Rectangle(WidthLeft, intForRowTop + TopAdd, IntColumnWidth, RowHeight);
  560. g.DrawString(StrStringValue, ft11b, b, rec1_1);
  561. }
  562. Point p11_1 = new Point(intMinGroupRowLeft + IntColumnWidth, intForRowTop);
  563. Point p11_2 = new Point(intMinGroupRowLeft + IntColumnWidth, intForRowTop + recMin.Height);
  564. g.DrawLine(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, p11_1, p11_2);
  565. intMinGroupRowLeft += IntColumnWidth;
  566. break;
  567. }
  568. }
  569. #endregion
  570. DataRow[] dtRowTeamPerson = dtTeamPerson.Select("大队编号 = '" + this.cmbtreevMaxTeamName.StrGetName.ToString().Trim() + "' And 小组编号 = '" + dtMinGroupBy[j]["小组编号"].ToString().Trim() + "'", "完成任务 DESC");
  571. for (int k = 0; k < dtRowTeamPerson.Length; k++)
  572. {
  573. #region 绘制组员
  574. intForRowTop += RowHeight;
  575. Rectangle recGroup = new Rectangle(rec1.X, intForRowTop, TableWidth, RowHeight);
  576. g.DrawRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, recGroup);
  577. int intGroupRowLeft = recGroup.X;
  578. for (int l = 0; l < dtTeamPerson.Columns.Count; l++)
  579. {
  580. switch (dtTeamPerson.Columns[l].ColumnName.Trim())
  581. {
  582. case "大队编号":
  583. case "小组编号":
  584. case "大队名称":
  585. break;
  586. default:
  587. int IntColumnWidth = Convert.ToInt32(htColumnWidth[dtTeamPerson.Columns[l].ColumnName.Trim()].ToString().Trim());
  588. if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("保底完成情况") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("目标完成情况") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("冲刺完成情况") != -1)
  589. {
  590. Rectangle recA = new Rectangle(intGroupRowLeft + TopAdd, recGroup.Y + (RowHeight - 20) / 2, 150, 20);
  591. g.DrawRectangle(new Pen(Brushes.LightSkyBlue, 1), recA);
  592. decimal decValue = Convert.ToDecimal(dtRowTeamPerson[k][dtTeamPerson.Columns[l].ColumnName.Trim()]);
  593. int recBWidth = Convert.ToInt32(recA.Width * decValue / 100);
  594. if (recBWidth > (recA.Width - 1))
  595. { recBWidth = recA.Width - 1; }
  596. Rectangle recB = new Rectangle(recA.X + 1, recA.Y + 1, recBWidth, recA.Height - 1);
  597. g.FillRectangle(Brushes.LightSlateGray, recB);
  598. string StrValue = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(decValue) + "%";
  599. SizeF sizef = g.MeasureString(StrValue, ft11b);
  600. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  601. Rectangle recC = new Rectangle(recA.X + recA.Width + TopAdd, intForRowTop + TopAdd, FtWidth, RowHeight);
  602. g.DrawString(StrValue, ft11b, b, recC);
  603. }
  604. else
  605. {
  606. string StrStringValue = dtRowTeamPerson[k][dtTeamPerson.Columns[l].ColumnName.Trim()].ToString().Trim();
  607. int WidthLeft = intGroupRowLeft;
  608. if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("任务") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("业绩") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("均价") != -1)
  609. {
  610. StrStringValue = Convert.ToDecimal(StrStringValue).ToString("0.00");
  611. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  612. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  613. WidthLeft = intGroupRowLeft + IntColumnWidth - FtWidth - TopAdd;
  614. }
  615. else if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("单数") != -1)
  616. {
  617. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  618. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  619. WidthLeft = intGroupRowLeft + IntColumnWidth / 2 - FtWidth / 2;
  620. }
  621. else
  622. { WidthLeft = intGroupRowLeft + TopAdd; }
  623. if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("大队名称") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("小组名称") != -1)
  624. { StrStringValue = ""; }
  625. Rectangle rec1_1 = new Rectangle(WidthLeft, intForRowTop + TopAdd, IntColumnWidth, RowHeight);
  626. g.DrawString(StrStringValue, ft11b, b, rec1_1);
  627. }
  628. Point p11_1 = new Point(intGroupRowLeft + IntColumnWidth, intForRowTop);
  629. Point p11_2 = new Point(intGroupRowLeft + IntColumnWidth, intForRowTop + recGroup.Height);
  630. g.DrawLine(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, p11_1, p11_2);
  631. intGroupRowLeft += IntColumnWidth;
  632. break;
  633. }
  634. }
  635. #endregion
  636. }
  637. }
  638. #endregion
  639. }
  640. else if (!string.IsNullOrEmpty(this.cmbtreevMaxTeamName.Text.Trim()) && !string.IsNullOrEmpty(this.cmbtreevMinTeamName.Text.Trim()))
  641. {
  642. #region 选择活动名称和大队名称、小组名称
  643. DataRow[] dtRowTeamPerson = dtTeamPerson.Select("大队编号 = '" + this.cmbtreevMaxTeamName.StrGetName.ToString().Trim() + "' And 小组编号 = '" + this.cmbtreevMinTeamName.StrGetName.ToString().Trim() + "'", "完成任务 DESC");
  644. for (int k = 0; k < dtRowTeamPerson.Length; k++)
  645. {
  646. #region 绘制组员
  647. intForRowTop += RowHeight;
  648. Rectangle recGroup = new Rectangle(rec1.X, intForRowTop, TableWidth, RowHeight);
  649. g.DrawRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, recGroup);
  650. Rectangle rec2_1 = new Rectangle(recGroup.X + 1, recGroup.Y + 1, recGroup.Width - 1, recGroup.Height - 1);
  651. if ((k % 2) > 0)
  652. { g.FillRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.brSingle, rec2_1); }
  653. else
  654. { g.FillRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.brDouble, rec2_1); }
  655. int intGroupRowLeft = recGroup.X;
  656. for (int l = 0; l < dtTeamPerson.Columns.Count; l++)
  657. {
  658. switch (dtTeamPerson.Columns[l].ColumnName.Trim())
  659. {
  660. case "大队编号":
  661. case "小组编号":
  662. case "大队名称":
  663. case "小组名称":
  664. break;
  665. default:
  666. int IntColumnWidth = Convert.ToInt32(htColumnWidth[dtTeamPerson.Columns[l].ColumnName.Trim()].ToString().Trim());
  667. if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("保底完成情况") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("目标完成情况") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("冲刺完成情况") != -1)
  668. {
  669. Rectangle recA = new Rectangle(intGroupRowLeft + TopAdd, recGroup.Y + (RowHeight - 20) / 2, 150, 20);
  670. g.DrawRectangle(new Pen(Brushes.LightSkyBlue, 1), recA);
  671. decimal decValue = Convert.ToDecimal(dtRowTeamPerson[k][dtTeamPerson.Columns[l].ColumnName.Trim()]);
  672. int recBWidth = Convert.ToInt32(recA.Width * decValue / 100);
  673. if (recBWidth > (recA.Width - 1))
  674. { recBWidth = recA.Width - 1; }
  675. Rectangle recB = new Rectangle(recA.X + 1, recA.Y + 1, recBWidth, recA.Height - 1);
  676. g.FillRectangle(Brushes.LightSlateGray, recB);
  677. string StrValue = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(decValue) + "%";
  678. SizeF sizef = g.MeasureString(StrValue, ft11b);
  679. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  680. Rectangle recC = new Rectangle(recA.X + recA.Width + TopAdd, intForRowTop + TopAdd, FtWidth, RowHeight);
  681. g.DrawString(StrValue, ft11b, b, recC);
  682. }
  683. else
  684. {
  685. string StrStringValue = dtRowTeamPerson[k][dtTeamPerson.Columns[l].ColumnName.Trim()].ToString().Trim();
  686. int WidthLeft = intGroupRowLeft;
  687. if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("任务") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("业绩") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("均价") != -1)
  688. {
  689. StrStringValue = Convert.ToDecimal(StrStringValue).ToString("0.00");
  690. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  691. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  692. WidthLeft = intGroupRowLeft + IntColumnWidth - FtWidth - TopAdd;
  693. }
  694. else if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("单数") != -1)
  695. {
  696. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  697. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  698. WidthLeft = intGroupRowLeft + IntColumnWidth / 2 - FtWidth / 2;
  699. }
  700. else
  701. { WidthLeft = intGroupRowLeft + TopAdd; }
  702. if (dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("大队名称") != -1 || dtTeamPerson.Columns[l].ColumnName.Trim().IndexOf("小组名称") != -1)
  703. { StrStringValue = ""; }
  704. Rectangle rec1_1 = new Rectangle(WidthLeft, intForRowTop + TopAdd, IntColumnWidth, RowHeight);
  705. g.DrawString(StrStringValue, ft11b, b, rec1_1);
  706. }
  707. Point p11_1 = new Point(intGroupRowLeft + IntColumnWidth, intForRowTop);
  708. Point p11_2 = new Point(intGroupRowLeft + IntColumnWidth, intForRowTop + recGroup.Height);
  709. g.DrawLine(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, p11_1, p11_2);
  710. intGroupRowLeft += IntColumnWidth;
  711. break;
  712. }
  713. }
  714. #endregion
  715. }
  716. #endregion
  717. }
  718. }
  719. else
  720. {
  721. #region 按个人业绩排序
  722. DataRow[] dtRows = dtTeamPerson.Select("", "完成任务 DESC,小组名称 ASC,员工姓名 ASC");
  723. for (int i = 0; i < dtRows.Length; i++)
  724. {
  725. intForRowTop += RowHeight;
  726. Rectangle rec2 = new Rectangle(rec1.X, intForRowTop, TableWidth, RowHeight);
  727. g.DrawRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, rec2);
  728. Rectangle rec2_1 = new Rectangle(rec1.X + 1, rec2.Y + 1, rec2.Width - 1, rec2.Height - 1);
  729. if ((i % 2) > 0)
  730. { g.FillRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.brSingle, rec2_1); }
  731. else
  732. { g.FillRectangle(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.brDouble, rec2_1); }
  733. int intForRowLeft = rec2.X;
  734. for (int j = 0; j < dtTeamPerson.Columns.Count; j++)
  735. {
  736. switch (dtTeamPerson.Columns[j].ColumnName.Trim())
  737. {
  738. case "大队编号":
  739. case "小组编号":
  740. break;
  741. default:
  742. int IntColumnWidth = Convert.ToInt32(htColumnWidth[dtTeamPerson.Columns[j].ColumnName.Trim()].ToString().Trim());
  743. if (dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("保底完成情况") != -1 || dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("目标完成情况") != -1 || dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("冲刺完成情况") != -1)
  744. {
  745. Rectangle recA = new Rectangle(intForRowLeft + TopAdd, rec2.Y + (RowHeight - 20) / 2, 150, 20);
  746. g.DrawRectangle(new Pen(Brushes.LightSkyBlue, 1), recA);
  747. decimal decValue = Convert.ToDecimal(dtRows[i][dtTeamPerson.Columns[j].ColumnName.Trim()]);
  748. int recBWidth = Convert.ToInt32(recA.Width * decValue / 100);
  749. if (recBWidth > (recA.Width - 1))
  750. { recBWidth = recA.Width - 1; }
  751. Rectangle recB = new Rectangle(recA.X + 1, recA.Y + 1, recBWidth, recA.Height - 1);
  752. g.FillRectangle(Brushes.LightSlateGray, recB);
  753. string StrValue = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(decValue) + "%";
  754. SizeF sizef = g.MeasureString(StrValue, ft11b);
  755. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  756. Rectangle recC = new Rectangle(recA.X + recA.Width + TopAdd, intForRowTop + TopAdd, FtWidth, RowHeight);
  757. g.DrawString(StrValue, ft11b, b, recC);
  758. }
  759. else
  760. {
  761. string StrStringValue = dtRows[i][dtTeamPerson.Columns[j].ColumnName.Trim()].ToString().Trim();
  762. int WidthLeft = intForRowLeft;
  763. if (dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("任务") != -1 || dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("业绩") != -1 || dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("均价") != -1)
  764. {
  765. StrStringValue = Convert.ToDecimal(StrStringValue).ToString("0.00");
  766. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  767. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  768. WidthLeft = intForRowLeft + IntColumnWidth - FtWidth - TopAdd;
  769. }
  770. else if (dtTeamPerson.Columns[j].ColumnName.Trim().IndexOf("单数") != -1)
  771. {
  772. SizeF sizef = g.MeasureString(StrStringValue, ft11b);
  773. int FtWidth = Convert.ToInt32(sizef.Width) + 1;
  774. WidthLeft = intForRowLeft + IntColumnWidth / 2 - FtWidth / 2;
  775. }
  776. else
  777. { WidthLeft = intForRowLeft + TopAdd; }
  778. Rectangle rec1_1 = new Rectangle(WidthLeft, intForRowTop + TopAdd, IntColumnWidth, RowHeight);
  779. g.DrawString(StrStringValue, ft11b, b, rec1_1);
  780. }
  781. Point p11_1 = new Point(intForRowLeft + IntColumnWidth, intForRowTop);
  782. Point p11_2 = new Point(intForRowLeft + IntColumnWidth, intForRowTop + rec2.Height);
  783. g.DrawLine(LYFZ.Software.MainBusiness.DoorCityProcess.PublicGraphics.PenborderColor, p11_1, p11_2);
  784. intForRowLeft += IntColumnWidth;
  785. break;
  786. }
  787. }
  788. }
  789. #endregion
  790. }
  791. this.pictImage.Dock = DockStyle.None;
  792. this.pictImage.Image = newBmp;
  793. this.pictImage.Height = newBmp.Height;
  794. this.pictImage.Width = newBmp.Width;
  795. }
  796. }
  797. }
  798. /// <summary>
  799. /// 获取列宽
  800. /// </summary>
  801. Hashtable GetColumnWidth()
  802. {
  803. Hashtable htColumnWidth = new Hashtable();
  804. htColumnWidth["大队名称"] = 130;
  805. htColumnWidth["小组名称"] = 130;
  806. htColumnWidth["员工姓名"] = 100;
  807. htColumnWidth["完成任务"] = 100;
  808. htColumnWidth["保底任务"] = 100;
  809. htColumnWidth["保底完成情况"] = 230;
  810. htColumnWidth["目标任务"] = 100;
  811. htColumnWidth["目标完成情况"] = 230;
  812. htColumnWidth["冲刺任务"] = 100;
  813. htColumnWidth["冲刺完成情况"] = 230;
  814. htColumnWidth["婚纱单数"] = 100;
  815. htColumnWidth["婚纱业绩"] = 100;
  816. htColumnWidth["婚纱均价"] = 100;
  817. htColumnWidth["儿童单数"] = 100;
  818. htColumnWidth["儿童业绩"] = 100;
  819. htColumnWidth["儿童均价"] = 100;
  820. htColumnWidth["写真单数"] = 100;
  821. htColumnWidth["写真业绩"] = 100;
  822. htColumnWidth["写真均价"] = 100;
  823. htColumnWidth["服务单数"] = 100;
  824. htColumnWidth["服务业绩"] = 100;
  825. htColumnWidth["服务均价"] = 100;
  826. htColumnWidth["婚庆单数"] = 100;
  827. htColumnWidth["婚庆业绩"] = 100;
  828. htColumnWidth["婚庆均价"] = 100;
  829. return htColumnWidth;
  830. }
  831. /// <summary>
  832. /// 组织收款接单人数据
  833. /// </summary>
  834. /// <param name="dt"></param>
  835. DataTable OpenOrderPersonDataTable(DateTime StrTimeStart, DateTime StrTimeEnd)
  836. {
  837. DataTable NewTable = new DataTable();
  838. NewTable.Columns.Add("OrdNumber", typeof(string));
  839. NewTable.Columns.Add("OpenSingle", typeof(string));
  840. NewTable.Columns.Add("OrdType", typeof(string));
  841. NewTable.Columns.Add("PaymentAmount", typeof(decimal));
  842. NewTable.Columns.Add("SeriesPrice", typeof(decimal));
  843. NewTable.Columns.Add("MinVice", typeof(string));
  844. string StrTableName = "tb_ErpPayment Left Join tb_ErpOrder on Ord_Number = Pay_OrdNumber";
  845. string StrWhere = "Pay_Type = '0' And Pay_Category in ('预约收款', '预约补款', '全款') And (Pay_CreateDatetime between '" + StrTimeStart.ToString("yyyy-MM-dd HH:mm:ss") + "' And '" + StrTimeEnd.ToString("yyyy-MM-dd HH:mm:ss") + "')";
  846. string StrColumnName = "Pay_OrdNumber,Sum(Pay_AmountOf) AS Pay_AmountOf,Pay_OpenSingle,Ord_Type,Max(Ord_SeriesPrice) AS Ord_SeriesPrice";
  847. DataTable dt = orbll.GetView_Custom(StrTableName, StrWhere: StrWhere, ShowColumnName: StrColumnName, GroupBy: "Pay_OrdNumber,Pay_OpenSingle,Ord_Type").Tables[0];
  848. if (dt.Rows.Count > 0)
  849. {
  850. for (int i = 0; i < dt.Rows.Count; i++)
  851. {
  852. string[] StrArray = dt.Rows[i]["Pay_OpenSingle"].ToString().Trim().Split(',');
  853. for (int j = 0; j < StrArray.Length; j++)
  854. {
  855. if (!string.IsNullOrEmpty(StrArray[j].Trim()))
  856. {
  857. DataRow newRow = NewTable.NewRow();
  858. newRow["OrdNumber"] = dt.Rows[i]["Pay_OrdNumber"].ToString().Trim();
  859. newRow["OpenSingle"] = StrArray[j].Trim();
  860. newRow["OrdType"] = dt.Rows[i]["Ord_Type"].ToString().Trim();
  861. decimal decAmount = Convert.ToDecimal(dt.Rows[i]["Pay_AmountOf"]) / (MinStoreProportion + ViceStoreProportion * (dt.Rows[i]["Pay_OpenSingle"].ToString().Trim().Length - dt.Rows[i]["Pay_OpenSingle"].ToString().Trim().Replace(",", "").Trim().Length));
  862. if (j == 0)
  863. {
  864. newRow["PaymentAmount"] = decAmount * MinStoreProportion;
  865. newRow["SeriesPrice"] = Convert.ToDecimal(dt.Rows[i]["Ord_SeriesPrice"]);
  866. newRow["MinVice"] = "Min";
  867. }
  868. else
  869. {
  870. newRow["PaymentAmount"] = decAmount * ViceStoreProportion;
  871. newRow["SeriesPrice"] = 0;
  872. newRow["MinVice"] = "Vice";
  873. }
  874. NewTable.Rows.Add(newRow);
  875. }
  876. }
  877. }
  878. }
  879. return NewTable;
  880. }
  881. /// <summary>
  882. /// 合并计算实收金额
  883. /// </summary>
  884. /// <param name="dt"></param>
  885. /// <returns></returns>
  886. DataTable OpenOrderPersonGroupDataTable(DataTable dt)
  887. {
  888. Hashtable htData = new Hashtable();
  889. for (int i = 0; i < dt.Rows.Count; i++)
  890. {
  891. string StrKeys = dt.Rows[i]["OpenSingle"].ToString().Trim();
  892. DataRow[] dtRow = dt.Select("OpenSingle = '" + StrKeys.Trim() + "' And OrdType = '0' And MinVice = 'Min'");
  893. DataRow[] dtRow1 = dt.Select("OpenSingle = '" + StrKeys.Trim() + "' And OrdType = '1' And MinVice = 'Min'");
  894. DataRow[] dtRow2 = dt.Select("OpenSingle = '" + StrKeys.Trim() + "' And OrdType = '2' And MinVice = 'Min'");
  895. DataRow[] dtRow3 = dt.Select("OpenSingle = '" + StrKeys.Trim() + "' And OrdType = '3' And MinVice = 'Min'");
  896. DataRow[] dtRow4 = dt.Select("OpenSingle = '" + StrKeys.Trim() + "' And OrdType = '4' And MinVice = 'Min'");
  897. decimal SeriesPrice = 0;
  898. decimal SeriesPrice1 = 0;
  899. decimal SeriesPrice2 = 0;
  900. decimal SeriesPrice3 = 0;
  901. decimal SeriesPrice4 = 0;
  902. for (int j = 0; j < dtRow.Length; j++)
  903. { SeriesPrice += Convert.ToDecimal(dtRow[j]["SeriesPrice"]); }
  904. for (int j = 0; j < dtRow1.Length; j++)
  905. { SeriesPrice1 += Convert.ToDecimal(dtRow1[j]["SeriesPrice"]); }
  906. for (int j = 0; j < dtRow2.Length; j++)
  907. { SeriesPrice2 += Convert.ToDecimal(dtRow2[j]["SeriesPrice"]); }
  908. for (int j = 0; j < dtRow3.Length; j++)
  909. { SeriesPrice3 += Convert.ToDecimal(dtRow3[j]["SeriesPrice"]); }
  910. for (int j = 0; j < dtRow4.Length; j++)
  911. { SeriesPrice4 += Convert.ToDecimal(dtRow4[j]["SeriesPrice"]); }
  912. string StrOrdering = "0:" + dtRow.Length + ":" + SeriesPrice;
  913. StrOrdering += "/1:" + dtRow1.Length + ":" + SeriesPrice1;
  914. StrOrdering += "/2:" + dtRow2.Length + ":" + SeriesPrice2;
  915. StrOrdering += "/3:" + dtRow3.Length + ":" + SeriesPrice3;
  916. StrOrdering += "/4:" + dtRow4.Length + ":" + SeriesPrice4;
  917. if (htData.ContainsKey(StrKeys))
  918. {
  919. string[] StrValue = htData[StrKeys].ToString().Trim().Split('|');
  920. decimal decPaymentAmount = Convert.ToDecimal(dt.Rows[i]["PaymentAmount"]) + Convert.ToDecimal(StrValue[0].Trim());
  921. //decimal decSeriesPrice = Convert.ToDecimal(dt.Rows[i]["SeriesPrice"]) + Convert.ToDecimal(StrValue[1].Trim());
  922. htData[StrKeys] = decPaymentAmount.ToString().Trim() + "|" + StrOrdering;
  923. //htData[StrKeys] = decPaymentAmount.ToString().Trim() + "|" + decSeriesPrice.ToString().Trim() + "|" + dtRow.Length.ToString().Trim();
  924. }
  925. else
  926. { htData[StrKeys] = dt.Rows[i]["PaymentAmount"].ToString().Trim() + "|" + StrOrdering; }
  927. }
  928. DataTable NewTable = new DataTable();
  929. NewTable.Columns.Add("OpenSingle", typeof(string));
  930. NewTable.Columns.Add("PaymentAmount", typeof(decimal));
  931. NewTable.Columns.Add("SeriesPrice", typeof(decimal));
  932. NewTable.Columns.Add("Quantity", typeof(int));
  933. NewTable.Columns.Add("AveragePrice", typeof(string));
  934. NewTable.Columns.Add("SeriesPrice1", typeof(decimal));
  935. NewTable.Columns.Add("Quantity1", typeof(int));
  936. NewTable.Columns.Add("AveragePrice1", typeof(string));
  937. NewTable.Columns.Add("SeriesPrice2", typeof(decimal));
  938. NewTable.Columns.Add("Quantity2", typeof(int));
  939. NewTable.Columns.Add("AveragePrice2", typeof(string));
  940. NewTable.Columns.Add("SeriesPrice3", typeof(decimal));
  941. NewTable.Columns.Add("Quantity3", typeof(int));
  942. NewTable.Columns.Add("AveragePrice3", typeof(string));
  943. NewTable.Columns.Add("SeriesPrice4", typeof(decimal));
  944. NewTable.Columns.Add("Quantity4", typeof(int));
  945. NewTable.Columns.Add("AveragePrice4", typeof(string));
  946. switch (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetBusinessType())
  947. {
  948. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.婚纱版:
  949. NewTable.Columns.Remove("SeriesPrice1");
  950. NewTable.Columns.Remove("Quantity1");
  951. NewTable.Columns.Remove("AveragePrice1");
  952. break;
  953. case LYFZ.Software.MainBusiness.EnumPermissions.BusinessType.儿童版:
  954. NewTable.Columns.Remove("SeriesPrice");
  955. NewTable.Columns.Remove("Quantity");
  956. NewTable.Columns.Remove("AveragePrice");
  957. break;
  958. default:
  959. break;
  960. }
  961. if (!LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.IsEnablePhotoEdition)
  962. {
  963. NewTable.Columns.Remove("SeriesPrice2");
  964. NewTable.Columns.Remove("Quantity2");
  965. NewTable.Columns.Remove("AveragePrice2");
  966. }
  967. foreach (DictionaryEntry item in htData)
  968. {
  969. string StrKey = item.Key.ToString().Trim();
  970. string[] StrArrayValue = item.Value.ToString().Trim().Split('|');
  971. DataRow newRow = NewTable.NewRow();
  972. newRow["OpenSingle"] = StrKey.Trim();
  973. newRow["PaymentAmount"] = Convert.ToDecimal(StrArrayValue[0].Trim());
  974. string[] StrArrayType = StrArrayValue[1].Trim().Split('/');
  975. for (int i = 0; i < StrArrayType.Length; i++)
  976. {
  977. string[] StrArray = StrArrayType[i].Trim().Split(':');
  978. switch (StrArray[0].Trim())
  979. {
  980. case "0":
  981. if (NewTable.Columns.Contains("SeriesPrice"))
  982. {
  983. newRow["Quantity"] = StrArray[1].Trim();
  984. newRow["SeriesPrice"] = StrArray[2].Trim();
  985. newRow["AveragePrice"] = 0;
  986. if (Convert.ToDecimal(StrArray[1]) > 0)
  987. { newRow["AveragePrice"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((Convert.ToDecimal(StrArray[2]) / Convert.ToDecimal(StrArray[1])).ToString("0.00")); }
  988. }
  989. break;
  990. case "1":
  991. if (NewTable.Columns.Contains("SeriesPrice1"))
  992. {
  993. newRow["Quantity1"] = StrArray[1].Trim();
  994. newRow["SeriesPrice1"] = StrArray[2].Trim();
  995. newRow["AveragePrice1"] = 0;
  996. if (Convert.ToDecimal(StrArray[1]) > 0)
  997. { newRow["AveragePrice1"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((Convert.ToDecimal(StrArray[2]) / Convert.ToDecimal(StrArray[1])).ToString("0.00")); }
  998. }
  999. break;
  1000. case "2":
  1001. if (NewTable.Columns.Contains("SeriesPrice2"))
  1002. {
  1003. newRow["Quantity2"] = StrArray[1].Trim();
  1004. newRow["SeriesPrice2"] = StrArray[2].Trim();
  1005. newRow["AveragePrice2"] = 0;
  1006. if (Convert.ToDecimal(StrArray[1]) > 0)
  1007. { newRow["AveragePrice2"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((Convert.ToDecimal(StrArray[2]) / Convert.ToDecimal(StrArray[1])).ToString("0.00")); }
  1008. }
  1009. break;
  1010. case "3":
  1011. if (NewTable.Columns.Contains("SeriesPrice3"))
  1012. {
  1013. newRow["Quantity3"] = StrArray[1].Trim();
  1014. newRow["SeriesPrice3"] = StrArray[2].Trim();
  1015. newRow["AveragePrice3"] = 0;
  1016. if (Convert.ToDecimal(StrArray[1]) > 0)
  1017. { newRow["AveragePrice3"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((Convert.ToDecimal(StrArray[2]) / Convert.ToDecimal(StrArray[1])).ToString("0.00")); }
  1018. }
  1019. break;
  1020. case "4":
  1021. if (NewTable.Columns.Contains("SeriesPrice4"))
  1022. {
  1023. newRow["Quantity4"] = StrArray[1].Trim();
  1024. newRow["SeriesPrice4"] = StrArray[2].Trim();
  1025. newRow["AveragePrice4"] = 0;
  1026. if (Convert.ToDecimal(StrArray[1]) > 0)
  1027. { newRow["AveragePrice4"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((Convert.ToDecimal(StrArray[2]) / Convert.ToDecimal(StrArray[1])).ToString("0.00")); }
  1028. }
  1029. break;
  1030. }
  1031. }
  1032. NewTable.Rows.Add(newRow);
  1033. }
  1034. return NewTable;
  1035. }
  1036. /// <summary>
  1037. /// 获取参与活动的所有小组人员的数据
  1038. /// </summary>
  1039. /// <returns></returns>
  1040. DataTable TeamPersonRankedDataTable(DataTable dtTeamPerson, DataTable dtOpenSingle)
  1041. {
  1042. DataTable NewTable = new DataTable();
  1043. NewTable.Columns.Add("大队编号", typeof(string));
  1044. NewTable.Columns.Add("小组编号", typeof(string));
  1045. NewTable.Columns.Add("大队名称", typeof(string));
  1046. NewTable.Columns.Add("小组名称", typeof(string));
  1047. NewTable.Columns.Add("员工姓名", typeof(string));
  1048. NewTable.Columns.Add("完成任务", typeof(decimal));
  1049. NewTable.Columns.Add("保底任务", typeof(string));
  1050. NewTable.Columns.Add("保底完成情况", typeof(string));
  1051. NewTable.Columns.Add("目标任务", typeof(string));
  1052. NewTable.Columns.Add("目标完成情况", typeof(string));
  1053. NewTable.Columns.Add("冲刺任务", typeof(string));
  1054. NewTable.Columns.Add("冲刺完成情况", typeof(string));
  1055. if (dtOpenSingle.Columns.Contains("SeriesPrice"))
  1056. {
  1057. NewTable.Columns.Add("婚纱单数", typeof(string));
  1058. NewTable.Columns.Add("婚纱业绩", typeof(string));
  1059. NewTable.Columns.Add("婚纱均价", typeof(string));
  1060. }
  1061. if (dtOpenSingle.Columns.Contains("SeriesPrice1"))
  1062. {
  1063. NewTable.Columns.Add("儿童单数", typeof(string));
  1064. NewTable.Columns.Add("儿童业绩", typeof(string));
  1065. NewTable.Columns.Add("儿童均价", typeof(string));
  1066. }
  1067. if (dtOpenSingle.Columns.Contains("SeriesPrice2"))
  1068. {
  1069. NewTable.Columns.Add("写真单数", typeof(string));
  1070. NewTable.Columns.Add("写真业绩", typeof(string));
  1071. NewTable.Columns.Add("写真均价", typeof(string));
  1072. }
  1073. if (dtOpenSingle.Columns.Contains("SeriesPrice3"))
  1074. {
  1075. NewTable.Columns.Add("服务单数", typeof(string));
  1076. NewTable.Columns.Add("服务业绩", typeof(string));
  1077. NewTable.Columns.Add("服务均价", typeof(string));
  1078. }
  1079. if (dtOpenSingle.Columns.Contains("SeriesPrice4"))
  1080. {
  1081. NewTable.Columns.Add("婚庆单数", typeof(string));
  1082. NewTable.Columns.Add("婚庆业绩", typeof(string));
  1083. NewTable.Columns.Add("婚庆均价", typeof(string));
  1084. }
  1085. for (int i = 0; i < dtTeamPerson.Rows.Count; i++)
  1086. {
  1087. DataRow[] dtRow = dtOpenSingle.Select("OpenSingle = '" + dtTeamPerson.Rows[i]["Tps_UserNumber"].ToString().Trim() + "'");
  1088. decimal decCompletedTask = 0;
  1089. if (dtRow.Length > 0)
  1090. { decCompletedTask = Convert.ToDecimal(dtRow[0]["PaymentAmount"]); }
  1091. DataRow newRow = NewTable.NewRow();
  1092. newRow["大队编号"] = dtTeamPerson.Rows[i]["Tps_TmxtNumber"].ToString().Trim();
  1093. newRow["小组编号"] = dtTeamPerson.Rows[i]["Tps_TmitNumber"].ToString().Trim();
  1094. newRow["大队名称"] = dtTeamPerson.Rows[i]["Tmxn_Name"].ToString().Trim();
  1095. newRow["小组名称"] = dtTeamPerson.Rows[i]["Tmin_Name"].ToString().Trim();
  1096. newRow["员工姓名"] = dtTeamPerson.Rows[i]["User_Name"].ToString().Trim();
  1097. newRow["完成任务"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(decCompletedTask);
  1098. newRow["保底任务"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtTeamPerson.Rows[i]["Tps_BaodiTask"]);
  1099. newRow["保底完成情况"] = 0;
  1100. if (Convert.ToDecimal(dtTeamPerson.Rows[i]["Tps_BaodiTask"]) > 0)
  1101. { newRow["保底完成情况"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompletedTask / Convert.ToDecimal(dtTeamPerson.Rows[i]["Tps_BaodiTask"]) * 100).ToString("0.00")); }
  1102. newRow["目标任务"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtTeamPerson.Rows[i]["Tps_TargetTask"]);
  1103. newRow["目标完成情况"] = 0;
  1104. if (Convert.ToDecimal(dtTeamPerson.Rows[i]["Tps_TargetTask"]) > 0)
  1105. { newRow["目标完成情况"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompletedTask / Convert.ToDecimal(dtTeamPerson.Rows[i]["Tps_TargetTask"]) * 100).ToString("0.00")); }
  1106. newRow["冲刺任务"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtTeamPerson.Rows[i]["Tps_SprintTask"]);
  1107. newRow["冲刺完成情况"] = 0;
  1108. if (Convert.ToDecimal(dtTeamPerson.Rows[i]["Tps_SprintTask"]) > 0)
  1109. { newRow["冲刺完成情况"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompletedTask / Convert.ToDecimal(dtTeamPerson.Rows[i]["Tps_SprintTask"]) * 100).ToString("0.00")); }
  1110. if (NewTable.Columns.Contains("婚纱单数"))
  1111. {
  1112. newRow["婚纱单数"] = "0";
  1113. newRow["婚纱业绩"] = "0";
  1114. newRow["婚纱均价"] = "0";
  1115. if (dtOpenSingle.Columns.Contains("SeriesPrice") && dtRow.Length > 0)
  1116. {
  1117. newRow["婚纱单数"] = dtRow[0]["Quantity"].ToString().Trim();
  1118. newRow["婚纱业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtRow[0]["SeriesPrice"]);
  1119. newRow["婚纱均价"] = dtRow[0]["AveragePrice"].ToString().Trim();
  1120. }
  1121. }
  1122. if (NewTable.Columns.Contains("儿童单数"))
  1123. {
  1124. newRow["儿童单数"] = "0";
  1125. newRow["儿童业绩"] = "0";
  1126. newRow["儿童均价"] = "0";
  1127. if (dtOpenSingle.Columns.Contains("SeriesPrice1") && dtRow.Length > 0)
  1128. {
  1129. newRow["儿童单数"] = dtRow[0]["Quantity1"].ToString().Trim();
  1130. newRow["儿童业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtRow[0]["SeriesPrice1"]);
  1131. newRow["儿童均价"] = dtRow[0]["AveragePrice1"].ToString().Trim();
  1132. }
  1133. }
  1134. if (NewTable.Columns.Contains("写真单数"))
  1135. {
  1136. newRow["写真单数"] = "0";
  1137. newRow["写真业绩"] = "0";
  1138. newRow["写真均价"] = "0";
  1139. if (dtOpenSingle.Columns.Contains("SeriesPrice2") && dtRow.Length > 0)
  1140. {
  1141. newRow["写真单数"] = dtRow[0]["Quantity2"].ToString().Trim();
  1142. newRow["写真业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtRow[0]["SeriesPrice2"]);
  1143. newRow["写真均价"] = dtRow[0]["AveragePrice2"].ToString().Trim();
  1144. }
  1145. }
  1146. if (NewTable.Columns.Contains("服务单数"))
  1147. {
  1148. newRow["服务单数"] = "0";
  1149. newRow["服务业绩"] = "0";
  1150. newRow["服务均价"] = "0";
  1151. if (dtOpenSingle.Columns.Contains("SeriesPrice3") && dtRow.Length > 0)
  1152. {
  1153. newRow["服务单数"] = dtRow[0]["Quantity3"].ToString().Trim();
  1154. newRow["服务业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtRow[0]["SeriesPrice3"]);
  1155. newRow["服务均价"] = dtRow[0]["AveragePrice3"].ToString().Trim();
  1156. }
  1157. }
  1158. if (NewTable.Columns.Contains("婚庆单数"))
  1159. {
  1160. newRow["婚庆单数"] = "0";
  1161. newRow["婚庆业绩"] = "0";
  1162. newRow["婚庆均价"] = "0";
  1163. if (dtOpenSingle.Columns.Contains("SeriesPrice4") && dtRow.Length > 0)
  1164. {
  1165. newRow["婚庆单数"] = dtRow[0]["Quantity4"].ToString().Trim();
  1166. newRow["婚庆业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtRow[0]["SeriesPrice4"]);
  1167. newRow["婚庆均价"] = dtRow[0]["AveragePrice4"].ToString().Trim();
  1168. }
  1169. }
  1170. NewTable.Rows.Add(newRow);
  1171. }
  1172. return NewTable;
  1173. }
  1174. /// <summary>
  1175. /// 获取大队的完成任务数据
  1176. /// </summary>
  1177. /// <param name="dtTeamMax"></param>
  1178. /// <param name="dtTeamPerson"></param>
  1179. /// <returns></returns>
  1180. DataTable GetTeamMaxGroupBy(DataTable dtTeamMax, DataTable dtTeamPerson)
  1181. {
  1182. DataTable NewTable = new DataTable();
  1183. NewTable.Columns.Add("活动编号", typeof(string));
  1184. NewTable.Columns.Add("大队编号", typeof(string));
  1185. NewTable.Columns.Add("大队名称", typeof(string));
  1186. NewTable.Columns.Add("小组名称", typeof(string));
  1187. NewTable.Columns.Add("员工姓名", typeof(string));
  1188. NewTable.Columns.Add("完成任务", typeof(decimal));
  1189. NewTable.Columns.Add("保底任务", typeof(string));
  1190. NewTable.Columns.Add("保底完成情况", typeof(string));
  1191. NewTable.Columns.Add("目标任务", typeof(string));
  1192. NewTable.Columns.Add("目标完成情况", typeof(string));
  1193. NewTable.Columns.Add("冲刺任务", typeof(string));
  1194. NewTable.Columns.Add("冲刺完成情况", typeof(string));
  1195. if (dtTeamPerson.Columns.Contains("婚纱单数"))
  1196. {
  1197. NewTable.Columns.Add("婚纱单数", typeof(string));
  1198. NewTable.Columns.Add("婚纱业绩", typeof(string));
  1199. NewTable.Columns.Add("婚纱均价", typeof(string));
  1200. }
  1201. if (dtTeamPerson.Columns.Contains("儿童单数"))
  1202. {
  1203. NewTable.Columns.Add("儿童单数", typeof(string));
  1204. NewTable.Columns.Add("儿童业绩", typeof(string));
  1205. NewTable.Columns.Add("儿童均价", typeof(string));
  1206. }
  1207. if (dtTeamPerson.Columns.Contains("写真单数"))
  1208. {
  1209. NewTable.Columns.Add("写真单数", typeof(string));
  1210. NewTable.Columns.Add("写真业绩", typeof(string));
  1211. NewTable.Columns.Add("写真均价", typeof(string));
  1212. }
  1213. if (dtTeamPerson.Columns.Contains("服务单数"))
  1214. {
  1215. NewTable.Columns.Add("服务单数", typeof(string));
  1216. NewTable.Columns.Add("服务业绩", typeof(string));
  1217. NewTable.Columns.Add("服务均价", typeof(string));
  1218. }
  1219. if (dtTeamPerson.Columns.Contains("婚庆单数"))
  1220. {
  1221. NewTable.Columns.Add("婚庆单数", typeof(string));
  1222. NewTable.Columns.Add("婚庆业绩", typeof(string));
  1223. NewTable.Columns.Add("婚庆均价", typeof(string));
  1224. }
  1225. for (int i = 0; i < dtTeamMax.Rows.Count; i++)
  1226. {
  1227. decimal decCompletedTask = 0;
  1228. int decCompleteWeddingQuantity = 0;
  1229. decimal decCompleteWeddingAmount = 0;
  1230. int CompleteChildrenQuantity = 0;
  1231. decimal CompleteChildrenAmount = 0;
  1232. int CompletePortraitQuantity = 0;
  1233. decimal CompletePortraitAmount = 0;
  1234. int CompleteServiceQuantity = 0;
  1235. decimal CompleteServiceAmount = 0;
  1236. int CompleteWeddingCelebrationQuantity = 0;
  1237. decimal CompleteWeddingCelebrationAmount = 0;
  1238. DataRow[] dtRowTeamPerson = dtTeamPerson.Select("大队编号 = '" + dtTeamMax.Rows[i]["Tmxt_Number"].ToString().Trim() + "'");
  1239. for (int j = 0; j < dtRowTeamPerson.Length; j++)
  1240. {
  1241. decCompletedTask += Convert.ToDecimal(dtRowTeamPerson[j]["完成任务"]);
  1242. if (NewTable.Columns.Contains("婚纱单数"))
  1243. {
  1244. decCompleteWeddingQuantity += Convert.ToInt32(dtRowTeamPerson[j]["婚纱单数"]);
  1245. decCompleteWeddingAmount += Convert.ToDecimal(dtRowTeamPerson[j]["婚纱业绩"]);
  1246. }
  1247. if (NewTable.Columns.Contains("儿童单数"))
  1248. {
  1249. CompleteChildrenQuantity += Convert.ToInt32(dtRowTeamPerson[j]["儿童单数"]);
  1250. CompleteChildrenAmount += Convert.ToDecimal(dtRowTeamPerson[j]["儿童业绩"]);
  1251. }
  1252. if (NewTable.Columns.Contains("写真单数"))
  1253. {
  1254. CompletePortraitQuantity += Convert.ToInt32(dtRowTeamPerson[j]["写真单数"]);
  1255. CompletePortraitAmount += Convert.ToDecimal(dtRowTeamPerson[j]["写真业绩"]);
  1256. }
  1257. if (NewTable.Columns.Contains("服务单数"))
  1258. {
  1259. CompleteServiceQuantity += Convert.ToInt32(dtRowTeamPerson[j]["服务单数"]);
  1260. CompleteServiceAmount += Convert.ToDecimal(dtRowTeamPerson[j]["服务业绩"]);
  1261. }
  1262. if (NewTable.Columns.Contains("婚庆单数"))
  1263. {
  1264. CompleteWeddingCelebrationQuantity += Convert.ToInt32(dtRowTeamPerson[j]["婚庆单数"]);
  1265. CompleteWeddingCelebrationAmount += Convert.ToDecimal(dtRowTeamPerson[j]["婚庆业绩"]);
  1266. }
  1267. }
  1268. DataRow newRow = NewTable.NewRow();
  1269. newRow["活动编号"] = dtTeamMax.Rows[i]["Tmxt_TasNumber"].ToString().Trim();
  1270. newRow["大队编号"] = dtTeamMax.Rows[i]["Tmxt_Number"].ToString().Trim();
  1271. newRow["大队名称"] = dtTeamMax.Rows[i]["Tmxn_Name"].ToString().Trim();
  1272. newRow["小组名称"] = "";
  1273. newRow["员工姓名"] = "";
  1274. newRow["完成任务"] = decCompletedTask;
  1275. newRow["保底任务"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtTeamMax.Rows[i]["Tmxt_BaodiTask"].ToString().Trim());
  1276. newRow["保底完成情况"] = 0;
  1277. if (Convert.ToDecimal(dtTeamMax.Rows[i]["Tmxt_BaodiTask"]) > 0)
  1278. { newRow["保底完成情况"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompletedTask / Convert.ToDecimal(dtTeamMax.Rows[i]["Tmxt_BaodiTask"]) * 100).ToString("0.00")); }
  1279. newRow["目标任务"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtTeamMax.Rows[i]["Tmxt_TargetTask"].ToString().Trim());
  1280. newRow["目标完成情况"] = 0;
  1281. if (Convert.ToDecimal(dtTeamMax.Rows[i]["Tmxt_TargetTask"]) > 0)
  1282. { newRow["目标完成情况"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompletedTask / Convert.ToDecimal(dtTeamMax.Rows[i]["Tmxt_TargetTask"]) * 100).ToString("0.00")); }
  1283. newRow["冲刺任务"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtTeamMax.Rows[i]["Tmxt_SprintTask"].ToString().Trim());
  1284. newRow["冲刺完成情况"] = 0;
  1285. if (Convert.ToDecimal(dtTeamMax.Rows[i]["Tmxt_SprintTask"]) > 0)
  1286. { newRow["冲刺完成情况"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompletedTask / Convert.ToDecimal(dtTeamMax.Rows[i]["Tmxt_SprintTask"]) * 100).ToString("0.00")); }
  1287. if (NewTable.Columns.Contains("婚纱单数"))
  1288. {
  1289. newRow["婚纱单数"] = decCompleteWeddingQuantity;
  1290. newRow["婚纱业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(decCompleteWeddingAmount);
  1291. newRow["婚纱均价"] = 0;
  1292. if (decCompleteWeddingQuantity > 0)
  1293. { newRow["婚纱均价"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompleteWeddingAmount / decCompleteWeddingQuantity).ToString("0.00")); }
  1294. }
  1295. if (NewTable.Columns.Contains("儿童单数"))
  1296. {
  1297. newRow["儿童单数"] = CompleteChildrenQuantity;
  1298. newRow["儿童业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(CompleteChildrenAmount);
  1299. newRow["儿童均价"] = 0;
  1300. if (CompleteChildrenQuantity > 0)
  1301. { newRow["儿童均价"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((CompleteChildrenAmount / CompleteChildrenQuantity).ToString("0.00")); }
  1302. }
  1303. if (NewTable.Columns.Contains("写真单数"))
  1304. {
  1305. newRow["写真单数"] = CompletePortraitQuantity;
  1306. newRow["写真业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(CompletePortraitAmount);
  1307. newRow["写真均价"] = 0;
  1308. if (CompletePortraitQuantity > 0)
  1309. { newRow["写真均价"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((CompletePortraitAmount / CompletePortraitQuantity).ToString("0.00")); }
  1310. }
  1311. if (NewTable.Columns.Contains("服务单数"))
  1312. {
  1313. newRow["服务单数"] = CompleteServiceQuantity;
  1314. newRow["服务业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(CompleteServiceAmount);
  1315. newRow["服务均价"] = 0;
  1316. if (CompleteServiceQuantity > 0)
  1317. { newRow["服务均价"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((CompleteServiceAmount / CompleteServiceQuantity).ToString("0.00")); }
  1318. }
  1319. if (NewTable.Columns.Contains("婚庆单数"))
  1320. {
  1321. newRow["婚庆单数"] = CompleteWeddingCelebrationQuantity;
  1322. newRow["婚庆业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(CompleteWeddingCelebrationAmount);
  1323. newRow["婚庆均价"] = 0;
  1324. if (CompleteWeddingCelebrationQuantity > 0)
  1325. { newRow["婚庆均价"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((CompleteWeddingCelebrationAmount / CompleteWeddingCelebrationQuantity).ToString("0.00")); }
  1326. }
  1327. NewTable.Rows.Add(newRow);
  1328. }
  1329. return NewTable;
  1330. }
  1331. /// <summary>
  1332. /// 获取小组队的完成任务数据
  1333. /// </summary>
  1334. /// <param name="dtTeamMin"></param>
  1335. /// <param name="dtTeamPerson"></param>
  1336. DataTable GetTeamMinGroupBy(DataTable dtTeamMin, DataTable dtTeamPerson)
  1337. {
  1338. DataTable NewTable = new DataTable();
  1339. NewTable.Columns.Add("大队编号", typeof(string));
  1340. NewTable.Columns.Add("小组编号", typeof(string));
  1341. NewTable.Columns.Add("大队名称", typeof(string));
  1342. NewTable.Columns.Add("小组名称", typeof(string));
  1343. NewTable.Columns.Add("员工姓名", typeof(string));
  1344. NewTable.Columns.Add("完成任务", typeof(decimal));
  1345. NewTable.Columns.Add("保底任务", typeof(string));
  1346. NewTable.Columns.Add("保底完成情况", typeof(string));
  1347. NewTable.Columns.Add("目标任务", typeof(string));
  1348. NewTable.Columns.Add("目标完成情况", typeof(string));
  1349. NewTable.Columns.Add("冲刺任务", typeof(string));
  1350. NewTable.Columns.Add("冲刺完成情况", typeof(string));
  1351. if (dtTeamPerson.Columns.Contains("婚纱单数"))
  1352. {
  1353. NewTable.Columns.Add("婚纱单数", typeof(string));
  1354. NewTable.Columns.Add("婚纱业绩", typeof(string));
  1355. NewTable.Columns.Add("婚纱均价", typeof(string));
  1356. }
  1357. if (dtTeamPerson.Columns.Contains("儿童单数"))
  1358. {
  1359. NewTable.Columns.Add("儿童单数", typeof(string));
  1360. NewTable.Columns.Add("儿童业绩", typeof(string));
  1361. NewTable.Columns.Add("儿童均价", typeof(string));
  1362. }
  1363. if (dtTeamPerson.Columns.Contains("写真单数"))
  1364. {
  1365. NewTable.Columns.Add("写真单数", typeof(string));
  1366. NewTable.Columns.Add("写真业绩", typeof(string));
  1367. NewTable.Columns.Add("写真均价", typeof(string));
  1368. }
  1369. if (dtTeamPerson.Columns.Contains("服务单数"))
  1370. {
  1371. NewTable.Columns.Add("服务单数", typeof(string));
  1372. NewTable.Columns.Add("服务业绩", typeof(string));
  1373. NewTable.Columns.Add("服务均价", typeof(string));
  1374. }
  1375. if (dtTeamPerson.Columns.Contains("婚庆单数"))
  1376. {
  1377. NewTable.Columns.Add("婚庆单数", typeof(string));
  1378. NewTable.Columns.Add("婚庆业绩", typeof(string));
  1379. NewTable.Columns.Add("婚庆均价", typeof(string));
  1380. }
  1381. for (int i = 0; i < dtTeamMin.Rows.Count; i++)
  1382. {
  1383. decimal decCompletedTask = 0;
  1384. int decCompleteWeddingQuantity = 0;
  1385. decimal decCompleteWeddingAmount = 0;
  1386. int CompleteChildrenQuantity = 0;
  1387. decimal CompleteChildrenAmount = 0;
  1388. int CompletePortraitQuantity = 0;
  1389. decimal CompletePortraitAmount = 0;
  1390. int CompleteServiceQuantity = 0;
  1391. decimal CompleteServiceAmount = 0;
  1392. int CompleteWeddingCelebrationQuantity = 0;
  1393. decimal CompleteWeddingCelebrationAmount = 0;
  1394. DataRow[] dtRowTeamPerson = dtTeamPerson.Select("小组编号 = '" + dtTeamMin.Rows[i]["Tmit_Number"].ToString().Trim() + "'");
  1395. for (int j = 0; j < dtRowTeamPerson.Length; j++)
  1396. {
  1397. decCompletedTask += Convert.ToDecimal(dtRowTeamPerson[j]["完成任务"]);
  1398. if (NewTable.Columns.Contains("婚纱单数"))
  1399. {
  1400. decCompleteWeddingQuantity += Convert.ToInt32(dtRowTeamPerson[j]["婚纱单数"]);
  1401. decCompleteWeddingAmount += Convert.ToDecimal(dtRowTeamPerson[j]["婚纱业绩"]);
  1402. }
  1403. if (NewTable.Columns.Contains("儿童单数"))
  1404. {
  1405. CompleteChildrenQuantity += Convert.ToInt32(dtRowTeamPerson[j]["儿童单数"]);
  1406. CompleteChildrenAmount += Convert.ToDecimal(dtRowTeamPerson[j]["儿童业绩"]);
  1407. }
  1408. if (NewTable.Columns.Contains("写真单数"))
  1409. {
  1410. CompletePortraitQuantity += Convert.ToInt32(dtRowTeamPerson[j]["写真单数"]);
  1411. CompletePortraitAmount += Convert.ToDecimal(dtRowTeamPerson[j]["写真业绩"]);
  1412. }
  1413. if (NewTable.Columns.Contains("服务单数"))
  1414. {
  1415. CompleteServiceQuantity += Convert.ToInt32(dtRowTeamPerson[j]["服务单数"]);
  1416. CompleteServiceAmount += Convert.ToDecimal(dtRowTeamPerson[j]["服务业绩"]);
  1417. }
  1418. if (NewTable.Columns.Contains("婚庆单数"))
  1419. {
  1420. CompleteWeddingCelebrationQuantity += Convert.ToInt32(dtRowTeamPerson[j]["婚庆单数"]);
  1421. CompleteWeddingCelebrationAmount += Convert.ToDecimal(dtRowTeamPerson[j]["婚庆业绩"]);
  1422. }
  1423. }
  1424. DataRow newRow = NewTable.NewRow();
  1425. newRow["大队编号"] = dtTeamMin.Rows[i]["Tmit_TmxtNumber"].ToString().Trim();
  1426. newRow["小组编号"] = dtTeamMin.Rows[i]["Tmit_Number"].ToString().Trim();
  1427. newRow["大队名称"] = "";
  1428. newRow["小组名称"] = dtTeamMin.Rows[i]["Tmin_Name"].ToString().Trim();
  1429. newRow["员工姓名"] = "";
  1430. newRow["完成任务"] = decCompletedTask;
  1431. newRow["保底任务"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtTeamMin.Rows[i]["Tmit_BaodiTask"].ToString().Trim());
  1432. newRow["保底完成情况"] = 0;
  1433. if (Convert.ToDecimal(dtTeamMin.Rows[i]["Tmit_BaodiTask"]) > 0)
  1434. { newRow["保底完成情况"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompletedTask / Convert.ToDecimal(dtTeamMin.Rows[i]["Tmit_BaodiTask"]) * 100).ToString("0.00")); }
  1435. newRow["目标任务"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtTeamMin.Rows[i]["Tmit_TargetTask"].ToString().Trim());
  1436. newRow["目标完成情况"] = 0;
  1437. if (Convert.ToDecimal(dtTeamMin.Rows[i]["Tmit_TargetTask"]) > 0)
  1438. { newRow["目标完成情况"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompletedTask / Convert.ToDecimal(dtTeamMin.Rows[i]["Tmit_TargetTask"]) * 100).ToString("0.00")); }
  1439. newRow["冲刺任务"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(dtTeamMin.Rows[i]["Tmit_SprintTask"].ToString().Trim());
  1440. newRow["冲刺完成情况"] = 0;
  1441. if (Convert.ToDecimal(dtTeamMin.Rows[i]["Tmit_SprintTask"]) > 0)
  1442. { newRow["冲刺完成情况"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompletedTask / Convert.ToDecimal(dtTeamMin.Rows[i]["Tmit_SprintTask"]) * 100).ToString("0.00")); }
  1443. if (NewTable.Columns.Contains("婚纱单数"))
  1444. {
  1445. newRow["婚纱单数"] = decCompleteWeddingQuantity;
  1446. newRow["婚纱业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(decCompleteWeddingAmount);
  1447. newRow["婚纱均价"] = 0;
  1448. if (decCompleteWeddingQuantity > 0)
  1449. { newRow["婚纱均价"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((decCompleteWeddingAmount / decCompleteWeddingQuantity).ToString("0.00")); }
  1450. }
  1451. if (NewTable.Columns.Contains("儿童单数"))
  1452. {
  1453. newRow["儿童单数"] = CompleteChildrenQuantity;
  1454. newRow["儿童业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(CompleteChildrenAmount);
  1455. newRow["儿童均价"] = 0;
  1456. if (CompleteChildrenQuantity > 0)
  1457. { newRow["儿童均价"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((CompleteChildrenAmount / CompleteChildrenQuantity).ToString("0.00")); }
  1458. }
  1459. if (NewTable.Columns.Contains("写真单数"))
  1460. {
  1461. newRow["写真单数"] = CompletePortraitQuantity;
  1462. newRow["写真业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(CompletePortraitAmount);
  1463. newRow["写真均价"] = 0;
  1464. if (CompletePortraitQuantity > 0)
  1465. { newRow["写真均价"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((CompletePortraitAmount / CompletePortraitQuantity).ToString("0.00")); }
  1466. }
  1467. if (NewTable.Columns.Contains("服务单数"))
  1468. {
  1469. newRow["服务单数"] = CompleteServiceQuantity;
  1470. newRow["服务业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(CompleteServiceAmount);
  1471. newRow["服务均价"] = 0;
  1472. if (CompleteServiceQuantity > 0)
  1473. { newRow["服务均价"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((CompleteServiceAmount / CompleteServiceQuantity).ToString("0.00")); }
  1474. }
  1475. if (NewTable.Columns.Contains("婚庆单数"))
  1476. {
  1477. newRow["婚庆单数"] = CompleteWeddingCelebrationQuantity;
  1478. newRow["婚庆业绩"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero(CompleteWeddingCelebrationAmount);
  1479. newRow["婚庆均价"] = 0;
  1480. if (CompleteWeddingCelebrationQuantity > 0)
  1481. { newRow["婚庆均价"] = LYFZ.BLL.OtherCommonModel.RemoveLastExcessZero((CompleteWeddingCelebrationAmount / CompleteWeddingCelebrationQuantity).ToString("0.00")); }
  1482. }
  1483. NewTable.Rows.Add(newRow);
  1484. }
  1485. return NewTable;
  1486. }
  1487. }
  1488. }