示例#1
0
    private List <T_ReceiptList> addBillNoToDone(List <T_ReceiptList> lists, T_ReceiptHead head)
    {
        List <T_ReceiptList> newlists = new List <T_ReceiptList>();

        foreach (T_ReceiptList list in lists)
        {
            if (list.FCheckStatus > 0)
            {
                list.CustomerName = head.CustomerName;
                list.CustomerCode = head.CustomerCode;
                newlists.Add(list);
            }
        }
        return(newlists);
    }
示例#2
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();
    }
示例#3
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;
        }
    }
示例#4
0
 public void updateReceiptHead(T_ReceiptHead head)
 {
     Manager.updateReceiptHead(head);
 }
示例#5
0
 public void addReceiptHead(T_ReceiptHead head)
 {
     Manager.addReceiptHead(head);
 }
示例#6
0
 public void updateReceiptHeadAuditStatus(T_ReceiptHead head)
 {
     Manager.updateReceiptHeadAuditStatus(head);
 }