Example #1
0
        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);
        }
Example #2
0
        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
        }
Example #3
0
        private void ShowTotalInfo()
        {
            int selectedchargeUserId = 0;

            DataTable tbHandIn = AccountBookController.GetAccountList(dtpFrom.Value, dtpEnd.Value);

            List <PrivyAccountBook> lstAllBooks = new List <PrivyAccountBook>();

            #region 得到缴款员
            Hashtable htCharge = new Hashtable();
            for (int i = 0; i < tbHandIn.Rows.Count; i++)
            {
                int chargeUserId = Convert.ToInt32(tbHandIn.Rows[i]["AccountCode"]);
                if (!htCharge.ContainsKey(chargeUserId))
                {
                    htCharge.Add(chargeUserId, chargeUserId);
                }
            }
            #endregion

            #region 生成账单明细,并合并
            foreach (object obj in htCharge)
            {
                int       chargeUserId  = Convert.ToInt32(((DictionaryEntry)obj).Value);
                DataRow[] drsAccount    = tbHandIn.Select("ACCOUNTCODE=" + chargeUserId, "ACCOUNTDATE asc");
                int[]     accountIdList = new int[drsAccount.Length];
                for (int i = 0; i < drsAccount.Length; i++)
                {
                    accountIdList[i] = Convert.ToInt32(drsAccount[i]["ACCOUNTID"]);
                }
                DataTable tbInvoice;
                DataTable tbInvoiceDetail;
                AccountBookController.GetAccountData(chargeUserId, accountIdList, out tbInvoice, out tbInvoiceDetail);
                //个人所有账单
                List <PrivyAccountBook> lstBook = new List <PrivyAccountBook>();

                for (int i = 0; i < drsAccount.Length; i++)
                {
                    int accountId         = Convert.ToInt32(drsAccount[i]["ACCOUNTID"]);
                    PrivyAccountBook book = AccountBookController.GetPrivyAccountBook(chargeUserId, accountId, tbInvoice, tbInvoiceDetail, tbHandIn);
                    lstBook.Add(book);
                }

                PrivyAccountBook totalBook = AccountBookController.CollectPrivyAccountBook(lstBook);

                lstAllBooks.Add(totalBook);
            }
            #endregion

            CollectAccountBook allBook = AccountBookController.CollectAllAccountBook(lstAllBooks);

            List <FundInfo> lstFundInfo = new List <FundInfo>();
            if (allBook.TallyPart.Details != null)
            {
                for (int i = 0; i < allBook.TallyPart.Details.Length; i++)
                {
                    lstFundInfo.Add(allBook.TallyPart.Details[i]);
                }
            }

            FundInfo fdFavor = new FundInfo();
            fdFavor.Money   = allBook.FavorPart.TotalMoney;
            fdFavor.PayName = "优惠金额";
            lstFundInfo.Add(fdFavor);

            FundInfo fdCash = new FundInfo();
            fdCash.Money   = allBook.CashPart.TotalMoney;
            fdCash.PayName = "实收现金";
            lstFundInfo.Add(fdCash);



            FundInfo[] allInfo = lstFundInfo.ToArray();

            DataTable tbTotalInfo = new DataTable();
            for (int i = 0; i < 10; i++)
            {
                DataColumn col = new DataColumn();
                col.ColumnName = "C_" + i.ToString();
                tbTotalInfo.Columns.Add(col);
            }

            int colIndex = 0;
            tbTotalInfo.Rows.Add(tbTotalInfo.NewRow());
            int rowIndex = tbTotalInfo.Rows.Count - 1;
            //记账
            for (int i = 0; i < allInfo.Length; i++)
            {
                if (colIndex == 10)
                {
                    tbTotalInfo.Rows.Add(tbTotalInfo.NewRow());
                    rowIndex = tbTotalInfo.Rows.Count - 1;
                    colIndex = 0;
                }

                tbTotalInfo.Rows[rowIndex][colIndex]     = allInfo[i].PayName;
                tbTotalInfo.Rows[rowIndex][colIndex + 1] = allInfo[i].Money;
                colIndex = colIndex + 2;
            }
            dgvTotalInfo.Tag = allInfo;
            tbTotalInfo.Columns.Add("C_EMPTY");
            tbTotalInfo.Rows[tbTotalInfo.Rows.Count - 1]["C_EMPTY"] = "合计:" + allBook.InvoiceItemSumTotal.ToString();
            dgvTotalInfo.DataSource = tbTotalInfo;
            dgvTotalInfo.Columns[dgvTotalInfo.Columns.Count - 1].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

            for (int i = 0; i < dgvTotalInfo.Columns.Count; i++)
            {
                if (i % 2 == 1)
                {
                    dgvTotalInfo.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight;
                }
                else
                {
                    dgvTotalInfo.Columns[i].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
                }
            }
        }