private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            int currFeeYear = 0, currFeeMonth = 0;

            if (dtData.Rows.Count == 0)
            {
                new MsgBoxForm("提示", "没有要打印的单据!").ShowDialog();
                return;
            }
            else
            {
                currFeeYear  = Helper.Obj2Int(dtData.Rows[0]["年份"]);
                currFeeMonth = Helper.Obj2Int(dtData.Rows[0]["月份"]);
            }
            string v_业主编号 = "";

            if (this.业主姓名ComboBox.SelectedValue != null && this.业主姓名ComboBox.SelectedValue.ToString() != "System.Data.DataRowView")
            {
                v_业主编号 = this.业主姓名ComboBox.SelectedValue.ToString();
            }
            string    v_应收金额 = this.应收金额TextBox.Text;
            string    v_实收金额 = this.实收金额TextBox.Text;
            OwnerInfo ownerInfo = ownerInfoDic.ContainsKey(v_业主编号) ? ownerInfoDic[v_业主编号] : null;
            float     f_应收金额 = 0, f_实收金额 = 0, f_预存金额 = 0;

            float.TryParse(v_应收金额, out f_应收金额);
            float.TryParse(v_实收金额, out f_实收金额);
            f_预存金额 = f_实收金额 - f_应收金额;
            if (f_实收金额 < f_应收金额)
            {
                new MsgBoxForm("提示", "实收金额不能小于应收金额!").ShowDialog();
                return;
            }
            PriceInfo priceInfo = PriceHelper.GetPriceInfo();

            e.Graphics.DrawString(string.Format("{0}{1}年{2}月物业管理费明细单", this.MyCommunity, currFeeYear, currFeeMonth), new Font("宋体", 16), Brushes.Black, 180, 20);
            e.Graphics.DrawLine(new Pen(Color.Black, (float)1.00), 50, 45, 770, 45);
            e.Graphics.DrawString("业主姓名:" + this.交款人员TextBox.Text, new Font("宋体", 10), Brushes.Black, 55, 50);
            e.Graphics.DrawString("业主编号:" + v_业主编号, new Font("宋体", 10), Brushes.Black, 550, 50);
            e.Graphics.DrawLine(new Pen(Color.Black), 50, 70, 770, 70);
            e.Graphics.DrawString("电表序列", new Font("宋体", 10), Brushes.Black, 55, 78);
            e.Graphics.DrawString("电单价", new Font("宋体", 10), Brushes.Black, 125, 78);
            e.Graphics.DrawString("上月数", new Font("宋体", 10), Brushes.Black, 180, 78);
            e.Graphics.DrawString("本月数", new Font("宋体", 10), Brushes.Black, 235, 78);
            e.Graphics.DrawString("用量", new Font("宋体", 10), Brushes.Black, 290, 78);
            e.Graphics.DrawString("电费", new Font("宋体", 10), Brushes.Black, 340, 78);
            e.Graphics.DrawString("公共照明", new Font("宋体", 10), Brushes.Black, 400, 78);
            e.Graphics.DrawString("电损", new Font("宋体", 10), Brushes.Black, 470, 78);
            e.Graphics.DrawString("物业费", new Font("宋体", 10), Brushes.Black, 520, 78);
            e.Graphics.DrawString("合计", new Font("宋体", 10), Brushes.Black, 575, 78);
            int MyPosY = 98;
            int MyID   = 1;

            foreach (DataRow MyRow in this.dtData.Rows)
            {
                string v_物业费 = string.Empty;
                double d_物业费 = 0;
                if (ownerInfo != null && MyID == 1)
                {
                    d_物业费 = ownerInfo.d_物业费用;
                    v_物业费 = d_物业费.ToString("N2");
                }
                double d_电费 = Helper.Obj2Double(MyRow["金额"]);
                double d_合计 = d_电费 + d_物业费;
                e.Graphics.DrawString(MyID.ToString(), new Font("宋体", 10), Brushes.Black, 55, MyPosY);
                e.Graphics.DrawString(priceInfo.d_标准电费价格.ToString("N3"), new Font("宋体", 10), Brushes.Black, 125, MyPosY);
                e.Graphics.DrawString(Helper.Obj2String(MyRow["上月数"]), new Font("宋体", 10), Brushes.Black, 180, MyPosY);
                e.Graphics.DrawString(Helper.Obj2String(MyRow["本月数"]), new Font("宋体", 10), Brushes.Black, 235, MyPosY);
                e.Graphics.DrawString(Helper.Obj2String(MyRow["用量"]), new Font("宋体", 10), Brushes.Black, 290, MyPosY);
                e.Graphics.DrawString(d_电费.ToString("N2"), new Font("宋体", 10), Brushes.Black, 340, MyPosY);
                e.Graphics.DrawString(priceInfo.d_公共照明价格.ToString("N3"), new Font("宋体", 10), Brushes.Black, 400, MyPosY);
                e.Graphics.DrawString(priceInfo.d_电力损耗价格.ToString("N3"), new Font("宋体", 10), Brushes.Black, 470, MyPosY);
                e.Graphics.DrawString(v_物业费, new Font("宋体", 10), Brushes.Black, 520, MyPosY);
                e.Graphics.DrawString(d_合计.ToString("N2"), new Font("宋体", 10), Brushes.Black, 575, MyPosY);
                MyPosY += 20;
                MyID   += 1;
            }
            e.Graphics.DrawLine(new Pen(Color.Black), 50, MyPosY, 770, MyPosY);
            e.Graphics.DrawLine(new Pen(Color.Black), 120, 70, 120, MyPosY);
            e.Graphics.DrawLine(new Pen(Color.Black), 175, 70, 175, MyPosY);
            e.Graphics.DrawLine(new Pen(Color.Black), 230, 70, 230, MyPosY);
            e.Graphics.DrawLine(new Pen(Color.Black), 285, 70, 285, MyPosY + 50);
            e.Graphics.DrawLine(new Pen(Color.Black), 335, 70, 335, MyPosY);
            e.Graphics.DrawLine(new Pen(Color.Black), 395, 70, 395, MyPosY);
            e.Graphics.DrawLine(new Pen(Color.Black), 465, 70, 465, MyPosY);
            e.Graphics.DrawLine(new Pen(Color.Black), 515, 70, 515, MyPosY);
            e.Graphics.DrawLine(new Pen(Color.Black), 570, 70, 570, MyPosY + 50);
            e.Graphics.DrawLine(new Pen(Color.Black), 425, MyPosY, 425, MyPosY + 50);
            e.Graphics.DrawString("应收费用:" + f_应收金额.ToString("N2") + "元", new Font("宋体", 10), Brushes.Black, 55, MyPosY + 10);
            e.Graphics.DrawString("实收费用:" + f_实收金额.ToString("N2") + "元", new Font("宋体", 10), Brushes.Black, 290, MyPosY + 10);
            e.Graphics.DrawString("预收费用:" + f_预存金额.ToString("N2") + "元", new Font("宋体", 10), Brushes.Black, 430, MyPosY + 10);
            e.Graphics.DrawString("缴费时间:" + DateTime.Now.ToString("yyyy年M月d日"), new Font("宋体", 10), Brushes.Black, 575, MyPosY + 10);
            e.Graphics.DrawString("备注:" + this.补充说明TextBox.Text, new Font("宋体", 10), Brushes.Black, 55, MyPosY + 30);
            //下边框
            e.Graphics.DrawLine(new Pen(Color.Black, (float)1.00), 50, MyPosY + 50, 770, MyPosY + 50);
            //左边框
            e.Graphics.DrawLine(new Pen(Color.Black, (float)1.00), 50, 45, 50, MyPosY + 50);
            //右边框
            e.Graphics.DrawLine(new Pen(Color.Black, (float)1.00), 770, 45, 770, MyPosY + 50);
            if (communityInfoDic.ContainsKey(this.MyCommunity))
            {
                string v_服务电话 = communityInfoDic[this.MyCommunity];
                if (!string.IsNullOrEmpty(v_服务电话))
                {
                    e.Graphics.DrawString(string.Format("报修、查询费用请拨物业服务电话: {0}", v_服务电话), new Font("宋体", 10), Brushes.Black, 430, MyPosY + 55);
                }
            }
        }
        private void 水电气费BindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            string v_小区名称 = this.小区名称ToolStripComboBox.Text.Trim();
            string v_楼栋名称 = this.楼栋名称ToolStripComboBox.Text.Trim();
            string v_计费年份 = this.计费年份ToolStripComboBox.Text.Trim();
            string v_计费月份 = this.计费月份ToolStripComboBox.Text.Trim();
            string v_费用类型 = "物业费用";

            if (string.IsNullOrEmpty(v_计费年份) || string.IsNullOrEmpty(v_计费月份) || string.IsNullOrEmpty(v_小区名称) || string.IsNullOrEmpty(v_楼栋名称))
            {
                new MsgBoxForm("提示", "没有选择正确的计费年份,计费月份,小区名称,楼栋名称等信息!").ShowDialog();
                return;
            }

            try
            {
                PriceInfo priceInfo = PriceHelper.GetPriceInfo();
                foreach (DataGridViewRow gridViewRow in this.水电气费DataGridView.Rows)
                {
                    string v_业主编号 = Helper.GetCellValue(gridViewRow, "业主编号");
                    if (string.IsNullOrEmpty(v_业主编号))
                    {
                        continue;
                    }
                    string v_业主姓名 = Helper.GetCellValue(gridViewRow, "业主姓名");
                    string v_表编号 = Helper.GetCellValue(gridViewRow, "表编号");
                    string v_上月数 = Helper.GetCellValue(gridViewRow, "上月数");
                    string v_本月数 = Helper.GetCellValue(gridViewRow, "本月数");
                    string v_计费单价 = Helper.GetCellValue(gridViewRow, "计费单价");
                    string v_表用量 = string.Empty, v_补充说明 = string.Empty;
                    float  f_表底数 = 0, f_表止数 = 0, f_计费单价 = 0, f_应交金额;
                    float.TryParse(v_上月数, out f_表底数);
                    float.TryParse(v_本月数, out f_表止数);
                    float.TryParse(v_计费单价, out f_计费单价);

                    if (f_表底数 > f_表止数)
                    {
                        new MsgBoxForm("提示", "本月数不能小于上月数,请重新输入!").ShowDialog();
                        return;
                    }
                    if (f_计费单价 < 0)
                    {
                        new MsgBoxForm("提示", "计费单价不能小于0,请重新输入!").ShowDialog();
                        return;
                    }
                    v_表用量  = (f_表止数 - f_表底数).ToString("N2");
                    f_应交金额 = (f_表止数 - f_表底数) * f_计费单价;
                    v_补充说明 = string.Format("含公共照明:{0} 电力损耗:{1}", ((f_表止数 - f_表底数) * priceInfo.d_公共照明价格).ToString("N3"), ((f_表止数 - f_表底数) * priceInfo.d_电力损耗价格).ToString("N3"));
                    string query = "UPDATE 水电气费 SET 上月数=" + v_上月数 + ",本月数=" + v_本月数 + ",表用量=" + v_表用量 + ",计费单价=" + v_计费单价 + ",应交金额=" + f_应交金额 + ",补充说明='" + v_补充说明 + "' WHERE 计费年份=" + v_计费年份 +
                                   " AND 计费月份=" + v_计费月份 + " AND 费用类型='" + v_费用类型 + "' AND 楼栋名称='" + v_楼栋名称 + "' AND 业主编号='" + v_业主编号 + "' AND 业主姓名='" + v_业主姓名 + "' AND 表编号='" + v_表编号 + "'";
                    DataHelper.UpdateOrDeleteRecord(query);
                }
                DataHelper.CommitUpdate();
                SynGasRegisterInfo(v_计费年份, v_计费月份, v_楼栋名称, "正在登记");
                new MsgBoxForm("提示", "保存成功!").ShowDialog();
            }
            catch (Exception ex)
            {
                new MsgBoxForm("提示", "保存失败,请检查所填数据类型!").ShowDialog();
                LogHelper.LogError(ex);
            }
        }