frmWageQueryConfig.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace LYFZ.Software.MainBusiness.FinancialManagement
  9. {
  10. public class frmWageQueryConfig :LYFZ.Software.UI.FinancialManagement.frmWageQueryConfig
  11. {
  12. public frmWageQueryConfig() {
  13. this.btnAddProgram.Click += btnAddProgram_Click;
  14. this.Shown += frmWageQueryConfig_Shown;
  15. this.bntRefresh.Click += bntRefresh_Click;
  16. this.dgvSetList.CellContentClick += dgvSetList_CellContentClick;
  17. this.btnExport.Click += btnExport_Click;
  18. this.btnImport.Click += btnImport_Click;
  19. this.btnClose.Click += btnClose_Click;
  20. this.btnClosed.Click += btnClosed_Click;
  21. this.dgvStatisticsList.CellContentClick += dgvStatisticsList_CellContentClick;
  22. this.dgvStatisticsList.ColumnHeaderMouseDoubleClick += dgvStatisticsList_ColumnHeaderMouseDoubleClick;
  23. this.cmbEmployeeName.IsSelectParentNode = false;
  24. this.cmbEmployeeName.ComboBoxTree_NodeMouseClick += cmbEmployeeName_ComboBoxTree_NodeMouseClick;
  25. this.btnSave.Click += btnSave_Click;
  26. this.btnAllDel.Click += btnAllDel_Click;
  27. }
  28. bool allSelected = false;
  29. void dgvStatisticsList_ColumnHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
  30. {
  31. if (e.RowIndex == -1 && e.ColumnIndex == 0&&!string.IsNullOrEmpty(this.CurrentUser_EmployeeID))
  32. {
  33. allSelected = !allSelected;
  34. SetCancelAllSelected(allSelected);
  35. }
  36. }
  37. void btnAllDel_Click(object sender, EventArgs e)
  38. {
  39. if (MessageBoxCustom.Show("正在准备删除全部工资统计方案,您确定要删除吗?", msgBoxButton: MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
  40. {
  41. bool isDelOk = false;
  42. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  43. {
  44. isDelOk = wqcBll.Delete("id>0");
  45. if (isDelOk)
  46. {
  47. LoadWageQueryConfig();
  48. }
  49. });
  50. if (isDelOk)
  51. {
  52. BindAllDGVList();
  53. }
  54. }
  55. }
  56. LYFZ.Model.Model_ErpWagesSet WagesSetMode = null;
  57. void btnSave_Click(object sender, EventArgs e)
  58. {
  59. if (string.IsNullOrEmpty(currentUser_EmployeeID))
  60. {
  61. MessageBoxCustom.Show("请选择要设置的员工");
  62. return;
  63. }
  64. try
  65. {
  66. List<string> TempList = new List<string>();
  67. foreach (DataGridViewRow row in this.dgvStatisticsList.Rows)
  68. {
  69. LYFZ.Model.Model_WageQueryConfig wMode = (LYFZ.Model.Model_WageQueryConfig)row.Tag;
  70. if (Convert.ToBoolean(row.Cells[0].Value))
  71. {
  72. TempList.Add(wMode.ID.ToString());
  73. }
  74. }
  75. bool isSaveOk = false;
  76. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  77. {
  78. WagesSetMode = (LYFZ.Model.Model_ErpWagesSet)frmWageStatisticsQuery.wagesSetBll.GetModelObject("Ws_StaffCode", currentUser_EmployeeID);
  79. WagesSetMode.Ws_EarlyCommissionScheme = string.Join(",",TempList);
  80. if (WagesSetMode != null && WagesSetMode.ID > 0)
  81. {
  82. isSaveOk = frmWageStatisticsQuery.wagesSetBll.Update(WagesSetMode);
  83. }
  84. else
  85. {
  86. WagesSetMode.Ws_StaffCode = currentUser_EmployeeID;
  87. WagesSetMode.Ws_BasicWage = 0;
  88. isSaveOk = frmWageStatisticsQuery.wagesSetBll.Add(WagesSetMode);
  89. }
  90. if (isSaveOk)
  91. {
  92. frmWageStatisticsQuery.LoadWagesSetDataTable();
  93. }
  94. });
  95. if (isSaveOk)
  96. {
  97. MessageBoxCustom.Show("保存成功");
  98. }
  99. else
  100. {
  101. MessageBoxCustom.Show("保存失败,请重试");
  102. }
  103. }
  104. catch (Exception ex)
  105. {
  106. MessageBoxCustom.Show("保存出错:" + ex.Message);
  107. }
  108. }
  109. /// <summary>
  110. ///
  111. /// </summary>
  112. string currentUser_EmployeeID = "";
  113. /// <summary>
  114. /// 当前选择用户ID
  115. /// </summary>
  116. public string CurrentUser_EmployeeID
  117. {
  118. get { return currentUser_EmployeeID; }
  119. set { currentUser_EmployeeID = value; }
  120. }
  121. void cmbEmployeeName_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
  122. {
  123. if (e.Node.Tag == null || string.IsNullOrEmpty(e.Node.Tag.ToString()))
  124. {
  125. allSelected = false;
  126. SetCancelAllSelected(false);
  127. currentUser_EmployeeID = "";
  128. }
  129. else {
  130. string dataType = this.cmbEmployeeName.StrGetName.Trim();
  131. if (dataType.Length > 0)
  132. {
  133. switch (dataType.ToLower())
  134. {
  135. case "storename":
  136. break;
  137. case "department":
  138. break;
  139. case "user":
  140. currentUser_EmployeeID = e.Node.Tag.ToString();
  141. SetUserCommissionSchemeSelected(frmWageStatisticsQuery.GetCommissionScheme(currentUser_EmployeeID).Split(','));
  142. break;
  143. default:
  144. break;
  145. }
  146. }
  147. }
  148. }
  149. void SetUserCommissionSchemeSelected(string[] userCommissionSchemes)
  150. {
  151. bool tempSelected = true;
  152. foreach (DataGridViewRow row in this.dgvStatisticsList.Rows)
  153. {
  154. LYFZ.Model.Model_WageQueryConfig wMode = (LYFZ.Model.Model_WageQueryConfig)row.Tag;
  155. row.Cells[0].Value = GetSelected(wMode.ID.ToString(),userCommissionSchemes);
  156. if (!Convert.ToBoolean(row.Cells[0].Value))
  157. {
  158. tempSelected = false;
  159. }
  160. }
  161. this.allSelected = tempSelected;
  162. }
  163. void SetCancelAllSelected(bool selected)
  164. {
  165. foreach (DataGridViewRow row in this.dgvStatisticsList.Rows)
  166. {
  167. row.Cells[0].Value = selected;
  168. }
  169. }
  170. void dgvStatisticsList_CellContentClick(object sender, DataGridViewCellEventArgs e)
  171. {
  172. if (e.RowIndex >= 0 && e.ColumnIndex == 0)
  173. {
  174. this.dgvStatisticsList.Rows[e.RowIndex].Cells[0].Value = !Convert.ToBoolean(this.dgvStatisticsList.Rows[e.RowIndex].Cells[0].Value);
  175. }
  176. }
  177. void btnClosed_Click(object sender, EventArgs e)
  178. {
  179. this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  180. }
  181. void btnClose_Click(object sender, EventArgs e)
  182. {
  183. this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  184. }
  185. void btnImport_Click(object sender, EventArgs e)
  186. {
  187. OpenFileDialog ImportRoleDlg = new OpenFileDialog();
  188. ImportRoleDlg.Filter = "工资统计方案|*.wqc";
  189. if (ImportRoleDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  190. {
  191. try
  192. {
  193. string ImportRoleFileName = ImportRoleDlg.FileName;
  194. if (System.IO.File.Exists(ImportRoleFileName))
  195. {
  196. string[] ImportRoleDataList = System.IO.File.ReadAllText(ImportRoleFileName, Encoding.UTF8).Split('?');
  197. bool isSaveOk = false;
  198. int myCount = 1;
  199. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  200. {
  201. backgroundWorker.ReportProgress(0, "正在导入工资统计方案,请稍等...");
  202. foreach (string roleDatas in ImportRoleDataList)
  203. {
  204. string[] roles = roleDatas.Split('|');
  205. try
  206. {
  207. LYFZ.Model.Model_WageQueryConfig wModel = new Model.Model_WageQueryConfig();
  208. wModel.WQC_QueryName = LYFZ.WinAPI.SDKSecurity.Decode(roles[0]);
  209. wModel.WQC_StatisticalItems = Convert.ToInt32(LYFZ.WinAPI.SDKSecurity.Decode(roles[1]));
  210. wModel.WQC_ProjectContent = LYFZ.WinAPI.SDKSecurity.Decode(roles[2]);
  211. wModel.WQC_QueryCondition = LYFZ.WinAPI.SDKSecurity.Decode(roles[3]);
  212. wModel.WQC_CommissionProgram = LYFZ.WinAPI.SDKSecurity.Decode(roles[4]);
  213. wModel.WQC_Remarks = LYFZ.WinAPI.SDKSecurity.Decode(roles[5]);
  214. wModel.WQC_Type = Convert.ToInt32(LYFZ.WinAPI.SDKSecurity.Decode(roles[6]));
  215. wModel.WQC_CreateDateTime = SDateTime.NowToLong;
  216. wModel.WQC_CreateName = CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  217. wModel.WQC_UpdateDateTime = SDateTime.NowToLong;
  218. wModel.WQC_UpdateName = CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  219. backgroundWorker.ReportProgress(0, "正在导入" + myCount.ToString() + "/" + ImportRoleDataList.Length.ToString() + "条数据,请稍等...");
  220. if (!wqcBll.Exists("WQC_QueryName", wModel.WQC_QueryName))
  221. {
  222. isSaveOk = wqcBll.Add(wModel);
  223. if (!isSaveOk)
  224. {
  225. break;
  226. }
  227. }
  228. else {
  229. isSaveOk = true;
  230. }
  231. }
  232. catch (Exception ex)
  233. {
  234. isSaveOk = false;
  235. MessageBoxCustom.Show("工资统计方案导入失败:" + ex.Message);
  236. break;
  237. }
  238. }
  239. });
  240. if (isSaveOk)
  241. {
  242. LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.其它操作, "导入工资统计方案:" + ImportRoleDataList.Length.ToString() + "条", LYFZ.BLL.BLL_ErpUser.UsersModel.User_EmployeeID, LYFZ.BLL.BLL_ErpUser.UsersModel.User_Name);
  243. MessageBoxCustom.Show("工资统计方案导入成功");
  244. }
  245. else
  246. {
  247. MessageBoxCustom.Show("工资统计方案导入失败,请重启软件后重试");
  248. }
  249. bntRefresh_Click(null, null);
  250. }
  251. else
  252. {
  253. MessageBoxCustom.Show("选择的工资统计方案文件不存在");
  254. }
  255. }
  256. catch (Exception ex)
  257. {
  258. MessageBoxCustom.Show("工资统计方案导入失败:" + ex.Message);
  259. }
  260. }
  261. }
  262. void btnExport_Click(object sender, EventArgs e)
  263. {
  264. SaveFileDialog ExportRoleDlg = new SaveFileDialog();
  265. ExportRoleDlg.Filter = "工资统计方案|*.wqc";
  266. ExportRoleDlg.FileName = "工资统计方案_" + SDateTime.Now.ToString("yyyy-MM-dd");
  267. if (ExportRoleDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  268. {
  269. try
  270. {
  271. string ImportRoleFileName = LYFZ.WinAPI.CustomPublicMethod.GetFullDirectoryPath(System.IO.Path.GetDirectoryName(ExportRoleDlg.FileName))
  272. + System.IO.Path.GetFileNameWithoutExtension(ExportRoleDlg.FileName) + ".wqc";
  273. string ExportRoleData = "";
  274. foreach (LYFZ.Model.Model_WageQueryConfig wModel in WageQueryConfigModelList)
  275. {
  276. ExportRoleData += LYFZ.WinAPI.SDKSecurity.Encode(wModel.WQC_QueryName)
  277. + "|" + LYFZ.WinAPI.SDKSecurity.Encode(wModel.WQC_StatisticalItems.ToString())
  278. + "|" + LYFZ.WinAPI.SDKSecurity.Encode(wModel.WQC_ProjectContent)
  279. + "|" + LYFZ.WinAPI.SDKSecurity.Encode(wModel.WQC_QueryCondition)
  280. + "|" + LYFZ.WinAPI.SDKSecurity.Encode(wModel.WQC_CommissionProgram)
  281. + "|" + LYFZ.WinAPI.SDKSecurity.Encode(wModel.WQC_Remarks)
  282. + "|" + LYFZ.WinAPI.SDKSecurity.Encode(wModel.WQC_Type.ToString()) + "?";
  283. }
  284. System.IO.File.WriteAllText(ImportRoleFileName, ExportRoleData.Trim('?'), Encoding.UTF8);
  285. MessageBoxCustom.Show("工资统计方案导出成功");
  286. }
  287. catch (Exception ex)
  288. {
  289. MessageBoxCustom.Show("工资统计方案导出失败:" + ex.Message);
  290. }
  291. }
  292. }
  293. void dgvSetList_CellContentClick(object sender, DataGridViewCellEventArgs e)
  294. {
  295. if (e.RowIndex >= 0 && e.ColumnIndex >= 5)
  296. {
  297. try
  298. {
  299. switch (e.ColumnIndex)
  300. {
  301. case 5:
  302. frmEditStatisticsProgram frmEditSP = new frmEditStatisticsProgram();
  303. frmEditSP.WqcModel = (LYFZ.Model.Model_WageQueryConfig)this.dgvSetList.Rows[e.RowIndex].Tag;
  304. if (frmEditSP.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  305. {
  306. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  307. {
  308. LoadWageQueryConfig();
  309. });
  310. BindAllDGVList();
  311. }
  312. break;
  313. case 6:
  314. if (MessageBoxCustom.Show("您确定要删除“" + this.dgvSetList.Rows[e.RowIndex].Cells[0].Value.ToString() + "”的统计方安吗?", msgBoxButton: MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
  315. {
  316. LYFZ.Model.Model_WageQueryConfig delModel = (LYFZ.Model.Model_WageQueryConfig)this.dgvSetList.Rows[e.RowIndex].Tag;
  317. bool delOK = false;
  318. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  319. {
  320. delOK = wqcBll.Delete(delModel.ID);
  321. });
  322. if (delOK)
  323. {
  324. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  325. {
  326. LoadWageQueryConfig();
  327. });
  328. BindAllDGVList();
  329. }
  330. else
  331. {
  332. MessageBoxCustom.Show("删除失败,请重试");
  333. }
  334. }
  335. break;
  336. }
  337. }
  338. catch (Exception ex)
  339. {
  340. MessageBoxCustom.Show("操作出错:" + ex.Message);
  341. }
  342. }
  343. }
  344. void bntRefresh_Click(object sender, EventArgs e)
  345. {
  346. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  347. {
  348. LoadWageQueryConfig();
  349. frmEditStatisticsProgram.LoadAllSystemCategory();
  350. LoadWageQueryConfig();
  351. });
  352. BindAllDGVList();
  353. }
  354. static LYFZ.BLL.BLL_WageQueryConfig wqcBll = new BLL.BLL_WageQueryConfig();
  355. static DataTable wQCTable = null;
  356. /// <summary>
  357. /// 统计方案配置信息
  358. /// </summary>
  359. public static DataTable WQCTable
  360. {
  361. get {
  362. if (wQCTable == null) {
  363. wQCTable = wqcBll.GetAllList("WQC_StatisticalItems,WQC_ProjectContent").Tables[0];
  364. wQCTable.PrimaryKey = new DataColumn[] { wQCTable.Columns["id"] };
  365. }
  366. return wQCTable; }
  367. set { wQCTable = value; }
  368. }
  369. static List<LYFZ.Model.Model_WageQueryConfig> _WageQueryConfigModelList = null;
  370. public static List<LYFZ.Model.Model_WageQueryConfig> WageQueryConfigModelList
  371. {
  372. get {
  373. if (_WageQueryConfigModelList == null)
  374. {
  375. LoadWageQueryConfig();
  376. }
  377. return frmWageQueryConfig._WageQueryConfigModelList; }
  378. }
  379. public static LYFZ.Model.Model_WageQueryConfig FindWageQueryConfig(string id)
  380. {
  381. foreach (LYFZ.Model.Model_WageQueryConfig wqcModel in frmWageQueryConfig.WageQueryConfigModelList)
  382. {
  383. if (id.Trim().ToLower().ToString() == wqcModel.ID.ToString().ToLower())
  384. {
  385. return wqcModel;
  386. }
  387. }
  388. return null;
  389. }
  390. // static System.Collections.Hashtable hashList = new System.Collections.Hashtable();
  391. /// <summary>
  392. /// 重新加载统计方案配置信息
  393. /// </summary>
  394. public static void LoadWageQueryConfig()
  395. {
  396. if (wQCTable != null)
  397. {
  398. wQCTable.Rows.Clear();
  399. wQCTable.Dispose();
  400. wQCTable = null;
  401. }
  402. wQCTable = wqcBll.GetAllList("WQC_StatisticalItems,WQC_ProjectContent").Tables[0];
  403. wQCTable.PrimaryKey = new DataColumn[] { wQCTable.Columns["id"] };
  404. if (_WageQueryConfigModelList != null)
  405. {
  406. _WageQueryConfigModelList.Clear();
  407. _WageQueryConfigModelList = null;
  408. }
  409. _WageQueryConfigModelList = new List<Model.Model_WageQueryConfig>();
  410. foreach (DataRow row in WQCTable.Rows)
  411. {
  412. _WageQueryConfigModelList.Add(new Model.Model_WageQueryConfig(row));
  413. }
  414. }
  415. void frmWageQueryConfig_Shown(object sender, EventArgs e)
  416. {
  417. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  418. {
  419. if (wQCTable == null) {
  420. LoadWageQueryConfig();
  421. }
  422. });
  423. // 部门人员绑定
  424. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbEmployeeName, IsFirstNodeNull: true, IsShowResign: false, IsShowAdmin: true, tb_User: LYFZ.DAL.DAL_ErpUser.SimpleUserDataTable);
  425. if (!string.IsNullOrEmpty(CurrentUser_EmployeeID))
  426. {
  427. this.cmbEmployeeName.TagFindText(currentUser_EmployeeID);
  428. }
  429. BindAllDGVList();
  430. }
  431. void BindAllDGVList()
  432. {
  433. BindStatisticsList();
  434. BindSetList();
  435. }
  436. public static string GetClassCodeToCalssName(string classCode)
  437. {
  438. if (string.IsNullOrEmpty(classCode.Trim())) { return ""; }
  439. /*foreach (DataRow row in frmEditStatisticsProgram.AllSystemCategory.Rows)
  440. {
  441. if (row["Sc_ClassCode"].ToString().ToLower() == classCode.ToLower().Trim())
  442. {
  443. return row["Sc_ClassName"].ToString();
  444. }
  445. }
  446. if (classCode.ToUpper().StartsWith("B") || classCode.ToUpper().StartsWith("C")|| classCode.ToUpper().StartsWith("D"))
  447. {
  448. return "-";
  449. }*/
  450. return LYFZ.BLL.WageStatisticsProcess.GetClassCodeToCalssName(classCode);
  451. }
  452. /// <summary>
  453. /// 绑定方案选择列表
  454. /// </summary>
  455. /// <param name="uid"></param>
  456. void BindStatisticsList()
  457. {
  458. this.dgvStatisticsList.Rows.Clear();
  459. DataGridViewRow dgRow = null;
  460. foreach (LYFZ.Model.Model_WageQueryConfig wMode in WageQueryConfigModelList)
  461. {
  462. dgRow = new DataGridViewRow();
  463. dgRow.CreateCells(this.dgvStatisticsList);
  464. dgRow.Tag = wMode;
  465. dgRow.Cells[0].Value = GetSelected(wMode.ID.ToString(), frmWageStatisticsQuery.GetCommissionScheme(currentUser_EmployeeID).Split(','));
  466. dgRow.Cells[1].Value = wMode.WQC_QueryName;
  467. dgRow.Cells[2].Value = (LYFZ.Model.WageStatisticsQueryItem)wMode.WQC_StatisticalItems;//Convert.ToInt32(row["WQC_StatisticalItems"].ToString());
  468. dgRow.Cells[3].Value = GetClassCodeToCalssName(wMode.WQC_ProjectContent);//GetClassCodeToCalssName(row["WQC_ProjectContent"].ToString(), false);
  469. dgRow.Cells[4].Value = GetClassCodeToCalssName(wMode.WQC_CommissionProgram);
  470. dgRow.Cells[5].Value = GetQueryConditionText(wMode.WQC_QueryCondition, (LYFZ.Model.WageStatisticsQueryItem)wMode.WQC_StatisticalItems);
  471. this.dgvStatisticsList.Rows.Add(dgRow);
  472. }
  473. this.dgvStatisticsList.ClearSelection();
  474. }
  475. /// <summary>
  476. /// 获取指定方案ID 在指定用户的工资统计方案列表中是否存在
  477. /// </summary>
  478. /// <param name="wqcID"></param>
  479. /// <param name="userCommissionScheme"></param>
  480. /// <returns></returns>
  481. bool GetSelected(string wqcID, string[] userCommissionSchemes)
  482. {
  483. if (!string.IsNullOrEmpty(wqcID))
  484. {
  485. foreach (string uCSID in userCommissionSchemes)
  486. {
  487. if (uCSID.Trim().ToLower() == wqcID.Trim().ToLower())
  488. {
  489. return true;
  490. }
  491. }
  492. }
  493. return false;
  494. }
  495. /// <summary>
  496. /// 绑定统计方案设置列表
  497. /// </summary>
  498. void BindSetList()
  499. {
  500. this.dgvSetList.Rows.Clear();
  501. DataGridViewRow dgRow = null;
  502. foreach (LYFZ.Model.Model_WageQueryConfig wMode in WageQueryConfigModelList)
  503. {
  504. dgRow = new DataGridViewRow();
  505. dgRow.CreateCells(this.dgvSetList);
  506. dgRow.Tag = wMode;
  507. dgRow.Cells[0].Value = wMode.WQC_QueryName;
  508. dgRow.Cells[1].Value = (LYFZ.Model.WageStatisticsQueryItem)wMode.WQC_StatisticalItems;
  509. dgRow.Cells[2].Value = GetClassCodeToCalssName(wMode.WQC_ProjectContent);
  510. dgRow.Cells[3].Value = GetClassCodeToCalssName(wMode.WQC_CommissionProgram);
  511. dgRow.Cells[4].Value = GetQueryConditionText(wMode.WQC_QueryCondition, (LYFZ.Model.WageStatisticsQueryItem)wMode.WQC_StatisticalItems);
  512. dgRow.Cells[5].Value = "编辑";
  513. dgRow.Cells[6].Value ="删除";
  514. this.dgvSetList.Rows.Add(dgRow);
  515. }
  516. this.dgvSetList.ClearSelection();
  517. }
  518. string GetQueryConditionText(string queryCondition, Model.WageStatisticsQueryItem wqItem)
  519. {
  520. string retString = "";
  521. LYFZ.Model.AdditionalConditions acdit = new Model.AdditionalConditions(queryCondition);
  522. if (acdit.IsCustomerSource || acdit.IsOrderCategory || acdit.IsPaymentMethod)
  523. {
  524. LYFZ.Model.AdditionalConditions retAcdit = new Model.AdditionalConditions(queryCondition);
  525. if (acdit.IsCustomerSource)
  526. {
  527. retAcdit.CustomerSourceList.Clear();
  528. foreach (string code in acdit.CustomerSourceList)
  529. {
  530. retAcdit.CustomerSourceList.Add(GetClassCodeToCalssName(code));
  531. }
  532. }
  533. if (acdit.IsOrderCategory)
  534. {
  535. retAcdit.OrderCategoryList.Clear();
  536. foreach (string code in acdit.OrderCategoryList)
  537. {
  538. retAcdit.OrderCategoryList.Add(GetClassCodeToCalssName(code));
  539. }
  540. }
  541. if (acdit.IsPaymentMethod)
  542. {
  543. retAcdit.PaymentMethodList.Clear();
  544. foreach (string code in acdit.PaymentMethodList)
  545. {
  546. retAcdit.PaymentMethodList.Add(GetClassCodeToCalssName(code));
  547. }
  548. }
  549. acdit = null;
  550. retString = retAcdit.ToString().Trim('|');
  551. }
  552. else
  553. {
  554. acdit = null;
  555. retString = queryCondition.Trim('|');
  556. }
  557. if (wqItem == Model.WageStatisticsQueryItem.礼服租售
  558. ||wqItem== Model.WageStatisticsQueryItem.散客消费)
  559. {
  560. retString = retString.Replace("套系金额:", "订单金额:");
  561. }
  562. return retString;
  563. }
  564. void btnAddProgram_Click(object sender, EventArgs e)
  565. {
  566. frmEditStatisticsProgram frmEditSP = new frmEditStatisticsProgram();
  567. if (frmEditSP.ShowDialog() == System.Windows.Forms.DialogResult.OK)
  568. {
  569. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  570. {
  571. LoadWageQueryConfig();
  572. });
  573. BindAllDGVList();
  574. }
  575. }
  576. }
  577. }