Example #1
0
 public static RentExpenseQuery GetInstance()
 {
     if (reqform == null || reqform.IsDisposed)
     {
         reqform = new RentExpenseQuery();
     }
     return(reqform);
 }
Example #2
0
        private void barButtonItem查询_ItemClick(object sender, ItemClickEventArgs e)
        {
            RentExpenseQuery Frm = RentExpenseQuery.GetInstance();

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

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

            RentExpenseQuery.GetInfo(ref id, ref yyyymm, ref saletypeid, ref rentexpense);
            if (id != 0)
            {
                RentExpenseUpdate Frm = new RentExpenseUpdate();
                Frm.TopLevel = false;
                Frm.Parent   = this;
                Frm.Show();
                Frm.BringToFront();
            }
        }
Example #5
0
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string sql  = "update cost_rent_expense set rent_expense = ltrim(rtrim('" + textEditRentExpense.Text.ToString() + "'))";

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

            if (isok)
            {
                MessageBox.Show("修改成功!");
                RentExpenseQuery.RefreshEX();
                this.Close();
            }
            else
            {
                MessageBox.Show("失败!");
            }
            conn.Close();
        }
        private void simpleButton复制_Click(object sender, EventArgs e)
        {
            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;
                DateTime dt1   = Convert.ToDateTime(dateTimePicker1.Text);
                DateTime dt2   = System.DateTime.Now;
                int      month = (dt2.Year - dt1.Year) * 12 + (dt2.Month - dt1.Month);
                strsql2 = "select yyyymm from cost_rent_expense where yyyymm ='" + dateTimePicker1.Text.ToString() + "'";
                rows    = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该月度租赁费已经存在!");
                }
                else if (month < -1)
                {
                    MessageBox.Show("月份错误!");
                }
                else
                {
                    strsql = "insert into cost_rent_expense(yyyymm,sale_type_id,rent_expense) select '" + dateTimePicker1.Text + "',sale_type_id,rent_expense from cost_rent_expense where YYYYMM = (select Max(yyyymm) from cost_rent_expense) ";
                    isok   = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("复制成功!");
                        RentExpenseQuery.RefreshEX();
                        this.Close();
                    }
                }
                conn.Close();
            }
        }
Example #7
0
        private void RentExpenseUpdate_Load(object sender, EventArgs e)
        {
            string   yyyymm = "";
            int      id = 0, saletypeid = 0;
            decimal  rentexpense = 0;
            DateTime dt          = DateTime.Now;
            DateTime startMonth  = dt.AddDays(1 - dt.Day); //本月月初

            this.dateTimePicker1.Value = startMonth;
            RentExpenseQuery.GetInfo(ref id, ref yyyymm, ref saletypeid, ref rentexpense);
            Common.BasicDataBind("cost_saletype", comboBoxSaleType);
            if (id != 0)
            {
                comboBoxSaleType.SelectedIndex = -1;
                comboBoxSaleType.SelectedValue = saletypeid;
                dateTimePicker1.Text           = yyyymm;
                textEditRentExpense.Text       = rentexpense.ToString();
                textEditID.Text = id.ToString();
            }

            dateTimePicker1.Focus();
            SendKeys.Send("{RIGHT} ");
        }
        private void simpleButtonOK_Click(object sender, EventArgs e)
        {
            ConnDB conn = new ConnDB();
            string strsql, strsql2;
            int    rows;

            strsql  = "insert into cost_rent_expense(yyyymm,sale_type_id,rent_expense) values('" + dateTimePicker1.Text.ToString() + "'," + comboBoxSaleType.SelectedValue + ",ltrim(rtrim(" + textEditRentExpense.Text.ToString() + ")))";
            strsql2 = "select yyyymm from cost_rent_expense where yyyymm ='" + dateTimePicker1.Text.ToString() + "' and sale_type_id = " + comboBoxSaleType.SelectedValue;
            if (textEditRentExpense.Text.ToString() != "")
            {
                rows = conn.ReturnRecordCount(strsql2);
                if (rows > 0)
                {
                    MessageBox.Show("该租赁费已经存在!");
                }
                else
                {
                    bool isok = conn.EditDatabase(strsql);
                    if (isok)
                    {
                        MessageBox.Show("添加成功!");
                        RentExpenseQuery.RefreshEX();
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("失败!");
                    }
                }
            }
            else
            {
                MessageBox.Show("租赁费不能为空!");
            }
            conn.Close();
        }
Example #9
0
 private void barButtonItem刷新_ItemClick(object sender, ItemClickEventArgs e)
 {
     RentExpenseQuery.RefreshEX();
 }