Exemple #1
0
        private void m_GetAndFillData()
        {
            Domain.m_lngGetOneDayData(this.LoginInfo.m_strEmpID, checkDate, out dtCheckOut);
            #region 生成一个统计表
            dtStatistics = new DataTable();
            dtStatistics.Columns.Add("实收金额合计");
            dtStatistics.Columns.Add("实收现金合计");
            dtStatistics.Columns.Add("刷卡金额合计");
            dtStatistics.Columns.Add("支票金额合计");
            dtStatistics.Columns.Add("医保记账金额");
            dtStatistics.Columns.Add("公费记账金额");
            dtStatistics.Columns.Add("自费上缴金额");
            dtStatistics.Columns.Add("开票金额");
            dtStatistics.Columns.Add("退票金额合计");
            dtStatistics.Columns.Add("恢复金额合计");
            dtStatistics.Columns.Add("其它金额合计");
            #endregion

            #region 统计数据
            DataRow StatisticsRow = dtStatistics.NewRow();
            StatisticsRow["实收金额合计"] = 0.00;
            StatisticsRow["实收现金合计"] = 0.00;
            StatisticsRow["刷卡金额合计"] = 0.00;
            StatisticsRow["支票金额合计"] = 0.00;
            StatisticsRow["医保记账金额"] = 0.00;
            StatisticsRow["公费记账金额"] = 0.00;
            StatisticsRow["自费上缴金额"] = 0.00;

            StatisticsRow["开票金额"]   = 0.00;
            StatisticsRow["退票金额合计"] = 0.00;
            StatisticsRow["恢复金额合计"] = 0.00;
            StatisticsRow["其它金额合计"] = 0.00;
            if (dtCheckOut.Rows.Count > 0)
            {
                for (int i1 = 0; i1 < dtCheckOut.Rows.Count; i1++)
                {
                    if (dtCheckOut.Rows[i1]["STATUS_INT"].ToString().Trim() == "1")                 //统计开票数,开票金额
                    {
                        StatisticsRow["开票金额"] = Convert.ToDouble(StatisticsRow["开票金额"].ToString()) + Convert.ToDouble(dtCheckOut.Rows[i1]["TOTALSUM_MNY"].ToString());
                    }

                    if (dtCheckOut.Rows[i1]["STATUS_INT"].ToString().Trim() == "2")                 //退票数,退票金额合计,所有的退票号
                    {
                        StatisticsRow["退票金额合计"] = Convert.ToDouble(StatisticsRow["退票金额合计"].ToString()) - Convert.ToDouble(dtCheckOut.Rows[i1]["TOTALSUM_MNY"].ToString());
                    }

                    if (dtCheckOut.Rows[i1]["STATUS_INT"].ToString().Trim() == "3")                 //恢复票数,恢复金额合计
                    {
                        StatisticsRow["恢复金额合计"] = Convert.ToDouble(StatisticsRow["恢复金额合计"].ToString()) + Convert.ToDouble(dtCheckOut.Rows[i1]["TOTALSUM_MNY"].ToString());
                    }
                    if (dtCheckOut.Rows[i1]["PAYTYPE_INT"].ToString().Trim() == "0")                 //统计现金合计
                    {
                        StatisticsRow["实收现金合计"] = Convert.ToDouble(StatisticsRow["实收现金合计"].ToString().Trim()) + Convert.ToDouble(dtCheckOut.Rows[i1]["SBSUM_MNY"].ToString());
                    }
                    if (dtCheckOut.Rows[i1]["PAYTYPE_INT"].ToString().Trim() == "1")                 //刷卡合计
                    {
                        StatisticsRow["刷卡金额合计"] = Convert.ToDouble(StatisticsRow["刷卡金额合计"].ToString().Trim()) + Convert.ToDouble(dtCheckOut.Rows[i1]["SBSUM_MNY"].ToString());
                    }

                    if (dtCheckOut.Rows[i1]["PAYTYPE_INT"].ToString().Trim() == "2")                 //支票
                    {
                        StatisticsRow["支票金额合计"] = Convert.ToDouble(StatisticsRow["支票金额合计"].ToString().Trim()) + Convert.ToDouble(dtCheckOut.Rows[i1]["SBSUM_MNY"].ToString());
                    }

                    if (dtCheckOut.Rows[i1]["PAYTYPE_INT"].ToString().Trim() != "1" && dtCheckOut.Rows[i1]["PAYTYPE_INT"].ToString().Trim() != "2" && dtCheckOut.Rows[i1]["PAYTYPE_INT"].ToString().Trim() != "3" && dtCheckOut.Rows[i1]["PAYTYPE_INT"].ToString().Trim() != "0")     //统计其它金额
                    {
                        StatisticsRow["其它金额合计"] = Convert.ToDouble(StatisticsRow["其它金额合计"].ToString()) + Convert.ToDouble(dtCheckOut.Rows[i1]["TOTALSUM_MNY"].ToString());
                    }


                    if (dtCheckOut.Rows[i1]["INTERNALFLAG_INT"].ToString().Trim() == "2")                 //医保记账金额及人次
                    {
                        StatisticsRow["医保记账金额"] = Convert.ToDouble(StatisticsRow["医保记账金额"].ToString().Trim()) + Convert.ToDouble(dtCheckOut.Rows[i1]["ACCTSUM_MNY"].ToString());
                    }
                    if (dtCheckOut.Rows[i1]["INTERNALFLAG_INT"].ToString().Trim() == "1")                 //公费记账金额及人次
                    {
                        StatisticsRow["公费记账金额"] = Convert.ToDouble(StatisticsRow["公费记账金额"].ToString().Trim()) + Convert.ToDouble(dtCheckOut.Rows[i1]["ACCTSUM_MNY"].ToString());
                    }
                    if (dtCheckOut.Rows[i1]["INTERNALFLAG_INT"].ToString().Trim() == "0")                 //自费上缴金额及人次
                    {
                        StatisticsRow["自费上缴金额"] = Convert.ToDouble(StatisticsRow["自费上缴金额"].ToString().Trim()) + Convert.ToDouble(dtCheckOut.Rows[i1]["TOTALSUM_MNY"].ToString());
                    }
                }
            }
            Double AvailabilityMoney = Convert.ToDouble(StatisticsRow["开票金额"].ToString().Trim()) - Convert.ToDouble(StatisticsRow["退票金额合计"].ToString().Trim()) + Convert.ToDouble(StatisticsRow["恢复金额合计"].ToString().Trim());
            StatisticsRow["实收金额合计"] = AvailabilityMoney.ToString();
            #endregion
            listView1.Items.Clear();
            string strMoney = clsMain.CurrencyToString(Math.Abs(float.Parse(StatisticsRow["实收金额合计"].ToString())));
            label2.Text = strMoney + "(¥" + StatisticsRow["实收金额合计"].ToString() + ")";
            ListViewItem addItem = new ListViewItem("¥" + StatisticsRow["实收现金合计"].ToString());
            addItem.SubItems.Add("¥" + StatisticsRow["刷卡金额合计"].ToString());
            addItem.SubItems.Add("¥" + StatisticsRow["支票金额合计"].ToString());
            addItem.SubItems.Add("¥" + StatisticsRow["医保记账金额"].ToString());
            addItem.SubItems.Add("¥" + StatisticsRow["公费记账金额"].ToString());
            addItem.SubItems.Add("¥" + StatisticsRow["其它金额合计"].ToString());
            listView1.Items.Add(addItem);
            ArrayList arrList = new ArrayList();
            clsMain.m_Detach(dtCheckOut, "INVOICENO_VCHR", out arrList);
            ListViewItem newItem = null;
            string       temsun  = "";
            listView2.Items.Clear();
            if (arrList.Count > 0)
            {
                temsun = arrList[0].ToString();
                for (int i1 = 0; i1 < arrList.Count; i1++)
                {
                    if (arrList[i1].ToString() == ",")
                    {
                        newItem = new ListViewItem(temsun);
                        newItem.SubItems.Add(arrList[i1 - 1].ToString());
                        listView2.Items.Add(newItem);
                        temsun = arrList[i1 + 1].ToString();
                    }
                }
                newItem = new ListViewItem(temsun);
                newItem.SubItems.Add(arrList[arrList.Count - 1].ToString());
                listView2.Items.Add(newItem);
            }
        }