private void tvwAccountList_AfterCheck(object sender, TreeViewEventArgs e) { ClearInfo(); if (e.Node.Tag == null) { return; } accountBook = new List <PrivyAccountBook>(); notAccountBook = new List <PrivyAccountBook>(); this.tvwAccountList.AfterCheck -= new TreeViewEventHandler(tvwAccountList_AfterCheck); this.tvwAccountList.SelectedNode = e.Node; _currentAccountBook = (PrivyAccountBook)e.Node.Tag; accountBook.Clear(); //设置子节点是否勾选 SetNodeChecked(this.tvwAccountList.SelectedNode, this.tvwAccountList.SelectedNode.Checked); //勾已交款的节点把未交款节点全改为false,反之 bool b = GetParent(this.tvwAccountList.SelectedNode); //得到勾选的节点的ID GetNode(this.tvwAccountList.Nodes, b); if (b == true) { CollectAccountBook totalBook = AccountBookController.CollectAllAccountBook(accountBook); ShowAccountBook(totalBook); } else { CollectAccountBook totalBook1 = AccountBookController.CollectAllAccountBook(notAccountBook); ShowAccountBook(totalBook1); } this.tvwAccountList.AfterCheck += new TreeViewEventHandler(tvwAccountList_AfterCheck); }
/// <summary> /// /// </summary> /// <param name="AccountBook"></param> /// <param name="Kind"></param> public FrmViewInvoice(BaseAccountBook AccountBook, OPDBillKind Kind) { InitializeComponent( ); accountBook = AccountBook; kind = Kind; this.Text = this.Text + " --【" + kind.ToString( ) + "】"; }
private void ShowAccountBook(BaseAccountBook book) { int row = 0; #region 显示收费票据 if (book is PrivyAccountBook) { ChargeName.Visible = false; PrivyAccountBook privyBook = (PrivyAccountBook)book; row = dgvInvoiceList.Rows.Add( ); dgvInvoiceList[InvoiceType.Name, row].Value = "收费发票"; dgvInvoiceList[NumberStartAndEnd.Name, row].Value = privyBook.ChargeInvoiceInfo.StartNumber + " —— " + privyBook.ChargeInvoiceInfo.EndNumber; dgvInvoiceList[TotalNum.Name, row].Value = privyBook.ChargeInvoiceInfo.Count; dgvInvoiceList[RefundNum.Name, row].Value = privyBook.ChargeInvoiceInfo.RefundCount; dgvInvoiceList[RefundMoney.Name, row].Value = privyBook.ChargeInvoiceInfo.RefundMoney; row = dgvInvoiceList.Rows.Add( ); dgvInvoiceList[InvoiceType.Name, row].Value = "挂号发票"; dgvInvoiceList[NumberStartAndEnd.Name, row].Value = privyBook.RegisterInvoiceInfo.StartNumber + " —— " + privyBook.RegisterInvoiceInfo.EndNumber; dgvInvoiceList[TotalNum.Name, row].Value = privyBook.RegisterInvoiceInfo.Count; dgvInvoiceList[RefundNum.Name, row].Value = privyBook.RegisterInvoiceInfo.RefundCount; dgvInvoiceList[RefundMoney.Name, row].Value = privyBook.RegisterInvoiceInfo.RefundMoney; } else { ChargeName.Visible = true; CollectAccountBook collectBook = (CollectAccountBook)book; for (int i = 0; i < collectBook.ChargeInvoiceInfo.Length; i++) { if ((collectBook.ChargeInvoiceInfo[i].StartNumber != null && collectBook.ChargeInvoiceInfo[i].StartNumber != "") && (collectBook.ChargeInvoiceInfo[i].EndNumber != null && collectBook.ChargeInvoiceInfo[i].EndNumber != "")) { row = dgvInvoiceList.Rows.Add( ); dgvInvoiceList[InvoiceType.Name, row].Value = "收费发票"; dgvInvoiceList[ChargeName.Name, row].Value = collectBook.ChargeInvoiceInfo[i].ChargeName; dgvInvoiceList[NumberStartAndEnd.Name, row].Value = collectBook.ChargeInvoiceInfo[i].StartNumber + " —— " + collectBook.ChargeInvoiceInfo[i].EndNumber; dgvInvoiceList[TotalNum.Name, row].Value = collectBook.ChargeInvoiceInfo[i].Count; dgvInvoiceList[RefundNum.Name, row].Value = collectBook.ChargeInvoiceInfo[i].RefundCount; dgvInvoiceList[RefundMoney.Name, row].Value = collectBook.ChargeInvoiceInfo[i].RefundMoney; } } for (int i = 0; i < collectBook.RegisterInvoiceInfo.Length; i++) { if ((collectBook.RegisterInvoiceInfo[i].StartNumber != null && collectBook.RegisterInvoiceInfo[i].StartNumber != "") && (collectBook.RegisterInvoiceInfo[i].EndNumber != null && collectBook.RegisterInvoiceInfo[i].EndNumber != "")) { row = dgvInvoiceList.Rows.Add( ); dgvInvoiceList[InvoiceType.Name, row].Value = "挂号发票"; dgvInvoiceList[ChargeName.Name, row].Value = collectBook.RegisterInvoiceInfo[i].ChargeName; dgvInvoiceList[NumberStartAndEnd.Name, row].Value = collectBook.RegisterInvoiceInfo[i].StartNumber + " —— " + collectBook.RegisterInvoiceInfo[i].EndNumber; dgvInvoiceList[TotalNum.Name, row].Value = collectBook.RegisterInvoiceInfo[i].Count; dgvInvoiceList[RefundNum.Name, row].Value = collectBook.RegisterInvoiceInfo[i].RefundCount; dgvInvoiceList[RefundMoney.Name, row].Value = collectBook.RegisterInvoiceInfo[i].RefundMoney; } } } #endregion #region 显示发票科目 for (int i = 0; i < book.InvoiceItem.Length; i++) { row = dgvInvoiceItem.Rows.Add( ); //row = dgvInvoiceItem.Rows.Count - 1; dgvInvoiceItem[ITEM_NAME.Name, row].Value = book.InvoiceItem[i].ItemName.Trim( ); dgvInvoiceItem[MONEY.Name, row].Value = book.InvoiceItem[i].Cost; } row = dgvInvoiceItem.Rows.Add( ); //row = dgvInvoiceItem.Rows.Count - 1; dgvInvoiceItem[ITEM_NAME.Name, row].Value = "科目合计"; dgvInvoiceItem[MONEY.Name, row].Value = book.InvoiceItemSumTotal; dgvInvoiceItem[ITEM_NAME.Name, row].Style.Font = new Font("宋体", 12F, FontStyle.Bold); dgvInvoiceItem[MONEY.Name, row].Style.Font = new Font("宋体", 12F, FontStyle.Bold); #endregion #region 显示记账部分 int count = 0; if (book.TallyPart.Details != null) { for (int i = 0; i < book.TallyPart.Details.Length; i++) { row = dgvTallyPart.Rows.Add( ); dgvTallyPart[TallyType.Name, row].Value = book.TallyPart.Details[i].PayName.Replace("_记账", ""); dgvTallyPart[TallyNumber.Name, row].Value = book.TallyPart.Details[i].BillCount; dgvTallyPart[TallyMoney.Name, row].Value = book.TallyPart.Details[i].Money; count += book.TallyPart.Details[i].BillCount; } row = dgvTallyPart.Rows.Add( ); dgvTallyPart[TallyType.Name, row].Value = "记账合计"; dgvTallyPart[TallyNumber.Name, row].Value = count; dgvTallyPart[TallyMoney.Name, row].Value = book.TallyPart.TotalMoney; dgvTallyPart[TallyType.Name, row].Style.Font = new Font("宋体", 12F, FontStyle.Bold); dgvTallyPart[TallyNumber.Name, row].Style.Font = new Font("宋体", 12F, FontStyle.Bold); dgvTallyPart[TallyMoney.Name, row].Style.Font = new Font("宋体", 12F, FontStyle.Bold); } #endregion #region 现金 txtFavor.Text = book.FavorPart.TotalMoney.ToString( ); txtFactCash.Text = book.CashPart.TotalMoney.ToString( ); if (book.CashPart.Details != null) { txtChargeFee.Text = book.CashPart.Details[0].Money.ToString( ); txtRegFee.Text = book.CashPart.Details[1].Money.ToString( ); txtExiamFee.Text = book.CashPart.Details[2].Money.ToString( ); txtTotal.Text = book.InvoiceItemSumTotal.ToString( ); txtTotalCN.Text = HIS.SYSTEM.PubicBaseClasses.Money.NumToChn(book.InvoiceItemSumTotal.ToString( )); if (book.CashPart.TotalMoney != (book.CashPart.Details[1].Money + book.CashPart.Details[2].Money + book.CashPart.Details[0].Money)) { txtFactCash.ForeColor = Color.Red; } else { txtFactCash.ForeColor = Color.Black; } } #endregion }