⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 listkh.cs

📁 医药连锁软件源码,设计说明 需求说明请联系:dighonor@163.com
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;


namespace xlsb
{
    public partial class ListKH : Form
    {
        public ListKH()
        {
            InitializeComponent();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void ListKH_Activated(object sender, EventArgs e)
        {
            SqlConnection myConnection = new SqlConnection("Data Source=" + main.servername + ";Initial Catalog=" + main.dbname + ";Persist Security Info=True;User ID=" + main.saname + ";Password=" + main.pass);
            myConnection.Open();
          switch(xskdForm.flag)
          {
              case (1):
            {
                dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                SqlDataAdapter da = new SqlDataAdapter("select md_clientno as 公司编号,md_clientname as 公司名称, md_clientsimple as 公司简称 from client where md_supplyflag=0", myConnection);
                DataSet ds = new DataSet();
                da.Fill(ds);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
                break;
            }
              case (2):
            {
                dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
                SqlDataAdapter da = new SqlDataAdapter("SELECT MD_StaffNo AS 职员编号, MD_StaffName AS 职员姓名, MD_Sex AS 性别, MD_Birthday AS 出生年月, MD_DepartMent AS 部门 FROM STAFF", myConnection);
                DataSet ds = new DataSet();
                da.Fill(ds);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
                break;
            }
        case (3):
            {
                dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;

                SqlDataAdapter da = new SqlDataAdapter("SELECT SingProf.MD_GoodsNo as 商品编号,MD_GoodsName as 商品名称,Md_GoodsStyle as 规格,Md_GoodsSource as 产地,MD_Unit as 单位,MD_GoodsProofNo as 批号,SingProf.Md_Quantity as 数量,SingProf.MD_Price as 单价,STOREALL.MD_InPrice as 成本价,MD_GoodsSimple as 简称,Md_GoodsProofNo as 批号,Md_MakeDate as 生产日期 FROM SingProf inner join StoreAll on SingProf.Md_GoodsNo=StoreAll.Md_GoodsNo", myConnection);
                DataSet ds = new DataSet();
                da.Fill(ds);
                dataGridView1.DataSource = ds.Tables[0].DefaultView;
                break;
            }
          }
        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void button3_Click(object sender, EventArgs e)
        {
            dataGridView1_Click(null, null);
            xskdForm.flag = 0;
            this.Close();
        }

        private void dataGridView1_Click(object sender, EventArgs e)
        {
            switch(xskdForm.flag)
            {
                 case (1):
            {
                xskdForm.pCurrentWin.textBox2.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                xskdForm.pCurrentWin.textBox3.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                break;
            }
                case (2):
            {
                xskdForm.pCurrentWin.textBox6.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString();
                xskdForm.pCurrentWin.textBox7.Text = dataGridView1.CurrentRow.Cells[4].Value.ToString();
                xskdForm.saletaff = dataGridView1.CurrentRow.Cells[0].Value.ToString();
                break;
            }
                case (3):
            {
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_SaleProofNo"] = xskdForm.pCurrentWin.label20.Text.Trim();
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_GoodsNo"] = dataGridView1.CurrentRow.Cells[0].Value;
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_GoodsName"] = dataGridView1.CurrentRow.Cells[1].Value;
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_GoodsStyle"] = dataGridView1.CurrentRow.Cells[2].Value;
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_GoodsSource"] = dataGridView1.CurrentRow.Cells[3].Value;
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_GoodsUnit"] = dataGridView1.CurrentRow.Cells[4].Value;
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_GoodsProofNo"] = dataGridView1.CurrentRow.Cells[5].Value;
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_Price"] = dataGridView1.CurrentRow.Cells[7].Value;
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_Tax"] = Convert.ToDouble(dataGridView1.CurrentRow.Cells[7].Value) * Convert.ToDouble(xskdForm.pCurrentWin.textBox9.Text.Trim());
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_Discount"] = xskdForm.pCurrentWin.textBox8.Text.Trim();
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_Profit"] = 0;
                xskdForm.pCurrentWin.dt.Rows[xskdForm.pCurrentWin.dtShow.CurrentRow.Index]["MD_InPrice"] = dataGridView1.CurrentRow.Cells[8].Value;
                break; 
                
            }
        }
            this.Close();
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -