FrmMonthFinanceSeeDetails.cs 64 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181
  1. using LYFZ.Software.MainBusiness.DoorCityProcess;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Windows.Forms;
  11. namespace LYFZ.Software.MainBusiness.StatisticalInquiry.MonthFinance
  12. {
  13. public partial class FrmMonthFinanceSeeDetails : LYFZ.Software.UI.StatisticalInquiry.MonthFinance.FrmMonthFinanceSeeDetails
  14. {
  15. private delegate void UpdateControl();
  16. LYFZ.BLL.BLL_ErpPayment ptbll = new BLL.BLL_ErpPayment();
  17. LYFZ.BLL.BLL_ErpWagesSet WagesSetBll = new BLL.BLL_ErpWagesSet();
  18. LYFZ.BLL.BLL_AllViewSet AllViewSetBll = new BLL.BLL_AllViewSet();
  19. LYFZ.BLL.BLL_ErpMemberCardPayment mcptbll = new BLL.BLL_ErpMemberCardPayment();
  20. LYFZ.BLL.BLL_ErpTwoSalesOrder TwoSalesOrderbll = new BLL.BLL_ErpTwoSalesOrder();
  21. LYFZ.BLL.BLL_ErpDressSaleRentalOrder dsrobll = new BLL.BLL_ErpDressSaleRentalOrder();
  22. LYFZ.BLL.BLL_ErpOtherIncomeAndExpenses oiebll = new BLL.BLL_ErpOtherIncomeAndExpenses();
  23. LYFZ.BLL.BLL_ErpMemberCardRechargeRecord mcrrbll = new BLL.BLL_ErpMemberCardRechargeRecord();
  24. public string StrDateStart;
  25. public string StrDateEnd;
  26. public FrmMonthFinanceSeeDetails()
  27. {
  28. }
  29. /// <summary>
  30. /// 加载
  31. /// </summary>
  32. /// <param name="sender"></param>
  33. /// <param name="e"></param>
  34. protected override void FrmMonthFinanceSeeDetails_Shown(object sender, EventArgs e)
  35. {
  36. try
  37. {
  38. if (!string.IsNullOrEmpty(this.StrDateStart) && !string.IsNullOrEmpty(this.StrDateEnd))
  39. {
  40. this.lblDate.Text = this.StrDateStart + " — " + this.StrDateEnd;
  41. //获取支付方式
  42. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACCAFCCEAGAIHH", this.CtvTsorder_Name, IsFirstNodeNull: true);
  43. this.cmbProjectSearch.SelectedIndex = 0;
  44. this.btnFinancialAudit.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DayFinanceCompetence, CustomAttributes.OperatingAuthority.FinancialAudit);
  45. this.btnExPort.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DayFinanceCompetence, CustomAttributes.OperatingAuthority.DataExport);
  46. this.btnPrint.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DayFinanceCompetence, CustomAttributes.OperatingAuthority.Print);
  47. // btnFinancialExpenses.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DayFinanceCompetence, CustomAttributes.OperatingAuthority.FinancialExpenses);
  48. }
  49. }
  50. catch (Exception ex)
  51. { MessageBoxCustom.Show(ex.Message); }
  52. }
  53. #region 获取绑定数据(收入,营业收入,支出,财务支出,订单,补款,选片二销,其它收入,会员充值,服务卡充值,全部押金)
  54. /// <summary>
  55. /// 获取订单收款/其它二销/礼服租售记录
  56. /// </summary>
  57. public void BindOrdersReceivables()
  58. {
  59. StringBuilder str = new StringBuilder();
  60. str.Append(PublicCodeClasses.GetDateTime("convert(datetime,Pay_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0, ConnectWord: ""));
  61. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  62. { str.Append(" and Pay_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  63. #region 项目查询
  64. if (cmbProjectSearch.Text != "全部")
  65. {
  66. if (cmbProjectSearch.Text == "订单前期收入")
  67. {
  68. if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部")
  69. { str.Append(" and Pay_Category!='后期收款'"); }
  70. else
  71. { str.Append(" and Pay_Category='" + CtvTsorder_Name.Text.ToString() + "'"); }
  72. }
  73. else if (cmbProjectSearch.Text == "订单后期收入")
  74. {
  75. if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部")
  76. { str.Append(" and Pay_Category='后期收款' and Pay_Type=0"); }
  77. else
  78. { str.Append("and Pay_Category='后期收款' and Pay_Type=0 and Pay_TwoPinsCategory='" + CtvTsorder_Name.Tag.ToString() + "'"); }
  79. }
  80. else if (cmbProjectSearch.Text == "其它消费收入")
  81. {
  82. if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部")
  83. { str.Append(" and Pay_Category='后期收款' and Pay_Type=1"); }
  84. else
  85. { str.Append("and Pay_Category='后期收款' and Pay_Type=1 and Pay_TwoPinsCategory='" + CtvTsorder_Name.Tag.ToString() + "'"); }
  86. }
  87. else if (cmbProjectSearch.Text == "礼服租售收入")
  88. {
  89. if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部")
  90. { str.Append(" and Pay_Category='后期收款' and Pay_Type=2"); }
  91. else
  92. { str.Append("and Pay_Category='后期收款' and Pay_Type=2 and Pay_ReceivableProject='" + CtvTsorder_Name.Text.ToString() + "'"); }
  93. }
  94. }
  95. #endregion
  96. #region 获取订单收款记录
  97. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  98. {
  99. DataTable dt = AllViewSetBll.Vw_OrdersWagePaymentRecords(str.ToString()).Tables[0];
  100. if (dt.Rows.Count > 0)
  101. {
  102. this.Invoke(new UpdateControl(delegate()
  103. {
  104. for (int t = 0; t < dt.Rows.Count; t++)
  105. {
  106. DataGridViewRow dgvr = new DataGridViewRow();
  107. DataGridViewCell cell = null;
  108. //编号
  109. cell = new DataGridViewTextBoxCell();
  110. cell.Value = dt.Rows[t]["ID"].ToString();
  111. dgvr.Cells.Add(cell);
  112. //项目名称
  113. cell = new DataGridViewTextBoxCell();
  114. if (dt.Rows[t]["Pay_Type"].ToString() == "0")
  115. {
  116. if (!string.IsNullOrEmpty(dt.Rows[t]["Ord_SinceOrderNumber"].ToString()))
  117. { cell.Value = dt.Rows[t]["Ord_SinceOrderNumber"].ToString().Trim(); }
  118. else
  119. { cell.Value = dt.Rows[t]["Pay_OrdNumber"].ToString().Trim(); }
  120. }
  121. else if (dt.Rows[t]["Pay_Type"].ToString() == "1")
  122. { cell.Value = dt.Rows[t]["Tsorder_Name"].ToString().Trim(); }
  123. else if (dt.Rows[t]["Pay_Type"].ToString() == "2")
  124. { cell.Value = dt.Rows[t]["Pay_ReceivableProject"].ToString().Trim(); }
  125. dgvr.Cells.Add(cell);
  126. //开单人
  127. cell = new DataGridViewTextBoxCell();
  128. cell.Value = dt.Rows[t]["Pay_UserName"].ToString();
  129. dgvr.Cells.Add(cell);
  130. //客户
  131. cell = new DataGridViewTextBoxCell();
  132. if (dt.Rows[t]["Pay_Type"].ToString() == "0")
  133. { cell.Value = dt.Rows[t]["Ord_CustomerName1"].ToString().Trim(); }
  134. else if (dt.Rows[t]["Pay_Type"].ToString() == "1")
  135. { cell.Value = dt.Rows[t]["Tsorder_CustomerName"].ToString().Trim(); }
  136. else if (dt.Rows[t]["Pay_Type"].ToString() == "2")
  137. { cell.Value = dt.Rows[t]["Cus_Name"].ToString().Trim(); }
  138. dgvr.Cells.Add(cell);
  139. //金额
  140. cell = new DataGridViewTextBoxCell();
  141. cell.Value = Convert.ToDecimal(dt.Rows[t]["Pay_AmountOf"]).ToString();
  142. dgvr.Cells.Add(cell);
  143. //项目类别
  144. cell = new DataGridViewTextBoxCell();
  145. if (dt.Rows[t]["Pay_Category"].ToString() != "后期收款")
  146. { cell.Value = dt.Rows[t]["Pay_Category"].ToString(); }
  147. else
  148. {
  149. if (!string.IsNullOrEmpty(dt.Rows[t]["Cus_Name"].ToString()))
  150. { cell.Value = dt.Rows[t]["Pay_ReceivableProject"].ToString(); }
  151. else
  152. { cell.Value = dt.Rows[t]["Pay_TwoPinsCategoryName"].ToString(); }
  153. }
  154. dgvr.Cells.Add(cell);
  155. //收入/支出
  156. cell = new DataGridViewTextBoxCell();
  157. cell.Value = "收入";
  158. dgvr.Cells.Add(cell);
  159. //日期
  160. cell = new DataGridViewTextBoxCell();
  161. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["Pay_CreateDatetime"], "yyyy-MM-dd HH:mm");
  162. dgvr.Cells.Add(cell);
  163. //支付方式
  164. cell = new DataGridViewTextBoxCell();
  165. cell.Value = dt.Rows[t]["Pay_PaymentMethodName"].ToString().Trim();
  166. dgvr.Cells.Add(cell);
  167. //收银
  168. cell = new DataGridViewTextBoxCell();
  169. cell.Value = dt.Rows[t]["Pay_ThePayeeName"].ToString().Trim();
  170. dgvr.Cells.Add(cell);
  171. //财务审核
  172. cell = new DataGridViewTextBoxCell();
  173. cell.Value = dt.Rows[t]["Pay_FinancialAudit"].ToString().Trim() == "" ? "未审核/" : dt.Rows[t]["Pay_FinancialAudit"].ToString().Trim() + "/" + dt.Rows[t]["Pay_FinancialAuditdPeopleName"].ToString().Trim();
  174. dgvr.Cells.Add(cell);
  175. if (dt.Rows[t]["Pay_FinancialAudit"].ToString().Trim() == "" || dt.Rows[t]["Pay_FinancialAudit"].ToString().Trim() == "审核不通过")
  176. { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
  177. else
  178. { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
  179. this.dgv.Rows.Add(dgvr);
  180. }
  181. dgv.ClearSelection();
  182. }));
  183. }
  184. });
  185. #endregion
  186. }
  187. /// <summary>
  188. /// 获取其它收入
  189. /// </summary>
  190. public void BindOtherIncome()
  191. {
  192. LYFZ.BLL.BLL_ErpOtherIncomeAndExpenses bll = new BLL.BLL_ErpOtherIncomeAndExpenses();
  193. StringBuilder str = new StringBuilder();
  194. str.Append("Oiae_Type='收入' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0));
  195. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  196. { str.Append(" and Oiae_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  197. #region 获取其它收入
  198. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  199. {
  200. DataTable dt = bll.View_ErpOtherIncomeAndExpenses(str.ToString()).Tables[0];
  201. if (dt.Rows.Count > 0)
  202. {
  203. this.Invoke(new UpdateControl(delegate()
  204. {
  205. for (int t = 0; t < dt.Rows.Count; t++)
  206. {
  207. DataGridViewRow dgvr = new DataGridViewRow();
  208. DataGridViewCell cell = null;
  209. //编号
  210. cell = new DataGridViewTextBoxCell();
  211. cell.Value = dt.Rows[t]["ID"].ToString();
  212. dgvr.Cells.Add(cell);
  213. //项目名称
  214. cell = new DataGridViewTextBoxCell();
  215. cell.Value = dt.Rows[t]["Oiae_ProjectName"].ToString().Trim();
  216. dgvr.Cells.Add(cell);
  217. //开单人
  218. cell = new DataGridViewTextBoxCell();
  219. cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim();
  220. dgvr.Cells.Add(cell);
  221. //客户/备注
  222. cell = new DataGridViewTextBoxCell();
  223. cell.Value = dt.Rows[t]["Oiae_ThePayer"].ToString().Trim();
  224. dgvr.Cells.Add(cell);
  225. //金额
  226. cell = new DataGridViewTextBoxCell();
  227. cell.Value = Convert.ToDecimal(dt.Rows[t]["Oiae_Money"]).ToString();
  228. dgvr.Cells.Add(cell);
  229. //项目类别
  230. cell = new DataGridViewTextBoxCell();
  231. cell.Value = "其它收入";
  232. dgvr.Cells.Add(cell);
  233. //收入/支出
  234. cell = new DataGridViewTextBoxCell();
  235. cell.Value = "收入";
  236. dgvr.Cells.Add(cell);
  237. //日期
  238. cell = new DataGridViewTextBoxCell();
  239. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["Oiae_IEDatetime"], "yyyy-MM-dd HH:mm");
  240. dgvr.Cells.Add(cell);
  241. //支付方式
  242. cell = new DataGridViewTextBoxCell();
  243. cell.Value = dt.Rows[t]["Oiae_PaymentMethodName"].ToString().Trim(); ;
  244. dgvr.Cells.Add(cell);
  245. //收银
  246. cell = new DataGridViewTextBoxCell();
  247. cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim();
  248. dgvr.Cells.Add(cell);
  249. //财务审核
  250. cell = new DataGridViewTextBoxCell();
  251. cell.Value = dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() + "/" + dt.Rows[t]["Oiae_FinancialAuditPeopleName"].ToString().Trim();
  252. dgvr.Cells.Add(cell);
  253. if (dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "未审核" || dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "审核不通过")
  254. { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
  255. else
  256. { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
  257. this.dgv.Rows.Add(dgvr);
  258. }
  259. dgv.ClearSelection();
  260. }));
  261. }
  262. });
  263. #endregion
  264. }
  265. /// <summary>
  266. /// 获取会员充值
  267. /// </summary>
  268. public void GetMemberCardRechargeRecord()
  269. {
  270. LYFZ.BLL.BLL_ErpUser Userbll = new BLL.BLL_ErpUser();
  271. LYFZ.BLL.BLL_ErpMemberCardRechargeRecord CardRechargeRecordBll = new BLL.BLL_ErpMemberCardRechargeRecord();
  272. StringBuilder str = new StringBuilder();
  273. str.Append(PublicCodeClasses.GetDateTime("convert(datetime,Mcrr_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0));
  274. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  275. { str.Append(" and Mcrr_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  276. #region 获取会员充值
  277. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  278. {
  279. DataTable dt = CardRechargeRecordBll.GetView_MemberCardRechargeRecord(str.ToString()).Tables[0];
  280. if (dt.Rows.Count > 0)
  281. {
  282. this.Invoke(new UpdateControl(delegate()
  283. {
  284. for (int t = 0; t < dt.Rows.Count; t++)
  285. {
  286. DataGridViewRow dgvr = new DataGridViewRow();
  287. DataGridViewCell cell = null;
  288. //编号
  289. cell = new DataGridViewTextBoxCell();
  290. cell.Value = dt.Rows[t]["ID"].ToString();
  291. dgvr.Cells.Add(cell);
  292. //项目名称
  293. cell = new DataGridViewTextBoxCell();
  294. cell.Value = dt.Rows[t]["Mcrr_RechargeName"].ToString().Trim();
  295. dgvr.Cells.Add(cell);
  296. //开单人
  297. cell = new DataGridViewTextBoxCell();
  298. cell.Value = Userbll.GetUserName(dt.Rows[t]["Mcrr_OrderPerson"].ToString().Trim());
  299. dgvr.Cells.Add(cell);
  300. //客户/备注
  301. cell = new DataGridViewTextBoxCell();
  302. cell.Value = dt.Rows[t]["Cus_Name"].ToString().Trim();
  303. dgvr.Cells.Add(cell);
  304. //金额
  305. cell = new DataGridViewTextBoxCell();
  306. cell.Value = Convert.ToDecimal(dt.Rows[t]["Mcrr_RechargeAmount"]).ToString();
  307. dgvr.Cells.Add(cell);
  308. //项目类别
  309. cell = new DataGridViewTextBoxCell();
  310. cell.Value = "会员充值";
  311. dgvr.Cells.Add(cell);
  312. //收入/支出
  313. cell = new DataGridViewTextBoxCell();
  314. cell.Value = "收入";
  315. dgvr.Cells.Add(cell);
  316. //日期
  317. cell = new DataGridViewTextBoxCell();
  318. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["Mcrr_CreateDatetime"], "yyyy-MM-dd HH:mm");
  319. dgvr.Cells.Add(cell);
  320. //支付方式
  321. cell = new DataGridViewTextBoxCell();
  322. cell.Value = dt.Rows[t]["Mcrr_PaymentMethodName"].ToString().Trim(); ;
  323. dgvr.Cells.Add(cell);
  324. //收银
  325. cell = new DataGridViewTextBoxCell();
  326. cell.Value = Userbll.GetUserName(dt.Rows[t]["Mcrr_CreateName"].ToString().Trim());
  327. dgvr.Cells.Add(cell);
  328. //财务审核
  329. cell = new DataGridViewTextBoxCell();
  330. cell.Value = dt.Rows[t]["Mcrr_FinancialAudit"].ToString().Trim() == "" ? "未审核/" : dt.Rows[t]["Mcrr_FinancialAudit"].ToString().Trim() + "/" + Userbll.GetUserName(dt.Rows[t]["Mcrr_FinancialAuditName"].ToString().Trim());
  331. dgvr.Cells.Add(cell);
  332. if (dt.Rows[t]["Mcrr_FinancialAudit"].ToString().Trim() == "" || dt.Rows[t]["Mcrr_FinancialAudit"].ToString().Trim() == "审核不通过")
  333. { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
  334. else
  335. { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
  336. this.dgv.Rows.Add(dgvr);
  337. }
  338. dgv.ClearSelection();
  339. }));
  340. }
  341. });
  342. #endregion
  343. }
  344. /// <summary>
  345. /// 获取服务卡消费充值
  346. /// </summary>
  347. public void GetMemberCardPayment()
  348. {
  349. LYFZ.BLL.BLL_ErpUser Userbll = new BLL.BLL_ErpUser();
  350. StringBuilder str = new StringBuilder();
  351. str.Append(PublicCodeClasses.GetDateTime("convert(datetime,创建日期)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0));
  352. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  353. { str.Append(" and 付款方式编号='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  354. #region 获取服务卡消费充值
  355. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  356. {
  357. DataTable dt = AllViewSetBll.Vw_ErpMemberCardPayment(str.ToString()).Tables[0];
  358. if (dt.Rows.Count > 0)
  359. {
  360. this.Invoke(new UpdateControl(delegate()
  361. {
  362. for (int t = 0; t < dt.Rows.Count; t++)
  363. {
  364. DataGridViewRow dgvr = new DataGridViewRow();
  365. DataGridViewCell cell = null;
  366. //编号
  367. cell = new DataGridViewTextBoxCell();
  368. cell.Value = dt.Rows[t]["ID"].ToString();
  369. dgvr.Cells.Add(cell);
  370. //项目名称
  371. cell = new DataGridViewTextBoxCell();
  372. cell.Value = dt.Rows[t]["服务套系类别名称"].ToString().Trim();
  373. dgvr.Cells.Add(cell);
  374. //开单人
  375. cell = new DataGridViewTextBoxCell();
  376. cell.Value = dt.Rows[t]["接单人名称"].ToString().Trim();
  377. dgvr.Cells.Add(cell);
  378. //客户/备注
  379. cell = new DataGridViewTextBoxCell();
  380. cell.Value = dt.Rows[t]["客户姓名"].ToString().Trim();
  381. dgvr.Cells.Add(cell);
  382. //金额
  383. cell = new DataGridViewTextBoxCell();
  384. cell.Value = Convert.ToDecimal(dt.Rows[t]["收款金额"]).ToString();
  385. dgvr.Cells.Add(cell);
  386. //项目类别
  387. cell = new DataGridViewTextBoxCell();
  388. cell.Value = dt.Rows[t]["收款类型"].ToString();
  389. dgvr.Cells.Add(cell);
  390. //收入/支出
  391. cell = new DataGridViewTextBoxCell();
  392. cell.Value = "收入";
  393. dgvr.Cells.Add(cell);
  394. //日期
  395. cell = new DataGridViewTextBoxCell();
  396. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["创建日期"], "yyyy-MM-dd HH:mm");
  397. dgvr.Cells.Add(cell);
  398. //支付方式
  399. cell = new DataGridViewTextBoxCell();
  400. cell.Value = dt.Rows[t]["支付方式名称"].ToString().Trim(); ;
  401. dgvr.Cells.Add(cell);
  402. //收银
  403. cell = new DataGridViewTextBoxCell();
  404. cell.Value = dt.Rows[t]["创建人名称"].ToString().Trim();
  405. dgvr.Cells.Add(cell);
  406. //财务审核
  407. cell = new DataGridViewTextBoxCell();
  408. cell.Value = dt.Rows[t]["财务审核状态"].ToString().Trim() == "" ? "未审核/" : dt.Rows[t]["财务审核状态"].ToString().Trim() + "/" + Userbll.GetUserName(dt.Rows[t]["账务审核人"].ToString().Trim());
  409. dgvr.Cells.Add(cell);
  410. if (dt.Rows[t]["财务审核状态"].ToString().Trim() == "" || dt.Rows[t]["财务审核状态"].ToString().Trim() == "审核不通过")
  411. { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
  412. else
  413. { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
  414. this.dgv.Rows.Add(dgvr);
  415. }
  416. dgv.ClearSelection();
  417. }));
  418. }
  419. });
  420. #endregion
  421. }
  422. /// <summary>
  423. /// 获取现金支出
  424. /// </summary>
  425. public void BindCashExpenses()
  426. {
  427. LYFZ.BLL.BLL_ErpOtherIncomeAndExpenses bll = new BLL.BLL_ErpOtherIncomeAndExpenses();
  428. StringBuilder str = new StringBuilder();
  429. str.Append(" Oiae_Type='支出' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0));
  430. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  431. {
  432. if (cmbPay_PaymentMethod.Text != "现金")
  433. { return; }
  434. }
  435. if (cmbProjectSearch.Text != "全部" && cmbProjectSearch.Text == "店面支出")
  436. {
  437. if (!string.IsNullOrEmpty(CtvTsorder_Name.Text) && CtvTsorder_Name.Text != "全部")
  438. { str.Append("and Oiae_ProjectName='" + CtvTsorder_Name.Text.ToString() + "'"); }
  439. }
  440. #region 获取现金支出
  441. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  442. {
  443. DataTable dt = bll.View_ErpOtherIncomeAndExpenses(str.ToString()).Tables[0];
  444. if (dt.Rows.Count > 0)
  445. {
  446. this.Invoke(new UpdateControl(delegate()
  447. {
  448. for (int t = 0; t < dt.Rows.Count; t++)
  449. {
  450. DataGridViewRow dgvr = new DataGridViewRow();
  451. DataGridViewCell cell = null;
  452. //编号
  453. cell = new DataGridViewTextBoxCell();
  454. cell.Value = dt.Rows[t]["ID"].ToString();
  455. dgvr.Cells.Add(cell);
  456. //项目名称
  457. cell = new DataGridViewTextBoxCell();
  458. cell.Value = dt.Rows[t]["Oiae_ProjectName"].ToString().Trim();
  459. dgvr.Cells.Add(cell);
  460. //开单人
  461. cell = new DataGridViewTextBoxCell();
  462. cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim();
  463. dgvr.Cells.Add(cell);
  464. //客户/备注
  465. cell = new DataGridViewTextBoxCell();
  466. cell.Value = dt.Rows[t]["User_Name"].ToString().Trim() + "/" + dt.Rows[t]["Oiae_Remark"].ToString(); ;
  467. dgvr.Cells.Add(cell);
  468. //金额
  469. cell = new DataGridViewTextBoxCell();
  470. cell.Value = Convert.ToDecimal(dt.Rows[t]["Oiae_Money"]).ToString();
  471. dgvr.Cells.Add(cell);
  472. //项目类别
  473. cell = new DataGridViewTextBoxCell();
  474. cell.Value = "固定费用";
  475. dgvr.Cells.Add(cell);
  476. //收入/支出
  477. cell = new DataGridViewTextBoxCell();
  478. cell.Value = "店面支出";
  479. dgvr.Cells.Add(cell);
  480. //日期
  481. cell = new DataGridViewTextBoxCell();
  482. cell.Value = LYFZ.Command.Command_Validate.DateTimeToString(dt.Rows[t]["Oiae_IEDatetime"], "yyyy-MM-dd HH:mm");
  483. dgvr.Cells.Add(cell);
  484. //支付方式
  485. cell = new DataGridViewTextBoxCell();
  486. cell.Value = dt.Rows[t]["Oiae_PaymentMethodName"].ToString().Trim();
  487. dgvr.Cells.Add(cell);
  488. //收银
  489. cell = new DataGridViewTextBoxCell();
  490. cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim();
  491. dgvr.Cells.Add(cell);
  492. //财务审核
  493. cell = new DataGridViewTextBoxCell();
  494. cell.Value = dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() + "/" + dt.Rows[t]["Oiae_FinancialAuditPeopleName"].ToString().Trim();
  495. dgvr.Cells.Add(cell);
  496. if (dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "未审核" || dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "审核不通过")
  497. { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
  498. else
  499. { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
  500. this.dgv.Rows.Add(dgvr);
  501. }
  502. dgv.ClearSelection();
  503. }));
  504. }
  505. });
  506. #endregion
  507. }
  508. /// <summary>
  509. /// 财务支出
  510. /// </summary>
  511. public void BindFinancialExpenses()
  512. {
  513. LYFZ.BLL.BLL_ErpOtherIncomeAndExpenses bll = new BLL.BLL_ErpOtherIncomeAndExpenses();
  514. StringBuilder str = new StringBuilder();
  515. str.Append(" Oiae_Type='财务支出' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0));
  516. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  517. {
  518. if (cmbPay_PaymentMethod.Text != "现金")
  519. { return; }
  520. }
  521. if (cmbProjectSearch.Text != "全部" && cmbProjectSearch.Text == "财务支出")
  522. {
  523. if (!string.IsNullOrEmpty(CtvTsorder_Name.Text) && CtvTsorder_Name.Text != "全部")
  524. { str.Append("and Oiae_ProjectName='" + CtvTsorder_Name.Text.ToString() + "'"); }
  525. }
  526. #region 获取财务支出
  527. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  528. {
  529. DataTable dt = bll.View_ErpOtherIncomeAndExpenses(str.ToString()).Tables[0];
  530. if (dt.Rows.Count > 0)
  531. {
  532. this.Invoke(new UpdateControl(delegate()
  533. {
  534. for (int t = 0; t < dt.Rows.Count; t++)
  535. {
  536. DataGridViewRow dgvr = new DataGridViewRow();
  537. DataGridViewCell cell = null;
  538. //编号
  539. cell = new DataGridViewTextBoxCell();
  540. cell.Value = dt.Rows[t]["ID"].ToString();
  541. dgvr.Cells.Add(cell);
  542. //项目名称
  543. cell = new DataGridViewTextBoxCell();
  544. cell.Value = dt.Rows[t]["Oiae_ProjectName"].ToString().Trim();
  545. dgvr.Cells.Add(cell);
  546. //开单人
  547. cell = new DataGridViewTextBoxCell();
  548. cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim();
  549. dgvr.Cells.Add(cell);
  550. //客户/备注
  551. cell = new DataGridViewTextBoxCell();
  552. cell.Value = dt.Rows[t]["User_Name"].ToString().Trim() + "/" + dt.Rows[t]["Oiae_Remark"].ToString(); ;
  553. dgvr.Cells.Add(cell);
  554. //金额
  555. cell = new DataGridViewTextBoxCell();
  556. cell.Value = Convert.ToDecimal(dt.Rows[t]["Oiae_Money"]).ToString();
  557. dgvr.Cells.Add(cell);
  558. //项目类别
  559. cell = new DataGridViewTextBoxCell();
  560. cell.Value = "固定费用";
  561. dgvr.Cells.Add(cell);
  562. //收入/支出
  563. cell = new DataGridViewTextBoxCell();
  564. cell.Value = "财务支出";
  565. dgvr.Cells.Add(cell);
  566. //日期
  567. cell = new DataGridViewTextBoxCell();
  568. cell.Value =LYFZ.Command.Command_Validate.DateTimeToString( dt.Rows[t]["Oiae_IEDatetime"],"yyyy-MM-dd HH:mm");
  569. dgvr.Cells.Add(cell);
  570. //支付方式
  571. cell = new DataGridViewTextBoxCell();
  572. cell.Value = dt.Rows[t]["Oiae_PaymentMethodName"].ToString().Trim();
  573. dgvr.Cells.Add(cell);
  574. //收银
  575. cell = new DataGridViewTextBoxCell();
  576. cell.Value = dt.Rows[t]["Oiae_PersonHandlingName"].ToString().Trim();
  577. dgvr.Cells.Add(cell);
  578. //财务审核
  579. cell = new DataGridViewTextBoxCell();
  580. cell.Value = dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() + "/" + dt.Rows[t]["Oiae_FinancialAuditPeopleName"].ToString().Trim();
  581. dgvr.Cells.Add(cell);
  582. if (dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "未审核" || dt.Rows[t]["Oiae_FinancialAuditState"].ToString().Trim() == "审核不通过")
  583. { dgvr.DefaultCellStyle.ForeColor = Color.Red; }
  584. else
  585. { dgvr.DefaultCellStyle.ForeColor = Color.Blue; }
  586. this.dgv.Rows.Add(dgvr);
  587. }
  588. dgv.ClearSelection();
  589. }));
  590. }
  591. });
  592. #endregion
  593. }
  594. #endregion
  595. /// <summary>
  596. /// 所以查询事件绑定
  597. /// </summary>
  598. public void BindSelect()
  599. {
  600. this.dgv.Rows.Clear();
  601. if (this.cmbProjectSearch.Text == "全部")
  602. {
  603. // 获取订单收款/其它二销/礼服租售记录
  604. this.BindOrdersReceivables();
  605. // 获取其它收入
  606. this.BindOtherIncome();
  607. // 获取会员充值
  608. this.GetMemberCardRechargeRecord();
  609. // 获取现金支出
  610. this.BindCashExpenses();
  611. //获取财务支出
  612. this.BindFinancialExpenses();
  613. // 服务卡消费收入
  614. this.GetMemberCardPayment();
  615. }
  616. else if (this.cmbProjectSearch.Text == "订单前期收入" || this.cmbProjectSearch.Text == "订单后期收入" || this.cmbProjectSearch.Text == "其它消费收入" || this.cmbProjectSearch.Text == "礼服租售收入")
  617. { this.BindOrdersReceivables(); }
  618. else if (this.cmbProjectSearch.Text == "其它收入")
  619. { this.BindOtherIncome(); }
  620. else if (this.cmbProjectSearch.Text == "会员充值收入")
  621. { this.GetMemberCardRechargeRecord(); }
  622. else if (this.cmbProjectSearch.Text == "服务卡消费收入")
  623. { this.GetMemberCardPayment(); }
  624. else if (this.cmbProjectSearch.Text == "店面支出")
  625. { this.BindCashExpenses(); }
  626. else if (this.cmbProjectSearch.Text == "财务支出")
  627. { this.BindFinancialExpenses(); }
  628. //获取文本框金额
  629. this.BindTotal();
  630. }
  631. /// <summary>
  632. /// 获取订单前期
  633. /// </summary>
  634. /// <returns></returns>
  635. decimal OrderEarly()
  636. {
  637. decimal sum = 0;
  638. DataTable dt = WagesSetBll.GetTwoPieSum(PublicCodeClasses.GetDateTime("convert(datetime,Pay_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0, ConnectWord: "") + " and Pay_Category!='后期收款' and (Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID')").Tables[0];
  639. if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString()))
  640. { sum = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"]); }
  641. return sum;
  642. }
  643. /// <summary>
  644. /// 获取订单后期
  645. /// </summary>
  646. /// <returns></returns>
  647. decimal OrderLate()
  648. {
  649. decimal sum = 0;
  650. DataTable dt = WagesSetBll.GetTwoPieSum(PublicCodeClasses.GetDateTime("convert(datetime,Pay_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0, ConnectWord: "") + " and Pay_Category='后期收款' and (Pay_Type=0) and (Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID')").Tables[0];
  651. if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString()))
  652. { sum = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"]); }
  653. return sum;
  654. }
  655. /// <summary>
  656. /// 获取收款记录金额
  657. /// </summary>
  658. /// <param name="Symbol"></param>
  659. /// <returns></returns>
  660. decimal TotalRevenueSun(string Symbol)
  661. {
  662. decimal sum = 0;
  663. StringBuilder str = new StringBuilder();
  664. str.Append("" + Symbol + PublicCodeClasses.GetDateTime("convert(datetime,Pay_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0, ConnectWord: ""));
  665. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  666. { str.Append(" and Pay_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  667. #region 项目查询
  668. if (cmbProjectSearch.Text != "全部")
  669. {
  670. //订单前期
  671. if (cmbProjectSearch.Text == "订单前期收入")
  672. {
  673. if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部")
  674. { str.Append(" and Pay_Category!='后期收款'"); }
  675. else
  676. { str.Append(" and Pay_Category='" + CtvTsorder_Name.Text.ToString() + "'"); }
  677. }
  678. //订单后期收入
  679. if (cmbProjectSearch.Text == "订单后期收入")
  680. {
  681. if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部")
  682. { str.Append(" and Pay_Category='后期收款' and Pay_Type=0"); }
  683. else
  684. { str.Append("and Pay_Category='后期收款' and Pay_Type=0 and Pay_TwoPinsCategory='" + CtvTsorder_Name.Tag.ToString() + "'"); }
  685. }
  686. //其它消费收入
  687. if (cmbProjectSearch.Text == "其它消费收入")
  688. {
  689. if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部")
  690. { str.Append(" and Pay_Category='后期收款' and Pay_Type=1"); }
  691. else
  692. { str.Append("and Pay_Category='后期收款' and Pay_Type=1 and Pay_TwoPinsCategory='" + CtvTsorder_Name.Tag.ToString() + "'"); }
  693. }
  694. //礼服租售收入
  695. if (cmbProjectSearch.Text == "礼服租售收入")
  696. {
  697. if (string.IsNullOrEmpty(CtvTsorder_Name.Text) || CtvTsorder_Name.Text == "全部")
  698. { str.Append(" and Pay_Category='后期收款' and Pay_Type=2"); }
  699. else
  700. { str.Append("and Pay_Category='后期收款' and Pay_Type=2 and Pay_ReceivableProject='" + CtvTsorder_Name.Text.ToString() + "'"); }
  701. }
  702. }
  703. #endregion
  704. DataTable dt = WagesSetBll.GetTwoPieSum(str.ToString()).Tables[0];
  705. if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString()))
  706. { sum = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"]); }
  707. return sum;
  708. }
  709. /// <summary>
  710. /// 获取其它收入金额
  711. /// </summary>
  712. /// <returns></returns>
  713. decimal OtherIncomeSum()
  714. {
  715. decimal sum = 0;
  716. StringBuilder str = new StringBuilder();
  717. str.Append("Oiae_Type='收入' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0));
  718. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  719. { str.Append(" and Oiae_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  720. DataTable dt = WagesSetBll.GetOtherIncomeSum(str.ToString()).Tables[0];
  721. if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString()))
  722. { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); }
  723. return sum;
  724. }
  725. /// <summary>
  726. /// 获取会员充值金额
  727. /// </summary>
  728. /// <returns></returns>
  729. decimal MembersRechargeSum()
  730. {
  731. decimal sum = 0;
  732. StringBuilder str = new StringBuilder();
  733. str.Append(PublicCodeClasses.GetDateTime("convert(datetime,Mcrr_CreateDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0, ConnectWord: ""));
  734. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  735. { str.Append(" and Mcrr_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  736. DataTable dt = WagesSetBll.GetMembersRechargeSum(str.ToString()).Tables[0];
  737. if (!string.IsNullOrEmpty(dt.Rows[0]["Mcrr_RechargeAmount"].ToString()))
  738. { sum = Convert.ToDecimal(dt.Rows[0]["Mcrr_RechargeAmount"]); }
  739. return sum;
  740. }
  741. /// <summary>
  742. /// 获取服务卡消费充值金额
  743. /// </summary>
  744. /// <returns></returns>
  745. decimal MemberCardPayment()
  746. {
  747. decimal sum = 0;
  748. StringBuilder str = new StringBuilder();
  749. str.Append(PublicCodeClasses.GetDateTime("convert(datetime,创建日期)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0));
  750. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  751. { str.Append(" and 付款方式编号='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  752. DataTable dt = AllViewSetBll.GetMemberCardPaymentSum(str.ToString()).Tables[0];
  753. if (!string.IsNullOrEmpty(dt.Rows[0]["收款金额"].ToString()))
  754. { sum = Convert.ToDecimal(dt.Rows[0]["收款金额"]); }
  755. return sum;
  756. }
  757. /// <summary>
  758. /// 现金支出金额
  759. /// </summary>
  760. /// <param name="Time"></param>
  761. /// <returns></returns>
  762. decimal ExpenditureSum()
  763. {
  764. decimal sum = 0;
  765. StringBuilder str = new StringBuilder();
  766. str.Append(" Oiae_Type='支出' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0));
  767. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  768. { str.Append("and Oiae_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  769. if (cmbProjectSearch.Text != "全部" && cmbProjectSearch.Text == "店面支出")
  770. {
  771. if (!string.IsNullOrEmpty(CtvTsorder_Name.Text) && CtvTsorder_Name.Text != "全部")
  772. { str.Append("and Oiae_ProjectName='" + CtvTsorder_Name.Text.ToString() + "'"); }
  773. }
  774. DataTable dt = WagesSetBll.GetOtherIncomeSum(str.ToString()).Tables[0];
  775. if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString()))
  776. { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); }
  777. return sum;
  778. }
  779. /// <summary>
  780. /// 财务支出金额
  781. /// </summary>
  782. /// <param name="Time"></param>
  783. /// <returns></returns>
  784. decimal FinancialExpensesSum()
  785. {
  786. decimal sum = 0;
  787. StringBuilder str = new StringBuilder();
  788. str.Append(" Oiae_Type='财务支出' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0));
  789. if (!string.IsNullOrEmpty(cmbPay_PaymentMethod.Text) && cmbPay_PaymentMethod.Tag != null)
  790. { str.Append("and Oiae_PaymentMethod='" + cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  791. if (cmbProjectSearch.Text != "全部" && cmbProjectSearch.Text == "财务支出")
  792. {
  793. if (!string.IsNullOrEmpty(CtvTsorder_Name.Text) && CtvTsorder_Name.Text != "全部")
  794. { str.Append("and Oiae_ProjectName='" + CtvTsorder_Name.Text.ToString() + "'"); }
  795. }
  796. DataTable dt = WagesSetBll.GetOtherIncomeSum(str.ToString()).Tables[0];
  797. if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString()))
  798. { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); }
  799. return sum;
  800. }
  801. /// <summary>
  802. /// 文本框合计获取值
  803. /// </summary>
  804. public void BindTotal()
  805. {
  806. if (cmbProjectSearch.Text == "全部")
  807. {
  808. //收入
  809. txtTotalRevenue.Text = (TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ") + OtherIncomeSum()).ToString();
  810. //营业收入
  811. txtOperatingIncome.Text = (TotalRevenueSun("") + MembersRechargeSum() + MemberCardPayment()).ToString();
  812. //总支出
  813. txtTotalExpenditure.Text = (ExpenditureSum() + FinancialExpensesSum()).ToString();
  814. //净收入
  815. txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString();
  816. }
  817. else if (cmbProjectSearch.Text == "订单前期收入")
  818. {
  819. //收入
  820. txtTotalRevenue.Text = TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
  821. //营业收入
  822. txtOperatingIncome.Text = TotalRevenueSun("").ToString();
  823. //总支出
  824. txtTotalExpenditure.Text = "0";
  825. //净收入
  826. txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString();
  827. }
  828. else if (cmbProjectSearch.Text == "订单后期收入")
  829. {
  830. //收入
  831. txtTotalRevenue.Text = TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
  832. //营业收入
  833. txtOperatingIncome.Text = TotalRevenueSun("").ToString();
  834. //总支出
  835. txtTotalExpenditure.Text = "0";
  836. //净收入
  837. txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString();
  838. }
  839. else if (cmbProjectSearch.Text == "其它消费收入")
  840. {
  841. //收入
  842. txtTotalRevenue.Text = TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
  843. //营业收入
  844. txtOperatingIncome.Text = TotalRevenueSun("").ToString();
  845. //总支出
  846. txtTotalExpenditure.Text = "0";
  847. //净收入
  848. txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString();
  849. }
  850. else if (cmbProjectSearch.Text == "其它收入")
  851. {
  852. //收入
  853. txtTotalRevenue.Text = OtherIncomeSum().ToString();
  854. //营业收入
  855. txtOperatingIncome.Text = "0";
  856. //总支出
  857. txtTotalExpenditure.Text = "0";
  858. //净收入
  859. txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString();
  860. }
  861. else if (cmbProjectSearch.Text == "会员充值收入")
  862. {
  863. //收入
  864. txtTotalRevenue.Text = "0";// Convert.ToDecimal(Convert.ToDecimal(MembersRechargeSum(time))).ToString();
  865. //营业收入
  866. txtOperatingIncome.Text = MembersRechargeSum().ToString();
  867. //总支出
  868. txtTotalExpenditure.Text = "0";
  869. //净收入
  870. txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString();
  871. }
  872. else if (cmbProjectSearch.Text == "服务卡消费收入")
  873. {
  874. //收入
  875. txtTotalRevenue.Text = "0";//Convert.ToDecimal(Convert.ToDecimal(MemberCardPayment(time))).ToString();
  876. //营业收入
  877. txtOperatingIncome.Text = MemberCardPayment().ToString();
  878. //总支出
  879. txtTotalExpenditure.Text = "0";
  880. //净收入
  881. txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString();
  882. }
  883. else if (cmbProjectSearch.Text == "礼服租售收入")
  884. {
  885. //收入
  886. txtTotalRevenue.Text = TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
  887. //营业收入
  888. txtOperatingIncome.Text = TotalRevenueSun("").ToString();
  889. //总支出
  890. txtTotalExpenditure.Text = "0";
  891. //净收入
  892. txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString();
  893. }
  894. else if (cmbProjectSearch.Text == "店面支出")
  895. {
  896. //收入
  897. txtTotalRevenue.Text = "0";
  898. //营业收入
  899. txtOperatingIncome.Text = "0";
  900. //总支出
  901. txtTotalExpenditure.Text = ExpenditureSum().ToString();
  902. //净收入
  903. txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString();
  904. }
  905. else if (cmbProjectSearch.Text == "财务支出")
  906. {
  907. //收入
  908. txtTotalRevenue.Text = "0";
  909. //营业收入
  910. txtOperatingIncome.Text = "0";
  911. //总支出
  912. txtTotalExpenditure.Text = FinancialExpensesSum().ToString();
  913. //净收入
  914. txtNetIncome.Text = (Convert.ToDecimal(txtTotalRevenue.Text) - Convert.ToDecimal(txtTotalExpenditure.Text)).ToString();
  915. }
  916. else if (cmbProjectSearch.Text == "押金")
  917. {
  918. //收入
  919. txtTotalRevenue.Text = "0";
  920. //营业收入
  921. txtOperatingIncome.Text = "0";
  922. //总支出
  923. txtTotalExpenditure.Text = "0";
  924. //净收入
  925. txtNetIncome.Text = "0";
  926. }
  927. //订单前期
  928. txtPreliminaryResults.Text = OrderEarly().ToString();
  929. //订单后期
  930. txtLateResults.Text = OrderLate().ToString();
  931. }
  932. /// <summary>
  933. /// 项目查询
  934. /// </summary>
  935. /// <param name="sender"></param>
  936. /// <param name="e"></param>
  937. protected override void cmbProjectSearch_SelectedValueChanged(object sender, EventArgs e)
  938. {
  939. try
  940. {
  941. this.CtvTsorder_Name.Visible = true;
  942. this.CtvTsorder_Name.Text = "";
  943. this.dgv.Rows.Clear();
  944. if (this.cmbProjectSearch.Text == "全部")
  945. {
  946. this.CtvTsorder_Name.Visible = false;
  947. // 获取订单收款/其它二销/礼服租售记录
  948. this.BindOrdersReceivables();
  949. // 获取其它收入
  950. this.BindOtherIncome();
  951. // 获取会员充值
  952. this.GetMemberCardRechargeRecord();
  953. // 获取现金支出
  954. this.BindCashExpenses();
  955. //获取财务支出
  956. this.BindFinancialExpenses();
  957. // 服务卡消费收入
  958. this.GetMemberCardPayment();
  959. }
  960. else if (this.cmbProjectSearch.Text == "订单前期收入")
  961. {
  962. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.CtvTsorder_Name, "预约收款,预约补款,全款", IsFirstNodeNull: true, IsFirstNodeName: "全部");
  963. // 获取订单收款/其它二销/礼服租售记录
  964. this.BindOrdersReceivables();
  965. }
  966. else if (this.cmbProjectSearch.Text == "订单后期收入" || this.cmbProjectSearch.Text == "其它消费收入")
  967. {
  968. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACDAJDFDDEACGJ", this.CtvTsorder_Name, IsFirstNodeNull: true, IsFirstNodeName: "全部", StrWhere: "Sc_ClassCode!='BEBCADBFBCDFBGJHC' and Sc_ClassCode!='BEBCADBFBDDEGGABF' and Sc_ClassCode!='BEBCBFBICGDHCGBEJ' and Sc_ClassCode!='BEBCABBAAICBDHDHI' and Sc_ClassCode!='BEBCABBAAICJAAGDG' and Sc_ClassCode!='BEBCBFBICFCECBHFF'");
  969. // 获取订单收款/其它二销/礼服租售记录
  970. this.BindOrdersReceivables();
  971. }
  972. else if (this.cmbProjectSearch.Text == "其它收入")
  973. {
  974. this.CtvTsorder_Name.Visible = false;
  975. // 获取其它收入
  976. this.BindOtherIncome();
  977. }
  978. else if (this.cmbProjectSearch.Text == "会员充值收入")
  979. {
  980. this.CtvTsorder_Name.Visible = false;
  981. // 获取会员充值
  982. this.GetMemberCardRechargeRecord();
  983. }
  984. else if (this.cmbProjectSearch.Text == "服务卡消费收入")
  985. {
  986. this.CtvTsorder_Name.Visible = false;
  987. // 服务卡消费收入
  988. this.GetMemberCardPayment();
  989. }
  990. else if (this.cmbProjectSearch.Text == "礼服租售收入")
  991. {
  992. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.CtvTsorder_Name, "礼服出租,礼服出售", IsFirstNodeNull: true, IsFirstNodeName: "全部");
  993. // 获取订单收款/其它二销/礼服租售记录
  994. BindOrdersReceivables();
  995. }
  996. else if (this.cmbProjectSearch.Text == "店面支出")
  997. {
  998. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACIAFBEDIGJJFE", this.CtvTsorder_Name, IsFirstNodeNull: true, IsFirstNodeName: "全部");
  999. // 获取现金支出
  1000. this.BindCashExpenses();
  1001. }
  1002. else if (this.cmbProjectSearch.Text == "财务支出")
  1003. {
  1004. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BFAGBGBAEJBACEEHJ", this.CtvTsorder_Name, IsFirstNodeNull: true, IsFirstNodeName: "全部");
  1005. // 获取现金支出
  1006. this.BindFinancialExpenses();
  1007. }
  1008. //获取文本框金额
  1009. this.BindTotal();
  1010. }
  1011. catch (Exception ex)
  1012. { MessageBoxCustom.Show(ex.Message); }
  1013. }
  1014. /// <summary>
  1015. /// 项目名称
  1016. /// </summary>
  1017. /// <param name="sender"></param>
  1018. /// <param name="e"></param>
  1019. protected override void CtvTsorder_Name_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e)
  1020. { this.BindSelect(); }
  1021. /// <summary>
  1022. /// 选择支付方式
  1023. /// </summary>
  1024. /// <param name="sender"></param>
  1025. /// <param name="e"></param>
  1026. protected override void cmbPay_PaymentMethod_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e)
  1027. { this.BindSelect(); }
  1028. /// <summary>
  1029. /// 打印
  1030. /// </summary>
  1031. /// <param name="sender"></param>
  1032. /// <param name="e"></param>
  1033. protected override void btnPrint_Click(object sender, EventArgs e)
  1034. {
  1035. try
  1036. {
  1037. string StrDateWeek = this.StrDateStart + " — " + this.StrDateEnd;
  1038. //string StrDateWeek = this.StrDateStart + " — " + this.StrDateEnd + "(" + LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.CaculateWeekDay(Convert.ToDateTime(time).DayOfWeek.ToString()) + ")";
  1039. object StrText = null;
  1040. Hashtable htData = new Hashtable();
  1041. htData["dgvData"] = this.dgv;
  1042. htData["StrText"] = StrText;
  1043. htData["StrDateWeek"] = StrDateWeek;
  1044. LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(EnumPublic.PrintTypeEnum.财务报表日, htData);
  1045. }
  1046. catch (Exception ex)
  1047. { MessageBoxCustom.Show(ex.Message); }
  1048. }
  1049. /// <summary>
  1050. /// 财务审核
  1051. /// </summary>
  1052. /// <param name="sender"></param>
  1053. /// <param name="e"></param>
  1054. protected override void btnFinancialAudit_Click(object sender, EventArgs e)
  1055. {
  1056. try
  1057. {
  1058. if (this.dgv.SelectedRows.Count == 0)
  1059. { MessageBoxCustom.Show("请选择你要审核的数据!"); return; }
  1060. if (cmbProjectSearch.Text == "押金")
  1061. { MessageBoxCustom.Show("此订单无需审核!"); return; }
  1062. if (this.dgv.SelectedRows.Count > 10)
  1063. { MessageBoxCustom.Show("最多只能选择10条审核!"); return; }
  1064. string strValue = "";
  1065. if (MessageBoxCustom.Show("此单审核是否通过?", "审核提示", MessageBoxButtons.YesNo) == DialogResult.Yes)
  1066. { strValue = "已审核"; }
  1067. else
  1068. { strValue = "审核不通过"; }
  1069. List<Helper.CommandInfo> clist = new List<Helper.CommandInfo>();
  1070. for (int i = 0; i < this.dgv.SelectedRows.Count; i++)
  1071. {
  1072. string ItemCategory = this.dgv.SelectedRows[i].Cells["ItemCategory"].Value.ToString();
  1073. string ID = this.dgv.SelectedRows[i].Cells["ID"].Value.ToString();
  1074. if (ItemCategory == "固定费用" || ItemCategory == "其它收入")
  1075. {
  1076. LYFZ.Model.Model_ErpOtherIncomeAndExpenses mode = oiebll.GetModel(Convert.ToInt32(ID));
  1077. mode.Oiae_FinancialAuditPeople = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  1078. mode.Oiae_FinancialAuditState = strValue;
  1079. clist.Add(oiebll.GetUpdateCommandInfo(mode));
  1080. }
  1081. else if (ItemCategory == "会员充值")
  1082. {
  1083. LYFZ.Model.Model_ErpMemberCardRechargeRecord mode = mcrrbll.GetModel(Convert.ToInt32(ID));
  1084. mode.Mcrr_FinancialAuditName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  1085. mode.Mcrr_FinancialAudit = strValue;
  1086. clist.Add(mcrrbll.GetUpdateCommandInfo(mode));
  1087. }
  1088. else if (ItemCategory == "服务消费")
  1089. {
  1090. LYFZ.Model.Model_ErpMemberCardPayment mode = mcptbll.GetModel(Convert.ToInt32(ID));
  1091. mode.Mcpt_FinancialAuditName = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  1092. mode.Mcpt_FinancialAudit = strValue;
  1093. mode.Mcpt_FinancialAuditDateTime = DateTime.Now;
  1094. clist.Add(mcptbll.GetUpdateCommandInfo(mode));
  1095. }
  1096. else if (ItemCategory != "固定费用" && ItemCategory != "其它收入" && ItemCategory != "会员充值" && ItemCategory != "服务消费")
  1097. {
  1098. LYFZ.Model.Model_ErpPayment model = ptbll.GetModel(Convert.ToInt32(ID));
  1099. model.Pay_FinancialAudit = strValue;
  1100. model.Pay_FinancialAuditdPeople = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID;
  1101. clist.Add(ptbll.GetUpdateCommandInfo(model));
  1102. }
  1103. }
  1104. if (clist.Count > 0)
  1105. {
  1106. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
  1107. {
  1108. MessageBoxCustom.Show("审核完成!");
  1109. this.BindSelect();
  1110. }
  1111. else
  1112. { MessageBoxCustom.Show("审核失败!"); }
  1113. }
  1114. }
  1115. catch (Exception ex)
  1116. { MessageBoxCustom.Show(ex.Message); }
  1117. }
  1118. /// <summary>
  1119. /// 导出
  1120. /// </summary>
  1121. /// <param name="sender"></param>
  1122. /// <param name="e"></param>
  1123. protected override void btnExPort_Click(object sender, EventArgs e)
  1124. { this.dgv.ExportDataTable(); }
  1125. /// <summary>
  1126. /// 关闭
  1127. /// </summary>
  1128. /// <param name="sender"></param>
  1129. /// <param name="e"></param>
  1130. protected override void btnClose_Click(object sender, EventArgs e)
  1131. { this.Close(); }
  1132. /// <summary>
  1133. /// 财务支出
  1134. /// </summary>
  1135. /// <param name="sender"></param>
  1136. /// <param name="e"></param>
  1137. protected override void btnFinancialExpenses_Click(object sender, EventArgs e)
  1138. {
  1139. try
  1140. {
  1141. this.txtTotalRevenue.Text = "0";
  1142. this.txtOperatingIncome.Text = "0";
  1143. this.txtNetIncome.Text = "0";
  1144. this.dgv.Rows.Clear();
  1145. //获取财务支出
  1146. this.BindFinancialExpenses();
  1147. // 获取现金支出
  1148. this.BindCashExpenses();
  1149. //总支出
  1150. DataTable dt = WagesSetBll.GetOtherIncomeSum(" Oiae_Type!='收入' " + PublicCodeClasses.GetDateTime("convert(datetime,Oiae_IEDatetime)", this.StrDateStart, this.StrDateEnd, DateAddDays: 0)).Tables[0];
  1151. if (string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString()))
  1152. { this.txtTotalExpenditure.Text = "0"; }
  1153. else
  1154. { this.txtTotalExpenditure.Text = dt.Rows[0]["Oiae_Money"].ToString(); }
  1155. }
  1156. catch (Exception ex)
  1157. { MessageBoxCustom.Show(ex.Message); }
  1158. }
  1159. }
  1160. }