Exemplo n.º 1
0
        public void Filldj(int ghdw, int ywy, long id)
        {
            _id = id;
            string ssql = "";

            lblghdw.Text = Yp.SeekGhdw(ghdw, InstanceForm.BDatabase);
            Yp.AddcmbYwy(ghdw, cmbywy, InstanceForm.BDatabase);

            //添加已付款的记录
            ssql = "select '0' 序号,cast(1 as smallint) 选,dbo.fun_yp_ghdw(wldw) 供货单位,dbo.fun_yp_ywy(jsr) 业务员,djh 单据号,sdjh 单据号X,rq 日期,sumjhje 进货金额," +
                   " shdh 送货单号,fph 发票号,fprq 发票日期,djrq 登记时间,dbo.fun_getempname(a.djy) 登记员,id from " + _Table + " a,YP_FKJL B where a.id=b.djid and b.bdelete=0 and jllx=1";
            if (id != 0)
            {
                ssql = ssql + " and fid=" + id + "";
            }
            else
            {
                ssql = ssql + " and a.wldw=" + ghdw + "";
                if (ywy != 0)
                {
                    ssql = ssql + " and jsr=" + ywy + " ";
                }
            }
            ssql = ssql + " order by a.id";
            DataTable tb = InstanceForm.BDatabase.GetDataTable(ssql);

            FunBase.AddRowtNo(tb);
            tb.TableName = "Tb";
            this.myDataGrid1.DataSource = tb;
            //初始化其它信息
            if (id != 0)
            {
                ssql                 = "select * from yp_fkqcjc where id=" + id + "";
                tb                   = InstanceForm.BDatabase.GetDataTable(ssql);
                lblghdw.Text         = Yp.SeekGhdw(Convert.ToInt32(tb.Rows[0]["ghdw"]), InstanceForm.BDatabase);
                lblghdw.Tag          = tb.Rows[0]["ghdw"].ToString();
                cmbywy.SelectedValue = tb.Rows[0]["ywy"].ToString();
                cmbywy.Enabled       = false;
                checkBox1.Enabled    = false;
                checkBox1.Checked    = Convert.ToInt32(tb.Rows[0]["ywy"]) > 0?true:false;
                txtye.Text           = tb.Rows[0]["qcye"].ToString();
                lbldjsj.Text         = tb.Rows[0]["djsj"].ToString();
                lbldjy.Text          = Yp.SeekEmpName(Convert.ToInt32(tb.Rows[0]["djy"]), InstanceForm.BDatabase);
                txtbz.Text           = tb.Rows[0]["bz"].ToString();
            }
            else
            {
                lblghdw.Text = Yp.SeekGhdw(ghdw, InstanceForm.BDatabase);
                lblghdw.Tag  = ghdw.ToString();
                txtye.Text   = "";
                lbldjsj.Text = "";
                lbldjy.Text  = "";
                txtbz.Text   = "";
            }
        }