Beispiel #1
0
    private void GridViewBind()
    {
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
        DataSet             ds  = raa.getReceiptAuditHeads();

        show(ds);
    }
Beispiel #2
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        string receipt_id       = query_receipt_id.Text;
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();

        show(raa.getReceiptHeads(receipt_id));
    }
    private int getCusIDByName(string name)
    {
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
        int id = raa.getIDByName(name);

        return(id);
    }
Beispiel #4
0
    protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            string receipt_id = e.CommandArgument.ToString();

            ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
            InDecreaseAdapter   ida = new InDecreaseAdapter();
            DepositAdapter      da  = new DepositAdapter();

            try
            {
                DataSet ds = raa.getInDecreaseList(receipt_id);
                ida.updateHeadCheckStatus(ds);

                ds = raa.getDepositList(receipt_id);
                da.updateHeadCheckStatus(ds);



                raa.deleteToDone(receipt_id);
                raa.deleteReceipt(receipt_id);
                GridView3.SelectedIndex = -1;
                GridViewBind();

                Label1.Text = "删除成功";
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message;
            }
        }
    }
Beispiel #5
0
    protected void GridView3_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
            string type             = e.Row.Cells[3].Text;
            e.Row.Cells[3].Text = raa.getTypeNameByCode(type);
            CommonAdapter ca         = new CommonAdapter();
            int           currencyID = Int32.Parse(e.Row.Cells[6].Text);
            e.Row.Cells[6].Text = ca.getCurrencyByID(currencyID);
            //0-未核销,1-部分核销,2-完全核销
            int check_status = Int32.Parse(e.Row.Cells[14].Text);
            switch (check_status)
            {
            case 1:
                e.Row.Cells[14].Text = "部分核销";
                break;

            case 2:
                e.Row.Cells[14].Text = "完全核销";
                break;

            default:
                e.Row.Cells[14].Text = "未核销";
                break;
            }

            int DepartmentID = Int32.Parse(e.Row.Cells[8].Text);
            e.Row.Cells[8].Text = ca.getDepartmentNameByID(DepartmentID);

            int EmpID = Int32.Parse(e.Row.Cells[9].Text);
            e.Row.Cells[9].Text = ca.getEmpNameByID(EmpID);

            int CheckerID = Int32.Parse(e.Row.Cells[10].Text);
            e.Row.Cells[10].Text = ca.getEmpNameByID(CheckerID);



            string auditstatus = e.Row.Cells[13].Text.ToLower();
            if (auditstatus == "3")
            {
                e.Row.Cells[13].Text = "通过";
                Button btnDelete = e.Row.Cells[0].FindControl("btnDelete") as Button;
                btnDelete.Enabled = false;
            }
            else if (auditstatus == "2")
            {
                e.Row.Cells[13].Text = "不通过";
            }
            else if (auditstatus == "1")
            {
                e.Row.Cells[13].Text = "待审核";
            }
            else
            {
                e.Row.Cells[13].Text = "未提交";
            }
        }
    }
    private string LoadLastReceiptID()
    {
        string search = "SKDJ" + DateTime.Now.Year.ToString().Substring(2, 2);

        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();

        return(raa.getLastReceiptID(search));
    }
    private void GridViewBind(int id, string name, int currencyID)
    {
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
        DataSet             ds1 = raa.getUnCheckReceiptLists(id, currencyID);
        DataSet             ds2 = raa.getDoneBillNos(name);
        DataTable           dt  = sub(ds1, ds2);

        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
Beispiel #8
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        string receipt_id       = query_receipt_id.Text;
        string customer_name    = txt_customer.Text;
        string start_time       = CalendarBox1.Text;
        string end_time         = CalendarBox2.Text;
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();

        show(raa.queryReceiptHeads(receipt_id, customer_name, start_time, end_time));
    }
Beispiel #9
0
    private string getCusIDByName(string name)
    {
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
        DataSet             ds  = raa.getCustInfoByName(name);

        if (ds.Tables[0].Rows.Count > 0)
        {
            return(ds.Tables[0].Rows[0]["FNumber"].ToString());
        }
        else
        {
            return(string.Empty);
        }
    }
Beispiel #10
0
    private void DepositBind(string receipt_id)
    {
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
        DataSet             ds  = raa.getDepositList(receipt_id);

        if (ds.Tables[0].Rows.Count == 0)
        {
            GridView3EmptyBind();
        }
        else
        {
            GridView3.DataSource = ds;
            GridView3.DataBind();
        }
    }
Beispiel #11
0
    private void InDecreaseBind(string receipt_id)
    {
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
        DataSet             ds  = raa.getInDecreaseList(receipt_id);

        if (ds.Tables[0].Rows.Count == 0)
        {
            GridView2EmptyBind();
        }
        else
        {
            GridView2.DataSource = ds;
            GridView2.DataBind();
        }
    }
Beispiel #12
0
    private void show()
    {
        string fbillno          = txt_fbillno_id.Text.Trim();
        string start_time       = cb_start_time.Text;
        string end_time         = cb_end_time.Text;
        string customer         = txt_customer.Text.Trim();
        string check_status     = ddl_check_status.SelectedValue;
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
        DataSet             ds1 = raa.getICSaleList(start_time, end_time, fbillno, customer, check_status);
        DataSet             ds2 = raa.getICSaleListFromKindDee(start_time, end_time, fbillno, customer, check_status);
        DataTable           ds  = sub(ds2, ds1);

        ds.Merge(ds1.Tables[0]);
        ds = order(ds);
        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
Beispiel #13
0
    private void HeadBind(string receipt_id)
    {
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
        DataSet             ds  = raa.getReceiptHeads(receipt_id);

        if (ds.Tables[0].Rows.Count > 0)
        {
            DataRow dr = ds.Tables[0].Rows[0];
            txt_customer.Text = dr["customer_name"].ToString();
            d_date.Text       = DateTime.Parse(dr["receipt_date"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
            string currencyID = dr["currency"].ToString();
            ddl_currency.SelectedValue = currencyID;
            txt_amount.Text            = Decimal.Parse(dr["amount"].ToString()).ToString("0.00");
            if (!string.IsNullOrEmpty(dr["receipt_charge"].ToString()))
            {
                txt_receipt_charge.Text = Decimal.Parse(dr["receipt_charge"].ToString()).ToString("0.00");
            }
            else
            {
                txt_receipt_charge.Text = "";
            }
            ddl_receipt_type.SelectedValue = dr["receipt_type"].ToString();
            if (dr["receipt_type"].ToString() != "A" && dr["receipt_type"].ToString() != "B")
            {
                txt_amount.Enabled = true;
            }
            txt_account.Text             = dr["account_id"].ToString();
            ddl_department.SelectedValue = dr["FDeptID"].ToString();
            ddl_emp.SelectedValue        = dr["FEmpID"].ToString();
            ddl_preparer.SelectedValue   = dr["FPreparer"].ToString();
            ddl_checker.SelectedValue    = dr["FChecker"].ToString();
            check_date.Text = DateTime.Parse(dr["FCheckDate"].ToString()).ToString("yyyy-MM-dd HH:mm:ss");
            //通过审核后不让其修改
            string audit_status = dr["audit_status"].ToString();
            txt_note.Text = dr["note"].ToString();
            if (!string.IsNullOrEmpty(audit_status) && audit_status == "3")
            {
                updateUser.Enabled = false;
            }
        }
    }
Beispiel #14
0
    protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            string[] args         = e.CommandArgument.ToString().Split(',');
            string   receipt_id   = args[0];
            string   receipt_type = args[1];

            ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
            InDecreaseAdapter   ida = new InDecreaseAdapter();
            DepositAdapter      da  = new DepositAdapter();
            try
            {
                DataSet ds = raa.getInDecreaseList(receipt_id);
                ida.updateHeadCheckStatus(ds);

                ds = raa.getDepositList(receipt_id);
                if (receipt_type == "B")
                {
                    da.updateHeadIsPayed(ds);
                }
                else
                {
                    da.updateHeadCheckStatus(ds);//更新定金单的check_status值;
                }

                raa.deleteToDone(receipt_id);
                raa.deleteReceipt(receipt_id);
                GridView3.SelectedIndex = -1;
                GridViewBind();

                Label1.Text = "删除成功";
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message;
            }
        }
    }
Beispiel #15
0
    protected void btn_audit_Click(object sender, EventArgs e)
    {
        Button              bt         = sender as Button;
        string              args       = bt.CommandArgument.ToString();
        GridViewRow         row        = bt.Parent.Parent as GridViewRow;
        HyperLink           thisData   = row.Cells[1].Controls[0] as HyperLink;
        string              receipt_id = thisData.Text;
        ReceiptAuditAdapter raa        = new ReceiptAuditAdapter();
        T_ReceiptHead       head       = new T_ReceiptHead();

        head.ReceiptId = receipt_id;

        T_AccountLog account_log = new T_AccountLog();

        account_log.ReceiptId = receipt_id;

        account_log.AccountId   = (bt.Parent.FindControl("hdf_account_id") as HiddenField).Value;
        account_log.Operater    = UserInfoAdapter.CurrentUser.Name;
        account_log.OperateTime = DateTime.Now;
        account_log.Amount      = Decimal.Parse(row.Cells[5].Text);

        AccountLogAdapter ala = new AccountLogAdapter();

        if (args == "Y")
        {
            head.AuditStatus = 3;//通过
            //更新账户金额
        }
        else
        {
            account_log.Amount *= -1;
            head.AuditStatus    = 2;//不通过
        }
        ala.insert(account_log);
        ala.Add(account_log);
        raa.updateReceiptHeadAuditStatus(head);
        GridViewBind();
    }
    protected void add_Click(object sender, EventArgs e)
    {
        //表头
        T_IndecreaseHead head = new T_IndecreaseHead();

        head.AgentDate   = DateTime.Parse(agent_date.Text);
        head.BillNo      = bill_no.Text;
        head.Customer    = customer.Text;
        head.Agenter     = agent_name.Text;
        head.CheckStatus = 0;
        head.CurrencyID  = ddl_currency.SelectedValue;
        decimal             amount_all = 0;
        ReceiptAuditAdapter raa        = new ReceiptAuditAdapter();

        DataSet ds = raa.getCustInfoByName(head.Customer);

        if (ds.Tables[0].Rows.Count > 0)
        {
            head.CustomerID = Int32.Parse(ds.Tables[0].Rows[0]["FNumber"].ToString());
            head.ItemID     = Int32.Parse(ds.Tables[0].Rows[0]["FItemID"].ToString());
        }
        else
        {
            Label1.Text = "客户姓名请输入关键字后从下拉框选择!";
            return;
        }
        //表体
        DataTable dt = DefineDataTableSchema(hfRptColumns.Value);

        foreach (RepeaterItem item in rptTest.Items)
        {
            DataRow newRow = dt.NewRow();

            string name = ((TextBox)item.FindControl("txt_name")).Text;
            if (string.IsNullOrEmpty(name))
            {
                //如果项号是空,则过滤此条记录
                continue;
            }
            string amount = ((TextBox)item.FindControl("txt_amount")).Text;
            if (string.IsNullOrEmpty(amount))
            {
                //如果项号是空,则过滤此条记录
                continue;
            }
            string apply_date = ((TextBox)item.FindControl("cb_apply_date")).Text;
            if (string.IsNullOrEmpty(apply_date))
            {
                //如果项号是空,则过滤此条记录
                continue;
            }
            string type = ((DropDownList)item.FindControl("ddl_type")).SelectedValue;
            if (string.IsNullOrEmpty(type))
            {
                //如果项号是空,则过滤此条记录
                continue;
            }
            newRow["g_no"]       = ((TextBox)item.FindControl("txt_g_no")).Text;
            newRow["name"]       = name;
            newRow["amount"]     = amount;
            newRow["apply_date"] = apply_date;
            newRow["type"]       = type;
            if (type == "R")
            {
                amount_all += Decimal.Parse(amount) * -1;
            }
            else
            {
                amount_all += Decimal.Parse(amount);
            }
            newRow["note"]    = ((TextBox)item.FindControl("txt_note")).Text;;
            newRow["bill_no"] = bill_no.Text;
            dt.Rows.Add(newRow);
        }

        head.AmountAll = amount_all;
        try
        {
            InDecreaseAdapter ida = new InDecreaseAdapter();
            ida.insertInDecreaseList(dt);
            ida.addInDecreaseHead(head);
            clean();
            Label1.Text = "哟,小伙子,不错,被你录入成功了";
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }
Beispiel #17
0
    protected void add_Click(object sender, EventArgs e)
    {
        Label1.Text = "";
        //表头
        T_DepositHead head = new T_DepositHead();

        head.DepositId = txt_deposit_id.Text;
        head.Customer  = customer.Text;
        CommonAdapter ca = new CommonAdapter();

        head.Agenter            = ca.getEmpNameByID(Int32.Parse(ddl_agenter.SelectedValue));
        head.CheckStatus        = 0;
        head.CurrencyID         = ddl_currency.SelectedValue;
        head.AmountAll          = Decimal.Parse(txt_amount_all.Text);
        head.UnreceiveAmountFor = Decimal.Parse(txt_amount_all.Text);
        string str_agent_date = agent_date.Text;

        if (!string.IsNullOrEmpty(str_agent_date))
        {
            head.AgentDate = DateTime.Parse(str_agent_date);
        }
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();

        DataSet ds = raa.getCustInfoByName(head.Customer);

        if (ds.Tables[0].Rows.Count > 0)
        {
            head.CustomerID = Int32.Parse(ds.Tables[0].Rows[0]["FNumber"].ToString());
            head.ItemID     = Int32.Parse(ds.Tables[0].Rows[0]["FItemID"].ToString());
        }
        else
        {
            Label1.Text = "客户姓名请输入关键字后从下拉框选择!";
            return;
        }
        //表体
        List <T_DepositList> lists = new List <T_DepositList>();

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            T_DepositList list = new T_DepositList();
            list.DepositId = head.DepositId;
            list.GNo       = Int32.Parse((GridView1.Rows[i].Cells[0].FindControl("lbl_gno") as Label).Text);
            string fbillno = (GridView1.Rows[i].Cells[1].FindControl("txt_bill_no") as TextBox).Text;
            if (string.IsNullOrEmpty(fbillno))
            {
                continue;
            }
            list.FBillNo = fbillno;
            list.Fdate   = DateTime.Parse((GridView1.Rows[i].Cells[2].FindControl("lbl_fdate") as Label).Text);
            list.Amount  = Decimal.Parse((GridView1.Rows[i].Cells[3].FindControl("lbl_amountfor") as Label).Text);
            list.Note    = (GridView1.Rows[i].Cells[4].FindControl("txt_note") as TextBox).Text;

            lists.Add(list);
        }
        List <T_DepositList> addtodonelists = addBillNoToDone(lists, head);

        try
        {
            //保存数据
            DepositAdapter da = new DepositAdapter();
            da.addDepositHead(head);
            da.insertDepositList(lists);

            //TODO:更新销售发票的check_status,增减单的check_status
            da.addToDone(addtodonelists);
            Label1.Text = "哟,小伙子,不错,被你录入成功了";
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }
Beispiel #18
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int index = GridView1.SelectedIndex;

        if (index < 0)
        {
            Label1.Text = "请先点击某行的编辑按钮";
            return;
        }
        T_IndecreaseHead head = new T_IndecreaseHead();

        head.BillNo     = bill_no.Text.Trim();
        head.Customer   = customer.Text;
        head.CurrencyID = ddl_currency.SelectedValue;
        ReceiptAuditAdapter raa = new ReceiptAuditAdapter();

        DataSet ds = raa.getCustInfoByName(head.Customer);

        if (ds.Tables[0].Rows.Count > 0)
        {
            head.CustomerID = Int32.Parse(ds.Tables[0].Rows[0]["FNumber"].ToString());
            head.ItemID     = Int32.Parse(ds.Tables[0].Rows[0]["FItemID"].ToString());
        }
        else
        {
            Label1.Text = "客户姓名请输入关键字后从下拉框选择!";
            return;
        }
        head.AgentDate = DateTime.Parse(agent_date.Text);
        head.Agenter   = agent_name.Text;
        T_IndecreaseList list = new T_IndecreaseList();

        list.BillNo    = bill_no.Text.Trim();
        list.GNo       = Int32.Parse(txt_g_no.Text);
        list.Type      = ddl_type.SelectedValue;
        list.Note      = txt_note.Text;
        list.Name      = txt_name.Text;
        list.Amount    = Decimal.Parse(txt_amount.Text);
        list.ApplyDate = DateTime.Parse(cb_apply_date.Text);
        if (list.Type == "R")
        {
            head.AmountAll = Decimal.Parse(hdf_amount_all.Value) - Decimal.Parse(hdf_amount.Value) + Decimal.Parse(txt_amount.Text) * -1;
        }
        else
        {
            head.AmountAll = Decimal.Parse(hdf_amount_all.Value) - Decimal.Parse(hdf_amount.Value) + Decimal.Parse(txt_amount.Text);
        }

        InDecreaseAdapter ida = new InDecreaseAdapter();

        try
        {
            ida.updateHead(head);
            ida.updateList(list);
            GridView1.SelectedIndex = -1;
            GridViewBind();
            clean();
            Label1.Text = "更新成功";
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }
Beispiel #19
0
    protected void updateUser_Click(object sender, EventArgs e)
    {
        Label1.Text = "";
        T_ReceiptHead head = new T_ReceiptHead();

        head.CustomerName = txt_customer.Text;
        head.CustomerCode = getCusIDByName(head.CustomerName);

        head.ReceiptId   = txt_recetpt_no.Text;
        head.ReceiptDate = DateTime.Parse(d_date.Text);
        head.ReceiptType = ddl_receipt_type.SelectedValue;
        if (!String.IsNullOrEmpty(txt_amount.Text) && Decimal.Parse(txt_amount.Text) > 0)
        {
            head.Amount = Decimal.Parse(txt_amount.Text);
        }
        else
        {
            Label1.Text = "该收款单金额不能为0。";
            return;
        }
        head.Currency = ddl_currency.SelectedValue;
        if (!string.IsNullOrEmpty(txt_receipt_charge.Text))
        {
            head.ReceiptCharge = Decimal.Parse(txt_receipt_charge.Text);
        }
        head.FDeptID      = Int32.Parse(ddl_department.SelectedValue);
        head.FEmpID       = Int32.Parse(ddl_emp.SelectedValue);
        head.FPreparer    = Int32.Parse(ddl_preparer.SelectedValue);
        head.FChecker     = Int32.Parse(ddl_checker.SelectedValue);
        head.FCheckDate   = DateTime.Parse(check_date.Text);
        head.FCheckStatus = (int)2;
        head.Note         = txt_note.Text;
        CommonAdapter        ca    = new CommonAdapter();
        List <T_ReceiptList> lists = new List <T_ReceiptList>();

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            T_ReceiptList list = new T_ReceiptList();
            list.ReceiptId = head.ReceiptId;
            string g_no = GridView1.Rows[i].Cells[0].Text;
            if (string.IsNullOrEmpty(g_no) || g_no == "&nbsp;")
            {
                break;
            }
            list.ReceiptNo           = Int32.Parse(g_no);
            list.FBillNo             = GridView1.Rows[i].Cells[1].Text;
            list.FDate               = DateTime.Parse(GridView1.Rows[i].Cells[2].Text);
            list.FAmountFor          = Decimal.Parse(GridView1.Rows[i].Cells[3].Text);
            list.FReceiveAmountFor   = Decimal.Parse(GridView1.Rows[i].Cells[4].Text);
            list.FUnReceiveAmountFor = Decimal.Parse(GridView1.Rows[i].Cells[5].Text);
            string fcheckamountfor = (GridView1.Rows[i].Cells[6].FindControl("txt_fcheckamountfor") as TextBox).Text;
            if (string.IsNullOrEmpty(fcheckamountfor))
            {
                Label1.Text = "核销金额不能为空";
                return;
            }
            list.FCheckAmountFor = Decimal.Parse(fcheckamountfor);
            list.FCurrencyID     = ca.getIDByCurrency(GridView1.Rows[i].Cells[7].Text);
            list.FNote           = (GridView1.Rows[i].Cells[8].FindControl("txt_note") as TextBox).Text;
            if (list.FUnReceiveAmountFor - list.FCheckAmountFor == 0)
            {
                list.FCheckStatus = 2;
            }
            else
            {
                list.FCheckStatus = 1;
                head.FCheckStatus = 1;
            }
            lists.Add(list);
        }
        for (int i = 0; i < GridView2.Rows.Count; i++)
        {
            T_ReceiptList list = new T_ReceiptList();
            list.ReceiptId = head.ReceiptId;
            string g_no = (GridView2.Rows[i].Cells[0].FindControl("lbl_gno") as Label).Text;
            if (string.IsNullOrEmpty(g_no) || g_no == "&nbsp;")
            {
                break;
            }
            list.ReceiptNo = Int32.Parse(g_no);

            list.IndecreaseNo = (GridView2.Rows[i].Cells[1].FindControl("txt_bill_no") as TextBox).Text;
            list.FAmountFor   = Decimal.Parse((GridView2.Rows[i].Cells[3].FindControl("lbl_amount_all") as TextBox).Text);
            lists.Add(list);
        }
        List <T_ReceiptList> listsFromDeposit = new List <T_ReceiptList>();

        foreach (GridViewRow gvr in GridView3.Rows)
        {
            T_ReceiptList list = new T_ReceiptList();
            list.ReceiptId = head.ReceiptId;
            string g_no = (gvr.Cells[0].FindControl("lbl_gno") as Label).Text;
            if (string.IsNullOrEmpty(g_no) || g_no == "&nbsp;")
            {
                break;
            }
            list.ReceiptNo = GridView1.Rows.Count + GridView2.Rows.Count + Int32.Parse((gvr.Cells[0].FindControl("lbl_gno") as Label).Text);
            string deposit_id = (gvr.Cells[1].FindControl("txt_deposit_id") as TextBox).Text;
            if (string.IsNullOrEmpty(deposit_id))
            {
                continue;
            }
            list.DepositId           = deposit_id;
            list.FDate               = DateTime.Parse((gvr.Cells[2].FindControl("lbl_agent_date") as Label).Text);
            list.FNote               = (gvr.Cells[9].FindControl("txt_note") as TextBox).Text;
            list.FCurrencyID         = ca.getIDByCurrency((gvr.Cells[7].FindControl("lbl_fcurrencyid") as Label).Text);
            list.FAmountFor          = Decimal.Parse((gvr.Cells[3].FindControl("lbl_amount_all") as Label).Text);
            list.FReceiveAmountFor   = Decimal.Parse((gvr.Cells[4].FindControl("lbl_freceiveamountfor") as Label).Text);
            list.FUnReceiveAmountFor = Decimal.Parse((gvr.Cells[5].FindControl("lbl_funreceiveamountfor") as Label).Text);
            string str_deposit_checkamountfor = (gvr.Cells[6].FindControl("txt_deposit_checkamountfor") as TextBox).Text;
            if (string.IsNullOrEmpty(str_deposit_checkamountfor))
            {
                Label1.Text = "核销金额不能为空";
                return;
            }
            list.FCheckAmountFor = Decimal.Parse(str_deposit_checkamountfor);
            if (list.FUnReceiveAmountFor - list.FCheckAmountFor == 0)
            {
                list.FCheckStatus = 2;
            }
            else
            {
                list.FCheckStatus = 1;
                head.FCheckStatus = 1;
            }
            listsFromDeposit.Add(list);
        }
        List <T_ReceiptList> addtodonelists   = addBillNoToDone(lists, head);
        List <T_ReceiptList> checkStatusLists = addInDecreaseNoToDone(lists);

        try
        {
            //更新数据
            ReceiptAuditAdapter raa = new ReceiptAuditAdapter();
            DepositAdapter      da  = new DepositAdapter();

            raa.updateReceiptHead(head);
            raa.updateReceiptList(lists);
            raa.updateReceiptList(listsFromDeposit);

            //TODO:更新销售发票的check_status,增减单的check_status
            raa.updateToDone(addtodonelists);
            if (ddl_receipt_type.SelectedValue == "B")
            {
                da.updateHeadIsPayed(listsFromDeposit);
            }
            else
            {
                da.updateHeadCheckStatus(listsFromDeposit);//更新定金单的check_status值;
            }
            Label1.Text = "更新成功了";
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }