Ejemplo n.º 1
0
 private void ToolBarToolStripMenuItem_Click(object sender, EventArgs e)
 {
     exp           = new Expensemain();
     exp.MdiParent = this;
     exp.Dock      = DockStyle.Fill;
     exp.Show();
 }
Ejemplo n.º 2
0
        private void PurchaseOrder_Deactivate(object sender, EventArgs e)
        {
            if (textBox3.Text != "0" || textBox8.Text != "" || textBox9.Text != "" || textBox2.Text != "")
            {
                DialogResult result = MessageBox.Show("Do you want to save the record ?", "caption", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    try
                    {
                        int             x    = dataGridView1.Rows.Count;
                        SqlCeConnection conn = new SqlCeConnection(Properties.Settings.Default.conne);
                        SqlCeCommand    cmd  = new SqlCeCommand();
                        // conn.ConnectionString = "Data Source=DELL-PC;Initial Catalog=GST;Integrated Security=True";
                        conn.Open();
                        cmd.Connection = conn;
                        foreach (ListViewItem li in listView.Items)
                        {
                            string       it   = li.SubItems[0].Text;
                            string       qt   = li.SubItems[1].Text;
                            string       rat  = li.SubItems[2].Text;
                            string       amt  = li.SubItems[3].Text;
                            string       q1   = "INSERT INTO  pur_detail ([Vendor_name],[Ref],[Date],[Del_date],[Items],[Qty],[Rate],[Total]) VALUES('" + salution.Text + "','" + textBox2.Text + "','" + dateTimePicker1.Text + "','" + dateTimePicker2.Text + "','" + it + "','" + qt + "','" + rat + "','" + amt + "')";
                            SqlCeCommand cmd2 = new SqlCeCommand(q1, conn);
                            cmd2.ExecuteNonQuery();
                        }

                        Double val1 = Convert.ToDouble(textBox3.Text);
                        Double val2 = Convert.ToDouble(textBox8.Text);
                        Double val3 = val2 - val1;
                        cmd.CommandText = "INSERT INTO purchase_order([Date],[Vendor_name],[Ref],[Del_date],[Amt],[Paid],[Bal],[Pay_detail]) VALUES ('" + dateTimePicker1.Text + "','" + salution.Text + "','" + textBox2.Text + "','" + dateTimePicker2.Text + "','" + textBox8.Text + "','" + textBox3.Text + "','" + val3 + "','" + textBox9.Text + "')";
                        cmd.ExecuteNonQuery();
                        MessageBox.Show("Inserted Successfully");
                        listView.Items.Clear();
                        itde1.Text           = "";
                        qua1.Text            = "";
                        rat1.Text            = "";
                        salution.Text        = "";
                        dateTimePicker1.Text = "";
                        dateTimePicker2.Text = "";
                        textBox8.Text        = "";
                        textBox2.Text        = "";
                        textBox4.Text        = "";
                        textBox3.Text        = "0";
                        textBox9.Text        = "";
                        comboBox1.Text       = "";
                        panel1.Visible       = false;
                    }
                    catch (Exception ab4)
                    {
                        MessageBox.Show("Error :" + ab4);
                    }
                }
                else if (result == DialogResult.No)
                {
                    Expensemain ep = new Expensemain();
                    ep.Close();
                }
            }
        }
Ejemplo n.º 3
0
        private void BillsMain_Deactivate(object sender, EventArgs e)
        {
            if (textBox2.Text != "" || textBox8.Text != "" || textBox9.Text != "")
            {
                DialogResult result = MessageBox.Show("Do you want to save the record ?", "caption", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    save1();
                }

                else if (result == DialogResult.No)
                {
                    Expensemain ep = new Expensemain();
                    ep.Close();
                }
            }
        }
Ejemplo n.º 4
0
        private void RecurringExpMain_Deactivate(object sender, EventArgs e)
        {
            if (textBox3.Text != "" || qua1.Text != "" || textBox5.Text != "" || textBox2.Text != "")
            {
                DialogResult result = MessageBox.Show("Do you want to save the record ?", "caption", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    int             x    = dataGridView1.Rows.Count;
                    SqlCeConnection conn = new SqlCeConnection(Properties.Settings.Default.conne);
                    SqlCeCommand    cmd  = new SqlCeCommand();
                    // conn.ConnectionString = "Data Source=DELL-PC;Initial Catalog=GST;Integrated Security=True";
                    conn.Open();
                    cmd.Connection  = conn;
                    cmd.CommandText = "INSERT INTO  reccuring_exp([Prof_name],[Bill_no],[Repeat],[Start_date],[End_date],[Amount],[Paidby],[Vendor],[Notes],[Cust_name]) VALUES('" + textBox2.Text + "','" + comboBox2.Text + "','" + dateTimePicker1.Text + "','" + dateTimePicker2.Text + "','" + textBox3.Text + "','" + comboBox1.Text + "','" + comboBox3.Text + "','" + qua1.Text + "','" + textBox5.Text + "')";
                    cmd.ExecuteNonQuery();
                    MessageBox.Show("Inserted Successfully");
                    displayit();
                    textBox3.Text = "";
                    conn.Close();
                    textBox2.Text        = "";
                    comboBox2.Text       = "";
                    dateTimePicker1.Text = "";
                    dateTimePicker2.Text = "";
                    textBox3.Text        = "";
                    comboBox1.Text       = "";
                    textBox6.Text        = "";
                    comboBox3.Text       = "";
                    qua1.Text            = "";
                    textBox5.Text        = "";
                }

                else if (result == DialogResult.No)
                {
                    Expensemain ep = new Expensemain();
                    ep.Close();
                }
            }
        }
Ejemplo n.º 5
0
        private void Expensemain_Deactivate(object sender, EventArgs e)
        {
            try
            {
                if (textBox2.Text != "0" && textBox2.Text != "" || comboBox3.Text != "" || rat1.Text != "" || itde1.Text != "" || qua1.Text != "" || textBox4.Text != "" || comboBox2.Text != "")
                {
                    DialogResult result = MessageBox.Show("Do you want to save the record ?", "caption", MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {
                        int             x    = dataGridView1.Rows.Count;
                        SqlCeConnection conn = new SqlCeConnection(Properties.Settings.Default.conne);
                        SqlCeCommand    cmd  = new SqlCeCommand();
                        //conn.ConnectionString = "Data Source=DELL-PC;Initial Catalog=GST;Integrated Security=True";
                        conn.Open();
                        cmd.Connection  = conn;
                        cmd.CommandText = " INSERT INTO expenses ([Date],[Amount],[Paidby],[Vendor],[Billno],[Notes],[Cust_name],[Pay_details]) VALUES('" + dateTimePicker1.Text + "','" + textBox2.Text + "','" + comboBox3.Text + "','" + salution.Text + "','" + itde1.Text + "','" + qua1.Text + "','" + rat1.Text + "','" + textBox4.Text + "')";
                        cmd.ExecuteNonQuery();
                        MessageBox.Show("Inserted Successfully");
                        showit();
                        textBox3.Text = "Exp" + dataGridView1.Rows.Count.ToString();
                        conn.Close();
                        dateTimePicker1.Text = "";
                        textBox2.Text        = "";
                        comboBox3.Text       = "";
                        salution.Text        = "";
                        itde1.Text           = "";
                        qua1.Text            = "";
                        rat1.Text            = "";
                        textBox4.Text        = "";
                        comboBox2.Text       = "";
                    }
                    else if (result == DialogResult.No)
                    {
                        Expensemain ep = new Expensemain();
                        ep.Close();
                    }
                }
            }
            catch (Exception ab1)
            {
                MessageBox.Show("Error :" + ab1);
            }


            //   private void Autocomplete()
            //{
            //    try
            //    {
            //        SqlCeConnection con6 = new SqlCeConnection("Data Source=DELL-PC;Initial Catalog=GST;Integrated Security=True");
            //        SqlCeCommand cmd9 = new SqlCeCommand("SELECT [Cust_name] from [expenses]", con6);
            //        DataSet ds = new DataSet();
            //        SqlCeDataAdapter ad9 = new SqlCeDataAdapter("SELECT [Cust_name] from [expenses]", con6);
            //        ad9.Fill(ds, "expenses");
            //        AutoCompleteStringCollection col = new
            //        AutoCompleteStringCollection();
            //        int i = 0;
            //        for (i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
            //        {
            //            col.Add(ds.Tables[0].Rows[i]["Cust_name"].ToString());

            //        }
            //        textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;
            //        textBox1.AutoCompleteCustomSource = col;
            //        textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;

            //        con6.Close();
            //    }
            //    catch (Exception ex)
            //    {
            //        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK,MessageBoxIcon.Error);
            //    }
            //}
        }