public void loadSubCategories(String categ)
        {
            MySqlDataReader rd;
            String          serverPassqord = new implementActions().serverPassword;
            String          serverName     = new implementActions().serverName;
            String          serveruser     = new implementActions().serveruser;

            MySqlConnection conn;
            string          connetionString = null;

            connetionString = "server='" + serverName + "';database=ledger_horanadb;uid='" + serveruser + "';pwd='" + serverPassqord + "';";
            conn            = new MySqlConnection(connetionString);
            String query;


            query = "SELECT * FROM ledger_horanadb.subcategories where cname = '" + categ + "'";
            try
            {
                conn.Open();
                MySqlCommand command = new MySqlCommand(query, conn);
                rd = command.ExecuteReader();
                comboBox2.Items.Clear();
                while (rd.Read())
                {
                    comboBox2.Items.Add(rd.GetString("sname").ToUpper());

                    //Console.WriteLine(rd.GetString("sname"));
                }
                comboBox2.SelectedIndex = 0;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public void loadCategories()
        {
            MySqlDataReader rd;
            String          serverPassqord = new implementActions().serverPassword;

            MySqlConnection conn;
            string          connetionString = null;

            connetionString = "server=localhost;database=ledger_horanadb;uid=root;pwd='" + serverPassqord + "';";
            conn            = new MySqlConnection(connetionString);
            String query;


            query = "SELECT * FROM ledger_horanadb.categories";
            try
            {
                conn.Open();
                MySqlCommand command = new MySqlCommand(query, conn);
                rd = command.ExecuteReader();
                while (rd.Read())
                {
                    comboBox1.Items.Add(rd.GetString("cname").ToUpper());

                    Console.WriteLine(rd.GetString("cname"));
                }
                comboBox1.SelectedIndex = 0;
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
Exemplo n.º 3
0
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            bool status = new implementActions().addCategory(txtCategoryName.Text.ToString());

            if (status == true)
            {
                MessageBox.Show("Added Succcesfully");
            }
            else
            {
                MessageBox.Show("fail");
            }
        }
        private void bunifuThinButton21_Click(object sender, EventArgs e)
        {
            bool status = new implementActions().addSubCategory(comboBox1.SelectedItem.ToString(), txtCategoryName.Text.ToString());

            if (status == true)
            {
                MessageBox.Show("successfully added");
            }
            else
            {
                MessageBox.Show("failed");
            }
        }
Exemplo n.º 5
0
        private void txtSubmit_Click(object sender, EventArgs e)
        {
            if (txtBmn.Text == "" && txtInvoiceNo.Text == "" && txtInvoiceValue.Text == "" && txtPaidAmount.Text == "")
            {
                MessageBox.Show("Please fill all fields");
            }
            else
            {
                String category, subCategory, invoiceNo, cOrCheque, user;
                double invoiceValue, paidValue, igesheOld, igesheNew;
                int    bnn;
                String invoiceDate;

                category    = comboBox1.SelectedItem.ToString();
                subCategory = comboBox2.SelectedItem.ToString();

                invoiceNo = txtInvoiceNo.Text.ToString();
                cOrCheque = bunifuDropdown3.selectedValue.ToString();
                user      = "******";

                invoiceValue = double.Parse(txtInvoiceValue.Text);
                paidValue    = double.Parse(txtPaidAmount.Text);
                invoiceDate  = dateTimePicker1.Value.ToString();
                var d = dateTimePicker1.Value.Date;

                CultureInfo cul     = CultureInfo.CurrentCulture;
                int         weekNum = cul.Calendar.GetWeekOfYear(
                    d,
                    CalendarWeekRule.FirstDay,
                    DayOfWeek.Monday);

                int dateNum = cul.Calendar.GetDayOfYear(d);
                bnn = int.Parse(txtBmn.Text);
                String ret = new implementActions().getCreditFinal();
                igesheOld = double.Parse(ret);
                //Console.WriteLine(ret);



                igesheNew = igesheOld + invoiceValue;
                bool status = new implementActions().addCredit(category, subCategory, invoiceNo, invoiceDate, invoiceValue, paidValue, cOrCheque, bnn, user, igesheNew, weekNum.ToString(), dateNum.ToString());
                if (status == true)
                {
                    MessageBox.Show("success");
                }
                else
                {
                    MessageBox.Show("failes");
                }
            }
        }
Exemplo n.º 6
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            //new implementActions().updateDebitTotal(100);
            bool status = new implementActions().Login(txtUserName.Text.ToString(), txtPassword.Text.ToString());

            txtUserName.Text = "";
            txtPassword.Text = "";

            if (status == true)
            {
                this.Hide();
            }

            //new implementActions().checkDuePayements();
        }
Exemplo n.º 7
0
        public void viewDailyTotal()
        {
            var d = DateTime.Now;

            CultureInfo cul            = CultureInfo.CurrentCulture;
            String      serverName     = new implementActions().serverName;
            String      serveruser     = new implementActions().serveruser;
            String      serverPassword = new implementActions().serverPassword;

            int             dateNum = cul.Calendar.GetDayOfYear(d);
            MySqlDataReader rd;
            string          sMonth = DateTime.Now.ToString("MM");
            MySqlConnection conn;
            string          connetionString = null;

            connetionString = "server='" + serverName + "';database=ledger_horanadb;uid='" + serveruser + "';pwd='" + serverPassword + "';";
            conn            = new MySqlConnection(connetionString);
            String query;


            query = "select * from dailyTotal where dateNo='" + dateNum + "'";

            try
            {
                conn.Open();
                MySqlCommand command = new MySqlCommand(query, conn);
                rd = command.ExecuteReader();
                while (rd.Read())
                {
                    this.dt = rd["debitTotal"].ToString();
                    this.ct = rd["creditTotal"].ToString();
                    frmMain.ActiveForm.Controls["lblDebit"].Text = dt;
                    Console.WriteLine(dt);
                    Console.WriteLine(ct);
                }
                conn.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public void deleteInvoice(String invoiceNo)
        {
            MySqlDataReader rd;
            String          serverName     = new implementActions().serverName;
            String          serveruser     = new implementActions().serveruser;
            String          serverPassword = new implementActions().serverPassword;
            MySqlConnection conn;
            string          connetionString = null;

            connetionString = "server='" + serverName + "';database=ledger_horanadb;uid='" + serveruser + "';pwd='" + serverPassword + "';";
            conn            = new MySqlConnection(connetionString);
            conn.Open();
            try
            {
                MySqlCommand deletecmd = new MySqlCommand("delete from ledgerdebit where invoice_no = '" + invoiceNo + "'", conn);
                deletecmd.ExecuteNonQuery();
                conn.Close();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
        public void getInvoice(String invoiceNo)
        {
            MySqlDataReader rd;
            MySqlConnection conn;
            string          connetionString = null;
            String          serverName      = new implementActions().serverName;
            String          serveruser      = new implementActions().serveruser;
            String          serverPassword  = new implementActions().serverPassword;

            connetionString = "server='" + serverName + "';database=ledger_horanadb;uid='" + serveruser + "';pwd='" + serverPassword + "';";
            conn            = new MySqlConnection(connetionString);
            String query;


            query = "select * from ledgerdebit where invoice_no='" + invoiceNo + "'";


            try
            {
                conn.Open();
                MySqlCommand command = new MySqlCommand(query, conn);
                rd = command.ExecuteReader();
                while (rd.Read())
                {
                    txtBmn.Text = rd["bnn"].ToString();
                    bunifuMetroTextbox1.Text = rd["invoice_no"].ToString();
                    txtInvoiceValue.Text     = rd["invoice_value"].ToString();
                    txtPaidAmount.Text       = rd["paid_value"].ToString();
                }
                conn.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
        public void checkDueChequesDaily()
        {
            dataGridView1.Columns.Clear();
            dataGridView1.Rows.Clear();
            String serverPassword = new implementActions().serverPassword;
            String serverName     = new implementActions().serverName;
            String serveruser     = new implementActions().serveruser;
            var    d = dateTimePicker1.Value;

            CultureInfo cul     = CultureInfo.CurrentCulture;
            int         weekNum = cul.Calendar.GetWeekOfYear(
                d,
                CalendarWeekRule.FirstDay,
                DayOfWeek.Monday);
            int              dateNum = cul.Calendar.GetDayOfYear(d);
            MySqlDataReader  rd;
            MySqlConnection  conn;
            MySqlDataAdapter adapter;
            string           connetionString = null;

            connetionString = "server='" + serverName + "';database=ledger_horanadb;uid='" + serveruser + "';pwd=" + serverPassword + ";;";
            conn            = new MySqlConnection(connetionString);
            String query;
            int    count = 0;
            String checkNo, checkVal, bankName, invoiceNo, cod, credited, debited;

            Console.WriteLine("queryta kalin");
            query = "select * from duecheques where dueDayNo = '" + dateNum + "' ";
            Console.WriteLine("queryta passe");
            try
            {
                Console.WriteLine("querya thule");

                conn.Open();
                MySqlCommand command = new MySqlCommand(query, conn);
                rd = command.ExecuteReader();
                dataGridView1.Columns.Add("asd", "Cheque No");

                dataGridView1.Columns.Add("asd", "Cheque Amount");

                dataGridView1.Columns.Add("asd", "Bank");
                dataGridView1.Columns.Add("asd", "Invoice No");
                dataGridView1.Columns.Add("asd", "Credit or Debit");
                dataGridView1.Columns[0].Width = 160;
                dataGridView1.Columns[1].Width = 160;
                dataGridView1.Columns[2].Width = 160;
                dataGridView1.Columns[3].Width = 160;
                dataGridView1.Columns[4].Width = 160;

                while (rd.Read())
                {
                    Console.WriteLine("read eka athuke");

                    checkNo   = rd["chequeNo"].ToString();
                    checkVal  = rd["chequeValue"].ToString();
                    bankName  = rd["bankName"].ToString();
                    invoiceNo = rd["invoiceId"].ToString();
                    credited  = rd["credited"].ToString();
                    debited   = rd["debited"].ToString();


                    if (debited == "")
                    {
                        cod = "D";
                    }
                    else
                    {
                        cod = "C";
                    }
                    count = count + 1;
                    DataTable dt = new DataTable();
                    dt = (DataTable)dataGridView1.DataSource;

                    string[] row = { checkNo, checkVal, bankName, invoiceNo, cod };
                    dataGridView1.Rows.Add(row);
                }
                conn.Close();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }