FrmStatisticalInquiryPayroll.cs 129 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404
  1. using LYFZ.ComponentLibrary;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. namespace LYFZ.Software.MainBusiness.StatisticalInquiry
  11. {
  12. public partial class FrmStatisticalInquiryPayroll : LYFZ.Software.UI.StatisticalInquiry.FrmStatisticalInquiryPayroll
  13. {
  14. public FrmStatisticalInquiryPayroll()
  15. {
  16. }
  17. public string User_EmployeeID = "";
  18. public string TimeStart = "";
  19. public string TimeEnd = "";
  20. decimal Piece = 0; //计件提成
  21. #region 加载
  22. protected override void FrmStatisticalInquiryPayroll_Shown(object sender, EventArgs e)
  23. {
  24. WaitForm wf = new WaitForm();
  25. wf.ShowForm(this);
  26. try
  27. {
  28. #region 部门人员绑定
  29. LYFZ.BLL.BLL_ErpDepartment BLLerpdepartment = new BLL.BLL_ErpDepartment();
  30. DataTable tbl = BLLerpdepartment.GetAllList().Tables[0];
  31. if (tbl.Rows.Count > 0)
  32. {
  33. TreeNode root = null;
  34. for (int i = 0; i < tbl.Rows.Count; i++)
  35. {
  36. root = new TreeNode(tbl.Rows[i]["Dt_Name"].ToString());
  37. this.CreateTreeViewDepartmentUser(root.Nodes, tbl.Rows[i]["ID"].ToString());
  38. this.txtTsorder_OpenSingle.TreeView.Nodes.Add(root);
  39. }
  40. }
  41. #endregion
  42. if (!string.IsNullOrEmpty(User_EmployeeID))
  43. {
  44. dgv1.Rows.Clear();
  45. dgv2.Rows.Clear();
  46. dgv3.Rows.Clear();
  47. dgv4.Rows.Clear();
  48. txtWs_BasicWage.Text = "";
  49. txtEarlyResults.Text = "";
  50. txtTwoPinsResults.Text = "";
  51. txtPieceCommission.Text = "";
  52. txtTotalWages.Text = "";
  53. txtTsorder_OpenSingle.TagFindText("");
  54. txtTsorder_OpenSingle.TagFindText(User_EmployeeID);
  55. txtTimeStart.Text = TimeStart;
  56. txtTimeEnd.Text = TimeEnd;
  57. LYFZ.BLL.BLL_ErpWagesSet wagesBll = new BLL.BLL_ErpWagesSet();
  58. #region 获取人员基本信息
  59. DataTable wagesdt = wagesBll.GetList("Ws_StaffCode='" + txtTsorder_OpenSingle.Tag.ToString() + "'").Tables[0];
  60. if (wagesdt.Rows.Count > 0)
  61. {
  62. txtWs_Remark.Text = wagesdt.Rows[0]["Ws_Remark"].ToString();
  63. txtWs_BasicWage.Text = wagesdt.Rows[0]["Ws_BasicWage"].ToString();
  64. }
  65. else
  66. {
  67. txtWs_Remark.Text = "";
  68. txtWs_BasicWage.Text = "0.00";
  69. }
  70. #endregion
  71. #region 获取列表
  72. //订单,二销提成数据源绑定
  73. BindSalarylist(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
  74. //摄影与助理数据源绑定
  75. PhotographyBind();
  76. //修片与精修与设计
  77. BindPhoto();
  78. //计件提成
  79. BindPiece(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
  80. #endregion
  81. #region 获取工资
  82. GetWages(txtTsorder_OpenSingle.Tag.ToString());
  83. #endregion
  84. #region 自动统计
  85. BindAutomaticStatistics(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
  86. #endregion
  87. }
  88. else
  89. {
  90. txtTimeStart.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().AddDays(1 - LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().Day)).ToString("yyyy-MM-dd");
  91. txtTimeEnd.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime()).AddDays(1 - LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().Day).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
  92. }
  93. wf.CloseForm();
  94. wf = null;
  95. return;
  96. }
  97. catch
  98. {
  99. wf.CloseForm();
  100. wf = null;
  101. }
  102. }
  103. #endregion
  104. #region 选择人员事件
  105. protected override void txtTsorder_OpenSingle_ComboBoxTreeViewEx_TextChanged(object sender, EventArgs e)
  106. {
  107. WaitForm wf = new WaitForm();
  108. wf.ShowForm(this);
  109. try
  110. {
  111. dgv1.Rows.Clear();
  112. dgv2.Rows.Clear();
  113. dgv3.Rows.Clear();
  114. dgv4.Rows.Clear();
  115. txtWs_BasicWage.Text = "";
  116. txtEarlyResults.Text = "";
  117. txtTwoPinsResults.Text = "";
  118. txtPieceCommission.Text = "";
  119. txtTotalWages.Text = "";
  120. if (string.IsNullOrEmpty(txtTimeStart.Text) || string.IsNullOrEmpty(txtTimeEnd.Text))
  121. {
  122. MessageBoxCustom.Show("请输入时间!");
  123. return;
  124. }
  125. txtTsorder_OpenSingle.TextFindTag(txtTsorder_OpenSingle.Text.ToString());
  126. LYFZ.BLL.BLL_ErpWagesSet wagesBll = new BLL.BLL_ErpWagesSet();
  127. #region 获取人员基本信息
  128. DataTable wagesdt = wagesBll.GetList("Ws_StaffCode='" + txtTsorder_OpenSingle.Tag.ToString() + "'").Tables[0];
  129. if (wagesdt.Rows.Count > 0)
  130. {
  131. txtWs_Remark.Text = wagesdt.Rows[0]["Ws_Remark"].ToString();
  132. txtWs_BasicWage.Text = wagesdt.Rows[0]["Ws_BasicWage"].ToString();
  133. }
  134. else
  135. {
  136. txtWs_Remark.Text = "";
  137. txtWs_BasicWage.Text = "0.00";
  138. }
  139. #endregion
  140. #region 获取列表
  141. //订单,二销提成数据源绑定
  142. BindSalarylist(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
  143. //摄影与助理数据源绑定
  144. PhotographyBind();
  145. //修片与精修与设计
  146. BindPhoto();
  147. //计件提成
  148. BindPiece(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
  149. #endregion
  150. #region 获取工资
  151. GetWages(txtTsorder_OpenSingle.Tag.ToString());
  152. #endregion
  153. #region 自动统计
  154. BindAutomaticStatistics(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
  155. #endregion
  156. wf.CloseForm();
  157. wf = null;
  158. }
  159. catch
  160. {
  161. wf.CloseForm();
  162. wf = null;
  163. }
  164. }
  165. #region 订单,二销提成数据源绑定
  166. /// <summary>
  167. /// 订单,二销提成数据源绑定
  168. /// </summary>
  169. /// <param name="Tsorder_OpenSingle"></param>
  170. /// <param name="TimeStart"></param>
  171. /// <param name="TimeEnd"></param>
  172. public void BindSalarylist(string Tsorder_OpenSingle, string TimeStart, string TimeEnd)
  173. {
  174. try
  175. {
  176. LYFZ.BLL.BLL_ErpSystemConfigure SystemConfigureBll = new BLL.BLL_ErpSystemConfigure(); ;
  177. LYFZ.BLL.BLL_ErpWagesSet WagesSetBll = new BLL.BLL_ErpWagesSet();
  178. LYFZ.BLL.BLL_ErpOrdersPhotography OrdersPhotographyBll = new BLL.BLL_ErpOrdersPhotography();
  179. DataTable dt = new DataTable();
  180. StringBuilder sql = new StringBuilder();
  181. #region 查询人员是否有订单收款记录(前期,二销,其它消费)
  182. // or Ordpg_PhotographerId like '%" + Tsorder_OpenSingle + "%' or Ordpg_PhotographyAssistantId like '%" + Tsorder_OpenSingle + "%' or Ordpg_MakeupArtistId like '%" + Tsorder_OpenSingle + "%' or Ordpg_MakeupAssistantId like '%" + Tsorder_OpenSingle + "%' or Ordpg_BootDivisionId like '%" + Tsorder_OpenSingle + "%'
  183. sql.Append(" and (Pay_OpenSingle like '%" + Tsorder_OpenSingle + "%')");
  184. sql.Append(" and (Pay_CreateDatetime>='" + TimeStart + "' and Pay_CreateDatetime<='" + TimeEnd + " 23:59:59.000')");
  185. dt = WagesSetBll.Vw_OrdersWagePaymentRecords(sql.ToString()).Tables[0];
  186. if (dt.Rows.Count > 0)
  187. {
  188. //显示人员订单全部收款记录
  189. for (int t = 0; t < dt.Rows.Count; t++)
  190. {
  191. #region 获取订单 前期收款与后期收款 记录
  192. DataGridViewRow dgvr = new DataGridViewRow();
  193. DataGridViewCell cell = null;
  194. cell = new DataGridViewTextBoxCell();
  195. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  196. dgvr.Cells.Add(cell);
  197. cell = new DataGridViewTextBoxCell();
  198. cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "3" ? "服务订单" : "其它消费";
  199. dgvr.Cells.Add(cell);
  200. cell = new DataGridViewTextBoxCell();
  201. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  202. dgvr.Cells.Add(cell);
  203. cell = new DataGridViewTextBoxCell();
  204. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  205. dgvr.Cells.Add(cell);
  206. cell = new DataGridViewTextBoxCell();
  207. if (dt.Rows[t]["Pay_Category"].ToString().Trim() == "后期收款")
  208. {
  209. cell.Value = dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim();
  210. }
  211. else
  212. {
  213. cell.Value = "前期收款";
  214. }
  215. dgvr.Cells.Add(cell);
  216. cell = new DataGridViewTextBoxCell();
  217. if (string.IsNullOrEmpty(dt.Rows[t]["Ord_CustomerName1"].ToString().Trim()))
  218. {
  219. LYFZ.BLL.BLL_ErpTwoSalesOrder TwoSalesOrderbll = new BLL.BLL_ErpTwoSalesOrder();
  220. DataTable TwoSalesOrderdt = TwoSalesOrderbll.GetView_TwoSalesOrder(" Tsorder_Number='" + dt.Rows[t]["Pay_OrdNumber"].ToString().Trim() + "'").Tables[0];
  221. if (TwoSalesOrderdt.Rows.Count > 0)
  222. {
  223. cell.Value = TwoSalesOrderdt.Rows[0]["Tsorder_CustomerName"].ToString();
  224. }
  225. else { cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim(); }
  226. }
  227. else { cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim(); }
  228. dgvr.Cells.Add(cell);
  229. cell = new DataGridViewTextBoxCell();
  230. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  231. dgvr.Cells.Add(cell);
  232. cell = new DataGridViewTextBoxCell();
  233. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  234. dgvr.Cells.Add(cell);
  235. cell = new DataGridViewTextBoxCell();
  236. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  237. dgvr.Cells.Add(cell);
  238. //门市类型
  239. cell = new DataGridViewTextBoxCell();
  240. LYFZ.BLL.BLL_ErpOrdersPerson OrdersPersonbll = new BLL.BLL_ErpOrdersPerson();
  241. DataTable OrdersPersondt = OrdersPersonbll.GetList(" OrdPe_OrderNumber='" + dt.Rows[t]["Pay_OrdNumber"].ToString() + "' and OrdPe_OrdersPerson='" + txtTsorder_OpenSingle.Tag.ToString() + "'").Tables[0];
  242. if (OrdersPersondt.Rows.Count > 0)
  243. {
  244. if (dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款")
  245. {
  246. cell.Value = OrdersPersondt.Rows[0]["OrdPe_Type"];
  247. }
  248. }
  249. dgvr.Cells.Add(cell);
  250. cell = new DataGridViewTextBoxCell();
  251. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  252. dgvr.Cells.Add(cell);
  253. this.dgv1.Rows.Add(dgvr);
  254. #endregion
  255. dgv1.ClearSelection();
  256. }
  257. }
  258. #endregion
  259. #region 婚纱版/写真版 检测是否有化妆/摄影工作前期/与二销后期
  260. #region 摄影
  261. dt = new DataTable();
  262. sql = new StringBuilder();
  263. sql.Append(" (Ordpg_PhotographerId like '%" + Tsorder_OpenSingle + "%' or Ordpg_PhotographyAssistantId like '%" + Tsorder_OpenSingle + "%') and OrdPg_PhotographyStatus='ok' ");
  264. sql.Append(" and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + " 23:59:59.000')");
  265. dt = WagesSetBll.View_OrdersWagePaymentRecords_Wedding(sql.ToString()).Tables[0];
  266. if (dt.Rows.Count > 0)
  267. {
  268. for (int t = 0; t < dt.Rows.Count; t++)
  269. {
  270. #region 摄影
  271. if ((dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款"))
  272. {
  273. #region 摄影师也有前期提成(无二销)
  274. DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='PhotographerEarlyPinsPercentage'").Tables[0];
  275. if (dtSystemConfigure.Rows.Count > 0)
  276. {
  277. if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
  278. {
  279. DataGridViewRow dgvr = new DataGridViewRow();
  280. DataGridViewCell cell = null;
  281. cell = new DataGridViewTextBoxCell();
  282. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  283. dgvr.Cells.Add(cell);
  284. cell = new DataGridViewTextBoxCell();
  285. cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
  286. dgvr.Cells.Add(cell);
  287. cell = new DataGridViewTextBoxCell();
  288. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  289. dgvr.Cells.Add(cell);
  290. cell = new DataGridViewTextBoxCell();
  291. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  292. dgvr.Cells.Add(cell);
  293. cell = new DataGridViewTextBoxCell();
  294. cell.Value = "摄影前期";
  295. dgvr.Cells.Add(cell);
  296. cell = new DataGridViewTextBoxCell();
  297. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
  298. dgvr.Cells.Add(cell);
  299. cell = new DataGridViewTextBoxCell();
  300. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  301. dgvr.Cells.Add(cell);
  302. cell = new DataGridViewTextBoxCell();
  303. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  304. dgvr.Cells.Add(cell);
  305. cell = new DataGridViewTextBoxCell();
  306. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  307. dgvr.Cells.Add(cell);
  308. cell = new DataGridViewTextBoxCell();
  309. cell.Value = "";
  310. dgvr.Cells.Add(cell);
  311. cell = new DataGridViewTextBoxCell();
  312. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  313. dgvr.Cells.Add(cell);
  314. this.dgv1.Rows.Add(dgvr);
  315. dgv1.ClearSelection();
  316. }
  317. }
  318. #endregion
  319. }
  320. if ((dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim() == "选片二销"))
  321. {
  322. #region 摄影师也有选片二销提成
  323. DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='PhotographerTwoPinsPercentage'").Tables[0];
  324. if (dtSystemConfigure.Rows.Count > 0)
  325. {
  326. if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
  327. {
  328. DataGridViewRow dgvr = new DataGridViewRow();
  329. DataGridViewCell cell = null;
  330. cell = new DataGridViewTextBoxCell();
  331. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  332. dgvr.Cells.Add(cell);
  333. cell = new DataGridViewTextBoxCell();
  334. cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
  335. dgvr.Cells.Add(cell);
  336. cell = new DataGridViewTextBoxCell();
  337. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  338. dgvr.Cells.Add(cell);
  339. cell = new DataGridViewTextBoxCell();
  340. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  341. dgvr.Cells.Add(cell);
  342. cell = new DataGridViewTextBoxCell();
  343. cell.Value = "摄影选片二销";
  344. dgvr.Cells.Add(cell);
  345. cell = new DataGridViewTextBoxCell();
  346. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
  347. dgvr.Cells.Add(cell);
  348. cell = new DataGridViewTextBoxCell();
  349. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  350. dgvr.Cells.Add(cell);
  351. cell = new DataGridViewTextBoxCell();
  352. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  353. dgvr.Cells.Add(cell);
  354. cell = new DataGridViewTextBoxCell();
  355. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  356. dgvr.Cells.Add(cell);
  357. cell = new DataGridViewTextBoxCell();
  358. cell.Value = "";
  359. dgvr.Cells.Add(cell);
  360. cell = new DataGridViewTextBoxCell();
  361. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  362. dgvr.Cells.Add(cell);
  363. this.dgv1.Rows.Add(dgvr);
  364. dgv1.ClearSelection();
  365. }
  366. }
  367. #endregion
  368. }
  369. #endregion
  370. }
  371. }
  372. #endregion
  373. #region 化妆
  374. dt = new DataTable();
  375. sql = new StringBuilder();
  376. sql.Append(" (Ordpg_MakeupArtistId like '%" + Tsorder_OpenSingle + "%' or Ordpg_MakeupAssistantId like '%" + Tsorder_OpenSingle + "%') and OrdPg_PhotographyStatus='ok' ");
  377. sql.Append(" and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + " 23:59:59.000')");
  378. dt = WagesSetBll.View_OrdersWagePaymentRecords_Wedding(sql.ToString()).Tables[0];
  379. if (dt.Rows.Count > 0)
  380. {
  381. for (int t = 0; t < dt.Rows.Count; t++)
  382. {
  383. #region 化妆
  384. if ((dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款"))
  385. {
  386. #region 化妆师也有前期提成(无二销)
  387. DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupEarlyPinsPercentage'").Tables[0];
  388. if (dtSystemConfigure.Rows.Count > 0)
  389. {
  390. if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
  391. {
  392. DataGridViewRow dgvr = new DataGridViewRow();
  393. DataGridViewCell cell = null;
  394. cell = new DataGridViewTextBoxCell();
  395. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  396. dgvr.Cells.Add(cell);
  397. cell = new DataGridViewTextBoxCell();
  398. cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
  399. dgvr.Cells.Add(cell);
  400. cell = new DataGridViewTextBoxCell();
  401. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  402. dgvr.Cells.Add(cell);
  403. cell = new DataGridViewTextBoxCell();
  404. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  405. dgvr.Cells.Add(cell);
  406. cell = new DataGridViewTextBoxCell();
  407. cell.Value = "化妆前期";
  408. dgvr.Cells.Add(cell);
  409. cell = new DataGridViewTextBoxCell();
  410. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
  411. dgvr.Cells.Add(cell);
  412. cell = new DataGridViewTextBoxCell();
  413. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  414. dgvr.Cells.Add(cell);
  415. cell = new DataGridViewTextBoxCell();
  416. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  417. dgvr.Cells.Add(cell);
  418. cell = new DataGridViewTextBoxCell();
  419. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  420. dgvr.Cells.Add(cell);
  421. cell = new DataGridViewTextBoxCell();
  422. cell.Value = "";
  423. dgvr.Cells.Add(cell);
  424. cell = new DataGridViewTextBoxCell();
  425. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  426. dgvr.Cells.Add(cell);
  427. this.dgv1.Rows.Add(dgvr);
  428. dgv1.ClearSelection();
  429. }
  430. }
  431. #endregion
  432. }
  433. if ((dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim() == "选片二销"))
  434. {
  435. #region 化妆师也有选片二销提成
  436. DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupTwoPinsPercentage'").Tables[0];
  437. if (dtSystemConfigure.Rows.Count > 0)
  438. {
  439. if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
  440. {
  441. DataGridViewRow dgvr = new DataGridViewRow();
  442. DataGridViewCell cell = null;
  443. cell = new DataGridViewTextBoxCell();
  444. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  445. dgvr.Cells.Add(cell);
  446. cell = new DataGridViewTextBoxCell();
  447. cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
  448. dgvr.Cells.Add(cell);
  449. cell = new DataGridViewTextBoxCell();
  450. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  451. dgvr.Cells.Add(cell);
  452. cell = new DataGridViewTextBoxCell();
  453. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  454. dgvr.Cells.Add(cell);
  455. cell = new DataGridViewTextBoxCell();
  456. cell.Value = "化妆选片二销";
  457. dgvr.Cells.Add(cell);
  458. cell = new DataGridViewTextBoxCell();
  459. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
  460. dgvr.Cells.Add(cell);
  461. cell = new DataGridViewTextBoxCell();
  462. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  463. dgvr.Cells.Add(cell);
  464. cell = new DataGridViewTextBoxCell();
  465. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  466. dgvr.Cells.Add(cell);
  467. cell = new DataGridViewTextBoxCell();
  468. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  469. dgvr.Cells.Add(cell);
  470. cell = new DataGridViewTextBoxCell();
  471. cell.Value = "";
  472. dgvr.Cells.Add(cell);
  473. cell = new DataGridViewTextBoxCell();
  474. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  475. dgvr.Cells.Add(cell);
  476. this.dgv1.Rows.Add(dgvr);
  477. dgv1.ClearSelection();
  478. }
  479. }
  480. #endregion
  481. }
  482. #endregion
  483. }
  484. }
  485. #endregion
  486. #endregion
  487. #region 儿童版 检测是否有化妆/摄影/引导工作前期/与二销后期
  488. #region 摄影
  489. dt = new DataTable();
  490. sql = new StringBuilder();
  491. sql.Append(" (Ordpg_Photographer like '%" + Tsorder_OpenSingle + "%' or Ordpg_PhotographyAssistant like '%" + Tsorder_OpenSingle + "%') ");
  492. sql.Append(" and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + " 23:59:59.000')");
  493. dt = WagesSetBll.View_OrdersWagePaymentRecords_Child(sql.ToString()).Tables[0];
  494. if (dt.Rows.Count > 0)
  495. {
  496. for (int t = 0; t < dt.Rows.Count; t++)
  497. {
  498. #region 摄影
  499. if ((dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款"))
  500. {
  501. #region 摄影师也有前期提成(无二销)
  502. DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='PhotographerEarlyPinsPercentage'").Tables[0];
  503. if (dtSystemConfigure.Rows.Count > 0)
  504. {
  505. if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
  506. {
  507. DataGridViewRow dgvr = new DataGridViewRow();
  508. DataGridViewCell cell = null;
  509. cell = new DataGridViewTextBoxCell();
  510. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  511. dgvr.Cells.Add(cell);
  512. cell = new DataGridViewTextBoxCell();
  513. cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
  514. dgvr.Cells.Add(cell);
  515. cell = new DataGridViewTextBoxCell();
  516. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  517. dgvr.Cells.Add(cell);
  518. cell = new DataGridViewTextBoxCell();
  519. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  520. dgvr.Cells.Add(cell);
  521. cell = new DataGridViewTextBoxCell();
  522. cell.Value = "摄影前期";
  523. dgvr.Cells.Add(cell);
  524. cell = new DataGridViewTextBoxCell();
  525. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
  526. dgvr.Cells.Add(cell);
  527. cell = new DataGridViewTextBoxCell();
  528. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  529. dgvr.Cells.Add(cell);
  530. cell = new DataGridViewTextBoxCell();
  531. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  532. dgvr.Cells.Add(cell);
  533. cell = new DataGridViewTextBoxCell();
  534. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  535. dgvr.Cells.Add(cell);
  536. cell = new DataGridViewTextBoxCell();
  537. cell.Value = "";
  538. dgvr.Cells.Add(cell);
  539. cell = new DataGridViewTextBoxCell();
  540. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  541. dgvr.Cells.Add(cell);
  542. this.dgv1.Rows.Add(dgvr);
  543. dgv1.ClearSelection();
  544. }
  545. }
  546. #endregion
  547. }
  548. if ((dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim() == "选片二销"))
  549. {
  550. #region 摄影师也有选片二销提成
  551. DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='PhotographerTwoPinsPercentage'").Tables[0];
  552. if (dtSystemConfigure.Rows.Count > 0)
  553. {
  554. if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
  555. {
  556. DataGridViewRow dgvr = new DataGridViewRow();
  557. DataGridViewCell cell = null;
  558. cell = new DataGridViewTextBoxCell();
  559. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  560. dgvr.Cells.Add(cell);
  561. cell = new DataGridViewTextBoxCell();
  562. cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
  563. dgvr.Cells.Add(cell);
  564. cell = new DataGridViewTextBoxCell();
  565. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  566. dgvr.Cells.Add(cell);
  567. cell = new DataGridViewTextBoxCell();
  568. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  569. dgvr.Cells.Add(cell);
  570. cell = new DataGridViewTextBoxCell();
  571. cell.Value = "摄影选片二销";
  572. dgvr.Cells.Add(cell);
  573. cell = new DataGridViewTextBoxCell();
  574. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
  575. dgvr.Cells.Add(cell);
  576. cell = new DataGridViewTextBoxCell();
  577. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  578. dgvr.Cells.Add(cell);
  579. cell = new DataGridViewTextBoxCell();
  580. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  581. dgvr.Cells.Add(cell);
  582. cell = new DataGridViewTextBoxCell();
  583. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  584. dgvr.Cells.Add(cell);
  585. cell = new DataGridViewTextBoxCell();
  586. cell.Value = "";
  587. dgvr.Cells.Add(cell);
  588. cell = new DataGridViewTextBoxCell();
  589. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  590. dgvr.Cells.Add(cell);
  591. this.dgv1.Rows.Add(dgvr);
  592. dgv1.ClearSelection();
  593. }
  594. }
  595. #endregion
  596. }
  597. #endregion
  598. }
  599. }
  600. #endregion
  601. #region 化妆
  602. dt = new DataTable();
  603. sql = new StringBuilder();
  604. sql.Append(" (Ordpg_MakeupArtist like '%" + Tsorder_OpenSingle + "%' or Ordpg_MakeupAssistant like '%" + Tsorder_OpenSingle + "%') ");
  605. sql.Append(" and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + " 23:59:59.000')");
  606. dt = WagesSetBll.View_OrdersWagePaymentRecords_Child(sql.ToString()).Tables[0];
  607. if (dt.Rows.Count > 0)
  608. {
  609. for (int t = 0; t < dt.Rows.Count; t++)
  610. {
  611. #region 化妆
  612. if ((dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款"))
  613. {
  614. #region 化妆师也有前期提成(无二销)
  615. DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupEarlyPinsPercentage'").Tables[0];
  616. if (dtSystemConfigure.Rows.Count > 0)
  617. {
  618. if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
  619. {
  620. DataGridViewRow dgvr = new DataGridViewRow();
  621. DataGridViewCell cell = null;
  622. cell = new DataGridViewTextBoxCell();
  623. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  624. dgvr.Cells.Add(cell);
  625. cell = new DataGridViewTextBoxCell();
  626. cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
  627. dgvr.Cells.Add(cell);
  628. cell = new DataGridViewTextBoxCell();
  629. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  630. dgvr.Cells.Add(cell);
  631. cell = new DataGridViewTextBoxCell();
  632. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  633. dgvr.Cells.Add(cell);
  634. cell = new DataGridViewTextBoxCell();
  635. cell.Value = "化妆前期";
  636. dgvr.Cells.Add(cell);
  637. cell = new DataGridViewTextBoxCell();
  638. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
  639. dgvr.Cells.Add(cell);
  640. cell = new DataGridViewTextBoxCell();
  641. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  642. dgvr.Cells.Add(cell);
  643. cell = new DataGridViewTextBoxCell();
  644. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  645. dgvr.Cells.Add(cell);
  646. cell = new DataGridViewTextBoxCell();
  647. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  648. dgvr.Cells.Add(cell);
  649. cell = new DataGridViewTextBoxCell();
  650. cell.Value = "";
  651. dgvr.Cells.Add(cell);
  652. cell = new DataGridViewTextBoxCell();
  653. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  654. dgvr.Cells.Add(cell);
  655. this.dgv1.Rows.Add(dgvr);
  656. dgv1.ClearSelection();
  657. }
  658. }
  659. #endregion
  660. }
  661. if ((dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim() == "选片二销"))
  662. {
  663. #region 化妆师也有选片二销提成
  664. DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupTwoPinsPercentage'").Tables[0];
  665. if (dtSystemConfigure.Rows.Count > 0)
  666. {
  667. if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
  668. {
  669. DataGridViewRow dgvr = new DataGridViewRow();
  670. DataGridViewCell cell = null;
  671. cell = new DataGridViewTextBoxCell();
  672. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  673. dgvr.Cells.Add(cell);
  674. cell = new DataGridViewTextBoxCell();
  675. cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
  676. dgvr.Cells.Add(cell);
  677. cell = new DataGridViewTextBoxCell();
  678. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  679. dgvr.Cells.Add(cell);
  680. cell = new DataGridViewTextBoxCell();
  681. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  682. dgvr.Cells.Add(cell);
  683. cell = new DataGridViewTextBoxCell();
  684. cell.Value = "化妆选片二销";
  685. dgvr.Cells.Add(cell);
  686. cell = new DataGridViewTextBoxCell();
  687. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
  688. dgvr.Cells.Add(cell);
  689. cell = new DataGridViewTextBoxCell();
  690. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  691. dgvr.Cells.Add(cell);
  692. cell = new DataGridViewTextBoxCell();
  693. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  694. dgvr.Cells.Add(cell);
  695. cell = new DataGridViewTextBoxCell();
  696. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  697. dgvr.Cells.Add(cell);
  698. cell = new DataGridViewTextBoxCell();
  699. cell.Value = "";
  700. dgvr.Cells.Add(cell);
  701. cell = new DataGridViewTextBoxCell();
  702. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  703. dgvr.Cells.Add(cell);
  704. this.dgv1.Rows.Add(dgvr);
  705. dgv1.ClearSelection();
  706. }
  707. }
  708. #endregion
  709. }
  710. #endregion
  711. }
  712. }
  713. #endregion
  714. #region 引导
  715. dt = new DataTable();
  716. sql = new StringBuilder();
  717. sql.Append(" Ordpg_BootDivision like '%" + Tsorder_OpenSingle + "%' ");
  718. sql.Append(" and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + " 23:59:59.000')");
  719. dt = WagesSetBll.View_OrdersWagePaymentRecords_Child(sql.ToString()).Tables[0];
  720. if (dt.Rows.Count > 0)
  721. {
  722. for (int t = 0; t < dt.Rows.Count; t++)
  723. {
  724. #region 引导
  725. if ((dt.Rows[t]["Pay_Category"].ToString().Trim() != "后期收款"))
  726. {
  727. #region 引导师也有前期提成(无二销)
  728. DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupEarlyPinsPercentage'").Tables[0];
  729. if (dtSystemConfigure.Rows.Count > 0)
  730. {
  731. if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
  732. {
  733. DataGridViewRow dgvr = new DataGridViewRow();
  734. DataGridViewCell cell = null;
  735. cell = new DataGridViewTextBoxCell();
  736. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  737. dgvr.Cells.Add(cell);
  738. cell = new DataGridViewTextBoxCell();
  739. cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
  740. dgvr.Cells.Add(cell);
  741. cell = new DataGridViewTextBoxCell();
  742. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  743. dgvr.Cells.Add(cell);
  744. cell = new DataGridViewTextBoxCell();
  745. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  746. dgvr.Cells.Add(cell);
  747. cell = new DataGridViewTextBoxCell();
  748. cell.Value = "引导前期";
  749. dgvr.Cells.Add(cell);
  750. cell = new DataGridViewTextBoxCell();
  751. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
  752. dgvr.Cells.Add(cell);
  753. cell = new DataGridViewTextBoxCell();
  754. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  755. dgvr.Cells.Add(cell);
  756. cell = new DataGridViewTextBoxCell();
  757. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  758. dgvr.Cells.Add(cell);
  759. cell = new DataGridViewTextBoxCell();
  760. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  761. dgvr.Cells.Add(cell);
  762. cell = new DataGridViewTextBoxCell();
  763. cell.Value = "";
  764. dgvr.Cells.Add(cell);
  765. cell = new DataGridViewTextBoxCell();
  766. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  767. dgvr.Cells.Add(cell);
  768. this.dgv1.Rows.Add(dgvr);
  769. dgv1.ClearSelection();
  770. }
  771. }
  772. #endregion
  773. }
  774. if ((dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString().Trim() == "选片二销"))
  775. {
  776. #region 引导师也有选片二销提成
  777. DataTable dtSystemConfigure = SystemConfigureBll.GetList("Sconfig_Code='MakeupTwoPinsPercentage'").Tables[0];
  778. if (dtSystemConfigure.Rows.Count > 0)
  779. {
  780. if (Convert.ToBoolean(dtSystemConfigure.Rows[0]["Sconfig_IsEnabled"]) == true)
  781. {
  782. DataGridViewRow dgvr = new DataGridViewRow();
  783. DataGridViewCell cell = null;
  784. cell = new DataGridViewTextBoxCell();
  785. cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim();
  786. dgvr.Cells.Add(cell);
  787. cell = new DataGridViewTextBoxCell();
  788. cell.Value = (dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单") + "(" + (dt.Rows[t]["Ordpg_Sights"].ToString().Trim()) + ")";
  789. dgvr.Cells.Add(cell);
  790. cell = new DataGridViewTextBoxCell();
  791. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString("N0");
  792. dgvr.Cells.Add(cell);
  793. cell = new DataGridViewTextBoxCell();
  794. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pay_CreateDatetime"]).ToString("yyyy-MM-dd");
  795. dgvr.Cells.Add(cell);
  796. cell = new DataGridViewTextBoxCell();
  797. cell.Value = "引导选片二销";
  798. dgvr.Cells.Add(cell);
  799. cell = new DataGridViewTextBoxCell();
  800. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim();
  801. dgvr.Cells.Add(cell);
  802. cell = new DataGridViewTextBoxCell();
  803. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString().Trim();
  804. dgvr.Cells.Add(cell);
  805. cell = new DataGridViewTextBoxCell();
  806. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString().Trim();
  807. dgvr.Cells.Add(cell);
  808. cell = new DataGridViewTextBoxCell();
  809. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  810. dgvr.Cells.Add(cell);
  811. cell = new DataGridViewTextBoxCell();
  812. cell.Value = "";
  813. dgvr.Cells.Add(cell);
  814. cell = new DataGridViewTextBoxCell();
  815. cell.Value = dt.Rows[t]["Pay_CustomNumber"].ToString().Trim();
  816. dgvr.Cells.Add(cell);
  817. this.dgv1.Rows.Add(dgvr);
  818. dgv1.ClearSelection();
  819. }
  820. }
  821. #endregion
  822. }
  823. #endregion
  824. }
  825. }
  826. #endregion
  827. #endregion
  828. }
  829. catch (Exception ex)
  830. {
  831. MessageBoxCustom.Show(ex.Message);
  832. }
  833. }
  834. #endregion
  835. #region 摄影与助理数据源绑定
  836. public void PhotographyBind()
  837. {
  838. try
  839. {
  840. dgv2.Rows.Clear();
  841. LYFZ.BLL.BLL_ErpWagesSet WagesSetBll = new BLL.BLL_ErpWagesSet();
  842. DataTable dt = new DataTable();
  843. StringBuilder sql = new StringBuilder();
  844. sql.Append(" (OrdPg_Photographer like '%" + txtTsorder_OpenSingle.Tag.ToString() + "%' or OrdPg_PhotographyAssistant like '%" + txtTsorder_OpenSingle.Tag.ToString() + "%' or OrdPg_MakeupArtist like '%" + txtTsorder_OpenSingle.Tag.ToString() + "%' or OrdPg_MakeupAssistant like '%" + txtTsorder_OpenSingle.Tag.ToString() + "%' or OrdPg_BootDivision like '%" + txtTsorder_OpenSingle.Tag.ToString() + "%')");
  845. sql.Append(" and (OrdPg_PhotographyTime>='" + Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd") + "' and OrdPg_PhotographyTime<='" + Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd") + "' and OrdPg_PhotographyStatus='1' and Ord_Class='1')");
  846. dt = WagesSetBll.Vw_OrdersWagePhotography(sql.ToString()).Tables[0];
  847. if (dt.Rows.Count > 0)
  848. {
  849. for (int t = 0; t < dt.Rows.Count; t++)
  850. {
  851. #region
  852. DataGridViewRow dgvr = new DataGridViewRow();
  853. DataGridViewCell cell = null;
  854. //订单号
  855. cell = new DataGridViewTextBoxCell();
  856. cell.Value = dt.Rows[t]["Ordpg_Number"].ToString().Trim();
  857. dgvr.Cells.Add(cell);
  858. //订单类型
  859. cell = new DataGridViewTextBoxCell();
  860. cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
  861. dgvr.Cells.Add(cell);
  862. //客户1
  863. cell = new DataGridViewTextBoxCell();
  864. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString();
  865. dgvr.Cells.Add(cell);
  866. //客户2
  867. cell = new DataGridViewTextBoxCell();
  868. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString();
  869. dgvr.Cells.Add(cell);
  870. //套系
  871. cell = new DataGridViewTextBoxCell();
  872. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString();
  873. dgvr.Cells.Add(cell);
  874. //套系价格
  875. cell = new DataGridViewTextBoxCell();
  876. cell.Value = dt.Rows[t]["Ord_SeriesPrice"].ToString().Trim();
  877. dgvr.Cells.Add(cell);
  878. //景点
  879. cell = new DataGridViewTextBoxCell();
  880. cell.Value = dt.Rows[t]["OrdPg_Sights"].ToString().Trim();
  881. dgvr.Cells.Add(cell);
  882. //景点级别
  883. cell = new DataGridViewTextBoxCell();
  884. cell.Value = dt.Rows[t]["Sc_ClassName"].ToString().Trim();
  885. dgvr.Cells.Add(cell);
  886. //日期
  887. cell = new DataGridViewTextBoxCell();
  888. cell.Value = Convert.ToDateTime(dt.Rows[t]["OrdPg_PhotographyTime"]).ToString("yyyy-MM-dd");
  889. dgvr.Cells.Add(cell);
  890. //状态
  891. cell = new DataGridViewTextBoxCell();
  892. cell.Value = dt.Rows[t]["OrdPg_PhotographyStatusName"].ToString();
  893. dgvr.Cells.Add(cell);
  894. //摄影
  895. cell = new DataGridViewTextBoxCell();
  896. cell.Value = dt.Rows[t]["OrdPg_PhotographerName"].ToString().Trim();
  897. dgvr.Cells.Add(cell);
  898. //摄影助理
  899. cell = new DataGridViewTextBoxCell();
  900. cell.Value = dt.Rows[t]["OrdPg_PhotographyAssistantName"].ToString().Trim();
  901. dgvr.Cells.Add(cell);
  902. //化妆
  903. cell = new DataGridViewTextBoxCell();
  904. cell.Value = dt.Rows[t]["OrdPg_MakeupArtistName"].ToString().Trim();
  905. dgvr.Cells.Add(cell);
  906. //化妆助理
  907. cell = new DataGridViewTextBoxCell();
  908. cell.Value = dt.Rows[t]["OrdPg_MakeupAssistantName"].ToString().Trim();
  909. dgvr.Cells.Add(cell);
  910. //引导师
  911. cell = new DataGridViewTextBoxCell();
  912. cell.Value = dt.Rows[t]["OrdPg_BootDivisionName"].ToString().Trim();
  913. dgvr.Cells.Add(cell);
  914. //套系类别
  915. cell = new DataGridViewTextBoxCell();
  916. cell.Value = dt.Rows[t]["Ord_PhotographyCategory"].ToString().Trim();
  917. dgvr.Cells.Add(cell);
  918. this.dgv2.Rows.Add(dgvr);
  919. dgv2.ClearSelection();
  920. #endregion
  921. }
  922. }
  923. }
  924. catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
  925. }
  926. #endregion
  927. #region 修片与精修与设计
  928. public void BindPhoto()
  929. {
  930. try
  931. { //Ord_ClothingNameID='" + txtTsorder_OpenSingle.Tag.ToString() + "' or(Ord_ClothingTime>='" + txtTimeStart.Text + "' and Ord_ClothingTime<='" + txtTimeEnd.Text + " 23:59:59.000') or
  932. dgv3.Rows.Clear();
  933. LYFZ.BLL.BLL_ErpWagesSet wagesBll = new BLL.BLL_ErpWagesSet();
  934. DataTable dt = new DataTable();
  935. StringBuilder sql = new StringBuilder();
  936. sql.Append(" ( Ordv_EarlyRepairNameID='" + txtTsorder_OpenSingle.Tag.ToString() + "' or Ordv_DesignerNameID='" + txtTsorder_OpenSingle.Tag.ToString() + "' or Ordv_RefinementNameID='" + txtTsorder_OpenSingle.Tag.ToString() + "')");
  937. sql.Append(" and ((Ordv_EarlyRepairTime>='" + Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd") + "' and Ordv_EarlyRepairTime<='" + Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd") + " 23:59:59.000' and Ordv_EarlyRepairStatus='ok') or (Ordv_DesignerTime>='" + Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd") + "' and Ordv_DesignerTime<='" + Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd") + " 23:59:59.000' and Ordv_DesignerStatus='ok') or (Ordv_RefinementTime>='" + Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd") + "' and Ordv_RefinementTime<='" + Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd") + " 23:59:59.000' and Ordv_RefinementStatus='ok'))");
  938. dt = wagesBll.View_OrdersWage(sql.ToString()).Tables[0];
  939. if (dt.Rows.Count > 0)
  940. {
  941. for (int t = 0; t < dt.Rows.Count; t++)
  942. {
  943. #region
  944. DataGridViewRow dgvr = new DataGridViewRow();
  945. DataGridViewCell cell = null;
  946. //订单号
  947. cell = new DataGridViewTextBoxCell();
  948. cell.Value = dt.Rows[t]["Ord_Number"].ToString().Trim();
  949. dgvr.Cells.Add(cell);
  950. //订单类型
  951. cell = new DataGridViewTextBoxCell();
  952. cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
  953. dgvr.Cells.Add(cell);
  954. //客户1
  955. cell = new DataGridViewTextBoxCell();
  956. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString();
  957. dgvr.Cells.Add(cell);
  958. //客户2
  959. cell = new DataGridViewTextBoxCell();
  960. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString();
  961. dgvr.Cells.Add(cell);
  962. //套系
  963. cell = new DataGridViewTextBoxCell();
  964. cell.Value = dt.Rows[t]["Ord_SeriesName"].ToString();
  965. dgvr.Cells.Add(cell);
  966. //套系价格
  967. cell = new DataGridViewTextBoxCell();
  968. cell.Value = dt.Rows[t]["Ord_SeriesPrice"].ToString().Trim();
  969. dgvr.Cells.Add(cell);
  970. //套系类别
  971. cell = new DataGridViewTextBoxCell();
  972. cell.Value = dt.Rows[t]["Ord_PhotographyCategory"].ToString().Trim();
  973. dgvr.Cells.Add(cell);
  974. //景点
  975. cell = new DataGridViewTextBoxCell();
  976. cell.Value = dt.Rows[t]["OrdPg_Sights"].ToString().Trim();
  977. dgvr.Cells.Add(cell);
  978. //景点等级
  979. cell = new DataGridViewTextBoxCell();
  980. cell.Value = dt.Rows[t]["Sc_ClassName"].ToString().Trim();
  981. dgvr.Cells.Add(cell);
  982. //服装师
  983. cell = new DataGridViewTextBoxCell();
  984. cell.Value = dt.Rows[t]["Ordv_ClothingName"].ToString();
  985. dgvr.Cells.Add(cell);
  986. //日期1
  987. cell = new DataGridViewTextBoxCell();
  988. cell.Value = dt.Rows[t]["Ordv_ClothingTime"].ToString().Trim();
  989. dgvr.Cells.Add(cell);
  990. //服装状态
  991. cell = new DataGridViewTextBoxCell();
  992. cell.Value = dt.Rows[t]["Ordv_ClothingStatus"].ToString().Trim();
  993. dgvr.Cells.Add(cell);
  994. //初修师
  995. cell = new DataGridViewTextBoxCell();
  996. cell.Value = dt.Rows[t]["Ordv_EarlyRepairName"].ToString().Trim();
  997. dgvr.Cells.Add(cell);
  998. //日期2
  999. cell = new DataGridViewTextBoxCell();
  1000. cell.Value = dt.Rows[t]["Ordv_EarlyRepairTime"].ToString().Trim();
  1001. dgvr.Cells.Add(cell);
  1002. //初修状态
  1003. cell = new DataGridViewTextBoxCell();
  1004. cell.Value = dt.Rows[t]["Ordv_EarlyRepairStatus"].ToString().Trim();
  1005. dgvr.Cells.Add(cell);
  1006. //精修师
  1007. cell = new DataGridViewTextBoxCell();
  1008. cell.Value = dt.Rows[t]["Ordv_RefinementName"].ToString().Trim();
  1009. dgvr.Cells.Add(cell);
  1010. //日期3
  1011. cell = new DataGridViewTextBoxCell();
  1012. cell.Value = dt.Rows[t]["Ordv_RefinementTime"].ToString().Trim();
  1013. dgvr.Cells.Add(cell);
  1014. //精修状态
  1015. cell = new DataGridViewTextBoxCell();
  1016. cell.Value = dt.Rows[t]["Ordv_RefinementStatus"].ToString().Trim();
  1017. dgvr.Cells.Add(cell);
  1018. //设计师
  1019. cell = new DataGridViewTextBoxCell();
  1020. cell.Value = dt.Rows[t]["Ordv_DesignerName"].ToString().Trim();
  1021. dgvr.Cells.Add(cell);
  1022. //日期4
  1023. cell = new DataGridViewTextBoxCell();
  1024. cell.Value = dt.Rows[t]["Ordv_DesignerTime"].ToString().Trim();
  1025. dgvr.Cells.Add(cell);
  1026. //设计状态
  1027. cell = new DataGridViewTextBoxCell();
  1028. cell.Value = dt.Rows[t]["Ordv_DesignerStatus"].ToString().Trim();
  1029. dgvr.Cells.Add(cell);
  1030. //选片二销
  1031. cell = new DataGridViewTextBoxCell();
  1032. DataTable dtTwoPie = wagesBll.GetTwoPieSum("Pay_TwoPinsCategoryName='选片二销' and Pay_OrdNumber='" + dt.Rows[t]["Ord_Number"].ToString().Trim() + "'").Tables[0];
  1033. cell.Value = dtTwoPie.Rows[0]["Pay_AmountOf"].ToString() == "" ? "0.00" : dtTwoPie.Rows[0]["Pay_AmountOf"].ToString();
  1034. dgvr.Cells.Add(cell);
  1035. this.dgv3.Rows.Add(dgvr);
  1036. dgv3.ClearSelection();
  1037. #endregion
  1038. }
  1039. }
  1040. }
  1041. catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
  1042. }
  1043. #endregion
  1044. #region 计件提成
  1045. public void BindPiece(string Tsorder_OpenSingle, string TimeStart, string TimeEnd)
  1046. {
  1047. try
  1048. {
  1049. dgv4.Rows.Clear();
  1050. lblPrice.Visible = true;
  1051. decimal Price = 0;
  1052. LYFZ.BLL.BLL_ErpPieceCommissionRecords PieceCommissionRecordsBll = new BLL.BLL_ErpPieceCommissionRecords();
  1053. DataTable dt = new DataTable();
  1054. StringBuilder sql = new StringBuilder();
  1055. sql.Append(" Pcr_DigitalDivision='" + Tsorder_OpenSingle + "'");
  1056. sql.Append(" and (Pcr_Date>='" + TimeStart + "' and Pcr_Date<='" + TimeEnd + " 23:59:59.000')");
  1057. dt = PieceCommissionRecordsBll.Vw_ErpPieceCommissionRecords(sql.ToString()).Tables[0];
  1058. if (dt.Rows.Count > 0)
  1059. {
  1060. for (int t = 0; t < dt.Rows.Count; t++)
  1061. {
  1062. #region
  1063. DataGridViewRow dgvr = new DataGridViewRow();
  1064. DataGridViewCell cell = null;
  1065. cell = new DataGridViewTextBoxCell();
  1066. cell.Value = dt.Rows[t]["Pcr_OrderNumber"].ToString().Trim();
  1067. dgvr.Cells.Add(cell);
  1068. //订单类型
  1069. cell = new DataGridViewTextBoxCell();
  1070. cell.Value = dt.Rows[t]["Ord_Type"].ToString().Trim() == "0" ? "婚纱订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "1" ? "儿童订单" : dt.Rows[t]["Ord_Type"].ToString().Trim() == "2" ? "写真订单" : "服务订单";
  1071. dgvr.Cells.Add(cell);
  1072. cell = new DataGridViewTextBoxCell();
  1073. cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString();
  1074. dgvr.Cells.Add(cell);
  1075. cell = new DataGridViewTextBoxCell();
  1076. cell.Value = dt.Rows[t]["Ord_CustomerName2"].ToString();
  1077. dgvr.Cells.Add(cell);
  1078. //提成金额
  1079. LYFZ.BLL.BLL_ErpWageCommissionSet WageCommissionSetbll = new BLL.BLL_ErpWageCommissionSet();
  1080. DataTable dtWageCommissionSet = WageCommissionSetbll.GetList("Wcs_TypeCode='" + dt.Rows[t]["Pcr_CompletionContents"] + "'").Tables[0];
  1081. string Wcs_Percentage = "0";
  1082. if (dtWageCommissionSet.Rows.Count > 0)
  1083. {
  1084. Wcs_Percentage = dtWageCommissionSet.Rows[0]["Wcs_Percentage"].ToString() == "" ? "0" : dtWageCommissionSet.Rows[0]["Wcs_Percentage"].ToString();
  1085. }
  1086. cell = new DataGridViewTextBoxCell();
  1087. cell.Value = Convert.ToDecimal(Convert.ToDecimal(dt.Rows[t]["Pcr_Quantity"]) * Convert.ToDecimal(Wcs_Percentage)).ToString("N2");
  1088. dgvr.Cells.Add(cell);
  1089. //部门
  1090. cell = new DataGridViewTextBoxCell();
  1091. cell.Value = "数码师";
  1092. dgvr.Cells.Add(cell);
  1093. //内容
  1094. cell = new DataGridViewTextBoxCell();
  1095. cell.Value = dt.Rows[t]["Pcr_CompletionContentsName"].ToString().Trim();
  1096. dgvr.Cells.Add(cell);
  1097. //数量
  1098. cell = new DataGridViewTextBoxCell();
  1099. cell.Value = dt.Rows[t]["Pcr_Quantity"].ToString().Trim();
  1100. dgvr.Cells.Add(cell);
  1101. //单价
  1102. cell = new DataGridViewTextBoxCell();
  1103. cell.Value = Wcs_Percentage;
  1104. dgvr.Cells.Add(cell);
  1105. //提成方式
  1106. cell = new DataGridViewTextBoxCell();
  1107. cell.Value = "单价*数量";
  1108. dgvr.Cells.Add(cell);
  1109. //套系价格
  1110. cell = new DataGridViewTextBoxCell();
  1111. cell.Value = dt.Rows[t]["Ord_SeriesPrice"].ToString().Trim();
  1112. dgvr.Cells.Add(cell);
  1113. //日期
  1114. cell = new DataGridViewTextBoxCell();
  1115. cell.Value = Convert.ToDateTime(dt.Rows[t]["Pcr_Date"]).ToString("yyyy-MM-dd");
  1116. dgvr.Cells.Add(cell);
  1117. //合计总和
  1118. decimal ob = Convert.ToDecimal(Convert.ToDecimal(dt.Rows[t]["Pcr_Quantity"]) * Convert.ToDecimal(Wcs_Percentage));
  1119. Price += Convert.ToDecimal(ob.ToString("N2"));
  1120. this.dgv4.Rows.Add(dgvr);
  1121. dgv4.ClearSelection();
  1122. #endregion
  1123. lblPrice.Text = "(总和:" + Price + ")";
  1124. Piece = Price;
  1125. }
  1126. }
  1127. else
  1128. {
  1129. lblPrice.Text = "(总和:0.00)";
  1130. Piece = 0.00m;
  1131. }
  1132. }
  1133. catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
  1134. }
  1135. #endregion
  1136. #endregion
  1137. #region 绑定第二级人员
  1138. /// <summary>
  1139. /// 绑定第二级人员
  1140. /// </summary>
  1141. /// <param name="nodes">TreeView的节点集合</param>
  1142. /// <param name="dataSource">数据源</param>
  1143. /// <param name="parentid"></param>
  1144. private void CreateTreeViewDepartmentUser(TreeNodeCollection nodes, string ClassCode)
  1145. {
  1146. if (ClassCode != "")
  1147. {
  1148. LYFZ.BLL.BLL_ErpUser BLLerpuser = new BLL.BLL_ErpUser();
  1149. DataTable tbl = BLLerpuser.GetList("User_Department='" + ClassCode + "'").Tables[0];
  1150. if (tbl.Rows.Count > 0)
  1151. {
  1152. TreeNode node;
  1153. for (int i = 0; i < tbl.Rows.Count; i++)
  1154. {
  1155. node = new TreeNode();
  1156. node.Text = tbl.Rows[i]["User_Name"].ToString();
  1157. node.Tag = tbl.Rows[i]["User_EmployeeID"].ToString();
  1158. node.Name = tbl.Rows[i]["User_Account"].ToString();
  1159. nodes.Add(node);
  1160. }
  1161. }
  1162. }
  1163. }
  1164. #endregion
  1165. #region 时间控件
  1166. protected override void txtTimeStart_Leave(object sender, EventArgs e)
  1167. {
  1168. if (this.txtTimeStart.Text.Trim() != "")
  1169. {
  1170. if (LYFZ.Command.Command_Validate.IsDateTime(this.txtTimeStart.Text.Trim()) == false)
  1171. {
  1172. this.txtTimeStart.Text = "";
  1173. MessageBoxCustom.Show("开始时间格式输入错误");
  1174. txtTimeStart.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().AddDays(1 - LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().Day)).ToString("yyyy-MM-dd");
  1175. }
  1176. }
  1177. }
  1178. protected override void txtTimeStart_Enter(object sender, EventArgs e)
  1179. {
  1180. if (this.txtTimeStart.Text == "")
  1181. {
  1182. txtTimeStart.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().AddDays(1 - LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime().Day)).ToString("yyyy-MM-dd");
  1183. }
  1184. }
  1185. protected override void txtTimeEnd_Leave(object sender, EventArgs e)
  1186. {
  1187. if (this.txtTimeEnd.Text.Trim() != "")
  1188. {
  1189. if (LYFZ.Command.Command_Validate.IsDateTime(this.txtTimeEnd.Text.Trim()) == false)
  1190. {
  1191. this.txtTimeEnd.Text = "";
  1192. MessageBoxCustom.Show("结束时间格式输入错误");
  1193. txtTimeEnd.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime()).ToString("yyyy-MM-dd");
  1194. }
  1195. }
  1196. }
  1197. protected override void txtTimeEnd_Enter(object sender, EventArgs e)
  1198. {
  1199. if (this.txtTimeEnd.Text == "")
  1200. {
  1201. txtTimeEnd.Text = Convert.ToDateTime(LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetServerDateTime()).ToString("yyyy-MM-dd");
  1202. }
  1203. }
  1204. #endregion
  1205. #region 时间查询
  1206. protected override void btnSelect_Click(object sender, EventArgs e)
  1207. {
  1208. WaitForm wf = new WaitForm();
  1209. wf.ShowForm(this);
  1210. try
  1211. {
  1212. if (string.IsNullOrEmpty(txtTsorder_OpenSingle.Text))
  1213. {
  1214. MessageBoxCustom.Show("请选择人员!");
  1215. return;
  1216. }
  1217. dgv1.Rows.Clear();
  1218. dgv2.Rows.Clear();
  1219. dgv3.Rows.Clear();
  1220. dgv4.Rows.Clear();
  1221. if (string.IsNullOrEmpty(txtTimeStart.Text) || string.IsNullOrEmpty(txtTimeEnd.Text))
  1222. {
  1223. MessageBoxCustom.Show("请输入时间!");
  1224. return;
  1225. }
  1226. LYFZ.BLL.BLL_ErpWagesSet wagesBll = new BLL.BLL_ErpWagesSet();
  1227. #region 获取人员基本信息
  1228. DataTable wagesdt = wagesBll.GetList("Ws_StaffCode='" + txtTsorder_OpenSingle.Tag.ToString() + "'").Tables[0];
  1229. if (wagesdt.Rows.Count > 0)
  1230. {
  1231. txtWs_Remark.Text = wagesdt.Rows[0]["Ws_Remark"].ToString();
  1232. txtWs_BasicWage.Text = wagesdt.Rows[0]["Ws_BasicWage"].ToString();
  1233. }
  1234. else
  1235. {
  1236. txtWs_Remark.Text = "";
  1237. txtWs_BasicWage.Text = "0.00";
  1238. }
  1239. #endregion
  1240. #region 获取列表
  1241. //订单,二销提成数据源绑定
  1242. // PaymentBind();
  1243. BindSalarylist(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
  1244. //摄影与助理数据源绑定
  1245. PhotographyBind();
  1246. //修片与精修与设计
  1247. BindPhoto();
  1248. //计件提成
  1249. BindPiece(txtTsorder_OpenSingle.Tag.ToString(), Convert.ToDateTime(txtTimeStart.Text).ToString("yyyy-MM-dd"), Convert.ToDateTime(txtTimeEnd.Text).ToString("yyyy-MM-dd"));
  1250. #endregion
  1251. #region 获取工资
  1252. GetWages(txtTsorder_OpenSingle.Tag.ToString());
  1253. #endregion
  1254. wf.CloseForm();
  1255. wf = null;
  1256. }
  1257. catch (Exception ex)
  1258. {
  1259. wf.CloseForm();
  1260. wf = null;
  1261. MessageBoxCustom.Show(ex.Message);
  1262. }
  1263. }
  1264. #endregion
  1265. #region 获取工资
  1266. /// <summary>
  1267. /// 获取工资
  1268. /// </summary>
  1269. /// <param name="Tsorder_OpenSingle"></param>
  1270. public void GetWages(string Tsorder_OpenSingle)
  1271. {
  1272. try
  1273. {
  1274. LYFZ.BLL.BLL_ErpSystemCategory SystemCategorybll = new BLL.BLL_ErpSystemCategory();
  1275. LYFZ.BLL.BLL_ErpWagesSet Wagebll = new BLL.BLL_ErpWagesSet();
  1276. LYFZ.BLL.BLL_ErpCommissionPercentage CommissionPercentagebll = new BLL.BLL_ErpCommissionPercentage();
  1277. LYFZ.BLL.BLL_ErpOrdersPhotography OrdersPhotographybll = new BLL.BLL_ErpOrdersPhotography();
  1278. LYFZ.BLL.BLL_ErpWageCommissionSet WageCommissionSetbll = new BLL.BLL_ErpWageCommissionSet();
  1279. LYFZ.BLL.BLL_ErpWagesSet WagesSetbll = new BLL.BLL_ErpWagesSet();
  1280. LYFZ.BLL.BLL_ErpTwoPinsProjectCommissionProportion TwoPinsProjectCommissionProportion = new BLL.BLL_ErpTwoPinsProjectCommissionProportion();
  1281. DataTable dt = new DataTable();
  1282. if (dgv1.Rows.Count > 0)
  1283. {
  1284. for (int i = 0; i < dgv1.Rows.Count; i++)
  1285. {
  1286. string Pay_OrdNumber = dgv1.Rows[i].Cells["Pay_OrdNumber"].Value.ToString();
  1287. decimal Pay_AmountOf = Convert.ToDecimal(dgv1.Rows[i].Cells["Pay_AmountOf"].Value);
  1288. string Pay_Category = dgv1.Rows[i].Cells["Pay_Category"].Value.ToString();
  1289. object OrdPe_Type = dgv1.Rows[i].Cells["OrdPe_Type"].Value;
  1290. string Pay_CustomNumber = dgv1.Rows[i].Cells["Pay_CustomNumber"].Value.ToString();
  1291. #region 获取前期业绩收款记录
  1292. #region 先获取门市提成工资比重(只能在前期收款)
  1293. if (Pay_Category == "前期收款")
  1294. {
  1295. if (OrdPe_Type != null)
  1296. {
  1297. #region
  1298. //获取主门市个数
  1299. decimal MainCount = Convert.ToDecimal(Wagebll.GetPersonCount(" OrdPe_OrderNumber='" + Pay_OrdNumber + "' and OrdPe_Type='0'").Tables[0].Rows[0]["count"]);
  1300. //获取副门市个数
  1301. decimal DeputyCount = Convert.ToDecimal(Wagebll.GetPersonCount(" OrdPe_OrderNumber='" + Pay_OrdNumber + "' and OrdPe_Type='1'").Tables[0].Rows[0]["count"]);
  1302. //获取门市比重
  1303. decimal MainProportion = 0;
  1304. decimal DeputyProportion = 0;
  1305. if (CommissionPercentagebll.GetList("Cp_ProportionCode='MainStoreProportion'").Tables[0].Rows.Count > 0)
  1306. { MainProportion = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='MainStoreProportion'").Tables[0].Rows[0]["Cp_Proportion"]); }
  1307. else { MainProportion = 0; }
  1308. if (CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyStoreProportion'").Tables[0].Rows.Count > 0)
  1309. { DeputyProportion = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyStoreProportion'").Tables[0].Rows[0]["Cp_Proportion"]); }
  1310. else { DeputyProportion = 0; }
  1311. //如果主门市个数只有一个,则按100%比例分配
  1312. if ((MainCount == 1 && DeputyCount == 0))
  1313. {
  1314. dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Pay_AmountOf.ToString("N0"); ;
  1315. }
  1316. //如果主门市个数只有一个,副门市多个 则按比例分配
  1317. if ((MainCount == 1 && DeputyCount > 0))
  1318. {
  1319. //公式 金额=(总金额/总比例)*门市比重
  1320. if (Convert.ToInt32(OrdPe_Type) == 0) //主
  1321. {
  1322. decimal MsMoney = 0;
  1323. MsMoney = Pay_AmountOf / ((MainCount * MainProportion) + (DeputyCount * DeputyProportion)) * MainProportion;
  1324. dgv1.Rows[i].Cells["Pay_AmountOf"].Value = MsMoney.ToString("N0");
  1325. }
  1326. if (Convert.ToInt32(OrdPe_Type) == 1) //副
  1327. {
  1328. decimal MsMoney = 0;
  1329. MsMoney = Pay_AmountOf / ((MainCount * MainProportion) + (DeputyCount * DeputyProportion)) * DeputyProportion;
  1330. dgv1.Rows[i].Cells["Pay_AmountOf"].Value = MsMoney.ToString("N0");
  1331. }
  1332. }
  1333. #endregion
  1334. }
  1335. else { dgv1.Rows.RemoveAt(i); }
  1336. }
  1337. #endregion
  1338. #region 获取景点比重
  1339. #region 获取参数与定义参数
  1340. //获取等级级别比重
  1341. decimal OneLevel = 0;
  1342. decimal TwoLevel = 0;
  1343. decimal ThreeLevel = 0;
  1344. if (CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADDEBFJDFFC'").Tables[0].Rows.Count > 0)
  1345. { OneLevel = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADDEBFJDFFC'").Tables[0].Rows[0]["Cp_Proportion"]); }
  1346. else { OneLevel = 0; }
  1347. if (CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADEGBGAFFJC'").Tables[0].Rows.Count > 0)
  1348. { TwoLevel = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADEGBGAFFJC'").Tables[0].Rows[0]["Cp_Proportion"]); }
  1349. else { TwoLevel = 0; }
  1350. if (CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADAFBHBCHCI'").Tables[0].Rows.Count > 0)
  1351. { ThreeLevel = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='BEBBBCADAFBHBCHCI'").Tables[0].Rows[0]["Cp_Proportion"]); }
  1352. else { ThreeLevel = 0; }
  1353. //获取等级级别个数
  1354. decimal OneLevelCount = Convert.ToDecimal(Wagebll.GetAttractionsRatingCount(" Ordpg_Number='" + Pay_OrdNumber + "' and Ordpg_SightsLevel='BEBBBCADDEBFJDFFC'").Tables[0].Rows[0]["count"]);
  1355. decimal TwoLevelCount = Convert.ToDecimal(Wagebll.GetAttractionsRatingCount(" Ordpg_Number='" + Pay_OrdNumber + "' and Ordpg_SightsLevel='BEBBBCADEGBGAFFJC'").Tables[0].Rows[0]["count"]);
  1356. decimal ThreeLevelCount = Convert.ToDecimal(Wagebll.GetAttractionsRatingCount(" Ordpg_Number='" + Pay_OrdNumber + "' and Ordpg_SightsLevel='BEBBBCADAFBHBCHCI'").Tables[0].Rows[0]["count"]);
  1357. #endregion
  1358. #region 摄影前期
  1359. if (Pay_Category == "摄影前期")
  1360. {
  1361. //获取摄影比重
  1362. decimal MainPhotography = 0;
  1363. decimal DeputyPhotography = 0;
  1364. if (CommissionPercentagebll.GetList("Cp_ProportionCode='MainPhotography'").Tables[0].Rows.Count > 0)
  1365. { MainPhotography = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='MainPhotography'").Tables[0].Rows[0]["Cp_Proportion"]); }
  1366. else { MainPhotography = 0; }
  1367. if (CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyPhotography'").Tables[0].Rows.Count > 0)
  1368. { DeputyPhotography = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyPhotography'").Tables[0].Rows[0]["Cp_Proportion"]); }
  1369. else { DeputyPhotography = 0; }
  1370. //多种条件获取工资
  1371. #region 1.如果所以景点阶段都相同
  1372. if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
  1373. {
  1374. decimal Attractionswages = 0; //获取景点工资
  1375. //一级
  1376. if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0))
  1377. {
  1378. //获取景点工资
  1379. Attractionswages = Pay_AmountOf * (100 / 100 / OneLevelCount);
  1380. //获取摄影人员
  1381. dt = OrdersPhotographybll.GetList("OrdPg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADDEBFJDFFC'").Tables[0];
  1382. }
  1383. //二级
  1384. if ((OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0))
  1385. {
  1386. //获取景点工资
  1387. Attractionswages = Pay_AmountOf * (100 / 100 / TwoLevelCount);
  1388. //获取摄影人员
  1389. dt = OrdersPhotographybll.GetList("OrdPg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADEGBGAFFJC'").Tables[0];
  1390. }
  1391. //三级
  1392. if ((OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
  1393. {
  1394. //获取景点工资
  1395. Attractionswages = Pay_AmountOf * (100 / 100 / ThreeLevelCount);
  1396. //获取摄影人员
  1397. dt = OrdersPhotographybll.GetList("OrdPg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADAFBHBCHCI'").Tables[0];
  1398. }
  1399. if (dt.Rows.Count > 0)
  1400. {
  1401. decimal MainAttractionsPerWages = 0; //主摄影工资
  1402. decimal DeputyAttractionsPerWages = 0; //摄影助理工资
  1403. for (int y = 0; y < dt.Rows.Count; y++)
  1404. {
  1405. string OrdPg_Photographer = dt.Rows[y]["OrdPg_Photographer"].ToString();
  1406. string OrdPg_PhotographyAssistant = dt.Rows[y]["OrdPg_PhotographyAssistant"].ToString();
  1407. //主摄影工资
  1408. if (OrdPg_Photographer == txtTsorder_OpenSingle.Tag.ToString())
  1409. {
  1410. if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
  1411. {
  1412. MainAttractionsPerWages += Attractionswages * (MainPhotography / 100);
  1413. }
  1414. else
  1415. {
  1416. MainAttractionsPerWages += Attractionswages * 1;
  1417. }
  1418. }
  1419. //摄影助理工资
  1420. if (OrdPg_PhotographyAssistant == txtTsorder_OpenSingle.Tag.ToString())
  1421. {
  1422. if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
  1423. {
  1424. DeputyAttractionsPerWages += Attractionswages * (DeputyPhotography / 100);
  1425. }
  1426. else
  1427. {
  1428. DeputyAttractionsPerWages += Attractionswages * 1;
  1429. }
  1430. }
  1431. dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Convert.ToDecimal(MainAttractionsPerWages + DeputyAttractionsPerWages).ToString("N0");
  1432. }
  1433. }
  1434. }
  1435. #endregion
  1436. #region 2.如果等级不相同
  1437. // if ((OneLevelCount >= 1 && TwoLevelCount >= 1 && ThreeLevelCount >= 1))
  1438. else
  1439. {
  1440. decimal Onej = 0;//一级景点工资
  1441. decimal Twoj = 0; //二级景点工资
  1442. decimal Threej = 0; //三级景点工资
  1443. //获取景点等级总百分比
  1444. decimal AttractionsPercentage = (OneLevelCount * OneLevel) + (TwoLevelCount * TwoLevel) + (ThreeLevelCount * ThreeLevel);
  1445. Onej = Pay_AmountOf / AttractionsPercentage * OneLevel;
  1446. Twoj = Pay_AmountOf / AttractionsPercentage * TwoLevel;
  1447. Threej = Pay_AmountOf / AttractionsPercentage * ThreeLevel;
  1448. //按级别获取工资
  1449. //获取摄影人员
  1450. dt = OrdersPhotographybll.GetList("Ordpg_Number='" + Pay_OrdNumber + "'").Tables[0];
  1451. if (dt.Rows.Count > 0)
  1452. {
  1453. decimal MainAttractionsPerWages = 0; //主摄影工资
  1454. decimal DeputyAttractionsPerWages = 0; //摄影助理工资
  1455. for (int y = 0; y < dt.Rows.Count; y++)
  1456. {
  1457. string OrdPg_Photographer = dt.Rows[y]["OrdPg_Photographer"].ToString();
  1458. string OrdPg_PhotographyAssistant = dt.Rows[y]["OrdPg_PhotographyAssistant"].ToString();
  1459. string OrdPg_SightsLevel = dt.Rows[y]["OrdPg_SightsLevel"].ToString();
  1460. #region 主摄影工资
  1461. if (OrdPg_Photographer == txtTsorder_OpenSingle.Tag.ToString())
  1462. {
  1463. //一级
  1464. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  1465. {
  1466. if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
  1467. {
  1468. MainAttractionsPerWages += Onej * (MainPhotography / 100);
  1469. }
  1470. else
  1471. {
  1472. MainAttractionsPerWages += Onej * 1;
  1473. }
  1474. }
  1475. //二级
  1476. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  1477. {
  1478. if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
  1479. {
  1480. MainAttractionsPerWages += Twoj * (MainPhotography / 100);
  1481. }
  1482. else
  1483. {
  1484. MainAttractionsPerWages += Twoj * 1;
  1485. }
  1486. }
  1487. //三级
  1488. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  1489. {
  1490. if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
  1491. {
  1492. MainAttractionsPerWages += Threej * (MainPhotography / 100);
  1493. }
  1494. else
  1495. {
  1496. MainAttractionsPerWages += Threej * 1;
  1497. }
  1498. }
  1499. }
  1500. #endregion
  1501. #region 摄影助理工资
  1502. if (OrdPg_PhotographyAssistant == txtTsorder_OpenSingle.Tag.ToString())
  1503. {
  1504. //一级
  1505. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  1506. {
  1507. if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
  1508. {
  1509. DeputyAttractionsPerWages += Onej * (DeputyPhotography / 100);
  1510. }
  1511. else
  1512. {
  1513. DeputyAttractionsPerWages += Onej * 1;
  1514. }
  1515. }
  1516. //二级
  1517. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  1518. {
  1519. if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
  1520. {
  1521. DeputyAttractionsPerWages += Twoj * (DeputyPhotography / 100);
  1522. }
  1523. else
  1524. {
  1525. DeputyAttractionsPerWages += Twoj * 1;
  1526. }
  1527. }
  1528. //三级
  1529. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  1530. {
  1531. if (!string.IsNullOrEmpty(OrdPg_Photographer) && !string.IsNullOrEmpty(OrdPg_PhotographyAssistant))
  1532. {
  1533. DeputyAttractionsPerWages += Threej * (DeputyPhotography / 100);
  1534. }
  1535. else
  1536. {
  1537. DeputyAttractionsPerWages += Threej * 1;
  1538. }
  1539. }
  1540. }
  1541. #endregion
  1542. dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Convert.ToDecimal(MainAttractionsPerWages + DeputyAttractionsPerWages).ToString("N0");
  1543. }
  1544. }
  1545. }
  1546. #endregion
  1547. }
  1548. #endregion
  1549. #region 化妆前期
  1550. if (Pay_Category == "化妆前期")
  1551. {
  1552. //获取化妆比重
  1553. decimal MainMake = 0;
  1554. decimal DeputyMake = 0;
  1555. if (CommissionPercentagebll.GetList("Cp_ProportionCode='MainMake'").Tables[0].Rows.Count > 0)
  1556. { MainMake = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='MainMake'").Tables[0].Rows[0]["Cp_Proportion"]); }
  1557. else { MainMake = 0; }
  1558. if (CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyMake'").Tables[0].Rows.Count > 0)
  1559. { DeputyMake = Convert.ToDecimal(CommissionPercentagebll.GetList("Cp_ProportionCode='DeputyMake'").Tables[0].Rows[0]["Cp_Proportion"]); }
  1560. else { DeputyMake = 0; }
  1561. //多种条件获取工资
  1562. #region 1.如果所以景点阶段都相同
  1563. if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0) || (OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
  1564. {
  1565. decimal Attractionswages = 0; //获取景点工资
  1566. //一级
  1567. if ((OneLevelCount >= 1 && TwoLevelCount == 0 && ThreeLevelCount == 0))
  1568. {
  1569. //获取景点工资
  1570. Attractionswages = Pay_AmountOf * (100 / 100 / OneLevelCount);
  1571. //获取化妆人员
  1572. dt = OrdersPhotographybll.GetList("Ordpg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADDEBFJDFFC'").Tables[0];
  1573. }
  1574. //二级
  1575. if ((OneLevelCount == 0 && TwoLevelCount >= 1 && ThreeLevelCount == 0))
  1576. {
  1577. //获取景点工资
  1578. Attractionswages = Pay_AmountOf * (100 / 100 / TwoLevelCount);
  1579. //获取化妆人员
  1580. dt = OrdersPhotographybll.GetList("Ordpg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADEGBGAFFJC'").Tables[0];
  1581. }
  1582. //三级
  1583. if ((OneLevelCount == 0 && TwoLevelCount == 0 && ThreeLevelCount >= 1))
  1584. {
  1585. //获取景点工资
  1586. Attractionswages = Pay_AmountOf * (100 / 100 / ThreeLevelCount);
  1587. //获取化妆人员
  1588. dt = OrdersPhotographybll.GetList("Ordpg_Number='" + Pay_OrdNumber + "' and OrdPg_SightsLevel='BEBBBCADAFBHBCHCI'").Tables[0];
  1589. }
  1590. if (dt.Rows.Count > 0)
  1591. {
  1592. decimal MainAttractionsPerWages = 0; //主化妆师工资
  1593. decimal DeputyAttractionsPerWages = 0; //化妆助理工资
  1594. for (int y = 0; y < dt.Rows.Count; y++)
  1595. {
  1596. string OrdPg_MakeupArtist = dt.Rows[y]["OrdPg_MakeupArtist"].ToString();
  1597. string OrdPg_MakeupAssistant = dt.Rows[y]["OrdPg_MakeupAssistant"].ToString();
  1598. //主化妆工资
  1599. if (OrdPg_MakeupArtist == txtTsorder_OpenSingle.Tag.ToString())
  1600. {
  1601. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
  1602. {
  1603. MainAttractionsPerWages += Attractionswages * (MainMake / 100);
  1604. }
  1605. else
  1606. {
  1607. MainAttractionsPerWages += Attractionswages * 1;
  1608. }
  1609. }
  1610. //化妆助理工资
  1611. if (OrdPg_MakeupAssistant == txtTsorder_OpenSingle.Tag.ToString())
  1612. {
  1613. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
  1614. {
  1615. DeputyAttractionsPerWages += Attractionswages * (DeputyMake / 100);
  1616. }
  1617. else
  1618. {
  1619. DeputyAttractionsPerWages += Attractionswages * 1;
  1620. }
  1621. }
  1622. dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Convert.ToDecimal(MainAttractionsPerWages + DeputyAttractionsPerWages).ToString("N0");
  1623. }
  1624. }
  1625. }
  1626. #endregion
  1627. #region 2.如果等级不相同
  1628. // if ((OneLevelCount >= 1 && TwoLevelCount >= 1 && ThreeLevelCount >= 1))
  1629. else
  1630. {
  1631. decimal Onej = 0;//一级景点工资
  1632. decimal Twoj = 0; //二级景点工资
  1633. decimal Threej = 0; //三级景点工资
  1634. //获取景点等级总百分比
  1635. decimal AttractionsPercentage = (OneLevelCount * OneLevel) + (TwoLevelCount * TwoLevel) + (ThreeLevelCount * ThreeLevel);
  1636. Onej = Pay_AmountOf / AttractionsPercentage * OneLevel;
  1637. Twoj = Pay_AmountOf / AttractionsPercentage * TwoLevel;
  1638. Threej = Pay_AmountOf / AttractionsPercentage * ThreeLevel;
  1639. //按级别获取工资
  1640. //获取化妆人员
  1641. dt = OrdersPhotographybll.GetList("Ordpg_Number='" + Pay_OrdNumber + "'").Tables[0];
  1642. if (dt.Rows.Count > 0)
  1643. {
  1644. decimal MainAttractionsPerWages = 0; //主化妆工资
  1645. decimal DeputyAttractionsPerWages = 0; //化妆助理工资
  1646. for (int y = 0; y < dt.Rows.Count; y++)
  1647. {
  1648. string OrdPg_MakeupArtist = dt.Rows[y]["OrdPg_MakeupArtist"].ToString();
  1649. string OrdPg_MakeupAssistant = dt.Rows[y]["OrdPg_MakeupAssistant"].ToString();
  1650. string OrdPg_SightsLevel = dt.Rows[y]["OrdPg_SightsLevel"].ToString();
  1651. #region 主摄影工资
  1652. if (OrdPg_MakeupArtist == txtTsorder_OpenSingle.Tag.ToString())
  1653. {
  1654. //一级
  1655. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  1656. {
  1657. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
  1658. {
  1659. MainAttractionsPerWages += Onej * (MainMake / 100);
  1660. }
  1661. else
  1662. {
  1663. MainAttractionsPerWages += Onej * 1;
  1664. }
  1665. }
  1666. //二级
  1667. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  1668. {
  1669. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
  1670. {
  1671. MainAttractionsPerWages += Twoj * (MainMake / 100);
  1672. }
  1673. else
  1674. {
  1675. MainAttractionsPerWages += Twoj * 1;
  1676. }
  1677. }
  1678. //三级
  1679. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  1680. {
  1681. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
  1682. {
  1683. MainAttractionsPerWages += Threej * (MainMake / 100);
  1684. }
  1685. else
  1686. {
  1687. MainAttractionsPerWages += Threej * 1;
  1688. }
  1689. }
  1690. }
  1691. #endregion
  1692. #region 摄影助理工资
  1693. if (OrdPg_MakeupAssistant == txtTsorder_OpenSingle.Tag.ToString())
  1694. {
  1695. //一级
  1696. if (OrdPg_SightsLevel == "BEBBBCADDEBFJDFFC")
  1697. {
  1698. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
  1699. {
  1700. DeputyAttractionsPerWages += Onej * (DeputyMake / 100);
  1701. }
  1702. else
  1703. {
  1704. DeputyAttractionsPerWages += Onej * 1;
  1705. }
  1706. }
  1707. //二级
  1708. if (OrdPg_SightsLevel == "BEBBBCADEGBGAFFJC")
  1709. {
  1710. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
  1711. {
  1712. DeputyAttractionsPerWages += Twoj * (DeputyMake / 100);
  1713. }
  1714. else
  1715. {
  1716. DeputyAttractionsPerWages += Twoj * 1;
  1717. }
  1718. }
  1719. //三级
  1720. if (OrdPg_SightsLevel == "BEBBBCADAFBHBCHCI")
  1721. {
  1722. if (!string.IsNullOrEmpty(OrdPg_MakeupArtist) && !string.IsNullOrEmpty(OrdPg_MakeupAssistant))
  1723. {
  1724. DeputyAttractionsPerWages += Threej * (DeputyMake / 100);
  1725. }
  1726. else
  1727. {
  1728. DeputyAttractionsPerWages += Threej * 1;
  1729. }
  1730. }
  1731. }
  1732. #endregion
  1733. dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Convert.ToDecimal(MainAttractionsPerWages + DeputyAttractionsPerWages).ToString("N0");
  1734. }
  1735. }
  1736. }
  1737. #endregion
  1738. }
  1739. #endregion
  1740. #endregion
  1741. #endregion
  1742. #region 获取后期收款比重
  1743. if (!string.IsNullOrEmpty(Pay_CustomNumber))
  1744. {
  1745. dt = new DataTable();
  1746. dt = TwoPinsProjectCommissionProportion.GetList("Tpc_CustomNumber='" + Pay_CustomNumber + "' and Tpc_OpenSingle='" + Tsorder_OpenSingle + "'").Tables[0];
  1747. if (dt.Rows.Count > 0)
  1748. {
  1749. decimal Tpc_CommissionPercentage = Convert.ToDecimal(dt.Rows[0]["Tpc_CommissionPercentage"]);
  1750. if (Tpc_CommissionPercentage > 0)
  1751. {
  1752. dgv1.Rows[i].Cells["Pay_AmountOf"].Value = Convert.ToDecimal(Pay_AmountOf * Tpc_CommissionPercentage / 100).ToString("N0");
  1753. }
  1754. else { dgv1.Rows[i].Cells["Pay_AmountOf"].Value = "0"; }
  1755. }
  1756. }
  1757. #endregion
  1758. }
  1759. }
  1760. decimal S_QQYJ = 0; //前期收款业绩
  1761. decimal S_QQYJ_SH = 0; //摄影前期,化妆前期,引导前期业绩
  1762. decimal S_EXYJ = 0; //二销业绩
  1763. decimal S_EXYJ_Tc = 0; //二销提成
  1764. decimal QQSK_TC = 0; //前期收款提成
  1765. decimal QQSK_SH_TC = 0; //摄影,化妆前期,引导前期提成
  1766. string Wcs_TypeCode = ""; //类别代码
  1767. for (int i = 0; i < dgv1.Rows.Count; i++)
  1768. {
  1769. decimal Pay_AmountOf = Convert.ToDecimal(dgv1.Rows[i].Cells["Pay_AmountOf"].Value); //金额
  1770. string Pay_Category = dgv1.Rows[i].Cells["Pay_Category"].Value.ToString(); //类别
  1771. #region 工资各业绩总额
  1772. //前期收款
  1773. if (Pay_Category == "前期收款")
  1774. {
  1775. S_QQYJ += Pay_AmountOf;
  1776. }//摄影前期,化妆前期,引导前期
  1777. else if (Pay_Category == "摄影前期" || Pay_Category == "化妆前期" || Pay_Category == "引导前期")
  1778. {
  1779. S_QQYJ_SH += Pay_AmountOf;
  1780. }
  1781. else
  1782. {
  1783. //二销业绩
  1784. S_EXYJ += Pay_AmountOf;
  1785. }
  1786. #endregion
  1787. #region 获取二销提成
  1788. if (Pay_Category != "前期收款" && Pay_Category != "摄影前期" && Pay_Category != "化妆前期" && Pay_Category != "引导前期")
  1789. {
  1790. dt = SystemCategorybll.GetList("Sc_ClassName='" + Pay_Category + "'").Tables[0];
  1791. if (dt.Rows.Count > 0)
  1792. {
  1793. Wcs_TypeCode = dt.Rows[0]["Sc_ClassCode"].ToString();
  1794. S_EXYJ_Tc += WageCommissionSetbll.GetCommissionSpecifications(Wcs_TypeCode, Convert.ToDecimal(Pay_AmountOf));
  1795. }
  1796. }
  1797. #endregion
  1798. }
  1799. //前期业绩
  1800. txtEarlyResults.Text = (S_QQYJ + S_QQYJ_SH).ToString("N2");
  1801. //二销业绩
  1802. txtTwoPinsResults.Text = S_EXYJ.ToString("N2");
  1803. //计件提成
  1804. txtPieceCommission.Text = Piece.ToString("N2");
  1805. #region 总工资
  1806. #region 获取前期提成
  1807. dt = Wagebll.GetView_WagesSet("User_EmployeeID='" + Tsorder_OpenSingle + "'").Tables[0];
  1808. if (dt.Rows.Count > 0)
  1809. {
  1810. //获取前期收款提成
  1811. if (!string.IsNullOrEmpty(dt.Rows[0]["Ws_EarlyCommissionScheme"].ToString()))
  1812. {
  1813. Wcs_TypeCode = dt.Rows[0]["Ws_EarlyCommissionScheme"].ToString();
  1814. QQSK_TC = WageCommissionSetbll.GetCommissionSpecifications(Wcs_TypeCode, Convert.ToDecimal(S_QQYJ));
  1815. }
  1816. else { QQSK_TC = 0; }
  1817. //获取摄影,化妆前期,引导前期提成
  1818. if (!string.IsNullOrEmpty(dt.Rows[0]["Ws_PhotographyMakeupCommissionScheme"].ToString()))
  1819. {
  1820. Wcs_TypeCode = dt.Rows[0]["Ws_PhotographyMakeupCommissionScheme"].ToString();
  1821. QQSK_SH_TC = WageCommissionSetbll.GetCommissionSpecifications(Wcs_TypeCode, Convert.ToDecimal(S_QQYJ_SH));
  1822. }
  1823. else { QQSK_SH_TC = 0; }
  1824. }
  1825. #endregion
  1826. #endregion
  1827. //基本工资+前期提成+二销提成+计件提成
  1828. txtTotalWages.Text = Convert.ToDecimal(Convert.ToDecimal(txtWs_BasicWage.Text) + Convert.ToDecimal(QQSK_TC + QQSK_SH_TC) + Convert.ToDecimal(S_EXYJ_Tc) + Convert.ToDecimal(txtPieceCommission.Text)).ToString("N2");
  1829. }
  1830. catch (Exception ex)
  1831. {
  1832. MessageBoxCustom.Show(ex.Message);
  1833. }
  1834. }
  1835. #endregion
  1836. #region 排序
  1837. public class RowComparer : System.Collections.IComparer
  1838. {
  1839. private static int sortOrderModifier = 1;
  1840. public RowComparer(SortOrder sortOrder)
  1841. {
  1842. if (sortOrder == SortOrder.Descending)
  1843. {
  1844. sortOrderModifier = -1;
  1845. }
  1846. else if (sortOrder == SortOrder.Ascending)
  1847. {
  1848. sortOrderModifier = 1;
  1849. }
  1850. }
  1851. public int Compare(object x, object y)
  1852. {
  1853. DataGridViewRow DataGridViewRow1 = (DataGridViewRow)x;
  1854. DataGridViewRow DataGridViewRow2 = (DataGridViewRow)y;
  1855. // Try to sort based on the First Cells
  1856. int CompareResult = System.String.Compare(DataGridViewRow1.Cells[0].Value.ToString(), DataGridViewRow2.Cells[0].Value.ToString());
  1857. // If the Last Names are equal, sort based on the Sec. Cells
  1858. if (CompareResult == 0)
  1859. {
  1860. CompareResult = System.String.Compare(DataGridViewRow1.Cells[1].Value.ToString(), DataGridViewRow2.Cells[1].Value.ToString());
  1861. }
  1862. return CompareResult * sortOrderModifier;
  1863. }
  1864. }
  1865. #endregion
  1866. #region 关闭
  1867. protected override void btnClose_Click(object sender, EventArgs e)
  1868. {
  1869. this.Close();
  1870. }
  1871. #endregion
  1872. #region 自动统计
  1873. /// <summary>
  1874. /// 自动统计
  1875. /// </summary>
  1876. /// <param name="Tsorder_OpenSingle"></param>
  1877. /// <param name="TimeStart"></param>
  1878. /// <param name="TimeEnd"></param>
  1879. public void BindAutomaticStatistics(string Tsorder_OpenSingle, string TimeStart, string TimeEnd)
  1880. {
  1881. try
  1882. {
  1883. LYFZ.BLL.BLL_ErpWagesSet wagessetbll = new BLL.BLL_ErpWagesSet();
  1884. DataTable dt = new DataTable();
  1885. #region 获取摄影师与助理
  1886. //摄影师
  1887. dt = wagessetbll.GetPhotographyCount("OrdPg_Photographer like '%" + Tsorder_OpenSingle + "%' and OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "' and OrdPg_PhotographyStatus='1'").Tables[0];
  1888. decimal OrdPg_Photographer = Convert.ToDecimal(dt.Rows[0]["count"]);
  1889. //助理
  1890. dt = wagessetbll.GetPhotographyCount("OrdPg_PhotographyAssistant like '%" + Tsorder_OpenSingle + "%' and OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "' and OrdPg_PhotographyStatus='1'").Tables[0];
  1891. decimal OrdPg_PhotographyAssistant = Convert.ToDecimal(dt.Rows[0]["count"]);
  1892. //化妆师
  1893. dt = wagessetbll.GetPhotographyCount("OrdPg_MakeupArtist like '%" + Tsorder_OpenSingle + "%' and OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "' and OrdPg_PhotographyStatus='1'").Tables[0];
  1894. decimal OrdPg_MakeupArtist = Convert.ToDecimal(dt.Rows[0]["count"]);
  1895. //助理
  1896. dt = wagessetbll.GetPhotographyCount("OrdPg_MakeupAssistant like '%" + Tsorder_OpenSingle + "%' and OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "' and OrdPg_PhotographyStatus='1'").Tables[0];
  1897. decimal OrdPg_MakeupAssistant = Convert.ToDecimal(dt.Rows[0]["count"]);
  1898. //引导师
  1899. dt = wagessetbll.GetPhotographyCount("OrdPg_BootDivision like '%" + Tsorder_OpenSingle + "%' and OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "' and OrdPg_PhotographyStatus='1'").Tables[0];
  1900. decimal OrdPg_BootDivision = Convert.ToDecimal(dt.Rows[0]["count"]);
  1901. //总金额
  1902. dt = wagessetbll.GetPhotographySum("(OrdPg_Photographer like '%" + Tsorder_OpenSingle + "%' or OrdPg_PhotographyAssistant like '%" + Tsorder_OpenSingle + "%' or OrdPg_MakeupArtist like '%" + Tsorder_OpenSingle + "%' or OrdPg_MakeupAssistant like '%" + Tsorder_OpenSingle + "%' or OrdPg_BootDivision like '%" + Tsorder_OpenSingle + "%') and (OrdPg_PhotographyTime>='" + TimeStart + "' and OrdPg_PhotographyTime<='" + TimeEnd + "') and OrdPg_PhotographyStatus='1'").Tables[0];
  1903. decimal Syhe = 0;
  1904. if (!string.IsNullOrEmpty(dt.Rows[0]["he"].ToString()))
  1905. {
  1906. Syhe = Convert.ToDecimal(dt.Rows[0]["he"].ToString());
  1907. }
  1908. else { Syhe = 0; }
  1909. #endregion
  1910. decimal PhotoOrd_SeriesPrice1 = 0;
  1911. decimal SelectionTwoPins1 = 0;
  1912. decimal PhotoOrd_SeriesPrice2 = 0;
  1913. decimal SelectionTwoPins2 = 0;
  1914. decimal PhotoOrd_SeriesPrice3 = 0;
  1915. decimal SelectionTwoPins3 = 0;
  1916. #region 修片与精修与设计
  1917. //修片
  1918. dt = wagessetbll.GetRetouchingCount(" Ordv_EarlyRepairNameID like '%" + Tsorder_OpenSingle + "%' and Ordv_EarlyRepairTime>='" + TimeStart + "' and Ordv_EarlyRepairTime<='" + TimeEnd + " 23:59:59.000' and Ordv_EarlyRepairStatus='1'").Tables[0];
  1919. decimal Ord_EarlyRepairNameID = Convert.ToDecimal(dt.Rows[0]["count"]);
  1920. if (Ord_EarlyRepairNameID > 0)
  1921. {
  1922. if (dgv3.Rows.Count > 0)
  1923. {
  1924. for (int i = 0; i < dgv3.Rows.Count; i++)
  1925. {
  1926. if (dgv3.Rows[i].Cells["PhotoOrd_EarlyRepairStatus"].Value.ToString() == "OK")
  1927. {
  1928. PhotoOrd_SeriesPrice1 += Convert.ToDecimal(dgv3.Rows[i].Cells["PhotoOrd_SeriesPrice"].Value);
  1929. SelectionTwoPins1 += Convert.ToDecimal(dgv3.Rows[i].Cells["SelectionTwoPins"].Value);
  1930. }
  1931. }
  1932. }
  1933. }
  1934. //精修
  1935. dt = wagessetbll.GetRetouchingCount(" Ordv_RefinementNameID like '%" + Tsorder_OpenSingle + "%' and Ordv_RefinementTime>='" + TimeStart + "' and Ordv_RefinementTime<='" + TimeEnd + " 23:59:59.000' and Ordv_RefinementStatus='1'").Tables[0];
  1936. decimal Ord_RefinementNameID = Convert.ToDecimal(dt.Rows[0]["count"]);
  1937. if (Ord_RefinementNameID > 0)
  1938. {
  1939. if (dgv3.Rows.Count > 0)
  1940. {
  1941. for (int i = 0; i < dgv3.Rows.Count; i++)
  1942. {
  1943. if (dgv3.Rows[i].Cells["PhotoOrd_RefinementStatus"].Value.ToString() == "OK")
  1944. {
  1945. PhotoOrd_SeriesPrice2 += Convert.ToDecimal(dgv3.Rows[i].Cells["PhotoOrd_SeriesPrice"].Value);
  1946. SelectionTwoPins2 += Convert.ToDecimal(dgv3.Rows[i].Cells["SelectionTwoPins"].Value);
  1947. }
  1948. }
  1949. }
  1950. }
  1951. //设计
  1952. dt = wagessetbll.GetRetouchingCount(" Ordv_DesignerNameID like '%" + Tsorder_OpenSingle + "%' and Ordv_DesignerTime>='" + TimeStart + "' and Ordv_DesignerTime<='" + TimeEnd + " 23:59:59.000' and Ordv_DesignerStatus='1'").Tables[0];
  1953. decimal Ord_DesignerNameID = Convert.ToDecimal(dt.Rows[0]["count"]);
  1954. if (Ord_DesignerNameID > 0)
  1955. {
  1956. if (dgv3.Rows.Count > 0)
  1957. {
  1958. for (int i = 0; i < dgv3.Rows.Count; i++)
  1959. {
  1960. if (dgv3.Rows[i].Cells["PhotoOrd_DesignerStatus"].Value.ToString() == "OK")
  1961. {
  1962. PhotoOrd_SeriesPrice3 += Convert.ToDecimal(dgv3.Rows[i].Cells["PhotoOrd_SeriesPrice"].Value);
  1963. SelectionTwoPins3 += Convert.ToDecimal(dgv3.Rows[i].Cells["SelectionTwoPins"].Value);
  1964. }
  1965. }
  1966. }
  1967. }
  1968. #endregion
  1969. #region 显示文本
  1970. StringBuilder str = new StringBuilder();
  1971. str.Append("摄影师与助理\r\n");
  1972. str.Append("摄影师:" + OrdPg_Photographer + "\r\n");
  1973. str.Append("助理:" + OrdPg_PhotographyAssistant + "\r\n");
  1974. str.Append("化妆师:" + OrdPg_MakeupArtist + "\r\n");
  1975. str.Append("助理:" + OrdPg_MakeupAssistant + "\r\n");
  1976. str.Append("引导师:" + OrdPg_BootDivision + "\r\n");
  1977. str.Append("订单总金额:" + Syhe + "\r\n");
  1978. str.Append("\r\n");
  1979. str.Append("修片与精修与设计\r\n");
  1980. str.Append("初修:" + Ord_EarlyRepairNameID + "单\r\n");
  1981. str.Append("订单总金额:" + PhotoOrd_SeriesPrice1 + "\r\n");
  1982. str.Append("选片总金额:" + SelectionTwoPins1 + "\r\n");
  1983. str.Append("\r\n");
  1984. str.Append("精修:" + Ord_RefinementNameID + "单\r\n");
  1985. str.Append("订单总金额:" + PhotoOrd_SeriesPrice2 + "\r\n");
  1986. str.Append("选片总金额:" + SelectionTwoPins2 + "\r\n");
  1987. str.Append("\r\n");
  1988. str.Append("设计:" + Ord_DesignerNameID + "单\r\n");
  1989. str.Append("订单总金额:" + PhotoOrd_SeriesPrice3 + "\r\n");
  1990. str.Append("选片总金额:" + SelectionTwoPins3 + "\r\n");
  1991. txtAutomaticStatistics.Text = str.ToString();
  1992. #endregion
  1993. }
  1994. catch (Exception ex)
  1995. {
  1996. MessageBoxCustom.Show(ex.Message);
  1997. }
  1998. }
  1999. #endregion
  2000. #region 导出
  2001. protected override void btnExport4_Click(object sender, EventArgs e)
  2002. {
  2003. try
  2004. {
  2005. this.dgv4.ExportDataTable();
  2006. }
  2007. catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
  2008. }
  2009. protected override void btnExport3_Click(object sender, EventArgs e)
  2010. {
  2011. try
  2012. {
  2013. this.dgv3.ExportDataTable();
  2014. }
  2015. catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
  2016. }
  2017. protected override void btnExport2_Click(object sender, EventArgs e)
  2018. {
  2019. try
  2020. {
  2021. this.dgv2.ExportDataTable();
  2022. }
  2023. catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
  2024. }
  2025. protected override void btnExport1_Click(object sender, EventArgs e)
  2026. {
  2027. try
  2028. {
  2029. this.dgv1.ExportDataTable();
  2030. }
  2031. catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
  2032. }
  2033. #endregion
  2034. }
  2035. }