Beispiel #1
0
        private void buttonSearch_Click(object sender, EventArgs e)
        {
            int num;

            this.dataGridView1.Rows.Clear();
            string str   = this.dateTimePicker1.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
            string str2  = this.dateTimePicker2.Value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture);
            string query = "Select memo_no,customer_id,DATE_FORMAT(date, '%d-%M-%Y') AS date1 from firoz_center.tbl_sales_motorcycle order by date";

            List <string>[] listArray = new List <string> [3];

            int[] service_no = { 0, 30, 120, 240, 365, 480, 600, 720 };

            for (num = 0; num < 3; num++)
            {
                listArray[num] = new List <string>();
            }
            listArray = this.dbc.Select(3L, query);

            for (num = 0; num < listArray[0].Count; num++)
            {
                string memo_no     = listArray[0].ElementAt <string>(num);
                string customer_id = listArray[1].ElementAt <string>(num);
                string date        = listArray[2].ElementAt <string>(num);

                string sql_name    = "select name from firoz_center.tbl_customer where customer_id='" + customer_id + "'";
                string name        = this.dbc.SelectSingle(sql_name);
                string sql_contact = "select contact from firoz_center.tbl_customer where customer_id='" + customer_id + "'";
                string contact     = this.dbc.SelectSingle(sql_contact);

                DateTime dt      = DateTime.Parse(date);
                DateTime dtt     = DateTime.Parse(date);
                DateTime sale_dt = DateTime.Parse(date);

                DateTime start_dt = DateTime.Parse(str);
                DateTime end_dt   = DateTime.Parse(str2);

                for (int i = 1; i <= 7; i++)
                {
                    dt = dtt.AddDays(service_no[i]);

                    if (dt >= start_dt && dt <= end_dt)
                    {
                        long count = dbc.Count("SELECT * FROM firoz_center.tbl_servicing t where memo_no='" + memo_no + "' and service_no='" + i + "';");

                        if (count == -1)
                        {
                            this.dataGridView1.Rows.Add(new object[] { date, memo_no, name, contact, i });
                        }
                    }
                }
            }
        }
Beispiel #2
0
        public void load_order_id()
        {
            string query = "SELECT order_id FROM firoz_center.tbl_purchase_order t where status='1';";

            if (dbc.Count(query) == -1L)
            {
                MessageBox.Show("Open a new order");
                base.Dispose();
            }
            else
            {
                this.textBoxInvoiceNo.Text = dbc.SelectSingle(query);
                this.load_order();
            }
        }
Beispiel #3
0
        public EmployeeAdvancePayment()
        {
            this.InitializeComponent();
            this.load_employee();
            string query = "SELECT max(advancepay_id) FROM firoz_center.tbl_advance_pay t;";

            if (dbc.Count(query) == -1L)
            {
                this.textBoxMemoNo.Text = "4000001";
            }
            else
            {
                string str2 = "SELECT max(advancepay_id) FROM firoz_center.tbl_advance_pay t;";
                this.textBoxMemoNo.Text = (long.Parse(dbc.SelectSingle(str2)) + 1L).ToString();
            }
        }
Beispiel #4
0
        private void save_transcation()
        {
            string str13;
            string text = this.textBoxGroup.Text;
            string str2 = "Honda";
            string str3 = this.textBoxModel.Text;
            string str4 = this.textBoxPartsNo.Text;
            string str5 = this.textBoxDescription.Text;
            string str6 = this.textBoxPurchasePrice.Text;
            string str7 = this.textBoxR.Text;

            DateTime now = new DateTime();

            now = DateTime.Now;
            //string str8 = string.Format("{0:yyyy-MM-dd}", now);
            string str8 = "2016-01-01";

            string    str9    = this.textBoxW.Text;
            string    str10   = this.textBoxD.Text;
            DBConnect connect = new DBConnect();
            string    query   = "SELECT partsId FROM firoz_center.tbl_parts_info where partsNo='" + this.textBoxPartsNo.Text + "';";
            string    str12   = connect.SelectSingle(query);

            if (connect.Count(query) == -1L)
            {
                str13 = "insert into firoz_center.tbl_parts_info (`brand`,`model`,`partsNo`,`description`,`purchase_price`,`sale_price`,`date`,`wholesale_price`,`distributor_price`,`group`) values ('" + str2 + "','" + str3 + "','" + str4 + "','" + str5 + "','" + str6 + "','" + str7 + "','" + str8 + "','" + str9 + "','" + str10 + "','" + text + "');";
                connect.Insert(str13);
            }
            else
            {
                str13 = "insert into firoz_center.tbl_parts_info (`partsid`,`brand`,`model`,`partsNo`,`description`,`purchase_price`,`sale_price`,`date`,`wholesale_price`,`distributor_price`,`group`) values ('" + str12 + "','" + str2 + "','" + str3 + "','" + str4 + "','" + str5 + "','" + str6 + "','" + str7 + "','" + str8 + "','" + str9 + "','" + str10 + "','" + text + "');";
                connect.Insert(str13);
            }
            this.textBoxGroup.Text         = "";
            this.textBoxModel.Text         = "";
            this.textBoxPartsNo.Text       = "";
            this.textBoxPurchasePrice.Text = "";
            this.textBoxSalesPrice.Text    = "";
            this.textBoxDescription.Text   = "";
            this.textBoxWholeSAle.Text     = "";
            this.textBoxDealer.Text        = "";
            this.textBoxD.Text             = "";
            this.textBoxR.Text             = "";
            this.textBoxW.Text             = "";
            MessageBox.Show("Data Inserted");
        }