private void btnOK_Click(object sender, EventArgs e)
        {
            if (this.txtPayment.Text.Trim() == "")
            {
                DasherStation.HumanResource.CommUI.AlertError("本次付款不能为空!");
                return;
            }
            decimal mValue;

            if (decimal.TryParse(this.txtPayment.Text.Trim(), out mValue) == false)
            {
                DasherStation.HumanResource.CommUI.AlertError("在本次付款中请输入数值!");
                return;
            }
            if (decimal.Parse(this.txtCount2.Text) + decimal.Parse(this.txtPayment.Text) > decimal.Parse(this.txtCount1.Text))
            {
                DasherStation.HumanResource.CommUI.AlertError("已付总额不能大于应付总额!");
                return;
            }
            tFundsRecorderInfo entity = new tFundsRecorderInfo();

            tFundsRecorderInfo.tFundsRecorderRow oRow = entity.tFundsRecorder.NewtFundsRecorderRow();
            oRow.tuId   = long.Parse(this.cboClient.SelectedValue.ToString());
            oRow.paidUp = mValue;
            oRow.type   = EnumAccountType.运输款.ToString();
            if (this.chkCheck.Checked)
            {
                oRow.checkNo = this.txtCheckNo.Text.Trim();
            }
            if (this.chkInvoice.Checked)
            {
                oRow.invoiceNo = this.txtInvoiceNo.Text.Trim();
            }
            oRow.inputMan = this.UserName;
            if (this.txtMemo.Text.Trim() != "")
            {
                oRow.remark = this.txtMemo.Text.Trim();
            }
            oRow.cash1 = decimal.Parse(this.txtCount1.Text);
            oRow.cash2 = decimal.Parse(this.txtCount3.Text) - decimal.Parse(this.txtPayment.Text);
            entity.tFundsRecorder.AddtFundsRecorderRow(oRow);
            TransportBalanceLogic model = new TransportBalanceLogic();

            model.AddPaid(entity);
            this.txtPayment.Text    = "";
            this.chkCheck.Checked   = false;
            this.chkInvoice.Checked = false;
            this.txtCheckNo.Text    = "";
            this.txtInvoiceNo.Text  = "";
            this.txtMemo.Text       = "";
            this.InitForm(model);
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            TransportBalanceLogic model = new TransportBalanceLogic();

            this.cboClient.DataSource    = model.GetTransCorpInfo().Tables[0];
            this.cboClient.DisplayMember = "name";
            this.cboClient.ValueMember   = "id";
            if (this.cboClient.Items.Count > 0)
            {
                this.InitForm(model);
            }
        }
        private void InitForm(TransportBalanceLogic model)
        {
            long iClientID;

            long.TryParse(this.cboClient.SelectedValue.ToString(), out iClientID);
            this.dtgSettlement.AutoGenerateColumns = false;
            this.dtgSettlement.DataSource          = model.GetBalance(iClientID);
            this.dtgSettlement.DataMember          = "table";
            this.dtgRecord.AutoGenerateColumns     = false;
            this.dtgRecord.DataSource = model.GetRecord(iClientID);
            this.dtgRecord.DataMember = "table";
            decimal mCount = model.GetAccountPayable(iClientID);
            decimal mPaid  = model.GetPaidUp(iClientID);

            this.txtCount1.Text = mCount.ToString();
            this.txtCount2.Text = mPaid.ToString();
            this.txtCount3.Text = (mCount - mPaid).ToString();
        }