private void GetArt(int iRowHandle) { string sFilter = gridView1.GetRowCellValue(iRowHandle, "ARTNAME").ToString(); string sFilterSql = "SELECT " + " ARTID,NAME AS ARTNAME,ARTCODE,SPEC,UNIT,FACTORY,0 AS TAXREATE" + " FROM T_Article A " + " WHERE(ARTCODE ='" + sFilter + "' OR [NAME] LIKE '%" + sFilter + "%') "; if (sFilter.Trim() != "") { frmSelArt ofrmSelArt = new frmSelArt(); ofrmSelArt.ShowSelectData(sFilterSql); ofrmSelArt.ShowDialog(this); if (ofrmSelArt.DialogResult == DialogResult.OK) { gridView1.SetRowCellValue(iRowHandle, "ARTID", ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["ARTID"].ToString()); gridView1.SetRowCellValue(iRowHandle, "ARTNAME", ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["ARTNAME"].ToString()); } } }
private void txtArt_KeyPress(object sender, KeyPressEventArgs e) { string sFilter = txtArt.Text.Trim(); string sFilterSql = "SELECT " + " a.artid,a.name,a.spec,a.factory,a.unit,b.stopin, a.taxrate," + " a.custid as artcustid,a.validated as artvalidated,b.validated as deptvalidated, " + " e.lastprice,e.minprice, " + " (select minsaleprice from t_dept_art_sale_policy where deptid =" + Global.iDeptId.ToString() + " artid = a.artid) as minsaleprice, " + " (select lastprice from t_dept_art_buy_policy where deptid =" + Global.iDeptId.ToString() + " artid = a.artid) as lastprice, " + " (select lastprice from t_dept_art_buy_policy where deptid =" + Global.iDeptId.ToString() + " artid = a.artid) as lastprice, " + " (select min(tenderprice) from t_tender_art_price where artid = a.artid) as tenderprice,d.PACKQUANTITIES, " + " 0 as xz " + "FROM(" + " (select artid from t_article where ('%' = '" + sFilter + " ') or instr(name, '" + sFilter + "% ') > 0) " + " union " + " (select distinct artid from t_art_alias where ('%' = '" + sFilter + "') or instr(aliasname, '" + sFilter + "') > 0) " + " ) c, " + " t_article a, " + " t_dept_art b, " + " (" + " select a.custid,min(a.custname) custname,min(a.nickname) nickname " + " from t_cust a, t_cust_alias b " + " where a.custid = b.custid(+) and " + " ('%' = '" + sFilter + "' or instr(a.custname, '" + sFilter + "') > 0 or instr(a.nickname, '" + sFilter + "') > 0 or instr(b.aliasname, '" + sFilter + "') > 0) " + " group by a.custid " + " ) cust ," + " (SELECT ARTID,PACKQUANTITIES FROM T_ART_PACK WHERE NVL(CANCELED,0) = 1 AND ROWNUM = 1) d ," + " t_dept_art e " + "WHERE(b.artid = a.artid)and " + " (a.artid = c.artid) and " + " (a.artid = d.artid) and " + " (a.artid = e.artid) and (b.deptid = e.deptid) and e.custid =" + iCustId + " and " + " (nvl(a.checked, 0) = 1 and nvl(b.checked, 0) = 1) and " + " (a.custid = cust.custid) and " + " (b.deptid = " + Global.iDeptId.ToString() + ") " + "order by a.name "; if (txtArt.Text.Trim() != "") { frmSelArt ofrmSelArt = new frmSelArt(); ofrmSelArt.ShowSelectData(sFilterSql); ofrmSelArt.ShowDialog(this); if (ofrmSelArt.DialogResult == DialogResult.OK) { gridView1.AddNewRow(); int newRowHandle = gridView1.FocusedRowHandle; gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[0], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["ARTID"].ToString()); gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[1], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["NAME"].ToString()); gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[2], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["SPEC"].ToString()); gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[3], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["FACTORY"].ToString()); gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[4], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["UNIT"].ToString()); //gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[5], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["TOTAL"].ToString()); //gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[6], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["PRICE"].ToString()); //gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[7], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["AMOUNT"].ToString()); gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[8], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["TAXRATE"].ToString()); gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[9], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["PACKQUANTITIES"].ToString()); //gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[10], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["PACKAGECOUNT"].ToString()); //gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[11], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["COSTPRICE"].ToString()); //gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[12], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["SETTLEPRICE"].ToString()); //gridView1.SetRowCellValue(newRowHandle, gridView1.Columns[13], ((DataRowView)(ofrmSelArt.gridView1.GetFocusedRow())).Row["ARTID"].ToString()); gridView1.UpdateCurrentRow(); } } }