Ejemplo n.º 1
0
    private void GridViewBind()
    {
        PaymentDepositAdapter da = new PaymentDepositAdapter();
        DataSet ds = da.getListsAll();

        show(ds, GridView2);
    }
Ejemplo n.º 2
0
    private string LoadLastDepositId()
    {
        string search            = "FKDJ" + DateTime.Now.ToString("yyyyMMdd");
        PaymentDepositAdapter da = new PaymentDepositAdapter();

        return(da.getLastDepositID(search));
    }
Ejemplo n.º 3
0
    protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            string deposit_id         = e.CommandArgument.ToString();
            PaymentDepositAdapter pda = new PaymentDepositAdapter();
            PaymentAdapter        pa  = new PaymentAdapter();

            try
            {
                bool result = pa.depositIsUsed(deposit_id);
                if (result)
                {
                    Label1.Text = "该定金单已经被使用,不能删除!";
                    return;
                }
                else
                {
                    pda.delete(deposit_id);
                    pda.deleteToDone(deposit_id);
                    GridViewBind();
                    clean();
                    GridViewEmptyBind();
                    Label1.Text = "删除成功";
                }
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message;
            }
        }
    }
    protected void GridView3_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "Delete")
        {
            string receipt_id = e.CommandArgument.ToString();

            PaymentAdapter        raa = new PaymentAdapter();
            PaymentRequestAdapter ida = new PaymentRequestAdapter();
            PaymentDepositAdapter da  = new PaymentDepositAdapter();

            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;
            }
        }
    }
Ejemplo n.º 5
0
    protected void Button2_Click(object sender, EventArgs e)
    {
        string deposit_id        = query_deposit_id.Text;
        PaymentDepositAdapter da = new PaymentDepositAdapter();

        show(da.getDepositHeads(deposit_id), GridView2);
        GridView2.SelectedIndex = -1;
    }
    private void GridViewBind(int id, int currencyID, string type)
    {
        PaymentDepositAdapter da = new PaymentDepositAdapter();

        DataSet ds = da.getUnCheckDepositLists(id, currencyID, type);

        GridView1.DataSource = ds;
        GridView1.DataBind();
    }
    private void GridViewBind(int id, int currencyID, string custName)
    {
        PaymentDepositAdapter da = new PaymentDepositAdapter();
        DataSet   ds1            = da.getUnCheckPOOrderList(id, currencyID);
        DataSet   ds2            = da.getDoneDepositID(custName);
        DataTable dt             = sub(ds1, ds2);

        GridView1.DataSource = dt;
        GridView1.DataBind();
    }
    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];
            PaymentAdapter           raa          = new PaymentAdapter();
            PaymentRequestAdapter    ida          = new PaymentRequestAdapter();
            PaymentDepositAdapter    da           = new PaymentDepositAdapter();
            PaymentInDecreaseAdapter pia          = new PaymentInDecreaseAdapter();
            try
            {
                DataSet ds = raa.getInDecreaseList(receipt_id);
                pia.updateHeadCheckStatus(ds);

                ds = raa.getDepositList(receipt_id);

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

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

                Label1.Text = "删除成功";
            }
            catch (Exception ex)
            {
                Label1.Text = ex.Message;
            }
        }
    }
Ejemplo n.º 9
0
    protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
    {
        //定金表头
        int    index          = GridView2.SelectedIndex;
        string str_deposit_id = GridView2.SelectedRow.Cells[1].Text;

        txt_deposit_id.Text = str_deposit_id;
        PaymentDepositAdapter da = new PaymentDepositAdapter();
        DataSet ds = da.getDepositHeadByKey(str_deposit_id);

        customer.Text       = ds.Tables[0].Rows[0]["customer"].ToString();
        txt_amount_all.Text = ds.Tables[0].Rows[0]["amount_all"].ToString();
        CommonAdapter ca = new CommonAdapter();

        ddl_agenter.SelectedValue = ca.getIDByName(ds.Tables[0].Rows[0]["agenter"].ToString()).ToString();
        string str_agent_date = ds.Tables[0].Rows[0]["agent_date"].ToString();

        agent_date.Text            = DateTime.Parse(str_agent_date).ToString("yyyy-MM-dd HH:mm:ss");
        ddl_currency.SelectedValue = ds.Tables[0].Rows[0]["currencyID"].ToString();

        //定金表体
        ds = da.getDepositListByKey(str_deposit_id);
        show(ds, GridView1);
    }
Ejemplo n.º 10
0
    protected void add_Click(object sender, EventArgs e)
    {
        Label1.Text = "";
        //表头
        T_PaymentDepositHead head = new T_PaymentDepositHead();

        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.UnpayAmountFor = 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);
        }
        PaymentAdapter raa = new PaymentAdapter();

        DataSet ds = raa.getSupplierInfoByName(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_PaymentDepositList> lists = new List <T_PaymentDepositList>();

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            T_PaymentDepositList list = new T_PaymentDepositList();
            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_PaymentDepositList> addtodonelists = addBillNoToDone(lists, head);

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

            //TODO:更新销售发票的check_status,增减单的check_status
            da.addToDone(addtodonelists);
            Label1.Text = "哟,小伙子,不错,被你录入成功了";
        }
        catch (Exception ex)
        {
            Label1.Text = ex.Message;
        }
    }
Ejemplo n.º 11
0
    protected void updateUser_Click(object sender, EventArgs e)
    {
        Label1.Text = "";
        T_PaymentReceiptHead head = new T_PaymentReceiptHead();

        head.CustomerName = txt_customer.Text;
        head.CustomerCode = string.Empty;

        head.ReceiptId   = txt_recetpt_no.Text;
        head.ReceiptDate = DateTime.Parse(d_date.Text);
        head.ReceiptType = ddl_receipt_type.SelectedValue;
        //货款时供应商才从金蝶里读取
        if (head.ReceiptType == "A" || head.ReceiptType == "B")
        {
            if (!string.IsNullOrEmpty(head.CustomerName))
            {
                head.CustomerCode = getCusIDByName(head.CustomerName);
                if (string.IsNullOrEmpty(head.CustomerCode))
                {
                    Label1.Text = "输入的公司名称不对,请输入关键字然后从下拉框中选择!";
                    return;
                }
            }
        }
        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.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_PaymentReceiptList> lists = new List <T_PaymentReceiptList>();

        for (int i = 0; i < GridView1.Rows.Count; i++)
        {
            T_PaymentReceiptList list = new T_PaymentReceiptList();
            list.ReceiptId          = head.ReceiptId;
            list.ReceiptNo          = Int32.Parse(GridView1.Rows[i].Cells[0].Text);
            list.FBillNo            = GridView1.Rows[i].Cells[1].Text;
            list.FDate              = DateTime.Parse(GridView1.Rows[i].Cells[2].Text);
            list.FPurchaseAmountFor = Decimal.Parse(GridView1.Rows[i].Cells[3].Text);
            list.FPayAmountFor      = Decimal.Parse(GridView1.Rows[i].Cells[4].Text);
            list.FUnPayAmountFor    = 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.FUnPayAmountFor - 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_PaymentReceiptList list = new T_PaymentReceiptList();
            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.FPurchaseAmountFor = Decimal.Parse((GridView2.Rows[i].Cells[3].FindControl("lbl_amount_all") as TextBox).Text);
            lists.Add(list);
        }
        for (int i = 0; i < GridView4.Rows.Count; i++)
        {
            T_PaymentReceiptList list = new T_PaymentReceiptList();
            list.ReceiptId = head.ReceiptId;

            list.ReceiptNo = Int32.Parse((GridView4.Rows[i].Cells[0].FindControl("lbl_gno") as Label).Text);

            list.RequestID          = (GridView4.Rows[i].Cells[1].FindControl("txt_bill_no") as TextBox).Text;
            list.FPurchaseAmountFor = Decimal.Parse((GridView4.Rows[i].Cells[3].FindControl("lbl_amount_all") as Label).Text);
            lists.Add(list);
        }
        List <T_PaymentReceiptList> listsFromDeposit = new List <T_PaymentReceiptList>();

        foreach (GridViewRow gvr in GridView3.Rows)
        {
            T_PaymentReceiptList list = new T_PaymentReceiptList();
            list.ReceiptId = head.ReceiptId;
            list.ReceiptNo = 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.FPurchaseAmountFor = Decimal.Parse((gvr.Cells[3].FindControl("lbl_amount_all") as Label).Text);
            list.FPayAmountFor      = Decimal.Parse((gvr.Cells[4].FindControl("lbl_fpayamountfor") as Label).Text);
            list.FUnPayAmountFor    = Decimal.Parse((gvr.Cells[5].FindControl("lbl_funpayamountfor") 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.FUnPayAmountFor - list.FCheckAmountFor == 0)
            {
                list.FCheckStatus = 2;
            }
            else
            {
                list.FCheckStatus = 1;
                head.FCheckStatus = 1;
            }
            listsFromDeposit.Add(list);
        }
        List <T_PaymentReceiptList> addtodonelists   = addBillNoToDone(lists, head);
        List <T_PaymentReceiptList> checkStatusLists = addInDecreaseNoToDone(lists);

        try
        {
            //更新数据
            PaymentAdapter        raa = new PaymentAdapter();
            PaymentDepositAdapter da  = new PaymentDepositAdapter();

            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;
        }
    }