Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            decimal JE = 0;
            decimal d  = 0;
            string  jj = textBox2.Text.Trim();

            if (string.IsNullOrEmpty(jj) || !decimal.TryParse(jj, out d))
            {
                MessageBox.Show("金额必须为数字!");
                textBox2.Focus();
                textBox2.SelectAll();
            }
            JE = d;
            FinanceDetail finance = new FinanceDetail();

            finance.项目   = textBox1.Text.Trim();
            finance.金额   = JE;
            finance.是否进账 = checkBox1.Checked;
            finance.责任人  = (selectStaffControl1.SelectedStaffs != null && selectStaffControl1.SelectedStaffs.Count > 0) ? selectStaffControl1.SelectedStaffs[0] : null;
            finance.备注   = textBox4.Text;
            finance.Flag = checkBox2.Checked ? 1 : 0;
            FinanceDetailLogic pl = FinanceDetailLogic.GetInstance();
            int id = pl.AddFinanceDetail(finance);

            if (id > 0)
            {
                finance.ID = id;
                LoadFinanceDetails();
                MessageBox.Show("添加成功!");
            }
        }
Пример #2
0
        private DataTable Search(string name, Staff staff, int isIncome, int isCheck)
        {
            string nm = "";

            if (!string.IsNullOrEmpty(name) && name.Trim() != "")
            {
                nm = " and 项目 like '%" + name + "%'";
            }
            string mn = "";

            if (staff != null)
            {
                mn = " and 责任人='" + staff.姓名 + "'";
            }
            string ii = "";

            if (isIncome > 0)
            {
                ii = " and 是否进账='" + (isIncome == 1 ? "是" : "否") + "'";
            }
            string ic = "";

            if (isCheck > 0)
            {
                ic = " and 已报销='" + (Convert.ToInt32(isCheck - 1) == 1 ? "是" : "否") + "'";
            }
            string where = "(1=1)" + nm + mn + ii + ic;
            return(FinanceDetailLogic.GetInstance().GetFinanceDetails(where));
        }
Пример #3
0
        private void LoadFinanceDetails()
        {
            List <FinanceDetail> elements = FinanceDetailLogic.GetInstance().GetAllFinanceDetails();

            comboBox1.Items.Clear();
            foreach (FinanceDetail element in elements)
            {
                comboBox1.Items.Add(element);
            }
            if (id > 0)
            {
                Finance f = FinanceLogic.GetInstance().GetFinance(id);
                if (f != null)
                {
                    string ids = "ID=0";
                    if (!string.IsNullOrEmpty(f.Detail))
                    {
                        ids = "ID in (" + f.Detail + ")";
                    }
                    dataGridView1.DataSource = FinanceDetailLogic.GetInstance().GetFinanceDetails(ids);
                }
            }
            else
            {
                dataGridView1.DataSource = FinanceDetailLogic.GetInstance().GetFinanceDetails(string.Empty);
            }
        }
        private void Search(DateTime start, DateTime end, List <Staff> staffs)
        {
            string zrr = "";

            if (staffs != null && staffs.Count > 0)
            {
                StringBuilder sb = new StringBuilder();
                foreach (Staff staff in staffs)
                {
                    if (sb.Length == 0)
                    {
                        sb.Append(staff.ID);
                    }
                    else
                    {
                        sb.Append("," + staff.ID);
                    }
                }
                zrr = " and 责任人 in (" + sb.ToString() + ")";
            }
            string where = "(1=1)" + zrr + " and (提交时间 >= '" + start + "' and 提交时间 < '" + end.AddDays(1) + "')";
            listBox1.Items.Clear();
            List <FinanceDetail> details = FinanceDetailLogic.GetInstance().GetFinanceDetailList(where);

            listBox1.Tag = details;
            foreach (FinanceDetail detail in details)
            {
                string info = detail.DetailInfo;
                listBox1.Items.Add(info);
            }
        }
Пример #5
0
 private void button2_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         decimal JE = 0;
         decimal d  = 0;
         string  jj = textBox2.Text.Trim();
         if (string.IsNullOrEmpty(jj) || !decimal.TryParse(jj, out d))
         {
             MessageBox.Show("金额必须为数字!");
             textBox2.Focus();
             textBox2.SelectAll();
         }
         JE = d;
         FinanceDetail finance = new FinanceDetail();
         finance.项目   = textBox1.Text.Trim();
         finance.金额   = JE;
         finance.是否进账 = checkBox1.Checked;
         finance.责任人  = textBox3.Text.Trim();
         finance.备注   = textBox4.Text;
         FinanceDetailLogic pl = FinanceDetailLogic.GetInstance();
         if (pl.UpdateFinanceDetail(finance))
         {
             LoadFinanceDetails();
             MessageBox.Show("修改成功!");
         }
     }
     else
     {
         MessageBox.Show("先选定要修改的流水明细!");
     }
 }
Пример #6
0
        private void LoadFinanceDetails()
        {
            List <FinanceDetail> elements = FinanceDetailLogic.GetInstance().GetAllFinanceDetails();

            comboBox1.Items.Clear();
            foreach (FinanceDetail element in elements)
            {
                comboBox1.Items.Add(element);
            }
        }
        private void LoadAllDetails()
        {
            listBox1.Items.Clear();
            List <FinanceDetail> details = FinanceDetailLogic.GetInstance().GetAllFinanceDetails();

            listBox1.Tag = details;
            foreach (FinanceDetail detail in details)
            {
                string info = detail.DetailInfo;
                listBox1.Items.Add(info);
            }
        }
Пример #8
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (comboBox1.SelectedIndex > -1)
     {
         if (MessageBox.Show("确定要删除该流水明细?", "删除提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
         {
             FinanceDetail finance = (FinanceDetail)comboBox1.SelectedItem;
             if (FinanceDetailLogic.GetInstance().DeleteFinanceDetail(finance))
             {
                 LoadFinanceDetails();
             }
         }
     }
     else
     {
         MessageBox.Show("先选定要删除的流水明细!");
     }
 }
Пример #9
0
        private DataTable Search(string name, string man, int isIncome)
        {
            string nm = "";

            if (!string.IsNullOrEmpty(name) && name.Trim() != "")
            {
                nm = " and 项目 like '%" + name + "%'";
            }
            string mn = "";

            if (!string.IsNullOrEmpty(man) && man.Trim() != "")
            {
                mn = " and 责任人 like '%" + man.Trim() + "%'";
            }
            string ii = "";

            if (isIncome > 0)
            {
                ii = " and 是否进账=" + (isIncome == 1 ? "1" : "0");
            }
            string where = "(1=1)" + nm + mn + ii + " order by ID desc";
            return(FinanceDetailLogic.GetInstance().GetFinanceDetails(where));
        }
Пример #10
0
        public static List <FinanceDetail> GetDetailsByStr(string ids)
        {
            List <FinanceDetail> details = FinanceDetailLogic.GetInstance().GetFinanceDetailsByIds(ids);

            return(details);
        }