FrmYearFinance.cs 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. using LYFZ.ComponentLibrary;
  2. using LYFZ.Software.MainBusiness.DoorCityProcess;
  3. using System;
  4. using System.Collections;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Windows.Forms;
  12. namespace LYFZ.Software.MainBusiness.StatisticalInquiry
  13. {
  14. public partial class FrmYearFinance : LYFZ.Software.UI.StatisticalInquiry.FrmYearFinance
  15. {
  16. private delegate void UpdateControl();
  17. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  18. LYFZ.BLL.BLL_AllViewSet avsbll = new BLL.BLL_AllViewSet();
  19. LYFZ.BLL.BLL_ErpWagesSet wsbll = new BLL.BLL_ErpWagesSet();
  20. public FrmYearFinance()
  21. {
  22. }
  23. /// <summary>
  24. /// 加载
  25. /// </summary>
  26. /// <param name="sender"></param>
  27. /// <param name="e"></param>
  28. protected override void FrmYearFinance_Shown(object sender, EventArgs e)
  29. {
  30. try
  31. {
  32. //获取支付方式
  33. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACCAFCCEAGAIHH", this.cmbPay_PaymentMethod, IsFirstNodeNull: true);
  34. // 导出
  35. this.btnExPort.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.YearFinanceCompetence, CustomAttributes.OperatingAuthority.DataExport);
  36. // 打印
  37. this.btnPrint.Enabled = LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.YearFinanceCompetence, CustomAttributes.OperatingAuthority.Print);
  38. // 财务支出
  39. if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.DayFinanceCompetence, CustomAttributes.OperatingAuthority.FinancialExpenses))
  40. { this.cmbProjectSearch.Items.RemoveAt(8); }
  41. this.numYear.Value = SDateTime.Now.Year;
  42. this.cmbProjectSearch.SelectedIndex = 0;
  43. }
  44. catch (Exception ex)
  45. { MessageBoxCustom.Show(ex.Message); }
  46. }
  47. /// <summary>
  48. /// 获取每月绑定报表
  49. /// </summary>
  50. public void Bind()
  51. {
  52. this.dgvMonth.Rows.Clear();
  53. string time = this.numYear.Value.ToString();
  54. #region 获取月报表
  55. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker)
  56. {
  57. DataTable dt = avsbll.Vw_YearReport("convert(varchar,Pay_CreateDatetimes,120) like '%" + time + "%'").Tables[0];
  58. if (dt.Rows.Count > 0)
  59. {
  60. this.Invoke(new UpdateControl(delegate()
  61. {
  62. #region
  63. for (int t = 0; t < dt.Rows.Count; t++)
  64. {
  65. //订单收入
  66. decimal DayOrdersIncome = dt.Rows[t]["DayOrdersIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayOrdersIncome"]);
  67. //补款收入
  68. decimal DayReplenishmentIncome = dt.Rows[t]["DayReplenishmentIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayReplenishmentIncome"]);
  69. //后期收入
  70. decimal DayLateStageIncome = dt.Rows[t]["DayLateStageIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayLateStageIncome"]);
  71. //其它收入
  72. decimal DayOtherIncome = dt.Rows[t]["DayOtherIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayOtherIncome"]);
  73. //会员充值
  74. decimal DayMemberIncome = dt.Rows[t]["DayMemberIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayMemberIncome"]);
  75. //服务卡充值
  76. decimal DayMemberCardPaymentIncome = dt.Rows[t]["DayMemberCardPaymentIncome"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayMemberCardPaymentIncome"]);
  77. //前期业绩
  78. decimal DayEarlyPerformance = dt.Rows[t]["DayEarlyPerformance"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayEarlyPerformance"]);
  79. //后期业绩(加挑商品+其它消费)
  80. //加挑商品
  81. decimal DayPluslatepickPerformance = dt.Rows[t]["DayPluslatepickPerformance"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayPluslatepickPerformance"]);
  82. decimal DayOtherPerformance = dt.Rows[t]["DayOtherPerformance"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayOtherPerformance"]);
  83. //总店面支出
  84. decimal DayExpenditure = dt.Rows[t]["DayExpenditure"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayExpenditure"]);
  85. //总支出
  86. decimal DayExpenditure2 = dt.Rows[t]["DayExpenditure2"].ToString().Trim() == "" ? 0 : Convert.ToDecimal(dt.Rows[t]["DayExpenditure2"]);
  87. #region 获取月报表
  88. DataGridViewRow dgvr = new DataGridViewRow();
  89. DataGridViewCell cell = null;
  90. //日期
  91. cell = new DataGridViewTextBoxCell();
  92. cell.Value = dt.Rows[t]["Pay_CreateDatetimes"].ToString();
  93. dgvr.Cells.Add(cell);
  94. //总收入
  95. cell = new DataGridViewTextBoxCell();
  96. cell.Value = (DayOrdersIncome + DayReplenishmentIncome + DayLateStageIncome + DayOtherIncome + DayMemberIncome + DayMemberCardPaymentIncome);
  97. dgvr.Cells.Add(cell);
  98. //订单收入
  99. cell = new DataGridViewTextBoxCell();
  100. cell.Value = DayOrdersIncome;
  101. dgvr.Cells.Add(cell);
  102. //补款收入
  103. cell = new DataGridViewTextBoxCell();
  104. cell.Value = DayReplenishmentIncome;
  105. dgvr.Cells.Add(cell);
  106. //日后期收入
  107. cell = new DataGridViewTextBoxCell();
  108. cell.Value = DayLateStageIncome;
  109. dgvr.Cells.Add(cell);
  110. //其它收入
  111. cell = new DataGridViewTextBoxCell();
  112. cell.Value = DayOtherIncome;
  113. dgvr.Cells.Add(cell);
  114. //会员充值
  115. cell = new DataGridViewTextBoxCell();
  116. cell.Value = DayMemberIncome;
  117. dgvr.Cells.Add(cell);
  118. //服务卡充值
  119. cell = new DataGridViewTextBoxCell();
  120. cell.Value = DayMemberCardPaymentIncome;
  121. dgvr.Cells.Add(cell);
  122. //前期业绩
  123. cell = new DataGridViewTextBoxCell();
  124. cell.Value = DayEarlyPerformance;
  125. dgvr.Cells.Add(cell);
  126. //日后期业绩
  127. cell = new DataGridViewTextBoxCell();
  128. cell.Value = (DayPluslatepickPerformance + DayOtherPerformance);
  129. dgvr.Cells.Add(cell);
  130. //总业绩
  131. cell = new DataGridViewTextBoxCell();
  132. cell.Value = (DayEarlyPerformance + DayPluslatepickPerformance + DayOtherPerformance);
  133. dgvr.Cells.Add(cell);
  134. //总支出
  135. cell = new DataGridViewTextBoxCell();
  136. cell.Value = (DayExpenditure + DayExpenditure2);
  137. dgvr.Cells.Add(cell);
  138. this.dgvMonth.Rows.Add(dgvr);
  139. #endregion
  140. }
  141. dgvMonth.ClearSelection();
  142. #endregion
  143. }));
  144. }
  145. });
  146. #endregion
  147. }
  148. /// <summary>
  149. /// 获取订单前期
  150. /// </summary>
  151. /// <param name="time"></param>
  152. /// <returns></returns>
  153. decimal OrderEarly()
  154. {
  155. decimal sum = 0;
  156. DataTable dt = wsbll.GetTwoPieSum(" convert(varchar,Pay_CreateDatetime,120) like '%" + this.numYear.Value + "%' and Pay_Category!='后期收款' and (Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID')").Tables[0];
  157. if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString()))
  158. { sum = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"]); }
  159. return sum;
  160. }
  161. /// <summary>
  162. /// 获取订单后期
  163. /// </summary>
  164. /// <param name="time"></param>
  165. /// <returns></returns>
  166. decimal OrderLate()
  167. {
  168. decimal sum = 0;
  169. DataTable dt = wsbll.GetTwoPieSum("convert(varchar,Pay_CreateDatetime,120) like '%" + this.numYear.Value + "%' and Pay_Category='后期收款' and (Pay_Type=0) and (Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID')").Tables[0];
  170. if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString()))
  171. { sum = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"]); }
  172. return sum;
  173. }
  174. /// <summary>
  175. /// 获取收款记录金额
  176. /// </summary>
  177. /// <param name="time"></param>
  178. /// <param name="Symbol"></param>
  179. /// <returns></returns>
  180. decimal TotalRevenueSun(string Symbol)
  181. {
  182. decimal sum = 0;
  183. StringBuilder str = new StringBuilder();
  184. str.Append("" + Symbol + " convert(varchar,Pay_CreateDatetime,120) like '%" + this.numYear.Value + "%' ");
  185. if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
  186. { str.Append(" and Pay_PaymentMethod='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  187. if (this.cmbProjectSearch.Text != "全部")
  188. {
  189. if (this.cmbProjectSearch.Text == "订单前期收入")
  190. {
  191. if (string.IsNullOrEmpty(this.CtvTsorder_Name.Text) || this.CtvTsorder_Name.Text == "全部")
  192. { str.Append(" and Pay_Category!='后期收款'"); }
  193. else
  194. { str.Append(" and Pay_Category='" + this.CtvTsorder_Name.Text.ToString() + "'"); }
  195. }
  196. else if (this.cmbProjectSearch.Text == "订单后期收入")
  197. {
  198. if (string.IsNullOrEmpty(this.CtvTsorder_Name.Text) || this.CtvTsorder_Name.Text == "全部")
  199. { str.Append(" and Pay_Category='后期收款' and Pay_Type=0"); }
  200. else
  201. { str.Append("and Pay_Category='后期收款' and Pay_Type=0 and Pay_TwoPinsCategory='" + this.CtvTsorder_Name.Tag.ToString() + "'"); }
  202. }
  203. else if (this.cmbProjectSearch.Text == "其它消费收入")
  204. {
  205. if (string.IsNullOrEmpty(this.CtvTsorder_Name.Text) || this.CtvTsorder_Name.Text == "全部")
  206. { str.Append(" and Pay_Category='后期收款' and Pay_Type=1"); }
  207. else
  208. { str.Append("and Pay_Category='后期收款' and Pay_Type=1 and Pay_TwoPinsCategory='" + this.CtvTsorder_Name.Tag.ToString() + "'"); }
  209. }
  210. else if (this.cmbProjectSearch.Text == "礼服租售收入")
  211. {
  212. if (string.IsNullOrEmpty(this.CtvTsorder_Name.Text) || this.CtvTsorder_Name.Text == "全部")
  213. { str.Append(" and Pay_Category='后期收款' and Pay_Type=2"); }
  214. else
  215. { str.Append("and Pay_Category='后期收款' and Pay_Type=2 and Pay_ReceivableProject='" + this.CtvTsorder_Name.Text.ToString() + "'"); }
  216. }
  217. }
  218. DataTable dt = wsbll.GetTwoPieSum(str.ToString()).Tables[0];
  219. if (!string.IsNullOrEmpty(dt.Rows[0]["Pay_AmountOf"].ToString()))
  220. { sum = Convert.ToDecimal(dt.Rows[0]["Pay_AmountOf"]); }
  221. return sum;
  222. }
  223. /// <summary>
  224. /// 获取其它收入金额
  225. /// </summary>
  226. /// <param name="Time"></param>
  227. /// <returns></returns>
  228. decimal OtherIncomeSum()
  229. {
  230. decimal sum = 0;
  231. StringBuilder str = new StringBuilder();
  232. str.Append("Oiae_Type='收入' and convert(varchar,Oiae_IEDatetime,120) like '%" + this.numYear.Value + "%'");
  233. if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
  234. { str.Append(" and Oiae_PaymentMethod='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  235. DataTable dt = wsbll.GetOtherIncomeSum(str.ToString()).Tables[0];
  236. if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString()))
  237. { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); }
  238. return sum;
  239. }
  240. /// <summary>
  241. /// 获取会员充值金额
  242. /// </summary>
  243. /// <param name="Time"></param>
  244. /// <returns></returns>
  245. decimal MembersRechargeSum()
  246. {
  247. decimal sum = 0;
  248. StringBuilder str = new StringBuilder();
  249. str.Append(" convert(varchar,Mcrr_CreateDatetime,120) like '%" + this.numYear.Value + "%' ");
  250. if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
  251. { str.Append(" and Mcrr_PaymentMethod='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  252. DataTable dt = wsbll.GetMembersRechargeSum(str.ToString()).Tables[0];
  253. if (!string.IsNullOrEmpty(dt.Rows[0]["Mcrr_RechargeAmount"].ToString()))
  254. { sum = Convert.ToDecimal(dt.Rows[0]["Mcrr_RechargeAmount"]); }
  255. return sum;
  256. }
  257. /// <summary>
  258. /// 获取服务卡消费充值金额
  259. /// </summary>
  260. /// <param name="Time"></param>
  261. /// <returns></returns>
  262. decimal MemberCardPayment()
  263. {
  264. LYFZ.BLL.BLL_AllViewSet AllViewSetBll = new BLL.BLL_AllViewSet();
  265. decimal sum = 0;
  266. StringBuilder str = new StringBuilder();
  267. str.Append(" and convert(varchar,创建日期,120) like '%" + this.numYear.Value + "%' ");
  268. if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
  269. { str.Append(" and 付款方式编号='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  270. DataTable dt = AllViewSetBll.GetMemberCardPaymentSum(str.ToString()).Tables[0];
  271. if (!string.IsNullOrEmpty(dt.Rows[0]["收款金额"].ToString()))
  272. { sum = Convert.ToDecimal(dt.Rows[0]["收款金额"]); }
  273. return sum;
  274. }
  275. /// <summary>
  276. /// 现金支出金额
  277. /// </summary>
  278. /// <param name="Time"></param>
  279. /// <returns></returns>
  280. decimal ExpenditureSum()
  281. {
  282. decimal sum = 0;
  283. StringBuilder str = new StringBuilder();
  284. str.Append(" Oiae_Type='支出' and convert(varchar,Oiae_IEDatetime,120) like '%" + this.numYear.Value + "%' ");
  285. if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
  286. { str.Append("and Oiae_PaymentMethod='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  287. if (this.cmbProjectSearch.Text != "全部" && this.cmbProjectSearch.Text == "店面支出")
  288. {
  289. if (!string.IsNullOrEmpty(this.CtvTsorder_Name.Text) && this.CtvTsorder_Name.Text != "全部")
  290. { str.Append("and Oiae_ProjectName='" + this.CtvTsorder_Name.Text.ToString() + "'"); }
  291. }
  292. DataTable dt = wsbll.GetOtherIncomeSum(str.ToString()).Tables[0];
  293. if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString()))
  294. { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); }
  295. return sum;
  296. }
  297. /// <summary>
  298. /// 财务支出金额
  299. /// </summary>
  300. /// <param name="Time"></param>
  301. /// <returns></returns>
  302. decimal FinancialExpensesSum()
  303. {
  304. decimal sum = 0;
  305. StringBuilder str = new StringBuilder();
  306. str.Append(" Oiae_Type='财务支出' and convert(varchar,Oiae_IEDatetime,120) like '%" + this.numYear.Value + "%' ");
  307. if (!string.IsNullOrEmpty(this.cmbPay_PaymentMethod.Text) && this.cmbPay_PaymentMethod.Tag != null)
  308. { str.Append("and Oiae_PaymentMethod='" + this.cmbPay_PaymentMethod.Tag.ToString() + "'"); }
  309. if (this.cmbProjectSearch.Text != "全部" && this.cmbProjectSearch.Text == "财务支出")
  310. {
  311. if (!string.IsNullOrEmpty(this.CtvTsorder_Name.Text) && this.CtvTsorder_Name.Text != "全部")
  312. { str.Append("and Oiae_ProjectName='" + this.CtvTsorder_Name.Text.ToString() + "'"); }
  313. }
  314. DataTable dt = wsbll.GetOtherIncomeSum(str.ToString()).Tables[0];
  315. if (!string.IsNullOrEmpty(dt.Rows[0]["Oiae_Money"].ToString()))
  316. { sum = Convert.ToDecimal(dt.Rows[0]["Oiae_Money"]); }
  317. return sum;
  318. }
  319. /// <summary>
  320. /// 文本框合计获取值
  321. /// </summary>
  322. public void BindTotal()
  323. {
  324. string time = this.numYear.Value.ToString();
  325. if (this.cmbProjectSearch.Text == "全部")
  326. {
  327. //收入
  328. this.txtTotalRevenue.Text = (this.TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ") + this.OtherIncomeSum()).ToString();
  329. //营业收入
  330. this.txtOperatingIncome.Text = (this.TotalRevenueSun("") + this.MembersRechargeSum() + this.MemberCardPayment()).ToString();
  331. //总支出
  332. this.txtTotalExpenditure.Text = (this.ExpenditureSum() + this.FinancialExpensesSum()).ToString();
  333. //净收入
  334. this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
  335. }
  336. else if (this.cmbProjectSearch.Text == "订单前期收入")
  337. {
  338. //收入
  339. this.txtTotalRevenue.Text = this.TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
  340. //营业收入
  341. this.txtOperatingIncome.Text = this.TotalRevenueSun("").ToString();
  342. //总支出
  343. this.txtTotalExpenditure.Text = "0";
  344. //净收入
  345. this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
  346. }
  347. else if (this.cmbProjectSearch.Text == "订单后期收入")
  348. {
  349. //收入
  350. this.txtTotalRevenue.Text = this.TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
  351. //营业收入
  352. this.txtOperatingIncome.Text = this.TotalRevenueSun("").ToString();
  353. //总支出
  354. this.txtTotalExpenditure.Text = "0";
  355. //净收入
  356. this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
  357. }
  358. else if (this.cmbProjectSearch.Text == "其它消费收入")
  359. {
  360. //收入
  361. this.txtTotalRevenue.Text = this.TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
  362. //营业收入
  363. this.txtOperatingIncome.Text = this.TotalRevenueSun("").ToString();
  364. //总支出
  365. this.txtTotalExpenditure.Text = "0";
  366. //净收入
  367. this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
  368. }
  369. else if (this.cmbProjectSearch.Text == "其它收入")
  370. {
  371. //收入
  372. this.txtTotalRevenue.Text = this.OtherIncomeSum().ToString();
  373. //营业收入
  374. this.txtOperatingIncome.Text = "0";
  375. //总支出
  376. this.txtTotalExpenditure.Text = "0";
  377. //净收入
  378. this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
  379. }
  380. else if (this.cmbProjectSearch.Text == "会员充值收入")
  381. {
  382. //收入
  383. this.txtTotalRevenue.Text = "0";// Convert.ToDecimal(Convert.ToDecimal(MembersRechargeSum(time))).ToString();
  384. //营业收入
  385. this.txtOperatingIncome.Text = this.MembersRechargeSum().ToString();
  386. //总支出
  387. this.txtTotalExpenditure.Text = "0";
  388. //净收入
  389. this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
  390. }
  391. else if (this.cmbProjectSearch.Text == "服务卡消费收入")
  392. {
  393. //收入
  394. this.txtTotalRevenue.Text = "0";// Convert.ToDecimal(Convert.ToDecimal(MemberCardPayment(time))).ToString();
  395. //营业收入
  396. this.txtOperatingIncome.Text = this.MemberCardPayment().ToString();
  397. //总支出
  398. this.txtTotalExpenditure.Text = "0";
  399. //净收入
  400. this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
  401. }
  402. else if (this.cmbProjectSearch.Text == "礼服租售收入")
  403. {
  404. //收入
  405. this.txtTotalRevenue.Text = this.TotalRevenueSun("(Pay_PaymentMethod!='BEBACCAFEGECFBJFD' and Pay_PaymentMethod!='BEBCABAJBDFBBJGID') and ").ToString();
  406. //营业收入
  407. this.txtOperatingIncome.Text = this.TotalRevenueSun("").ToString();
  408. //总支出
  409. this.txtTotalExpenditure.Text = "0";
  410. //净收入
  411. this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
  412. }
  413. else if (this.cmbProjectSearch.Text == "店面支出")
  414. {
  415. //收入
  416. this.txtTotalRevenue.Text = "0";
  417. //营业收入
  418. this.txtOperatingIncome.Text = "0";
  419. //总支出
  420. this.txtTotalExpenditure.Text = this.ExpenditureSum().ToString();
  421. //净收入
  422. this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
  423. }
  424. else if (this.cmbProjectSearch.Text == "财务支出")
  425. {
  426. //收入
  427. this.txtTotalRevenue.Text = "0";
  428. //营业收入
  429. this.txtOperatingIncome.Text = "0";
  430. //总支出
  431. this.txtTotalExpenditure.Text = this.FinancialExpensesSum().ToString();
  432. //净收入
  433. this.txtNetIncome.Text = (Convert.ToDecimal(this.txtTotalRevenue.Text) - Convert.ToDecimal(this.txtTotalExpenditure.Text)).ToString();
  434. }
  435. else if (this.cmbProjectSearch.Text == "押金")
  436. {
  437. //收入
  438. this.txtTotalRevenue.Text = "0";
  439. //营业收入
  440. this.txtOperatingIncome.Text = "0";
  441. //总支出
  442. this.txtTotalExpenditure.Text = "0";
  443. //净收入
  444. this.txtNetIncome.Text = "0";
  445. }
  446. //订单前期
  447. this.txtPreliminaryResults.Text = this.OrderEarly().ToString();
  448. //订单后期
  449. this.txtLateResults.Text = this.OrderLate().ToString();
  450. }
  451. /// <summary>
  452. /// 项目查询
  453. /// </summary>
  454. /// <param name="sender"></param>
  455. /// <param name="e"></param>
  456. protected override void cmbProjectSearch_SelectedValueChanged(object sender, EventArgs e)
  457. {
  458. try
  459. {
  460. this.CtvTsorder_Name.Text = "";
  461. if (this.cmbProjectSearch.Text == "全部")
  462. { this.CtvTsorder_Name.Visible = false; }
  463. else if (this.cmbProjectSearch.Text == "订单前期收入")
  464. {
  465. this.CtvTsorder_Name.Visible = true;
  466. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.CtvTsorder_Name, "全部,预约收款,预约补款,全款");
  467. }
  468. else if (this.cmbProjectSearch.Text == "订单后期收入" || this.cmbProjectSearch.Text == "其它消费收入")
  469. {
  470. this.CtvTsorder_Name.Visible = true;
  471. 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'");
  472. }
  473. else if (this.cmbProjectSearch.Text == "其它收入")
  474. { this.CtvTsorder_Name.Visible = false; }
  475. else if (this.cmbProjectSearch.Text == "会员充值收入")
  476. { this.CtvTsorder_Name.Visible = false; }
  477. else if (this.cmbProjectSearch.Text == "服务卡消费收入")
  478. { this.CtvTsorder_Name.Visible = false; }
  479. else if (this.cmbProjectSearch.Text == "礼服租售收入")
  480. {
  481. this.CtvTsorder_Name.Visible = true;
  482. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboxTreeView(this.CtvTsorder_Name, "全部,礼服出租,礼服出售");
  483. }
  484. else if (this.cmbProjectSearch.Text == "店面支出")
  485. {
  486. this.CtvTsorder_Name.Visible = true;
  487. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BEBACIAFBEDIGJJFE", this.CtvTsorder_Name, IsFirstNodeNull: true, IsFirstNodeName: "全部");
  488. }
  489. else if (this.cmbProjectSearch.Text == "财务支出")
  490. {
  491. this.CtvTsorder_Name.Visible = true;
  492. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_SystemCategory("BFAGBGBAEJBACEEHJ", this.CtvTsorder_Name, IsFirstNodeNull: true, IsFirstNodeName: "全部");
  493. }
  494. else if (this.cmbProjectSearch.Text == "押金")
  495. { this.CtvTsorder_Name.Visible = false; }
  496. //获取文本框金额
  497. this.BindTotal();
  498. }
  499. catch (Exception ex)
  500. { MessageBoxCustom.Show(ex.Message); }
  501. }
  502. /// <summary>
  503. /// 项目名称
  504. /// </summary>
  505. /// <param name="sender"></param>
  506. /// <param name="e"></param>
  507. protected override void CtvTsorder_Name_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e)
  508. { this.BindTotal(); }
  509. /// <summary>
  510. /// 选择支付方式
  511. /// </summary>
  512. /// <param name="sender"></param>
  513. /// <param name="e"></param>
  514. protected override void cmbPay_PaymentMethod_ComboBoxTreeViewEx_TextChanged(object sender, TreeViewEventArgs e)
  515. { this.BindTotal(); }
  516. /// <summary>
  517. /// 查询年
  518. /// </summary>
  519. /// <param name="sender"></param>
  520. /// <param name="e"></param>
  521. protected override void numYear_ValueChanged(object sender, EventArgs e)
  522. {
  523. try
  524. { //获取订单数
  525. string strStartTime = this.numYear.Value + "-01-01";
  526. string strEndTime = Convert.ToDateTime(strStartTime).AddYears(1).AddSeconds(-1).ToString("yyyy-MM-dd HH:mm:ss.fff");
  527. string ExecuteSql = orbll.GetView_CustomReturnExecuteSql("tb_ErpOrder", StrWhere: PublicCodeClasses.GetDateTime("Ord_CreateDateTime", strStartTime, strEndTime, DateAddDays: 0, ConnectWord: ""), ShowColumnName: "Ord_Type,Ord_Class");
  528. DataSet dtSet = orbll.GetView_Custom(ExecuteSql);
  529. DataTable tbl1 = dtSet.Tables["ds"];
  530. DataRow[] dtRow = tbl1.Select("Ord_Type = '0'");
  531. DataRow[] dtRow1 = tbl1.Select("Ord_Type = '1'");
  532. DataRow[] dtRow2 = tbl1.Select("Ord_Type = '2'");
  533. DataRow[] dtRow3 = tbl1.Select("Ord_Type = '3'");
  534. DataRow[] dtRow4 = tbl1.Select("Ord_Type = '4'");
  535. DataRow[] dtRow5 = tbl1.Select("Ord_Class = '0'");
  536. this.lblCount.Text = "订单数: 婚纱:" + dtRow.Length + " 儿童:" + dtRow1.Length + " 写真:" + dtRow2.Length + " 服务:" + dtRow3.Length + " 婚庆:" + dtRow4.Length + " 其中意向:" + dtRow5.Length;
  537. this.BindTotal();
  538. this.Bind();
  539. }
  540. catch (Exception ex)
  541. { MessageBoxCustom.Show(ex.Message); }
  542. }
  543. /// <summary>
  544. /// 导出
  545. /// </summary>
  546. /// <param name="sender"></param>
  547. /// <param name="e"></param>
  548. protected override void btnExPort_Click(object sender, EventArgs e)
  549. { this.dgvMonth.ExportDataTable(); }
  550. /// <summary>
  551. /// 关闭
  552. /// </summary>
  553. /// <param name="sender"></param>
  554. /// <param name="e"></param>
  555. protected override void btnClose_Click(object sender, EventArgs e)
  556. { this.Close(); }
  557. /// <summary>
  558. /// 查询明细
  559. /// </summary>
  560. /// <param name="sender"></param>
  561. /// <param name="e"></param>
  562. protected override void dgvMonth_DoubleClick(object sender, EventArgs e)
  563. {
  564. try
  565. {
  566. if (this.dgvMonth.SelectedRows.Count == 0)
  567. { MessageBoxCustom.Show("请选择你要查看的日期!"); return; }
  568. LYFZ.Software.MainBusiness.StatisticalInquiry.FrmMonthFinance frm = new FrmMonthFinance();
  569. frm.DateTimeDay = this.dgvMonth.CurrentRow.Cells["DayNumber"].Value.ToString();
  570. frm.StartPosition = System.Windows.Forms.FormStartPosition.Manual;
  571. frm.Location = new Point(LYFZ.EnumPublic.FormLocation_X, LYFZ.EnumPublic.FormLocation_Y);
  572. frm.Size = new Size(LYFZ.EnumPublic.FormSize_Width, LYFZ.EnumPublic.FormSize_Height);
  573. frm.ShowDialog();
  574. }
  575. catch (Exception ex) { MessageBoxCustom.Show(ex.Message); }
  576. }
  577. /// <summary>
  578. /// 打印
  579. /// </summary>
  580. /// <param name="sender"></param>
  581. /// <param name="e"></param>
  582. protected override void btnPrint_Click(object sender, EventArgs e)
  583. {
  584. try
  585. {
  586. string StrDateWeek = this.numYear.Value.ToString().Trim() + "年";
  587. object StrText = "总收入:" + this.txtTotalRevenue.Text.Trim() + " 营业收入:" + this.txtOperatingIncome.Text.Trim() + " 总支出:" + this.txtTotalExpenditure.Text.Trim();
  588. StrText += "\r\n净收入:" + this.txtNetIncome.Text.Trim() + " 前期业绩:" + this.txtPreliminaryResults.Text.Trim() + " 后期业绩:" + this.txtLateResults.Text.Trim();
  589. StrText += "\r\n" + this.lblCount.Text.Trim();
  590. Hashtable htData = new Hashtable();
  591. htData["dgvData"] = this.dgvMonth;
  592. htData["StrText"] = StrText;
  593. htData["StrDateWeek"] = StrDateWeek;
  594. LYFZ.Software.MainBusiness.ReportPrint.ReportFixedFormat.PrintFixedFormat(EnumPublic.PrintTypeEnum.财务报表年, htData);
  595. }
  596. catch (Exception ex)
  597. { MessageBoxCustom.Show(ex.Message); }
  598. }
  599. }
  600. }