Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (comboBox1.SelectedIndex == -1 && comboBox2.SelectedIndex == -1)
                {
                    msg.Alert("يرجى تحديد حقل الترفيع من و الى", Form_Alert.enumType.Error);
                }
                else
                {
                    con.Open();
                    SqlCommand cmd = con.CreateCommand();
                    cmd.CommandType = CommandType.Text;
                    cmd.CommandText = "update student set  IDClass=@IDClass2  ,Class=@Class where IDClass=@IDClass and YaerSemesterID=@YaerSemesterID";
                    cmd.Parameters.AddWithValue("@IDClass", comboBox1.SelectedValue);
                    cmd.Parameters.AddWithValue("@IDClass2", comboBox2.SelectedValue);
                    cmd.Parameters.AddWithValue("@Class", comboBox2.Text);
                    cmd.Parameters.AddWithValue("@YaerSemesterID", Program.ID_Year);
                    cmd.ExecuteNonQuery();

                    msg.Alert("تم الترفيع بنجاح", Form_Alert.enumType.Success);
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                con.Close();
            }
        }
        private void MaxOrder()
        {
            try
            {
                con.Open();
                SqlCommand cmd21 = new SqlCommand("select isnull((Max(ID)+1),1) as max from " + D.DataPharmacy + "OrderMaterials where myear=@myear", con);
                cmd21.Parameters.AddWithValue("@myear", textBox_Year.Text);
                SqlDataReader dr;
                dr = cmd21.ExecuteReader();
                if (dr.Read())
                {
                    textBox_Invoice__Number.Text = dr["max"].ToString();
                }

                textBox_Invoice__Number.Focus();
            }
            catch (Exception ex)
            {
                msg.Alert("حدث خلل بسيط" + ex.Message, Form_Alert.enumType.Error);
            }
            finally
            {
                con.Close();
            }
        }
Example #3
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.Rows.Count > 0)
                {
                    R_Barcode       = dataGridView1.CurrentRow.Cells[clmR_Barcode.Name].Value.ToString();
                    R_ItemName      = dataGridView1.CurrentRow.Cells[clmR_ItemName.Name].Value.ToString();
                    R_Qty           = dataGridView1.CurrentRow.Cells[clm_R_Qty.Name].Value.ToString();
                    R_Tax           = dataGridView1.CurrentRow.Cells[clmR_Tax.Name].Value.ToString();
                    R_PriceSales    = dataGridView1.CurrentRow.Cells[clmR_PriceSales.Name].Value.ToString();
                    R_DateItem      = dataGridView1.CurrentRow.Cells[clmR_DateItem.Name].Value.ToString();
                    R_PriceParchase = dataGridView1.CurrentRow.Cells[clm_R_PriceParchase.Name].Value.ToString();
                    if (SCR_POS == true)
                    {
                        d2 = Convert.ToDateTime(convertDate.TODate(R_DateItem));
                        TimeSpan t = d1 - d2;
                        NrOfDays = t.TotalDays;
                        if (NrOfDays > 0)
                        {
                            msg.Alert("عذرا المادة منتهية الصلاحية ، لا يمكنك بيع مادة منتهية الصلاحية", Form_Alert.enumType.Warning);
                            return;
                        }
                        else
                        {
                            POS.pOS.dataGridView1.Rows.Add(POS.pOS.dataGridView1.Rows.Count + 1, R_Barcode, R_ItemName, 1, R_PriceSales, string.Empty, string.Empty, R_Tax, string.Empty, R_DateItem, R_PriceParchase);
                            POS.pOS.ALLEventSum();
                            POS.pOS.TotalAmount();
                            if (POS.pOS.ItemMax(R_Barcode) >= Convert.ToDouble(R_Qty))
                            {
                                msg.Alert("تنبيه : المادة وصلت حد الطلب" + " | الكمية المتبقية " + R_Qty, Form_Alert.enumType.Info);
                            }
                            if (NrOfDays > -31)
                            {
                                msg.Alert("تنبيه : المادة بالقرب من إنتهاء الصلاحية " + " | صالحه لتاريخ " + R_DateItem, Form_Alert.enumType.Info);
                            }
                        }
                        SCR_POS = false;
                    }
                }

                this.Close();
            }
            catch (Exception ee)
            {
                MessageBox.Show("يرجى تصوير الخطأ ومراجعة مدير النظام ، شكرا" + ee.Message, "ERROR 1004 Grid_QauntityPOS", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void PrintAllPaid_Load(object sender, EventArgs e)
        {
            try
            {
                SqlCommand cmd = con.CreateCommand();

                con.Open();
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.CommandText = "SP_PrintAllPaid";
                cmd.Parameters.AddWithValue("@YaerSemesterID", Program.ID_Year);
                cmd.ExecuteNonQuery();
                DataTable      dt = new DataTable();
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(dt);
                dataGridView1.DataSource = dt;
            }
            catch (Exception ex)
            {
                msg.Alert("حدث خطأ بسيط يرجى إعادة المحاولة" + ex.Message, Form_Alert.enumType.Error);
            }
            finally
            {
                con.Close();
            }
        }
Example #5
0
        private void btn_cancel_Click(object sender, EventArgs e)
        {
            try
            {
                btn_add.Visible    = true;
                btn_delete.Visible = false;
                btn_edit.Visible   = false;
                text_ID.Text       = string.Empty;
                text_name.Text     = string.Empty;
                btn_cancel.Visible = false;


                con.Open();
                SqlCommand    cmd2 = new SqlCommand("select ISNULL (MAX (ID_Supplier)+1,1) from add_Supplier", con);
                SqlDataReader Ra   = cmd2.ExecuteReader();

                Ra.Read();
                text_ID.Text = Ra[0].ToString();
                Ra.Close();
            }
            catch (Exception ee)
            {
                msg.Alert("يرجى تصوير الخطأ ومراجعة المبرمج ، شكرا" + ee.Message, Form_Alert.enumType.Error);
            }
            finally
            {
                con.Close();
            }
        }
 private void button2_Click(object sender, EventArgs e)
 {
     try
     {
         con.Open();
         SqlCommand cmd = con.CreateCommand();
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.CommandText = "SP_PrintDatePaid";
         cmd.Parameters.AddWithValue("@Date1", dateTimePicker1.Value.ToString("MM-dd-yyyy"));
         cmd.Parameters.AddWithValue("@Date2", dateTimePicker2.Value.ToString("MM-dd-yyyy"));
         cmd.Parameters.AddWithValue("@YaerSemesterID", Program.ID_Year);
         cmd.ExecuteNonQuery();
         DataTable      dt = new DataTable();
         SqlDataAdapter da = new SqlDataAdapter(cmd);
         da.Fill(dt);
         dataGridView2.DataSource = dt;
         if (dt.Rows.Count <= 0)
         {
             msg.Alert("لا يوجد بيانات خلال هذه الفترة", Form_Alert.enumType.Info);
         }
     }
     catch
     {
     }
     finally
     {
         con.Close();
     }
 }
Example #7
0
 private void FrmBillReturn_Load(object sender, EventArgs e)
 {
     try
     {
         con.Open();
         var dataTable = new DataTable();
         using (SqlCommand Cmd = con.CreateCommand())
         {
             Cmd.CommandType = CommandType.Text;
             Cmd.CommandText = "select distinct ID,FORMAT (DateInvoice, 'dd-MM-yyyy ') as DateInvoice ,Time,TotalAmount_Invoice from " + D.DataPharmacy + "Invoice_Sales where Bill_Suspension = 1 and ID_User=@ID_User and Myear=@Myear order by ID";
             Cmd.Parameters.AddWithValue("@ID_User", Program.user_ID);
             Cmd.Parameters.AddWithValue("@Myear", POS.pOS.MYear);
             SqlDataAdapter da = new SqlDataAdapter(Cmd);
             da.Fill(dataTable);
         }
         dataGridView1.DataSource = dataTable;
     }
     catch
     {
         msg.Alert("Error 1 FrmBillReturn ", Form_Alert.enumType.Error);
     }
     finally
     {
         con.Close();
     }
 }
        private void textBox_Item_No_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (textBox_Item_No.Text != string.Empty)
                    {
                        try
                        {
                            SqlCommand cmd = new SqlCommand("select Code,ItemName from " + D.DataPharmacy + "Drugs where Code=@Code", con);
                            cmd.Parameters.Add(new SqlParameter("@Code", textBox_Item_No.Text));
                            con.Open();
                            SqlDataReader Ra = cmd.ExecuteReader();

                            if (Ra.Read())
                            {
                                textBox_Item_Name.Text = Ra["ItemName"].ToString();
                            }
                            else
                            {
                                msg.Alert("لا يوجد مادة بهذا الرمز", Form_Alert.enumType.Warning);
                                textBox_Item_No.Text   = string.Empty;
                                textBox_Item_Name.Text = string.Empty;
                                textBox_Item_No.Focus();
                            }
                            Ra.Close();
                        }
                        catch (Exception ex)
                        {
                            msg.Alert("حدث خلل بسيط" + ex.Message, Form_Alert.enumType.Error);
                        }
                        finally
                        {
                            con.Close();
                        }
                    }
                }
            }
            catch (Exception ee)
            {
                msg.Alert("حدث خلل بسيط" + ee.Message, Form_Alert.enumType.Error);
            }
        }
Example #9
0
 private void dataGridView1_Click(object sender, EventArgs e)
 {
     try
     {
         if (dataGridView1.Rows.Count > 0)
         {
             R_Barcode       = dataGridView1.CurrentRow.Cells[Clm_R_Barcode.Name].Value.ToString();
             R_ItemName      = dataGridView1.CurrentRow.Cells[Clm_R_ItemName.Name].Value.ToString();
             R_Qty           = dataGridView1.CurrentRow.Cells[Clm_R_Qty.Name].Value.ToString();
             R_Tax           = dataGridView1.CurrentRow.Cells[Clm_R_Tax.Name].Value.ToString();
             R_PriceSales    = dataGridView1.CurrentRow.Cells[Clm_R_PriceSales.Name].Value.ToString();
             R_DateItem      = dataGridView1.CurrentRow.Cells[Clm_R_DateItem.Name].Value.ToString();
             R_PriceParchase = dataGridView1.CurrentRow.Cells[clm_R_PriceParchase.Name].Value.ToString();
             d2 = Convert.ToDateTime(convertDate.TODate(R_DateItem));
             TimeSpan t = d1 - d2;
             NrOfDays = t.TotalDays;
             if (NrOfDays > 0)
             {
                 msg.Alert("عذرا المادة منتهية الصلاحية ، لا يمكنك بيع مادة منتهية الصلاحية", Form_Alert.enumType.Warning);
                 return;
             }
             else
             {
                 POS.pOS.dataGridView1.Rows.Add(POS.pOS.dataGridView1.Rows.Count + 1, R_Barcode, R_ItemName, 1, R_PriceSales, string.Empty, string.Empty, R_Tax, string.Empty, R_DateItem, R_PriceParchase);
                 if (POS.pOS.ItemMax(R_Barcode) >= Convert.ToDouble(R_Qty))
                 {
                     msg.Alert("تنبيه : المادة وصلت حد الطلب" + " | الكمية المتبقية " + R_Qty, Form_Alert.enumType.Info);
                 }
                 if (NrOfDays > -31)
                 {
                     msg.Alert("تنبيه : المادة بالقرب من إنتهاء الصلاحية " + " | صالحه لتاريخ " + R_DateItem, Form_Alert.enumType.Info);
                 }
             }
         }
         this.Close();
     }
     catch
     {
         msg.Alert("يرجى تصوير الخطأ ومراجعة المبرمج ، شكرا" + "ERORR count2 1", Form_Alert.enumType.Error);
     }
 }
Example #10
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "insert into Tbl_Year values (@YearName)";
                cmd.Parameters.AddWithValue("@YearName", dateTimePicker2.Value.ToString("yyyy") + "-" + dateTimePicker1.Value.ToString("yyyy"));
                cmd.ExecuteNonQuery();

                msg.Alert("تم إضافة عام جديد", Form_Alert.enumType.Success);
            }
            catch (Exception ex)
            {
                msg.Alert("لم تتم عملية الحفظ", Form_Alert.enumType.Error);
            }
            finally
            {
                con.Close();
                Load1();
            }
        }
Example #11
0
 private void SelectPet_Load(object sender, EventArgs e)
 {
     try
     {
         con.Open();
         var dataTable = new DataTable();
         using (SqlCommand Cmd = con.CreateCommand())
         {
             Cmd.CommandType = CommandType.Text;
             Cmd.CommandText = "select number_Measures,Name_Measures,presnt_Measures,Name_pat from Table_PAT order by Name_pat";
             SqlDataAdapter da = new SqlDataAdapter(Cmd);
             da.Fill(dataTable);
         }
         dataGridView1.DataSource = dataTable;
     }
     catch
     {
         msg.Alert("Error 1 SelectPet ", Form_Alert.enumType.Error);
     }
     finally
     {
         con.Close();
     }
 }
Example #12
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = "insert into YaerSemester values (@ID_Year,@ID_Semester)";
                cmd.Parameters.AddWithValue("@ID_Year", comboBox1.SelectedValue);
                cmd.Parameters.AddWithValue("@ID_Semester", comboBox2.SelectedValue);
                cmd.ExecuteNonQuery();

                msg.Alert("تم إضافة عام جديد", Form_Alert.enumType.Success);
            }
            catch (Exception ex)
            {
                msg.Alert("لم تتم عملية الحفظ", Form_Alert.enumType.Error);
            }
            finally
            {
                con.Close();
                Load1();
            }
        }
Example #13
0
        private void text_Barcode_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.Enter)
                {
                    if (text_Barcode.Text == string.Empty)
                    {
                        msg.Alert("يرجى تحديد الباركود", Form_Alert.enumType.Warning);
                        return;
                    }
                    try
                    {
                        SqlCommand cmd = new SqlCommand();
                        cmd = new SqlCommand("select Code,ItemName,SalePrice,Tax,CostPrice,Number_Retail from " + D.DataPharmacy + "Drugs where Code=@Code", con);
                        cmd.Parameters.Add(new SqlParameter("@Code", text_Barcode.Text));
                        con.Open();
                        cmd.ExecuteNonQuery();
                        SqlDataReader dr;

                        dr = cmd.ExecuteReader();
                        while (dr.Read())
                        {
                            dataGridView1.Rows.Add(dr["Code"].ToString(), dr["ItemName"].ToString(), "", 1, 0, dr["Number_Retail"].ToString(), dr["CostPrice"].ToString(), dr["SalePrice"].ToString(), dr["Tax"].ToString(), "");


                            // Total();
                            //SubTotal();
                        }
                        dr.Close();
                        dataGridView1.CurrentCell = dataGridView1.Rows[row].Cells[0];
                        dataGridView1.Focus();
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("يرجى تصوير الخطأ ومراجعة المبرمج ، شكرا" + ex.Message, "ERROR 1115 Orders_Parchases", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
            catch (Exception ee)
            {
                MessageBox.Show("يرجى تصوير الخطأ ومراجعة المبرمج ، شكرا" + ee.Message, "ERROR 1005 Orders_Parchases", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #14
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.Rows.Count > 0)
                {
                    Supplier_no   = dataGridView1.CurrentRow.Cells[clm_ID_Supplier.Name].Value.ToString();
                    Supplier_Name = dataGridView1.CurrentRow.Cells[clm_Name_Supplier.Name].Value.ToString();


                    if (SCR_Invoice_Parchase == true)
                    {
                        Invoice_Parchase.Inv_Parchase.textBox_Supplier_No.Text   = Supplier_no;
                        Invoice_Parchase.Inv_Parchase.textBox_Supplier_Name.Text = Supplier_Name;
                        SCR_Invoice_Parchase = false;
                    }
                    if (SCR_Entry_Bond == true)
                    {
                        Entry_Bond.entry_Bond.textBox_Supplier_No.Text   = Supplier_no;
                        Entry_Bond.entry_Bond.textBox_Supplier_Name.Text = Supplier_Name;
                        SCR_Entry_Bond = false;
                    }
                    if (SCR_Out_Bond == true)
                    {
                        Out_Bond.out_Bond.textBox_Supplier_No.Text   = Supplier_no;
                        Out_Bond.out_Bond.textBox_Supplier_Name.Text = Supplier_Name;
                        SCR_Out_Bond = false;
                    }
                    if (SCR_Destruction_Bond == true)
                    {
                        Destruction_Bond.destruction_Bond.textBox_Supplier_No.Text   = Supplier_no;
                        Destruction_Bond.destruction_Bond.textBox_Supplier_Name.Text = Supplier_Name;
                        SCR_Destruction_Bond = false;
                    }
                }
                this.Close();
            }
            catch (Exception ex)
            {
                msg.Alert(ex.Message, Form_Alert.enumType.Error);
            }
        }
Example #15
0
 private void MaxOrder()
 {
     try
     {
         con.Open();
         SqlCommand    cmd21 = new SqlCommand("select isnull((Max(ID)+1),1) as max from " + D.DataPharmacy + "PRS ", con);
         SqlDataReader dr;
         dr = cmd21.ExecuteReader();
         if (dr.Read())
         {
             ID = dr["max"].ToString();
         }
     }
     catch (Exception ex)
     {
         msg.Alert("حدث خلل بسيط" + ex.Message, Form_Alert.enumType.Error);
     }
     finally
     {
         con.Close();
     }
 }
Example #16
0
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                if (text_IDNumber.Text == string.Empty)
                {
                    msg.Alert("يرجى ادخال الرقم الوطني", Form_Alert.enumType.Warning);
                    return;
                }
                con.Open();
                SqlCommand cmd = new SqlCommand("select IDNumber from student where IDNumber=@IDNumber and YaerSemesterID=@YaerSemesterID", con);
                cmd.Parameters.AddWithValue("@IDNumber", text_IDNumber.Text);
                cmd.Parameters.AddWithValue("@YaerSemesterID", Program.ID_Year);
                SqlDataReader dr;
                dr = cmd.ExecuteReader();
                int count = 0;
                while (dr.Read())
                {
                    count += 1;
                }
                if (count == 1)
                {
                    MessageBox.Show("موجود مسبقا  " + text_IDNumber.Text.Trim() + " الطالب صاحب الرقم الوطني", "تكرار البيانات الطالب موجود !", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    con.Close();
                    return;
                }
                con.Close();
                if (text_Name.Text == "")
                {
                    msg.Alert("يرجى ادخال اسم الطالب", Form_Alert.enumType.Warning);
                    return;
                }

                if (combo_Class.SelectedIndex == -1)
                {
                    msg.Alert("يرجى ادخال الصف الدراسي", Form_Alert.enumType.Warning);
                    return;
                }
                if (combo_gender.SelectedIndex == -1)
                {
                    msg.Alert("يرجى ادخال الجنس", Form_Alert.enumType.Warning);
                    return;
                }
                if (textALLPaid1.Text == "")
                {
                    msg.Alert("يرجى ادخال الدفعة الأولى", Form_Alert.enumType.Warning);
                    return;
                }
                if (text_Paid2.Text == "")
                {
                    msg.Alert("يرجى ادخال الدفعة الثانية", Form_Alert.enumType.Warning);
                    return;
                }
                if (text_Paid3.Text == "")
                {
                    msg.Alert("يرجى ادخال الدفعة الثالثة", Form_Alert.enumType.Warning);
                    return;
                }
                if (text_Paid4.Text == "")
                {
                    msg.Alert("يرجى ادخال الدفعة الرابعة", Form_Alert.enumType.Warning);
                    return;
                }
                if (text_Paid5.Text == "")
                {
                    msg.Alert("يرجى ادخال الدفعة الخامسة", Form_Alert.enumType.Warning);
                    return;
                }
                if (text_Paid6.Text == "")
                {
                    msg.Alert("يرجى ادخال الدفعة السادسة", Form_Alert.enumType.Warning);
                    return;
                }
                if (text_Paid7.Text == "")
                {
                    msg.Alert("يرجى ادخال الدفعة السابعة", Form_Alert.enumType.Warning);
                    return;
                }
                if (text_Paid8.Text == "")
                {
                    msg.Alert("يرجى ادخال الدفعة الثامنة", Form_Alert.enumType.Warning);
                    return;
                }
                if (text_Paid9.Text == "")
                {
                    msg.Alert("يرجى ادخال الدفعة التاسعة", Form_Alert.enumType.Warning);
                    return;
                }
                else
                {
                    con.Open();


                    SqlCommand cmd1 = con.CreateCommand();
                    cmd1.CommandType = CommandType.Text;
                    cmd1.CommandText = "insert into student values (@ContractNumber,@name, @gender, @Date_Registration,@IDClass ,@class, @IDNumber, @Status, @PhoneDAD, @PhoneMAM, @Social, @Profession_DAD, @Profession_MAM, @Paid1, @ALLPaid1, @Paid_uniform, @Paid_Bock, @Paid_transport, @Paid2, @Paid3, @Paid4, @Paid5, @Paid6, @Paid7, @Paid8, @Paid9, @PaidAll, @PaidTotal, @Flag_uniform, @Flag_Bock, @Flag_transport, @Region, @place, @Street, @Note, @YaerSemesterID)  ";
                    cmd1.Parameters.AddWithValue("@ContractNumber", txtContractNumber.Text);
                    cmd1.Parameters.AddWithValue("@name", text_Name.Text);
                    cmd1.Parameters.AddWithValue("@gender", combo_gender.SelectedValue);
                    cmd1.Parameters.AddWithValue("@Date_Registration", date_registration.Value);
                    cmd1.Parameters.AddWithValue("@IDClass", combo_Class.SelectedValue);
                    cmd1.Parameters.AddWithValue("@class", combo_Class.Text);
                    cmd1.Parameters.AddWithValue("@IDNumber", text_IDNumber.Text);
                    cmd1.Parameters.AddWithValue("@Status", text_Status.Text);
                    cmd1.Parameters.AddWithValue("@PhoneDAD", text_PhoneDAD.Text);
                    cmd1.Parameters.AddWithValue("@PhoneMAM", text_PhoneMAM.Text);
                    if (radio_married_1.Checked == true)
                    {
                        cmd1.Parameters.AddWithValue("@Social", 1);
                    }
                    else if (radio_separate_2.Checked == true)
                    {
                        cmd1.Parameters.AddWithValue("@Social", 2);
                    }
                    else if (radio_orphan_3.Checked == true)
                    {
                        cmd1.Parameters.AddWithValue("@Social", 3);
                    }
                    else
                    {
                        cmd1.Parameters.AddWithValue("@Social", 0);
                    }
                    cmd1.Parameters.AddWithValue("@Profession_DAD", text_Profession_DAD.Text);
                    cmd1.Parameters.AddWithValue("@Profession_MAM", text_Profession_MAM.Text);
                    cmd1.Parameters.AddWithValue("@Paid1", text_Paid1.Text);
                    cmd1.Parameters.AddWithValue("@ALLPaid1", textALLPaid1.Text);
                    if (text_uniform.Text == string.Empty)
                    {
                        cmd1.Parameters.AddWithValue("@Paid_uniform", "0");
                    }
                    else
                    {
                        cmd1.Parameters.AddWithValue("@Paid_uniform", text_uniform.Text);
                    }

                    if (text_Bock.Text == string.Empty)
                    {
                        cmd1.Parameters.AddWithValue("@Paid_Bock", "0");
                    }
                    else
                    {
                        cmd1.Parameters.AddWithValue("@Paid_Bock", text_Bock.Text);
                    }


                    if (text_transport.Text == string.Empty)
                    {
                        cmd1.Parameters.AddWithValue("@Paid_transport", "0");
                    }
                    else
                    {
                        cmd1.Parameters.AddWithValue("@Paid_transport", text_transport.Text);
                    }

                    cmd1.Parameters.AddWithValue("@Paid2", text_Paid2.Text);
                    cmd1.Parameters.AddWithValue("@Paid3", text_Paid3.Text);
                    cmd1.Parameters.AddWithValue("@Paid4", text_Paid4.Text);
                    cmd1.Parameters.AddWithValue("@Paid5", text_Paid5.Text);
                    cmd1.Parameters.AddWithValue("@Paid6", text_Paid6.Text);
                    cmd1.Parameters.AddWithValue("@Paid7", text_Paid7.Text);
                    cmd1.Parameters.AddWithValue("@Paid8", text_Paid8.Text);
                    cmd1.Parameters.AddWithValue("@Paid9", text_Paid9.Text);
                    cmd1.Parameters.AddWithValue("@PaidAll", textPaidAll.Text);
                    cmd1.Parameters.AddWithValue("@PaidTotal", textPaidTotal.Text);
                    cmd1.Parameters.AddWithValue("@Flag_uniform", Flag_uniform);
                    cmd1.Parameters.AddWithValue("@Flag_Bock", Flag_Bock);
                    cmd1.Parameters.AddWithValue("@Flag_transport", Flag_transport);
                    cmd1.Parameters.AddWithValue("@Region", text_Region.Text);
                    cmd1.Parameters.AddWithValue("@place", text_place.Text);
                    cmd1.Parameters.AddWithValue("@Street", text_Street.Text);
                    cmd1.Parameters.AddWithValue("@Note", text_Note.Text);
                    cmd1.Parameters.AddWithValue("@YaerSemesterID", Program.ID_Year);
                    cmd1.ExecuteNonQuery();



                    msg.Alert("تم إضافة الطالب بنجاح", Form_Alert.enumType.Success);
                    ClearScreen();
                }
            }
            catch (Exception ex)
            {
                msg.Alert("لم تتم عملية الحفظ" + ex.Message, Form_Alert.enumType.Error);
            }
            finally
            {
                con.Close();
            }
        }
Example #17
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (text_ID.Text == string.Empty)
            {
                MessageBox.Show("يرجى عدم ترك حقل رقم بطاقة التأمين فارغ", "حقل إجباري", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (text_name.Text == string.Empty)
            {
                MessageBox.Show("يرجى عدم ترك حقل اسم الشركة فارغ", "حقل إجباري", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (textBox2.Text == string.Empty)
            {
                MessageBox.Show("يرجى عدم ترك حقل نسبة التحمل فارغة", "حقل إجباري", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (textBox1.Text == string.Empty)
            {
                MessageBox.Show("يرجى عدم ترك حقل اسم المستفيد فارغ", "حقل إجباري", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            try
            {
                con.Open();
                SqlCommand cmd21 = new SqlCommand("select Name_pat from Table_PAT where Name_pat=@Name_pat", con);
                cmd21.Parameters.Add(new SqlParameter("@Name_pat", textBox1.Text.Trim()));
                SqlDataReader dr;
                dr = cmd21.ExecuteReader();
                int count = 0;
                if (dr.Read())
                {
                    count += 1;
                }
                if (count == 1)
                {
                    MessageBox.Show("اسم المستفيد موجود مسبقا ، لا يمكن إضافة تأمين بنفس الأسم  " + textBox1.Text.Trim(), "تكرار البيانات اسم المستفيد موجود مسبقا !", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    return;
                }
            }
            catch
            {
                msg.Alert("ERROR M-3 Add_Mesures Search Name Pat", Form_Alert.enumType.Error);
            }
            finally
            {
                con.Close();
            }

            try
            {
                con.Open();
                SqlCommand cmd = con.CreateCommand();
                cmd.CommandType = CommandType.Text;
                cmd.CommandText = @"INSERT INTO Table_PAT
                         (ID_pat,number_Measures, Name_Measures, presnt_Measures, Name_pat)
                            VALUES((select isnull(max(ID_pat+1),1) as ID_pat from Table_PAT),@number_Measures, @Name_Measures, @presnt_Measures, @Name_pat)";

                cmd.Parameters.Add(new SqlParameter("@number_Measures", text_ID.Text.Trim()));
                cmd.Parameters.Add(new SqlParameter("@Name_Measures", text_name.Text.Trim()));
                cmd.Parameters.Add(new SqlParameter("@presnt_Measures", textBox2.Text.Trim()));
                cmd.Parameters.Add(new SqlParameter("@Name_pat", textBox1.Text.Trim()));
                cmd.ExecuteNonQuery();

                MessageBox.Show("تم إضافة التأمين بنجاح", "عملية صحيحة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearScreen();
            }
            catch
            {
                msg.Alert("ERROR M-2 Add_Mesures ADD Data", Form_Alert.enumType.Error);
            }
            finally
            {
                con.Close();
                LoadDataGrid();
            }
        }
Example #18
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBox_ID_Orders.Text == string.Empty)
                {
                    MessageBox.Show("لا يمكن تخزين الفاتورة ، لا يوجد رقم تأمين للمستفيد", "عملية خاطئة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (textBox_Name_MU.Text == string.Empty)
                {
                    MessageBox.Show("لا يمكن تخزين الفاتورة ، اسم شركة التأمين للمستفيد فارغ", "عملية خاطئة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                if (textBox_Name_Pat.Text == string.Empty)
                {
                    MessageBox.Show("لا يمكن تخزين الفاتورة ، اسم المستفيد فارغ", "عملية خاطئة", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                //----------------------------------------------تفقيد الفاتورة موجودة في الداتا--------------------------------------------------------------
                try
                {
                    con.Open();
                    SqlCommand cmd22 = new SqlCommand("select DISTINCT ID from " + D.DataPharmacy + "Invoice_Sales where ID=@ID and MYear=@MYear", con);
                    cmd22.Parameters.AddWithValue("@ID", POS.pOS.label5.Text);
                    cmd22.Parameters.AddWithValue("@MYear", POS.pOS.MYear);
                    SqlDataReader dr2;
                    dr2 = cmd22.ExecuteReader();

                    if (dr2.Read())
                    {
                        NewRow = 1;
                    }
                    else
                    {
                        NewRow = 0;
                    }
                }
                catch (Exception ex)
                {
                    msg.Alert("حدث خلل بسيط" + ex.Message, Form_Alert.enumType.Error);
                }
                finally
                {
                    con.Close();
                }
                //----------------------------------------------------------------------------------------------------------------
                if (NewRow == 0)
                {
                    if (POS.pOS.ADD_Row_Dic_Pet(textBox_ID_Orders.Text, textBox_Name_MU.Text, textBox_Name_Pat.Text, textBox_Total_Pat.Text, textBox_berfore_Total.Text, lbl_cc.Text) == true)
                    {
                        if (POS.pOS.ADD_Row_Trans_Dic_Pet(textBox_berfore_Total.Text, (Convert.ToDouble(textBox_berfore_Total.Text) - Convert.ToDouble(textBox_After_Total.Text)).ToString(), textBox_After_Total.Text) == true)
                        {
                            history.EventHistory(POS.pOS.label5.Text, history.ADD, history.NameADD, docType.Invoice_Sales, "فاتورة بيع صيدلية تأمين");
                            msg.Alert("تم تخزين الفاتورة  بنجاح بالرقم " + POS.pOS.label5.Text + "", Form_Alert.enumType.Success);
                            POS.pOS.ClearScreen();
                            POS.pOS.MaxInvoice();
                        }
                    }
                }
                else if (NewRow == 1)
                {
                    if (POS.pOS.Delete_Row() == true)
                    {
                        if (POS.pOS.Delete_Row_Trans() == true)
                        {
                            if (POS.pOS.ADD_Row_Dic_Pet(textBox_ID_Orders.Text, textBox_Name_MU.Text, textBox_Name_Pat.Text, textBox_Total_Pat.Text, textBox_berfore_Total.Text, lbl_cc.Text) == true)
                            {
                                if (POS.pOS.ADD_Row_Trans_Dic_Pet(textBox_berfore_Total.Text, (Convert.ToDouble(textBox_berfore_Total.Text) - Convert.ToDouble(textBox_After_Total.Text)).ToString(), textBox_After_Total.Text) == true)
                                {
                                    history.EventHistory(POS.pOS.label5.Text, history.Edit, history.NameEdit, docType.Invoice_Sales, "فاتورة بيع صيدلية تأمين");
                                    msg.Alert("تم تخزين الفاتورة  بنجاح بالرقم " + POS.pOS.label5.Text + "", Form_Alert.enumType.Success);
                                    POS.pOS.ClearScreen();
                                    POS.pOS.MaxInvoice();
                                }
                            }
                        }
                    }
                }
                this.Close();
            }
            catch (Exception ee)
            {
            }
        }
Example #19
0
        private void dataGridView1_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                if (dataGridView1.Rows.Count > 0)
                {
                    Item_No       = dataGridView1.CurrentRow.Cells[clm_Code.Name].Value.ToString();
                    Item_Name     = dataGridView1.CurrentRow.Cells[clm_ItemName.Name].Value.ToString();
                    Tax           = dataGridView1.CurrentRow.Cells[clm_Tax.Name].Value.ToString();
                    CostPrice     = dataGridView1.CurrentRow.Cells[clm_CostPrice.Name].Value.ToString();
                    AvgCost       = dataGridView1.CurrentRow.Cells[clm_AvgCost.Name].Value.ToString();
                    SalePrice     = dataGridView1.CurrentRow.Cells[clm_SalePrice.Name].Value.ToString();
                    Number_Retail = dataGridView1.CurrentRow.Cells[clm_Number_Retail.Name].Value.ToString();
                    Item_MAX      = dataGridView1.CurrentRow.Cells[clmItem_MAX.Name].Value.ToString();
                    if (SCR_Invoice_Parchase == true)
                    {
                        Invoice_Parchase.Inv_Parchase.textBox_Item_No.Text        = Item_No;
                        Invoice_Parchase.Inv_Parchase.textBox_Item_Name.Text      = Item_Name;
                        Invoice_Parchase.Inv_Parchase.textBox_Price_Parchase.Text = CostPrice;
                        Invoice_Parchase.Inv_Parchase.textBox3.Text = SalePrice;
                        Invoice_Parchase.Inv_Parchase.textBox4.Text = Tax;
                        Invoice_Parchase.Inv_Parchase.textBox_Qantity.Focus();
                        SCR_Invoice_Parchase = false;
                    }
                    if (SCR_Entry_Bond == true)
                    {
                        Entry_Bond.entry_Bond.textBox_Item_No.Text        = Item_No;
                        Entry_Bond.entry_Bond.textBox_Item_Name.Text      = Item_Name;
                        Entry_Bond.entry_Bond.textBox_Price_Parchase.Text = CostPrice;
                        Entry_Bond.entry_Bond.textBox3.Text = SalePrice;
                        Entry_Bond.entry_Bond.textBox4.Text = Tax;
                        Entry_Bond.entry_Bond.textBox_Qantity.Focus();
                        SCR_Entry_Bond = false;
                    }
                    if (SCR_Out_Bond == true)
                    {
                        Out_Bond.out_Bond.textBox_Item_No.Text        = Item_No;
                        Out_Bond.out_Bond.textBox_Item_Name.Text      = Item_Name;
                        Out_Bond.out_Bond.textBox_Price_Parchase.Text = CostPrice;
                        Out_Bond.out_Bond.textBox3.Text = SalePrice;
                        Out_Bond.out_Bond.textBox4.Text = Tax;
                        Out_Bond.out_Bond.textBox_Qantity.Focus();
                        SCR_Out_Bond = false;
                    }
                    if (SCR_Destruction_Bond == true)
                    {
                        Destruction_Bond.destruction_Bond.textBox_Item_No.Text        = Item_No;
                        Destruction_Bond.destruction_Bond.textBox_Item_Name.Text      = Item_Name;
                        Destruction_Bond.destruction_Bond.textBox_Price_Parchase.Text = CostPrice;
                        Destruction_Bond.destruction_Bond.textBox3.Text = SalePrice;
                        Destruction_Bond.destruction_Bond.textBox4.Text = Tax;
                        Destruction_Bond.destruction_Bond.textBox_Qantity.Focus();
                        SCR_Destruction_Bond = false;
                    }
                    if (SCR_ADD_recpie == true)
                    {
                        ADD_recpie.aDD_Recpie.text_Barcode.Text       = Item_No;
                        ADD_recpie.aDD_Recpie.text_ItemName.Text      = Item_Name;
                        ADD_recpie.aDD_Recpie.text_cost_parchase.Text = CostPrice;
                        ADD_recpie.aDD_Recpie.text_cost_sales.Text    = SalePrice;
                        ADD_recpie.aDD_Recpie.text_TAX.Text           = Tax;
                        ADD_recpie.aDD_Recpie.text_cost_AVG.Text      = AvgCost;
                        ADD_recpie.aDD_Recpie.text_Qu.Text            = Number_Retail;
                        ADD_recpie.aDD_Recpie.textBox_Max.Text        = Item_MAX;
                        SCR_ADD_recpie = false;
                    }
                    if (SCR_FRM_Report_Material_inventory == true)
                    {
                        FRM_Report_Material_inventory.fRM_Report_Material_.textBox_Item_No.Text   = Item_No;
                        FRM_Report_Material_inventory.fRM_Report_Material_.textBox_Item_Name.Text = Item_Name;
                        SCR_FRM_Report_Material_inventory = false;
                    }
                }

                this.Close();
            }
            catch (Exception ex)
            {
                msg.Alert(ex.Message, Form_Alert.enumType.Error);
            }
        }
Example #20
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            try
            {
                if (text_Barcode.Text == string.Empty)
                {
                    msg.Alert("يرجى عدم ترك حقل الباركود فارغ", Form_Alert.enumType.Warning);
                    text_Barcode.Focus();
                    return;
                }
                if (text_ItemName.Text == string.Empty)
                {
                    msg.Alert("يرجى عدم ترك حقل اسم المادة فارغ", Form_Alert.enumType.Warning);
                    text_ItemName.Focus();
                    return;
                }
                if (text_cost_parchase.Text == string.Empty)
                {
                    msg.Alert("يرجى عدم ترك حقل سعر الشراء فارغ", Form_Alert.enumType.Warning);
                    text_cost_parchase.Focus();
                    return;
                }
                if (text_TAX.Text == string.Empty)
                {
                    msg.Alert("يرجى عد ترك حقل الضريبة فارغ ، في حال لا يوجد ضريبة يرجى ادخال قيمة 0", Form_Alert.enumType.Warning);
                    text_TAX.Focus();
                    return;
                }
                if (text_cost_sales.Text == string.Empty)
                {
                    msg.Alert("يرجى عدم ترك حقل سعر البيع فارغ", Form_Alert.enumType.Warning);
                    text_cost_sales.Focus();
                    return;
                }
                if (text_cost_AVG.Text == string.Empty)
                {
                    msg.Alert("يرجى عدم ترك حقل سعر التكلفة فارغ", Form_Alert.enumType.Warning);
                    text_cost_AVG.Focus();
                    return;
                }
                con.Open();
                SqlCommand cmd21 = new SqlCommand("select Code from Drugs where Code=@Code", con);
                cmd21.Parameters.AddWithValue("@Code", text_Barcode.Text);
                SqlDataReader dr;
                dr = cmd21.ExecuteReader();
                int count = 0;
                if (dr.Read())
                {
                    count += 1;
                }

                con.Close();
                if (count == 1)
                {
                    try
                    {
                        con.Open();
                        SqlCommand cmd = con.CreateCommand();
                        cmd.CommandType = CommandType.Text;
                        cmd.CommandText = "UPDATE       " + D.DataPharmacy + "Drugs SET ItemName =@ItemName, Tax =@Tax, CostPrice =@CostPrice, AvgCost =@AvgCost, SalePrice =@SalePrice, Number_Retail =@Number_Retail, Item_MAX =@Item_MAX where Code=@Code";

                        cmd.Parameters.AddWithValue("@Code", text_Barcode.Text.Trim());
                        cmd.Parameters.AddWithValue("@ItemName", text_ItemName.Text.Trim());
                        cmd.Parameters.AddWithValue("@Tax", text_TAX.Text.Trim());
                        cmd.Parameters.AddWithValue("@CostPrice", text_cost_parchase.Text.Trim());
                        cmd.Parameters.AddWithValue("@AvgCost", text_cost_AVG.Text.Trim());
                        cmd.Parameters.AddWithValue("@SalePrice", text_cost_sales.Text.Trim());
                        cmd.Parameters.AddWithValue("@Number_Retail", text_Qu.Text.Trim());
                        if (textBox_Max.Text == string.Empty)
                        {
                            cmd.Parameters.AddWithValue("@Item_MAX", 0);
                        }
                        else
                        {
                            cmd.Parameters.AddWithValue("@Item_MAX", textBox_Max.Text.Trim());
                        }
                        cmd.ExecuteNonQuery();
                        history.EventHistory(text_Barcode.Text, history.Edit, history.NameEdit, docType.ADD_recpie, this.Text);
                        msg.Alert("تم تعديل بيانات المادة بنجاح", Form_Alert.enumType.Success);
                        ClearScreen();
                    }
                    catch (Exception ex)
                    {
                        msg.Alert("حدث خلل بسيط" + ex.Message, Form_Alert.enumType.Error);
                    }
                    finally
                    {
                        con.Close();
                    }
                }
                else
                {
                    try
                    {
                        con.Open();
                        SqlCommand cmd = con.CreateCommand();
                        cmd.CommandType = CommandType.Text;
                        cmd.CommandText = "INSERT INTO " + D.DataPharmacy + "Drugs (Code, ItemName, Tax, CostPrice, AvgCost, SalePrice, Number_Retail, Item_MAX) VALUES        (@Code, @ItemName, @Tax, @CostPrice, @AvgCost, @SalePrice, @Number_Retail, @Item_MAX) ";
                        cmd.Parameters.AddWithValue("@Code", text_Barcode.Text.Trim());
                        cmd.Parameters.AddWithValue("@ItemName", text_ItemName.Text.Trim());
                        cmd.Parameters.AddWithValue("@Tax", text_TAX.Text.Trim());
                        cmd.Parameters.AddWithValue("@CostPrice", text_cost_parchase.Text.Trim());
                        cmd.Parameters.AddWithValue("@AvgCost", text_cost_AVG.Text.Trim());
                        cmd.Parameters.AddWithValue("@SalePrice", text_cost_sales.Text.Trim());
                        cmd.Parameters.AddWithValue("@Number_Retail", text_Qu.Text.Trim());
                        if (textBox_Max.Text == string.Empty)
                        {
                            cmd.Parameters.AddWithValue("@Item_MAX", 0);
                        }
                        else
                        {
                            cmd.Parameters.AddWithValue("@Item_MAX", textBox_Max.Text.Trim());
                        }
                        cmd.ExecuteNonQuery();
                        history.EventHistory(text_Barcode.Text, history.ADD, history.NameADD, docType.ADD_recpie, this.Text);
                        msg.Alert("تم إضافة بيانات المادة بنجاح", Form_Alert.enumType.Success);
                        ClearScreen();
                    }
                    catch (Exception ex)
                    {
                        msg.Alert("حدث خلل بسيط" + ex.Message, Form_Alert.enumType.Error);
                    }
                    finally
                    {
                        con.Close();
                    }
                }
            }
            catch (Exception ee)
            {
                con.Close();
                MessageBox.Show("يرجى تصوير الخطأ ومراجعة المبرمج ، شكرا" + ee.Message, "ERROR 1007 ADD_recipe", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }