Esempio n. 1
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            try
            {
                if (company_nam_cmbx.Text.Trim() != "")
                {
                    sels_q_grid.Columns.Clear();
                    company_nam_cmbx.ValueMember = "com_id";
                    SqlCommand     select_cmd = con.CreateCommand();
                    SqlDataAdapter adap       = new SqlDataAdapter();
                    DataTable      dtb        = new DataTable();
                    adap.SelectCommand     = select_cmd;
                    select_cmd.CommandText = "SELECT expire_id as 'كود العملية',expire_item_id as 'ID',ItemName as 'الصنف',DATEDIFF(dd, getdate()," +
                                             "expire_date)/30 as 'المتبقى بالشهر تقريبا',DATEDIFF(dd, getdate(),expire_date) as 'المتبقى باليوم'," +
                                             "expire_date as 'تاريخ الانتهاء' ,com_name as 'الشركة المنتجة'" +
                                             "  FROM expire_item_table join (Items join (ItemDetails join company_table on ItemDetails.item_comp_id=company_table.com_id) on Items.ItemId=ItemDetails.ItemId) on expire_item_table.expire_item_id=Items.ItemId " + " where com_id=" +
                                             company_nam_cmbx.SelectedValue.ToString() + " and DATEDIFF(dd, getdate(),expire_date)<=" + day_num.Value.ToString() +
                                             " and ex_it_date_flag <>29";
                    wait_frm w_frm = new wait_frm();
                    w_frm.Show();
                    adap.Fill(dtb);

                    sels_q_grid.DataSource = dtb;
                    w_frm.Close();
                }
            }
            catch (Exception dd)
            {
                MessageBox.Show(dd.Message);
            }
        }
Esempio n. 2
0
        private void item_expire_finish_btn_Click(object sender, EventArgs e)
        {
            try
            {
                wait_frm w = new wait_frm();
                w.Show();
                sels_q_grid.Columns.Clear();

                string messag = "";
                int    i      = 0;
                if (sels_q_grid.Columns.Count <= 0)
                {
                    sels_q_grid.Columns.Add("0", "كودالعملية");
                    sels_q_grid.Columns.Add("1", "ID");
                    sels_q_grid.Columns.Add("2", "اسم الصنف");
                    sels_q_grid.Columns.Add("3", "المدة المتبقية باليوم");

                    sels_q_grid.Columns.Add("5", "تاريخ الانتهاء");
                    sels_q_grid.Columns.Add("4", "المتبقى");
                    sels_q_grid.Columns.Add("6", "الشركة المنتجة");
                }
                if (meth.expire_date_less_what_day(0).Rows.Count > 0)
                {
                    for (int row = 0; row < meth.expire_date_less_what_day(0).Rows.Count; row++)
                    {
                        if (Convert.ToInt32(meth.expire_date_less_what_day(0).Rows[row][0].ToString()) <=

                            1)
                        {
                            sels_q_grid.DataSource = null;
                            sels_q_grid.Rows.Add(1);


                            sels_q_grid.Rows[i].Cells[0].Value = meth.expire_date_less_what_day(0).Rows[row][4].ToString();

                            sels_q_grid.Rows[i].Cells[1].Value = meth.expire_date_less_what_day(0).Rows[row][2].ToString();

                            sels_q_grid.Rows[i].Cells[2].Value = meth.expire_date_less_what_day(0).Rows[row][1].ToString();

                            sels_q_grid.Rows[i].Cells[3].Value = meth.expire_date_less_what_day(0).Rows[row][0].ToString();

                            sels_q_grid.Rows[i].Cells[5].Value = DateTime.Parse(meth.expire_date_less_what_day(0).Rows[row][3].ToString()).ToShortDateString();

                            sels_q_grid.Rows[i].Cells[4].Value =
                                meth.select_sanf_data_store(meth.expire_date_less_what_day(0).Rows[row][2].ToString());

                            sels_q_grid.Rows[i].Cells[6].Value = meth.expire_date_less_what_day(0).Rows[row][5].ToString();
                            i = i + 1;
                        }
                    }
                }

                w.Close();
            }
            catch (Exception dd)
            {
                MessageBox.Show(dd.Message + " خطا فى ادخال البيانات");
            }
        }