Пример #1
0
        private void GetCust()
        {
            string sFilter    = txtCust.Text.Trim();
            string sFilterSql =


                "SELECT     " +
                "    CUSTID,CUSTNAME,TaxCustName,A.INVTYPEID,B.INVTYPENAME,TAXNO," +
                "    BANKNAME + BANKACCOUNT AS BANKNAME, ADDRESS+CONTACTPHONE AS ADDRESS   " +
                " FROM T_Cust_TaxCode A LEFT JOIN T_Invoice_Type B ON A.INVTYPEID = B.INVTYPEID   " +
                " WHERE(CUSTCODE ='" + sFilter + "' OR CUSTNAME LIKE '%" + sFilter + "%') ";

            if (txtCust.Text.Trim() != "")
            {
                frmSelCust ofrmSelCust = new frmSelCust();
                ofrmSelCust.ShowSelectData(sFilterSql);
                ofrmSelCust.ShowDialog(this);

                if (ofrmSelCust.DialogResult == DialogResult.OK)
                {
                    sCustId         = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["CUSTID"].ToString();
                    txtCust.Text    = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["CUSTNAME"].ToString();
                    txtInvCust.Text = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["TAXCUSTNAME"].ToString();
                    txtTaxNo.Text   = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["TAXNO"].ToString();
                    txtBank.Text    = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["BANKNAME"].ToString();
                    txtAddress.Text = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["ADDRESS"].ToString();
                    //cbbInvType.EditValue = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["INVTYPEID"].ToString();
                    cbbInvType.ItemIndex = int.Parse(((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["INVTYPEID"].ToString());
                }
            }
        }
Пример #2
0
        private void GetCust()
        {
            string sFilter    = txtCust.Text.Trim();
            string sFilterSql =


                "SELECT     " +
                "    CUSTID,CUSTNAME,TaxCustName,A.INVTYPEID,B.INVTYPENAME,TAXNO,   " +
                "	BANKNAME + BANKACCOUNT AS BANKNAME, ADDRESS+CONTACTPHONE AS ADDRESS   "+
                " FROM T_Cust_TaxCode A LEFT JOIN T_Invoice_Type B ON A.INVTYPEID = B.INVTYPEID   " +
                " WHERE(CUSTNAME LIKE '%" + sFilter + "% ' OR DBO.FGETPY(CUSTNAME) LIKE '%" + sFilter + "%') ";

            if (txtCust.Text.Trim() != "")
            {
                frmSelCust ofrmSelCust = new frmSelCust();
                ofrmSelCust.ShowSelectData(sFilterSql);
                ofrmSelCust.ShowDialog(this);

                if (ofrmSelCust.DialogResult == DialogResult.OK)
                {
                    sCustId      = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["CUSTID"].ToString();
                    txtCust.Text = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["CUSTNAME"].ToString();
                }
            }
        }
Пример #3
0
        private void GetCust()
        {
            string sFilter    = txtCust.Text.Trim();
            string sFilterSql =
                "SELECT A.CUSTID,B.CUSTNAME FROM T_DEPT_CUST A " +
                "LEFT JOIN T_CUST B ON A.CUSTID = B.CUSTID " +
                "LEFT JOIN(SELECT CUSTID, wm_concat(ALIASNAME) AS ALIASNAME FROM T_CUST_ALIAS GROUP BY CUSTID) C " +
                "ON A.CUSTID = C.CUSTID " +
                "WHERE A.ISSUPPLIER = 1 AND A.DEPTID = " + Global.iDeptId.ToString() +
                "      AND(B.CUSTNAME LIKE '%" + sFilter + "% ' OR C.ALIASNAME LIKE '%" + sFilter + "%') ";

            if (txtCust.Text.Trim() != "")
            {
                frmSelCust ofrmSelCust = new frmSelCust();
                ofrmSelCust.ShowSelectData(sFilterSql);
                ofrmSelCust.ShowDialog(this);

                if (ofrmSelCust.DialogResult == DialogResult.OK)
                {
                    iCustId      = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["CUSTID"].ToString();
                    txtCust.Text = ((DataRowView)(ofrmSelCust.gridView1.GetFocusedRow())).Row["CUSTNAME"].ToString();
                }
            }
        }