private void CostRateUpdate_Load(object sender, EventArgs e)
        {
            string   yyyy = "";
            int      id = 0, saletypeid = 0, quarterid = 0, deptid = 0;
            decimal  costrate   = 0;
            DateTime dt         = DateTime.Now;
            DateTime startMonth = dt.AddDays(1 - dt.Day);  //本月月初

            this.dateTimePicker1.Value = startMonth;
            CostDeptRateQuery.GetInfo(ref id, ref yyyy, ref quarterid, ref saletypeid, ref deptid, ref costrate);
            Common.BasicDataBind("cost_saletype", comboBoxSaleType);
            Common.BasicDataBind("cost_quarter", comboBoxQuarter);
            BindDept();
            if (id != 0)
            {
                comboBoxSaleType.SelectedIndex = -1;
                comboBoxSaleType.SelectedValue = saletypeid;
                comboBoxQuarter.SelectedIndex  = -1;
                comboBoxQuarter.SelectedValue  = quarterid;
                comboBoxDept.SelectedIndex     = -1;
                comboBoxDept.SelectedValue     = deptid;
                dateTimePicker1.Value          = Convert.ToDateTime(yyyy + "-01");
                textEditCostRate.Text          = costrate.ToString();
                textEditID.Text = id.ToString();
            }
        }
 public static CostDeptRateQuery GetInstance()
 {
     if (crqform == null || crqform.IsDisposed)
     {
         crqform = new CostDeptRateQuery();
     }
     return(crqform);
 }
Example #3
0
        private void barButtonItem查询_ItemClick(object sender, ItemClickEventArgs e)
        {
            CostDeptRateQuery Frm = CostDeptRateQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
        }
Example #4
0
        private void CostRate_Load(object sender, EventArgs e)
        {
            this.WindowState = FormWindowState.Maximized;
            CostDeptRateQuery Frm = CostDeptRateQuery.GetInstance();

            Frm.TopLevel = false;
            Frm.Parent   = this;
            Frm.Show();
            Frm.BringToFront();
            Frm.Height = this.Height - 20;
        }
Example #5
0
        private void barButtonItem修改_ItemClick(object sender, ItemClickEventArgs e)
        {
            string  yyyy = "";
            int     id = 0, saletypeid = 0, quarterid = 0, deptid = 0;
            decimal standardpoint = 0;

            CostDeptRateQuery.GetInfo(ref id, ref yyyy, ref quarterid, ref saletypeid, ref deptid, ref standardpoint);
            if (id != 0)
            {
                CostRateUpdate Frm = new CostRateUpdate();
                Frm.TopLevel = false;
                Frm.Parent   = this;
                Frm.Show();
                Frm.BringToFront();
            }
        }
Example #6
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_rate(yyyy,quarter_id,sale_type_id,dept_id,cost_rate) values('" + dateTimePicker1.Text.ToString() + "'," + comboBoxQuarter.SelectedValue.ToString() + "," + comboBoxSaleType.SelectedValue.ToString() + "," + comboBoxDept.SelectedValue.ToString() + ",ltrim(rtrim(" + Common.IsNull(textEditCostRate.Text.ToString()) + ")))";
            strsql2 = "select * from cost_rate where yyyy ='" + dateTimePicker1.Text.ToString() + "' and sale_type_id = " + Common.IsZero(comboBoxSaleType.SelectedValue.ToString()) + " and quarter_id = " + Common.IsZero(comboBoxQuarter.SelectedValue.ToString()) + " and dept_id = " + comboBoxDept.SelectedValue;
            if (comboBoxQuarter.SelectedValue.ToString() == "0")
            {
                MessageBox.Show("请选择季度");
            }
            else if (comboBoxSaleType.SelectedValue.ToString() == "0")
            {
                MessageBox.Show("请选择营业类型");
            }
            else if (comboBoxDept.SelectedValue.ToString() == "0")
            {
                MessageBox.Show("部门不能为空!");
            }
            else if (textEditCostRate.Text.ToString() == "")
            {
                MessageBox.Show("成本比率不能为空!");
            }
            else
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该部门成本比率已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        CostDeptRateQuery.RefreshEX();
                        this.Close();
                    }
                }
            }
            conn.Close();
        }
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_rate set cost_rate = ltrim(rtrim('" + Common.IsNull(textEditCostRate.Text.ToString()) + "'))";

            sql = sql + " where cid = " + textEditID.Text.ToString();
            bool isok = conn.EditDatabase(sql);

            if (isok)
            {
                MessageBox.Show("修改成功!");
                CostDeptRateQuery.RefreshEX();
                this.Close();
            }
            else
            {
                MessageBox.Show("失败!");
            }
            conn.Close();
        }
Example #8
0
 private void simpleButton复制_Click(object sender, EventArgs e)
 {
     if (comboBoxQuarter.SelectedValue.ToString() == "0")
     {
         MessageBox.Show("请选择季度");
     }
     else
     {
         MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
         DialogResult      dr         = MessageBox.Show("将按最近的季度数据自动新增当前选择季度的数据,确认复制吗?", "复制最近季度数据", messButton);
         if (dr == DialogResult.OK)
         {
             ConnDB conn = new ConnDB();
             string strsql, strsql2;
             int    rows;
             bool   isok = false;
             strsql2 = "select * from cost_rate where yyyy ='" + dateTimePicker1.Text.ToString() + "' and dept_id >0 and quarter_id = " + Common.IsZero(comboBoxQuarter.SelectedValue.ToString());
             rows    = conn.ReturnRecordCount(strsql2);
             if (rows > 0)
             {
                 MessageBox.Show("该季度部门成本比率已经存在!");
             }
             else
             {
                 strsql = "insert into cost_rate(yyyy,quarter_id,sale_type_id,dept_id,cost_rate) select '" + dateTimePicker1.Text + "','" + Common.IsZero(comboBoxQuarter.SelectedValue.ToString()) + "',sale_type_id,dept_id,cost_rate from cost_rate where YYYY + cast(quarter_id as varchar(10)) = (select Max(yyyy+cast(quarter_id as varchar(10))) from cost_rate where dept_id >0) and dept_id >0";
                 isok   = conn.EditDatabase(strsql);
                 if (isok)
                 {
                     MessageBox.Show("复制成功!");
                     CostDeptRateQuery.RefreshEX();
                     this.Close();
                 }
             }
             conn.Close();
         }
     }
 }
Example #9
0
 private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e)
 {
     CostDeptRateQuery.RefreshEX();
 }