示例#1
0
        private void getid()
        {
            get_id order = new get_id();

            order.taxinvoice();
            textBox1.Text = Convert.ToString(get_id.sales_return_no);
        }
示例#2
0
        private void getid()
        {
            get_id order = new get_id();

            order.taxinvoice();
            textBox2.Text = Convert.ToString(get_id.taxinvoice_id);
        }
示例#3
0
        private void getid()
        {
            get_id order = new get_id();

            order.taxinvoice();
            textBox1.Text = Convert.ToString(get_id.stockreceipt_receipt_no);
            textBox2.Text = Convert.ToString(get_id.stockreceipt_ref_no);
        }
示例#4
0
        private void getid()
        {
            get_id order = new get_id();

            order.taxinvoice();
            textBox1.Text = Convert.ToString(get_id.p_order_no);
            textBox2.Text = Convert.ToString(get_id.p_orderref_no);
        }
示例#5
0
        private void reecipt()
        {
            get_id gie = new get_id();

            gie.taxinvoice();
            int text = get_id.pay_re;

            textBox1.Text = Convert.ToString(text);
            textBox2.Text = Convert.ToString(text);
        }
示例#6
0
        private void button3_Click(object sender, EventArgs e)
        {
            try
            {
                int id = Convert.ToInt32(textBox3.Text);

                if (id == 0)
                {
                    foreach (DataGridViewRow row in dataGridView2.Rows)
                    {
                        connection.Close();
                        connection.Open();
                        string       command = "insert into payment_receipt(re_no,re_date,c_name,payment_type,invoice_type,payment_mode,ref_no,ref_date,in_no,in_date,total_amount,due_amount,receive_amount,notes,total_receive) values('" + textBox1.Text + "','" + dateTimePicker1.Text + "','" + comboBox4.Text + "','" + comboBox2.Text + "','" + comboBox5.Text + "','" + comboBox1.Text + "','" + textBox2.Text + "','" + dateTimePicker2.Text + "',@in_no,@in_date,@total_amount,@due_amount,@receive_amount,'" + textBox4.Text + "','" + textBox5.Text + "') ";
                        OleDbCommand cmdd    = new OleDbCommand(command, connection);

                        cmdd.Parameters.AddWithValue("@in_no", row.Cells[0].Value);
                        cmdd.Parameters.AddWithValue("@in_date", row.Cells[1].Value);
                        cmdd.Parameters.AddWithValue("@total_amount", row.Cells[2].Value);
                        string dueamount = Convert.ToString(Convert.ToDouble(row.Cells[2].Value.ToString()) - Convert.ToDouble(row.Cells[4].Value.ToString()));
                        cmdd.Parameters.AddWithValue("@due_amount", dueamount);
                        cmdd.Parameters.AddWithValue("@receive_amount", row.Cells[4].Value);
                        cmdd.ExecuteNonQuery();
                    }
                    string bla = "";
                    bla = "1";

                    get_id gi = new get_id();
                    gi.taxinvoice();
                    int          receipt_no = get_id.pay_re + 1;
                    OleDbCommand command1   = new OleDbCommand(@"UPDATE get_id
                                                    SET pay_re = @City_Name
                                                       
                                                    WHERE ID = " + bla + "", connection);

                    command1.Parameters.AddWithValue("@City_Name", receipt_no);
                    command1.ExecuteNonQuery();
                }
                else
                {
                    foreach (DataGridViewRow row in dataGridView2.Rows)
                    {
                        OleDbCommand command = new OleDbCommand(@"UPDATE payment_receipt
                                                    SET payment_mode = @payment_mode,
                                                        due_amount = @due_amount,
                                                        receive_amount = @receive_amount,
                                                        notes = @notes,
                                                        total_receive = @total_receive
                                                      WHERE re_no = @re_no", connection);


                        command.Parameters.AddWithValue("@payment_mode", comboBox1.Text);
                        command.Parameters.AddWithValue("@due_amount", row.Cells[3].Value);
                        command.Parameters.AddWithValue("@receive_amount", row.Cells[4].Value);
                        command.Parameters.AddWithValue("@notes", textBox4.Text);
                        command.Parameters.AddWithValue("@total_receive", textBox5.Text);
                        command.Parameters.AddWithValue("@re_no", textBox1.Text);
                        try
                        {
                            connection.Close();
                            connection.Open();
                        }
                        catch (Exception)
                        {
                            MessageBox.Show("connection error");
                        }
                        try
                        {
                            command.ExecuteNonQuery();
                            MessageBox.Show("Updated");
                            connection.Close();
                            reset();
                            gridview();
                            grid();
                            //   comm.ExecuteNonQuery();
                        }
                        catch (Exception q)
                        {
                            MessageBox.Show("update errorrrrrrrrrrrr" + q);
                        }
                    }
                }
            }
            catch (Exception t)
            {
                MessageBox.Show("" + t);
            }
            finally
            {
                connection.Close();
                reset();
                reecipt();
                gridview();
                grid();
            }
        }
示例#7
0
        private void button1_Click(object sender, EventArgs e)
        {
            string total = Convert.ToString(Convert.ToDouble(dataGridView1.Rows[0].Cells[3].Value) * Convert.ToDouble(dataGridView1.Rows[0].Cells[5].Value));

            try
            {
                get_id order = new get_id();
                order.taxinvoice();
                string       or      = Convert.ToString(get_id.p_order_no);
                string       refe    = Convert.ToString(get_id.p_orderref_no);
                string       command = "insert into p_order(or_no, or_date, ref_no, deli_date, supplier_name,item_code, item_name, unit, qty, purchase_price, dis_on_p, cgst, sgst, total_amount, status,amount) values(@or_no,@or_date,@ref_no,@deli_date,@supplier,@item_code,@item_name,@unit,@qty,@purchase_price,@dis_on_p,@cgst,@sgst,@total_amount,@status,@amount) ";
                OleDbCommand cmdd    = new OleDbCommand(command, connection);
                cmdd.Parameters.AddWithValue("@or_no", or);
                cmdd.Parameters.AddWithValue("@or_date", DateTime.Now.ToShortDateString());
                cmdd.Parameters.AddWithValue("@ref_no", refe);
                cmdd.Parameters.AddWithValue("@deli_date", DateTime.Now.ToShortDateString());
                cmdd.Parameters.AddWithValue("@supplier", dataGridView1.Rows[0].Cells[7].Value);
                cmdd.Parameters.AddWithValue("@item_code", dataGridView1.Rows[0].Cells[0].Value);
                cmdd.Parameters.AddWithValue("@item_name", dataGridView1.Rows[0].Cells[1].Value);
                cmdd.Parameters.AddWithValue("@unit", dataGridView1.Rows[0].Cells[4].Value);
                cmdd.Parameters.AddWithValue("@qty", dataGridView1.Rows[0].Cells[3].Value);
                cmdd.Parameters.AddWithValue("@purchase_price", dataGridView1.Rows[0].Cells[5].Value);
                cmdd.Parameters.AddWithValue("@dis_on_p", dataGridView1.Rows[0].Cells[6].Value);
                cmdd.Parameters.AddWithValue("@cgst", dataGridView1.Rows[0].Cells[8].Value);
                cmdd.Parameters.AddWithValue("@sgst", dataGridView1.Rows[0].Cells[9].Value);
                cmdd.Parameters.AddWithValue("@total_amount", total);
                cmdd.Parameters.AddWithValue("@status", "pending");
                cmdd.Parameters.AddWithValue("@amount", "Due");
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
                connection.Open();
                cmdd.ExecuteNonQuery();

                string       comman = "insert into purchase_main(p_no, p_date, d_date, s_name, amount, status) values(@or_no,@or_date,@deli_date,@supplier,@amount,@status) ";
                OleDbCommand cmd    = new OleDbCommand(comman, connection);
                cmd.Parameters.AddWithValue("@or_no", or);
                cmd.Parameters.AddWithValue("@or_date", DateTime.Now.ToShortDateString());
                cmd.Parameters.AddWithValue("@deli_date", DateTime.Now.ToShortDateString());
                cmd.Parameters.AddWithValue("@supplier", dataGridView1.Rows[0].Cells[7].Value);
                cmd.Parameters.AddWithValue("@amount", total);
                cmd.Parameters.AddWithValue("@status", "pending");
                if (connection.State == ConnectionState.Open)
                {
                    connection.Close();
                }
                connection.Open();
                cmd.ExecuteNonQuery();
                MessageBox.Show("Please check your order details");

                //update order id and ref no by 1
                int order_no     = 0;
                int reference_no = 0;
                int idd          = 1;
                order_no     = get_id.p_order_no + 1;
                reference_no = get_id.p_orderref_no + 1;
                try
                {
                    OleDbCommand command1 = new OleDbCommand(@"UPDATE get_id
                                                    SET p_order_no = @p_order_no,
                                                        p_orderref_no = @p_orderref_no
                                                    WHERE ID = " + idd + "", connection);

                    command1.Parameters.AddWithValue("@p_order_no", order_no);
                    command1.Parameters.AddWithValue("@p_orderref_no", reference_no);
                    command1.ExecuteNonQuery();
                }
                catch (Exception a)
                {
                    MessageBox.Show("" + a);
                }
            }
            catch (Exception o) {
                MessageBox.Show("" + o);
            }
            finally
            {
                connection.Close();
            }
        }
示例#8
0
        // int id = 0;
        // string id1 = "";
        private void button9_Click(object sender, EventArgs e)
        {
            string in_no = "";

            // insert query into payment Receipt


            DataGridViewRow newDataRow = dataGridView1.Rows[selectedrow];
            DataGridViewRow row        = dataGridView1.Rows[selectedrow];

            try
            {
                connection.Close();
                connection.Open();

                OleDbDataReader rdr = null;
                OleDbCommand    cmd = new OleDbCommand("select * from payment_receipt where invoice_type = 'Tax-Invoice' AND in_no = '" + row.Cells[0].Value + "' ", connection);
                rdr = cmd.ExecuteReader();
                if (rdr.Read())
                {
                    in_no = Convert.ToString(rdr["in_no"]);
                }
            }
            catch (Exception o)
            {
                MessageBox.Show("getid" + o);
            }
            finally
            {
                connection.Close();
            }

            if (in_no == row.Cells[0].Value.ToString())
            {
                MessageBox.Show("Already exist");
            }
            else
            {
                try
                {
                    string bla = "";
                    bla = "1";

                    get_id gi = new get_id();
                    gi.taxinvoice();
                    int receipt_no = get_id.pay_re;


                    connection.Close();
                    connection.Open();
                    string       command = "insert into payment_receipt(re_no,re_date,payment_type,invoice_type,ref_no,ref_date,in_no,in_date,c_name,total_amount,due_amount,receive_amount,total_receive) values(@re_no,@re_date,@payment_type,@invoice_type,@ref_no,@ref_date,@in_no,@in_date,@c_name,@in_amount,@due_amount,@receive_amount,@total_receive) ";
                    OleDbCommand cmdd    = new OleDbCommand(command, connection);
                    cmdd.Parameters.AddWithValue("@re_no", receipt_no);
                    cmdd.Parameters.AddWithValue("@re_date", DateTime.Now.ToString("MM-dd-yyyy"));
                    cmdd.Parameters.AddWithValue("@payment_type", "Against Invoice");
                    cmdd.Parameters.AddWithValue("@invoice_type", "Tax-Invoice");
                    cmdd.Parameters.AddWithValue("@re_no", receipt_no);
                    cmdd.Parameters.AddWithValue("@re_date", DateTime.Now.ToString("MM-dd-yyyy"));
                    cmdd.Parameters.AddWithValue("@in_no", row.Cells[0].Value);
                    cmdd.Parameters.AddWithValue("@in_date", row.Cells[1].Value);
                    cmdd.Parameters.AddWithValue("@c_name", row.Cells[4].Value);
                    cmdd.Parameters.AddWithValue("@in_amount", row.Cells[5].Value);
                    cmdd.Parameters.AddWithValue("@due_amount", row.Cells[7].Value);
                    string receive = Convert.ToString(Convert.ToDouble(row.Cells[5].Value.ToString()) - Convert.ToDouble(row.Cells[7].Value.ToString()));
                    cmdd.Parameters.AddWithValue("@receive_amount", receive);
                    cmdd.Parameters.AddWithValue("@total_receive", receive);
                    cmdd.ExecuteNonQuery();

                    //update into id
                    int          df       = get_id.pay_re + 1;
                    OleDbCommand command1 = new OleDbCommand(@"UPDATE get_id
                                                    SET pay_re = @City_Name
                                                       
                                                    WHERE ID = " + bla + "", connection);

                    command1.Parameters.AddWithValue("@City_Name", df);

                    command1.ExecuteNonQuery();
                }

                catch (Exception p)
                {
                    MessageBox.Show("" + p);
                }
                finally
                {
                    connection.Close();

                    payment_re ts = new payment_re();
                    ts.ShowDialog();
                }
            }
        }