Exemplo n.º 1
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (this.Tag != null)
     {
         PrivyAccountBook book = (PrivyAccountBook)this.Tag;
         if (book.AccountId == 0)
         {
             MessageBox.Show("没交款的账单不能打印!", "", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             return;
         }
         PrintController.PrintAccountBook(book);
     }
 }
Exemplo n.º 2
0
 private void dgvInvoiceList_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.ColumnIndex == dgvInvoiceList.Columns[ViewDetail.Name].Index)
     {
         if (this.Tag != null)
         {
             FrmViewInvoice   fView = null;
             PrivyAccountBook book  = (PrivyAccountBook)this.Tag;
             if (dgvInvoiceList["InvoiceType", e.RowIndex].Value.ToString( ) == "收费发票")
             {
                 fView = new FrmViewInvoice(book, OPDBillKind.门诊收费发票);
             }
             else
             {
                 fView = new FrmViewInvoice(book, OPDBillKind.门诊挂号发票);
             }
             fView.ShowDialog( );
         }
     }
 }
Exemplo n.º 3
0
 private void dgvInvoiceList_CellContentClick(object sender, DataGridViewCellEventArgs e)
 {
     if (this.Tag != null)
     {
         PrivyAccountBook book     = (PrivyAccountBook)this.Tag;
         Invoice[]        invoices = null;
         bool             refund   = false;
         if (e.ColumnIndex == dgvInvoiceList.Columns[TotalNum.Name].Index)
         {
             if (book != null)
             {
                 if (dgvInvoiceList["InvoiceType", e.RowIndex].Value.ToString( ) == "收费发票")
                 {
                     invoices = ((PrivyAccountBook)book).ChargeInvoiceInfo.InvoiceList;
                 }
                 else
                 {
                     invoices = ((PrivyAccountBook)book).RegisterInvoiceInfo.InvoiceList;
                 }
             }
         }
         else if (e.ColumnIndex == dgvInvoiceList.Columns[RefundNum.Name].Index)
         {
             if (dgvInvoiceList["InvoiceType", e.RowIndex].Value.ToString( ) == "收费发票")
             {
                 invoices = ((PrivyAccountBook)book).ChargeInvoiceInfo.RefundInvoice;
             }
             else
             {
                 invoices = ((PrivyAccountBook)book).RegisterInvoiceInfo.RefundInvoice;
             }
             refund = true;
         }
         else
         {
             return;
         }
         FrmViewInvoice fView = new FrmViewInvoice(invoices, refund);
         fView.ShowDialog( );
     }
 }
Exemplo n.º 4
0
        private void ShowAccountBook(PrivyAccountBook book)
        {
            int row = 0;

            #region 显示收费票据
            row = dgvInvoiceList.Rows.Add( );
            //row = dgvInvoiceList.Rows.Count-1;
            dgvInvoiceList[InvoiceType.Name, row].Value       = "收费发票";
            dgvInvoiceList[NumberStartAndEnd.Name, row].Value = book.ChargeInvoiceInfo.StartNumber + "  ——  " + book.ChargeInvoiceInfo.EndNumber;
            dgvInvoiceList[TotalNum.Name, row].Value          = book.ChargeInvoiceInfo.Count;
            dgvInvoiceList[RefundNum.Name, row].Value         = book.ChargeInvoiceInfo.RefundCount;
            dgvInvoiceList[RefundMoney.Name, row].Value       = book.ChargeInvoiceInfo.RefundMoney;

            row = dgvInvoiceList.Rows.Add( );
            //row = dgvInvoiceList.Rows.Count - 1;
            dgvInvoiceList[InvoiceType.Name, row].Value       = "挂号发票";
            dgvInvoiceList[NumberStartAndEnd.Name, row].Value = book.RegisterInvoiceInfo.StartNumber + "  ——  " + book.RegisterInvoiceInfo.EndNumber;
            dgvInvoiceList[TotalNum.Name, row].Value          = book.RegisterInvoiceInfo.Count;
            dgvInvoiceList[RefundNum.Name, row].Value         = book.RegisterInvoiceInfo.RefundCount;
            dgvInvoiceList[RefundMoney.Name, row].Value       = book.RegisterInvoiceInfo.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;
            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( );

            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
        }
Exemplo n.º 5
0
        private void CreateTreeList()
        {
            int selectedchargeUserId = 0;

            if (chkChargeUser.Checked)
            {
                selectedchargeUserId = Convert.ToInt32(cboChargeUser.SelectedValue);
            }

            tvwAccountList.Nodes.Clear( );
            DataTable tbHandIn = AccountBookController.GetAccountList(dtpFrom.Value, dtpTo.Value);
            TreeNode  tdHandIn = new TreeNode( );

            tdHandIn.Text = "已交款";
            List <PrivyAccountBook> lstAllBooks = new List <PrivyAccountBook>( );

            #region 构造交款员树
            for (int i = 0; i < tbHandIn.Rows.Count; i++)
            {
                int chargeUserId = Convert.ToInt32(tbHandIn.Rows[i]["AccountCode"]);
                if (chkChargeUser.Checked && chargeUserId != selectedchargeUserId)
                {
                    continue;
                }

                if (tdHandIn.Nodes.Count == 0)
                {
                    TreeNode ndUser = new TreeNode( );
                    ndUser.Text = BaseDataController.GetName(BaseDataCatalog.人员列表, chargeUserId);
                    ndUser.Tag  = chargeUserId;
                    tdHandIn.Nodes.Add(ndUser);
                }
                else
                {
                    bool hasIntree = false;
                    foreach (TreeNode nd in tdHandIn.Nodes)
                    {
                        if (Convert.ToInt32(nd.Tag) == chargeUserId)
                        {
                            hasIntree = true;
                            break;
                        }
                    }
                    if (!hasIntree)
                    {
                        TreeNode ndUser = new TreeNode( );
                        ndUser.Text = BaseDataController.GetName(BaseDataCatalog.人员列表, chargeUserId);
                        ndUser.Tag  = chargeUserId;
                        tdHandIn.Nodes.Add(ndUser);
                    }
                }
            }
            #endregion

            #region 生成账单明细,并合并
            foreach (TreeNode ndUser in tdHandIn.Nodes)
            {
                int       chargeUserId  = Convert.ToInt32(ndUser.Tag);
                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++)
                {
                    TreeNode ndDate = new TreeNode( );
                    ndDate.Text = Convert.ToDateTime(drsAccount[i]["ACCOUNTDATE"]).ToString("yyyy-MM-dd HH:mm:ss");
                    int accountId         = Convert.ToInt32(drsAccount[i]["ACCOUNTID"]);
                    PrivyAccountBook book = AccountBookController.GetPrivyAccountBook(chargeUserId, accountId, tbInvoice, tbInvoiceDetail, tbHandIn);
                    ndDate.Tag = book;
                    ndUser.Nodes.Add(ndDate);
                    lstBook.Add(book);
                }
                //PrivyAccountBook totalBook = AccountBookController.CollectPrivyAccountBook( lstBook );
                ndUser.Tag = new PrivyAccountBook();
                //lstAllBooks.Add( totalBook );
            }
            #endregion
            tvwAccountList.Nodes.Add(tdHandIn);
            //CollectAccountBook allBook = AccountBookController.CollectAllAccountBook( lstAllBooks );
            tdHandIn.Tag = new PrivyAccountBook();

            DataTable tbUnHandIn = AccountBookController.GetNotHandInAccountUser( );
            TreeNode  ndUnHandIn = new TreeNode( );
            List <PrivyAccountBook> lstAllnothandBook = new List <PrivyAccountBook>( );
            ndUnHandIn.Text = "未交款";
            for (int i = 0; i < tbUnHandIn.Rows.Count; i++)
            {
                TreeNode ndUnhandInUser = new TreeNode( );
                ndUnhandInUser.Text = tbUnHandIn.Rows[i]["CHARGENAME"].ToString().Trim();
                int chargeUserId = Convert.ToInt32(tbUnHandIn.Rows[i]["CHARGECODE"]);
                if (chkChargeUser.Checked && chargeUserId != selectedchargeUserId)
                {
                    continue;
                }

                //PrivyAccountBook book = AccountBookController.GetPrivyAccountBook( chargeUserId , 0 );
                ndUnhandInUser.Tag = new PrivyAccountBook();
                ndUnHandIn.Nodes.Add(ndUnhandInUser);
                // lstAllnothandBook.Add( book );
            }

            tvwAccountList.Nodes.Add(ndUnHandIn);
            //CollectAccountBook notHandBook = AccountBookController.CollectAllAccountBook( lstAllnothandBook );
            ndUnHandIn.Tag = new PrivyAccountBook();

            tvwAccountList.ExpandAll( );
        }
Exemplo n.º 6
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;
                }
            }
        }