Ejemplo n.º 1
0
 private void simpleButton8_Click(object sender, EventArgs e)
 {
     if (cl.checkpermissions(connectiondata.user_id, "الخزينة", "delete_", 1) == false)
     {
         return;
     }
     if (gridView1.RowCount == 0)
     {
         return;
     }
     if (MSg.showmsg("حذف بيانات الأيصال", MSg.msgbutton.okcancel, MSg.msgicon.warning) == MSg.result.CANCEL)
     {
         return;
     }
     if (gridView1.GetFocusedRowCellValue("invoice_type").ToString() == "تحويلات خزينة")
     {
         SqlParameter[] pa = new SqlParameter[1];
         pa[0] = new SqlParameter("@transfer_code", int.Parse(gridView1.GetFocusedRowCellValue("transfer_code").ToString()));
         cd.runproc("sp_deleteTransfer", pa);
     }
     else
     {
         int            rowindex = gridView1.FocusedRowHandle;
         string         move_no  = gridView1.GetRowCellValue(rowindex, "move_no").ToString();
         SqlParameter[] p        = new SqlParameter[1];
         p[0] = new SqlParameter("@move_no", move_no);
         cd.runproc("sp_cashierremove", p);
     }
     bindingcashierdata();
     bindingbalance();
 }
Ejemplo n.º 2
0
 private void bunifuMetroTextbox1_KeyDown(object sender, KeyEventArgs e)
 {
     if (string.IsNullOrEmpty(txt_password.Text))
     {
         lb_password.Visible = true;
     }
     else
     {
         lb_password.Visible = false;
     }
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txt_password.Text) || string.IsNullOrEmpty(txt_username.Text))
         {
             MSg.showmsg("يرجى أدخال أسم المستخدم وكلمة المرور", MSg.msgbutton.ok, MSg.msgicon.information);
             return;
         }
         if (checklogin() == true)
         {
             this.Hide();
             frm_othermain.getmain.lb_user_name.Text = connectiondata._username;
             frm_othermain.getmain.ShowDialog();
             this.Close();
         }
         else
         {
             MSg.showmsg("خطأ فى أسم المستخدم أو كلمة المرور", MSg.msgbutton.ok, MSg.msgicon.information);
         }
     }
 }
Ejemplo n.º 3
0
 private void simpleButton1_Click_1(object sender, EventArgs e)
 {
     if (MSg.showmsg("حذف بيانات الفرع && المخزن", MSg.msgbutton.okcancel, MSg.msgicon.delete) == MSg.result.OK)
     {
         int currentrow = gridView1.FocusedRowHandle;
         int store_id   = int.Parse(gridView1.GetRowCellValue(currentrow, "store_id").ToString());
         //check befor delete......
         SqlParameter[] pa = new SqlParameter[1];
         pa[0] = new SqlParameter("@store_id", store_id);
         DataTable dt = new DataTable();
         dt = cd.getdata("sp_checkstorebefordelete", pa);
         if (dt.Rows[0][0].ToString() != "0")
         {
             MSg.showmsg("لايمكن حذف بيانات المخزن لوجود عمليات تمت عليه", MSg.msgbutton.ok, MSg.msgicon.warning);
             return;
         }
         else
         {
             SqlParameter[] p = new SqlParameter[1];
             p[0] = new SqlParameter("@store_id", store_id);
             cd.runproc("sp_storedelete", p);
             bindingstores();
         }
     }
 }
Ejemplo n.º 4
0
 private void btn_cashier_Click(object sender, EventArgs e)
 {
     if (btn_cashier.Tag.ToString() == "0")
     {
         SqlParameter[] p = new SqlParameter[6];
         p[0] = new SqlParameter("@user_name", txt_user.Text);
         p[1] = new SqlParameter("@password", txt_pass.Text);
         p[2] = new SqlParameter("@branch_code", cmb_stores.EditValue);
         p[3] = new SqlParameter("@cashier_code", cmb_cashier.EditValue);
         p[4] = new SqlParameter("@dt", dt);
         p[5] = new SqlParameter("@full_name", txt_fulluser.Text);
         cd.runproc("sp_userinser", p);
         MSg.showmsg("تم حفظ بياتات المستخدم", MSg.msgbutton.ok, MSg.msgicon.information);
         frm_settings.get_main.bindinguser();
     }
     else
     {
         SqlParameter[] p = new SqlParameter[7];
         p[0] = new SqlParameter("@user_name", txt_user.Text);
         p[1] = new SqlParameter("@password", txt_pass.Text);
         p[2] = new SqlParameter("@branch_code", cmb_stores.EditValue);
         p[3] = new SqlParameter("@cashier_code", cmb_cashier.EditValue);
         p[4] = new SqlParameter("@dt", dt);
         p[5] = new SqlParameter("@user_id", user_id);
         p[6] = new SqlParameter("@full_name", txt_fulluser.Text);
         cd.runproc("sp_userupdate", p);
         MSg.showmsg("تم حفظ بياتات المستخدم", MSg.msgbutton.ok, MSg.msgicon.information);
         frm_settings.get_main.bindinguser();
     }
     this.Close();
 }
Ejemplo n.º 5
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(dateEdit1.Text) || string.IsNullOrEmpty(dateEdit2.Text))
     {
         MSg.showmsg("حدد الفترة اولا", MSg.msgbutton.ok, MSg.msgicon.delete);
         return;
     }
     binding_data();
 }
Ejemplo n.º 6
0
 private void simpleButton7_Click(object sender, EventArgs e)
 {
     if (MSg.showmsg("حذف بيانات المستخدم", MSg.msgbutton.okcancel, MSg.msgicon.delete) == MSg.result.OK)
     {
         SqlParameter[] p = new SqlParameter[1];
         p[0] = new SqlParameter("@user_id", int.Parse(gridView3.GetFocusedRowCellValue("user_id").ToString()));
         cd.runproc("sp_userdelete", p);
         bindinguser();
     }
 }
Ejemplo n.º 7
0
        private void btn_savenew_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_name.Text))
            {
                errorProvider1.SetError(txt_name, "يرجى أدخال أسم الحساب");
                return;
            }
            if (validating == false)
            {
                MSg.showmsg("يرجى التاكد من ادخال البيانات بشكل صحيح", MSg.msgbutton.ok, MSg.msgicon.information);
                return;
            }
            if (addnew == true)
            {
                SqlParameter[] p = new SqlParameter[10];
                p[0] = new SqlParameter("@account_name", txt_name.Text);
                p[1] = new SqlParameter("@account_type", radioGroup1.EditValue.ToString());
                p[2] = new SqlParameter("@debit", (string.IsNullOrEmpty(txt_debit.Text)) ? Convert.ToDecimal(0) : Convert.ToDecimal(txt_debit.Text));
                p[3] = new SqlParameter("@credit", (string.IsNullOrEmpty(txt_creadit.Text)) ? Convert.ToDecimal(0) : Convert.ToDecimal(txt_creadit.Text));
                p[4] = new SqlParameter("@date_balance", dt_firstbalance.Text);
                p[5] = new SqlParameter("@phone", txt_phonenumber.Text);
                p[6] = new SqlParameter("@emial", txt_email.Text);
                p[7] = new SqlParameter("@adress", txt_adress.Text);
                p[8] = new SqlParameter("@user_id", connectiondata.user_id);
                p[9] = new SqlParameter("@notes", txt_notes.Text);

                cd.runproc("sp_accountsInsert", p);
                frm_accounts.getmain.bindingaccounts();
                int focusedrow = frm_accounts.getmain.gridView1.LocateByValue("account_name", txt_name.Text, null);
                frm_accounts.getmain.gridView1.FocusedRowHandle = focusedrow;
                cleardata();
            }
            else
            {
                SqlParameter[] p = new SqlParameter[10];
                p[0] = new SqlParameter("@account_name", txt_name.Text);
                p[1] = new SqlParameter("@account_type", radioGroup1.EditValue.ToString());
                p[2] = new SqlParameter("@debit", (string.IsNullOrEmpty(txt_debit.Text)) ? Convert.ToDecimal(0) : Convert.ToDecimal(txt_debit.Text));
                p[3] = new SqlParameter("@credit", (string.IsNullOrEmpty(txt_creadit.Text)) ? Convert.ToDecimal(0) : Convert.ToDecimal(txt_creadit.Text));
                p[4] = new SqlParameter("@date_balance", dt_firstbalance.Text);
                p[5] = new SqlParameter("@phone", txt_phonenumber.Text);
                p[6] = new SqlParameter("@emial", txt_email.Text);
                p[7] = new SqlParameter("@adress", txt_adress.Text);
                p[8] = new SqlParameter("@account_code", account_code);
                p[9] = new SqlParameter("@notes", txt_notes.Text);

                cd.runproc("sp_accountsUpdate", p);
                frm_accounts.getmain.bindingaccounts();
                int focusedrow = frm_accounts.getmain.gridView1.LocateByValue("account_name", txt_name.Text, null);
                frm_accounts.getmain.gridView1.FocusedRowHandle = focusedrow;
                cleardata();
                addnew = true;
            }
        }
Ejemplo n.º 8
0
 private void btn_remove_Click(object sender, EventArgs e)
 {
     if (gridView1.RowCount == 0)
     {
         return;
     }
     if (MSg.showmsg("حذف بيانات الصنف من الفاتورة", MSg.msgbutton.okcancel, MSg.msgicon.delete) == MSg.result.OK)
     {
         gridView1.DeleteSelectedRows();
         dt_products.AcceptChanges();
         updatetotal();
     }
 }
Ejemplo n.º 9
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (cl.checkpermissions(connectiondata.user_id, "تسوية مخزن", "add_new", 1) == false)
            {
                return;
            }

            gridView1.ActiveFilter.Clear();
            if (gridView1.RowCount == 0)
            {
                MSg.showmsg("لا يمكن حفظ فاتورة شراء خالية من الأصناف", MSg.msgbutton.ok, MSg.msgicon.information);
                return;
            }
            #region addnew invoice.....
            if (addnew == true)
            {
                SqlParameter[] param = new SqlParameter[7];
                param[0] = new SqlParameter("@move_type", "تسوية");
                param[1] = new SqlParameter("@move_date", Convert.ToDateTime(txt_date.Text));
                param[2] = new SqlParameter("@invoice_no", txt_invice_no.Text);
                param[3] = new SqlParameter("@store_code", cmb_stores.EditValue);
                param[4] = new SqlParameter("@user_id", connectiondata.user_id);
                param[5] = new SqlParameter("@purchasetable", dt_products);
                param[6] = new SqlParameter("@total_value", decimal.Parse(txt_total.Text));
                cd.runproc("sp_Adjustinsert", param);
                MSg.showmsg("تم حفظ بيانات الفاتورة", MSg.msgbutton.ok, MSg.msgicon.saved);
                binding_navigations();
                bindingsearch();
                cleardata();
                gridControl2.Visible = false;
                return;
            }
            #endregion
            #region update invoice.....
            SqlParameter[] param1 = new SqlParameter[7];
            param1[0] = new SqlParameter("@move_type", "تسوية");
            param1[1] = new SqlParameter("@move_date", Convert.ToDateTime(txt_date.Text));
            param1[2] = new SqlParameter("@invoice_no", txt_invice_no.Text);
            param1[3] = new SqlParameter("@store_code", cmb_stores.EditValue);
            param1[4] = new SqlParameter("@total_value", decimal.Parse(txt_total.Text));
            param1[5] = new SqlParameter("@purchasetable", dt_products);
            int rowno = navigations_view.FocusedRowHandle;
            param1[6] = new SqlParameter("@move_no", navigations_view.GetRowCellValue(rowno, "move_no").ToString());
            cd.runproc("sp_AdjustUpdate", param1);
            MSg.showmsg("تم حفظ بيانات الفاتورة", MSg.msgbutton.ok, MSg.msgicon.saved);
            cleardata();
            addnew               = true;
            cmb_stores.Enabled   = true;
            gridControl2.Visible = false;
            #endregion
        }
Ejemplo n.º 10
0
 private void btn_delete_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (MSg.showmsg("هل تريد حذف بيانات الفاتورة", MSg.msgbutton.okcancel, MSg.msgicon.delete) == MSg.result.OK)
     {
         SqlParameter[] p = new SqlParameter[3];
         p[0] = new SqlParameter("@move_no", int.Parse(gridView1.GetFocusedRowCellValue("move_no").ToString()));
         p[1] = new SqlParameter("@invoice_no", int.Parse(gridView1.GetFocusedRowCellValue("invoice_no").ToString()));
         p[2] = new SqlParameter("@invoice_type", gridView1.GetFocusedRowCellValue("move_type").ToString());
         cd.runproc("sp_movesdelete", p);
         gridView1.DeleteSelectedRows();
         if (gridView1.RowCount == 0)
         {
             dt_detalis.Clear();
             gridControl2.DataSource = dt_detalis;
         }
     }
 }
Ejemplo n.º 11
0
 private void simpleButton4_Click(object sender, EventArgs e)
 {
     if (MSg.showmsg("حذف بيانات الخزينة", MSg.msgbutton.okcancel, MSg.msgicon.delete) == MSg.result.OK)
     {
         SqlParameter[] p = new SqlParameter[1];
         p[0] = new SqlParameter("@cashier_code", int.Parse(gridView2.GetFocusedRowCellValue("cashier_id").ToString()));
         try
         {
             cd.runproc("sp_cashierdelete", p);
         }
         catch (Exception)
         {
             MSg.showmsg("غير قادر على حذف بيانات الخزينة", MSg.msgbutton.ok, MSg.msgicon.delete);
         }
         bindingcashier();
     }
 }
Ejemplo n.º 12
0
 private void simpleButton2_Click(object sender, EventArgs e)
 {
     if (MSg.showmsg("هل تريد حفظ تعديلات على اسعار البيع", MSg.msgbutton.okcancel, MSg.msgicon.information) == MSg.result.CANCEL)
     {
         return;
     }
     foreach (DataRow item in dt_prodcuts.Rows)
     {
         if (Convert.ToBoolean(item["select_"].ToString()) == true)
         {
             SqlParameter[] p = new SqlParameter[2];
             p[0] = new SqlParameter("@product_code", int.Parse(item["product_code"].ToString()));
             p[1] = new SqlParameter("@price", decimal.Parse(item["sell_price"].ToString()));
             cd.runproc("sp_changeprice", p);
         }
     }
 }
Ejemplo n.º 13
0
 private void simpleButton14_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txt_invice_no.Text))
     {
         return;
     }
     if (MSg.showmsg("هل تريد حذف بيانات الفاتورة", MSg.msgbutton.okcancel, MSg.msgicon.delete) == MSg.result.OK)
     {
         SqlParameter[] p = new SqlParameter[1];
         p[0] = new SqlParameter("@invoice_no", txt_invice_no.Text);
         cd.runproc("sp_orderDelete", p);
         cleardata();
         binding_navigations();
         addnew = true;
         gridControl2.Visible = false;
     }
 }
Ejemplo n.º 14
0
 private void simpleButton5_Click(object sender, EventArgs e)
 {
     if (addnew == false)
     {
         if (MSg.showmsg("تنفيذ طلب تحويل البضاعه", MSg.msgbutton.okcancel, MSg.msgicon.information) == MSg.result.CANCEL)
         {
             return;
         }
         SqlParameter[] p = new SqlParameter[2];
         p[0] = new SqlParameter("@invoice_no", txt_invice_no.Text);
         p[1] = new SqlParameter("@user_id", connectiondata.user_id);
         cd.runproc("sp_AcceptOrder", p);
         cleardata();
         binding_navigations();
         bindingsearch();
     }
 }
Ejemplo n.º 15
0
 private void simpleButton3_Click(object sender, EventArgs e)
 {
     if (gridView1.RowCount == 0)
     {
         return;
     }
     if (int.Parse(gridView1.GetFocusedRowCellValue("acount_code").ToString()) == 1)
     {
         return;
     }
     if (MSg.showmsg("حذف بيانات الحساب", MSg.msgbutton.okcancel, MSg.msgicon.delete) == MSg.result.OK)
     {
         SqlParameter[] p = new SqlParameter[1];
         p[0] = new SqlParameter("@account_code", int.Parse(gridView1.GetFocusedRowCellValue("acount_code").ToString()));
         cd.runproc("sp_accountdelete", p);
         bindingaccounts();
     }
 }
Ejemplo n.º 16
0
        private void simpleButton2_Click(object sender, EventArgs e)
        {
            Properties.Settings.Default.left_margins = Convert.ToInt16(left_margian.Text);
            Properties.Settings.Default.top_margins  = Convert.ToInt16(top_mirgain.Text);
            Properties.Settings.Default.b_width      = Convert.ToInt16(b_width.Text);
            Properties.Settings.Default.b_high       = Convert.ToInt16(b_height.Text);
            Properties.Settings.Default.show_barcode = Convert.ToBoolean(show_barcode.EditValue);
            Properties.Settings.Default.show_name    = Convert.ToBoolean(show_name.EditValue);
            Properties.Settings.Default.show_price   = Convert.ToBoolean(show_price.EditValue);
            Properties.Settings.Default.name_size    = int.Parse(name_size.Text);
            Properties.Settings.Default.barcode_size = int.Parse(barode_size.Text);
            Properties.Settings.Default.price_size   = int.Parse(price_size.Text);
            Properties.Settings.Default.font_name    = font_name.Text;
            Properties.Settings.Default.printer_name = printr_name.Text;

            Properties.Settings.Default.Save();
            MSg.showmsg("تم حفظ التصميم", MSg.msgbutton.ok, MSg.msgicon.saved);
        }
Ejemplo n.º 17
0
        private void btn_pay_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_paid.Text))
            {
                return;
            }
            if (frm_purchase.get_main.radioGroup1.EditValue.ToString() == "نقدى")
            {
                if (Convert.ToDecimal(txt_remain.Text) != 0)
                {
                    MSg.showmsg("يرجى سداد المبلغ بالكامل", MSg.msgbutton.ok, MSg.msgicon.information);
                    return;
                }
            }

            //   frm_purchase.get_main.txt_paidvalue.Text = txt_paid.Text;
            this.Close();
        }
Ejemplo n.º 18
0
 private void btn_save_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txt_name.Text))
     {
         errorProvider1.SetError(txt_name, "أدخل أسم المخزن او الفرع");
         return;
     }
     if (btn_save.Tag.ToString() == "0")
     {
         if (checkname() == false)
         {
             errorProvider1.SetError(txt_name, "لا يمكن تكرار أسم المخزن");
             return;
         }
         else
         {
             errorProvider1.Dispose();
             SqlParameter[] p = new SqlParameter[1];
             p[0] = new SqlParameter("@store_name", txt_name.Text);
             cd.runproc("sp_storesinsert", p);
             frm_settings.get_main.bindingstores();
             this.Close();
         }
     }
     else
     {
         if (checkbeforupdate() == false)
         {
             MSg.showmsg("أسم المخزن مسجل مسبقا ولا يمكن تكراره", MSg.msgbutton.ok, MSg.msgicon.information);
             return;
         }
         else
         {
             errorProvider1.Dispose();
             SqlParameter[] p = new SqlParameter[2];
             p[0] = new SqlParameter("@store_name", txt_name.Text);
             p[1] = new SqlParameter("@store_id", store_id);
             cd.runproc("sp_storesupdate", p);
             frm_settings.get_main.bindingstores();
             this.Close();
         }
     }
 }
Ejemplo n.º 19
0
        private void simpleButton10_Click(object sender, EventArgs e)
        {
            //saving image
            //if (product_image.Image == null) { product_image.Image = ROSESONLY.Properties.Resources.product_image; }
            MemoryStream ms = new MemoryStream();

            logo.Image.Save(ms, logo.Image.RawFormat);
            byte[]         imagebyte = ms.ToArray();
            SqlParameter[] p         = new SqlParameter[1];
            p[0] = new SqlParameter("@logo", imagebyte);
            cd.runproc("sp_InsertCompanyData", p);
            Properties.Settings.Default.company_name = txt_name.Text;
            Properties.Settings.Default.adress       = txt_adress.Text;
            Properties.Settings.Default.phone2       = txt_phone1.Text;
            Properties.Settings.Default.phone1       = txt_phone1.Text;
            Properties.Settings.Default.email        = txt_email.Text;
            Properties.Settings.Default.Save();
            MSg.showmsg("تم حفظ بيانات شركتك", MSg.msgbutton.ok, MSg.msgicon.delete);
        }
Ejemplo n.º 20
0
        private void simpleButton6_Click(object sender, EventArgs e)
        {
            if (gridView1.RowCount == 0)
            {
                return;
            }

            if (cl.checkpermissions(connectiondata.user_id, "الأصناف", "delete_", 1) == false)
            {
                return;
            }

            try
            {
                if (MSg.showmsg("حذف بيانات الاصناف المحدده", MSg.msgbutton.okcancel, MSg.msgicon.delete) == MSg.result.OK)
                {
                    for (int i = 0; i < gridView1.RowCount; i++)
                    {
                        if (Convert.ToBoolean(gridView1.GetRowCellValue(i, "select_").ToString()) == true)
                        {
                            int            product_code = int.Parse(gridView1.GetRowCellValue(i, "product_code").ToString());
                            SqlParameter[] p            = new SqlParameter[1];
                            p[0] = new SqlParameter("@product_code", product_code);
                            DataTable dt = new DataTable();
                            dt = cd.getdata("sp_checkproductbefordelete", p);
                            if (dt.Rows.Count != 0)
                            {
                                continue;
                            }
                            else
                            {
                                SqlParameter[] pa = new SqlParameter[1];
                                pa[0] = new SqlParameter("@product_code", product_code);
                                cd.runproc("sp_products_remove", pa);
                            }
                        }
                    }
                    bindingproducts();
                }
            }
            catch
            { }
        }
Ejemplo n.º 21
0
 private void simpleButton1_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(txt_password.Text) || string.IsNullOrEmpty(txt_username.Text))
     {
         MSg.showmsg("يرجى أدخال أسم المستخدم وكلمة المرور", MSg.msgbutton.ok, MSg.msgicon.information);
         return;
     }
     if (checklogin() == true)
     {
         this.Hide();
         frm_othermain.getmain.lb_user_name.Text = connectiondata._username;
         frm_othermain.getmain.ShowDialog();
         this.Close();
     }
     else
     {
         MSg.showmsg("خطأ فى أسم المستخدم أو كلمة المرور", MSg.msgbutton.ok, MSg.msgicon.information);
     }
 }
Ejemplo n.º 22
0
        public void btn_show_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(txt_products.Text))
            {
                MSg.showmsg("يرجى أختيار الصنف اولا", MSg.msgbutton.ok, MSg.msgicon.information);
                return;
            }
            string move = "";

            if (cmb_move_type.Text == "جميع الحركات")
            {
                move = "";
            }
            else
            {
                move = cmb_move_type.Text;
            }
            bindingmovements(int.Parse(txt_products.EditValue.ToString()), cmb_stores.Text, Convert.ToDateTime(txt_date1.Text),
                             Convert.ToDateTime(txt_date2.Text), move);
            product_name.Text     = txt_products.Text;
            gridView1.ViewCaption = product_name.Text;
        }
Ejemplo n.º 23
0
 private void btn_delete__ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
 {
     if (MSg.showmsg("حذف بيانات  الصنف", MSg.msgbutton.okcancel, MSg.msgicon.delete) == MSg.result.OK)
     {
         int            product_code = int.Parse(gridView1.GetFocusedRowCellValue("product_code").ToString());
         SqlParameter[] p            = new SqlParameter[1];
         p[0] = new SqlParameter("@product_code", product_code);
         DataTable dt = new DataTable();
         dt = cd.getdata("sp_checkproductbefordelete", p);
         if (dt.Rows.Count != 0)
         {
             MSg.showmsg("لا يمكن حذف الصنف لوجود حركات  علية", MSg.msgbutton.ok, MSg.msgicon.delete);
         }
         else
         {
             SqlParameter[] pa = new SqlParameter[1];
             pa[0] = new SqlParameter("@product_code", product_code);
             cd.runproc("sp_products_remove", pa);
         }
     }
     bindingproducts();
 }
Ejemplo n.º 24
0
        private void simpleButton14_Click(object sender, EventArgs e)
        {
            if (cl.checkpermissions(connectiondata.user_id, "تسوية مخزن", "delete_", 1) == false)
            {
                return;
            }

            if (string.IsNullOrEmpty(txt_invice_no.Text))
            {
                return;
            }
            if (MSg.showmsg("هل تريد حذف بيانات الفاتورة", MSg.msgbutton.okcancel, MSg.msgicon.delete) == MSg.result.OK)
            {
                SqlParameter[] p = new SqlParameter[3];
                p[0] = new SqlParameter("@move_no", int.Parse(navigations_view.GetFocusedRowCellValue("move_no").ToString()));
                p[1] = new SqlParameter("@invoice_no", int.Parse(navigations_view.GetFocusedRowCellValue("invoice_no").ToString()));
                p[2] = new SqlParameter("@invoice_type", "بيع");
                cd.runproc("sp_movesdelete", p);
                cleardata();
                binding_navigations();
                addnew = true;
            }
        }
Ejemplo n.º 25
0
        private void repositoryItemButtonEdit2_Click(object sender, EventArgs e)
        {
            int currentrow = gridView1.FocusedRowHandle;
            int cat_code   = int.Parse(gridView1.GetRowCellValue(currentrow, "category_code").ToString());

            SqlParameter[] pa = new SqlParameter[1];
            pa[0] = new SqlParameter("@cat_code", cat_code);
            DataTable dt1 = new DataTable();

            dt1 = cd.getdata("sp_categorybefordelete", pa);
            if (dt1.Rows[0][0].ToString() != "0")
            {
                MSg.showmsg("لا يمكن حذف بيانات المجموعة لوجود أصناف بهذه المجموعة", MSg.msgbutton.okcancel, MSg.msgicon.warning);
                return;
            }
            if (MSg.showmsg("حذف بيانات المجموعة", MSg.msgbutton.okcancel, MSg.msgicon.warning) == MSg.result.OK)
            {
                SqlParameter[] p = new SqlParameter[1];
                p[0] = new SqlParameter("@cat_code", cat_code);
                cd.runproc("sp_categorydelete", p);
                gridView1.DeleteSelectedRows();
                txt_name.Text = string.Empty;
            }
        }
Ejemplo n.º 26
0
        private void btn_change_Click(object sender, EventArgs e)
        {
            if (form_name != "purchase" && form_name != "sales_return" && form_name != "adjust")
            {
                //get unit count
                SqlParameter[] ps = new SqlParameter[2];
                ps[0] = new SqlParameter("@unit_name", cmb_unit.Text);
                ps[1] = new SqlParameter("@product_code", product_code);
                DataTable dt_unit = new DataTable();
                dt_unit = cd.getdata("sp_bindingprice", ps);
                decimal x = available_qty + (qty * Convert.ToDecimal(dt_unit.Rows[0][2].ToString()));

                if (addnew == false)
                {
                    if (Convert.ToDecimal(txt_qty.Text) * Convert.ToDecimal(dt_unit.Rows[0][2].ToString()) > x)
                    {
                        MSg.showmsg("عفوا الكمية المتاحة أقل من الكمية المطلوبة  متاح " + (Math.Round(available_qty / Convert.ToDecimal(dt_unit.Rows[0][2].ToString()), 2) + (qty)).ToString(), MSg.msgbutton.ok, MSg.msgicon.information);
                        return;
                    }
                }
                else
                {
                    if (Convert.ToDecimal(txt_qty.Text) * Convert.ToDecimal(dt_unit.Rows[0][2].ToString()) > available_qty)
                    {
                        MSg.showmsg("عفوا الكمية المتاحة أقل من الكمية المطلوبة  متاح " + (Math.Round(available_qty / Convert.ToDecimal(dt_unit.Rows[0][2].ToString()), 2)).ToString(), MSg.msgbutton.ok, MSg.msgicon.information);
                        return;
                    }
                }
            }
            DataRow[] findrow;
            switch (form_name)
            {
            case "purchase":
                findrow = frm_purchase.get_main.dt_products.Select("id=" + id + "");
                if (findrow.Length != 0)
                {
                    findrow[0].BeginEdit();
                    findrow[0]["qty"]       = decimal.Parse(txt_qty.Text);
                    findrow[0]["price"]     = decimal.Parse(txt_price.Text);
                    findrow[0]["unit_name"] = cmb_unit.Text;
                    findrow[0].EndEdit();
                }
                frm_purchase.get_main.updatetotal();
                break;

            case "purchase_return":
                findrow = frm_purchaseReturn.get_main.dt_products.Select("id=" + id + "");
                if (findrow.Length != 0)
                {
                    findrow[0].BeginEdit();
                    findrow[0]["qty"]       = decimal.Parse(txt_qty.Text);
                    findrow[0]["price"]     = decimal.Parse(txt_price.Text);
                    findrow[0]["unit_name"] = cmb_unit.Text;
                    findrow[0].EndEdit();
                }
                frm_purchaseReturn.get_main.updatetotal();
                break;

            case "sales":
                findrow = frm_SalesInvoice.get_main.dt_products.Select("id=" + id + "");
                if (findrow.Length != 0)
                {
                    //check product price is less then limite price................
                    #region checkprice
                    DataTable      dt_price = new DataTable();
                    SqlParameter[] p_price  = new SqlParameter[1];
                    p_price[0] = new SqlParameter("@product_code", int.Parse(findrow[0]["product_code"].ToString()));
                    dt_price   = cd.getdata("sp_getlimiteprice", p_price);
                    if (dt_price.Rows.Count != 0)
                    {
                        if (Convert.ToDecimal(dt_price.Rows[0]["limit_sellprice"].ToString()) > Convert.ToDecimal(txt_price.Text))
                        {
                            MSg.showmsg("سعر البيع أقل من  السعر المسموح به ", MSg.msgbutton.ok, MSg.msgicon.information);
                        }
                    }
                    #endregion

                    findrow[0].BeginEdit();
                    findrow[0]["discount_value"] = Convert.ToDecimal(txt_qty.Text) * frm_SalesInvoice.get_main.discount_value * Convert.ToDecimal(txt_price.Text);
                    findrow[0]["qty"]            = decimal.Parse(txt_qty.Text);
                    findrow[0]["price"]          = decimal.Parse(txt_price.Text);
                    findrow[0]["unit_name"]      = cmb_unit.Text;
                    findrow[0].EndEdit();
                }
                frm_SalesInvoice.get_main.updatetotal();
                break;

            case "sales_return":
                findrow = frm_salesreturn.get_main.dt_products.Select("id=" + id + "");
                if (findrow.Length != 0)
                {
                    findrow[0].BeginEdit();
                    findrow[0]["discount_value"] = Convert.ToDecimal(txt_qty.Text) * frm_salesreturn.get_main.discount_value * Convert.ToDecimal(txt_price.Text);
                    findrow[0]["qty"]            = decimal.Parse(txt_qty.Text);
                    findrow[0]["price"]          = decimal.Parse(txt_price.Text);
                    findrow[0]["unit_name"]      = cmb_unit.Text;
                    findrow[0].EndEdit();
                }

                frm_salesreturn.get_main.updatetotal();
                break;

            case "transfer":
                findrow = frm_storeTransfer.get_main.dt_products.Select("id=" + id + "");
                if (findrow.Length != 0)
                {
                    findrow[0].BeginEdit();
                    findrow[0]["qty"]       = decimal.Parse(txt_qty.Text);
                    findrow[0]["price"]     = decimal.Parse(txt_price.Text);
                    findrow[0]["unit_name"] = cmb_unit.Text;
                    findrow[0].EndEdit();
                }

                frm_storeTransfer.get_main.updatetotal();
                break;

            case "adjust":
                findrow = frm_adjustment.get_main.dt_products.Select("id=" + id + "");
                if (findrow.Length != 0)
                {
                    findrow[0].BeginEdit();
                    findrow[0]["qty"]       = decimal.Parse(txt_qty.Text);
                    findrow[0]["price"]     = decimal.Parse(txt_price.Text);
                    findrow[0]["unit_name"] = cmb_unit.Text;
                    findrow[0].EndEdit();
                }

                frm_adjustment.get_main.updatetotal();
                break;
            }
            this.Close();
        }
Ejemplo n.º 27
0
        private void simpleButton12_Click_1(object sender, EventArgs e)
        {
            if (cl.checkpermissions(connectiondata.user_id, "تحويل لمخزن", "add_new", 1) == false)
            {
                return;
            }

            gridView1.ActiveFilter.Clear();
            if (string.IsNullOrEmpty(cmb_store2.Text))
            {
                MSg.showmsg("يرجى أختيار المخزن المحول الية", MSg.msgbutton.ok, MSg.msgicon.information);
                return;
            }

            if (gridView1.RowCount == 0)
            {
                MSg.showmsg("لا يمكن حفظ فاتورة شراء خالية من الأصناف", MSg.msgbutton.ok, MSg.msgicon.information);
                return;
            }
            #region addnew invoice.....
            if (addnew == true)
            {
                bindinginvoiceNO();

                SqlParameter[] param = new SqlParameter[8];
                param[0] = new SqlParameter("@move_type", "تحويل");
                param[1] = new SqlParameter("@move_date", Convert.ToDateTime(txt_date.Text));
                param[2] = new SqlParameter("@invoice_no", txt_invice_no.Text);
                param[3] = new SqlParameter("@store_code", cmb_stores.EditValue);
                param[4] = new SqlParameter("@store2", cmb_store2.EditValue);
                param[5] = new SqlParameter("@user_id", connectiondata.user_id);
                param[6] = new SqlParameter("@purchasetable", dt_products);
                param[7] = new SqlParameter("@total_value", decimal.Parse(txt_total.Text));
                cd.runproc("sp_Transferinsert", param);
                MSg.showmsg("تم حفظ بيانات الفاتورة", MSg.msgbutton.ok, MSg.msgicon.saved);
                binding_navigations();
                bindingsearch();
                //print invoicedata
                SqlParameter[] para = new SqlParameter[2];
                para[0] = new SqlParameter("@invoice_no", txt_invice_no.Text);
                para[1] = new SqlParameter("@invoice_type", "تحويل");
                DataTable dt_r = new DataTable();
                dt_r = cd.getdata("rpt_purchaseInvoicePrint", para);
                ROSESONLY.reports.rpt_purchaseInvoice rpt = new reports.rpt_purchaseInvoice();
                rpt.DataSource = dt_r;
                frm_showreports frm1 = new frm_showreports();
                frm1.documentViewer1.DocumentSource = rpt;
                frm1.ShowDialog();
                cleardata();
                gridControl2.Visible = false;

                return;
            }
            #endregion
            #region update invoice.....
            SqlParameter[] param1 = new SqlParameter[8];
            param1[0] = new SqlParameter("@move_type", "تحويل");
            param1[1] = new SqlParameter("@move_date", Convert.ToDateTime(txt_date.Text));
            param1[2] = new SqlParameter("@invoice_no", txt_invice_no.Text);
            param1[3] = new SqlParameter("@store_code", cmb_stores.EditValue);
            param1[4] = new SqlParameter("@total_value", decimal.Parse(txt_total.Text));
            param1[5] = new SqlParameter("@store_id2", cmb_store2.EditValue);
            param1[6] = new SqlParameter("@purchasetable", dt_products);
            int rowno = navigations_view.FocusedRowHandle;
            param1[7] = new SqlParameter("@move_no", navigations_view.GetRowCellValue(rowno, "move_no").ToString());
            cd.runproc("sp_transferUpdate", param1);

            MSg.showmsg("تم حفظ بيانات الفاتورة", MSg.msgbutton.ok, MSg.msgicon.saved);
            //print invoicedata
            SqlParameter[] pam = new SqlParameter[2];
            pam[0] = new SqlParameter("@invoice_no", txt_invice_no.Text);
            pam[1] = new SqlParameter("@invoice_type", "تحويل");
            DataTable dt_r1 = new DataTable();
            dt_r1 = cd.getdata("rpt_purchaseInvoicePrint", pam);
            ROSESONLY.reports.rpt_purchaseInvoice rpt1 = new reports.rpt_purchaseInvoice();
            rpt1.DataSource = dt_r1;
            frm_showreports frm2 = new frm_showreports();
            frm2.documentViewer1.DocumentSource = rpt1;
            frm2.ShowDialog();

            cleardata();
            addnew = true;
            gridControl2.Visible = false;
            cmb_stores.Enabled   = true;
            cmb_store2.Enabled   = true;

            #endregion
        }
Ejemplo n.º 28
0
        void addnewproduct()
        {
            #region validating
            if (validating == false)
            {
                return;
            }
            if (string.IsNullOrEmpty(txt_code.Text))
            {
                errorProvider1.SetError(txt_code, "يرجى أختيار الصنف");
                return;
            }
            if (string.IsNullOrEmpty(txt_unit.Text))
            {
                errorProvider1.SetError(txt_unit, "يرجى أختيار الوحده");
                return;
            }
            errorProvider1.Dispose();
            gridControl2.Visible = false;
            #endregion
            //cheack if available qty was larg than required qty
            SqlParameter[] p = new SqlParameter[2];
            p[0] = new SqlParameter("@product_code", code);
            p[1] = new SqlParameter("@store_id", cmb_stores.EditValue);

            DataTable dt_qty = new DataTable();
            dt_qty = cd.getdata("sp_prodcust_balance", p);

            SqlParameter[] ps = new SqlParameter[2];
            ps[0] = new SqlParameter("@unit_name", txt_unit.Text);
            ps[1] = new SqlParameter("@product_code", code);
            DataTable dt_unit = new DataTable();
            dt_unit = cd.getdata("sp_bindingprice", ps);
            //get the quantity of product adding befor in the datatable
            decimal q = 0;
            foreach (DataRow item in dt_products.Rows)
            {
                if (int.Parse(item["product_code"].ToString()) == code)
                {
                    q += Convert.ToDecimal(item["qty"].ToString()) * Convert.ToDecimal(dt_unit.Rows[0][2].ToString());
                }
            }


            if (Convert.ToDecimal(dt_qty.Rows[0][0].ToString()) < (Convert.ToDecimal(txt_qty.Text) * decimal.Parse(dt_unit.Rows[0][2].ToString())) + q)
            {
                MSg.showmsg("عفوا الكمية المتاحة أقل من الكمية المطلوبة  متاح " + Math.Round((decimal.Parse(dt_qty.Rows[0][0].ToString()) / decimal.Parse(dt_unit.Rows[0][2].ToString())), 2), MSg.msgbutton.ok, MSg.msgicon.information);
                return;
            }

            // check if product was added befor in the invoice
            DataRow[] findrow;
            findrow = dt_products.Select("product_code=" + code + "");
            if (findrow.Length > 0 && Convert.ToDecimal(findrow[0]["price"].ToString()) == Convert.ToDecimal(txt_price.Text))
            {
                if (Convert.ToBoolean(ck_productRepet.EditValue) == true)
                {
                    #region NewProduct
                    DataRow newproduct;
                    newproduct = dt_products.NewRow();
                    newproduct["product_code"]  = code;
                    newproduct["product_name"]  = txt_code.Text;
                    newproduct["unit_name"]     = txt_unit.Text;
                    newproduct["qty"]           = Convert.ToDecimal(txt_qty.Text);
                    newproduct["price"]         = Convert.ToDecimal(txt_price.Text);
                    newproduct["available_qty"] = Convert.ToDecimal(dt_qty.Rows[0][0].ToString());
                    dt_products.Rows.Add(newproduct);
                    int focus_id = gridView1.LocateByValue("id", newproduct["id"], null);
                    gridView1.FocusedRowHandle = focus_id;
                    clearproduct_data();
                    updatetotal();
                    #endregion
                }
                else
                {
                    #region UpdatCurrentProduct
                    findrow[0].BeginEdit();
                    findrow[0]["qty"] = decimal.Parse(findrow[0]["qty"].ToString()) + decimal.Parse(txt_qty.Text);
                    findrow[0].EndEdit();
                    clearproduct_data();
                    updatetotal();
                    int focusid = gridView1.LocateByValue("id", findrow[0]["id"], null);
                    gridView1.FocusedRowHandle = focusid;
                    #endregion
                }
            }
            else
            {
                #region NewProduct
                DataRow newproduct;
                newproduct = dt_products.NewRow();
                newproduct["product_code"]  = code;
                newproduct["product_name"]  = txt_code.Text;
                newproduct["unit_name"]     = txt_unit.Text;
                newproduct["qty"]           = Convert.ToDecimal(txt_qty.Text);
                newproduct["price"]         = Convert.ToDecimal(txt_price.Text);
                newproduct["available_qty"] = Convert.ToDecimal(dt_qty.Rows[0][0].ToString());
                dt_products.Rows.Add(newproduct);
                int focus_id = gridView1.LocateByValue("id", newproduct["id"], null);
                gridView1.FocusedRowHandle = focus_id;
                clearproduct_data();
                updatetotal();
                #endregion
            }
        }
Ejemplo n.º 29
0
        private void simpleButton1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cmb_mainaccount.Text))
            {
                MSg.showmsg("يرجى أختيار الحساب المباشر", MSg.msgbutton.ok, MSg.msgicon.delete);
                return;
            }
            if (string.IsNullOrEmpty(cmb_maincashier.Text))
            {
                MSg.showmsg("يرجى أختيار الخزينة المباشرة", MSg.msgbutton.ok, MSg.msgicon.delete);
                return;
            }
            if (string.IsNullOrEmpty(cmb_mainstore.Text))
            {
                MSg.showmsg("يرجى أختيار المخزن المباشر", MSg.msgbutton.ok, MSg.msgicon.delete);
                return;
            }
            if (string.IsNullOrEmpty(txt_backup.Text))
            {
                MSg.showmsg("يرجى أختيار مسار حفظ النسخة الأحتياطية", MSg.msgbutton.ok, MSg.msgicon.delete);
                return;
            }
            Properties.Settings.Default.backup_path         = txt_backup.Text;
            Properties.Settings.Default.mainaccount         = int.Parse(cmb_mainaccount.EditValue.ToString());
            Properties.Settings.Default.main_cashier        = int.Parse(cmb_maincashier.EditValue.ToString());
            Properties.Settings.Default.main_store          = int.Parse(cmb_mainstore.EditValue.ToString());
            Properties.Settings.Default.sales_paper         = sales_type.EditValue.ToString();
            Properties.Settings.Default.sales_returnpaper   = sales_returntype.EditValue.ToString();
            Properties.Settings.Default.pur_paper           = purchase_type.EditValue.ToString();
            Properties.Settings.Default.pur_returnpaper     = purchaseruturntype.EditValue.ToString();
            Properties.Settings.Default.sales_printer       = cmb_salesprinter.Text;
            Properties.Settings.Default.sales_returnprinter = cmb_salesreturnprinter.Text;
            Properties.Settings.Default.pur_printer         = cmb_purchaseprinter.Text;
            Properties.Settings.Default.pur_returnprintre   = cmb_purcashereturnprinter.Text;
            Properties.Settings.Default.invoice_notes       = txt_notes.Text;
            Properties.Settings.Default.auto_add            = Convert.ToBoolean(auto_add.EditValue);
            Properties.Settings.Default.use_barcode         = Convert.ToBoolean(use_barcode.EditValue);
            Properties.Settings.Default.repeate             = Convert.ToBoolean(product_repaet.EditValue);
            Properties.Settings.Default.change_price        = Convert.ToBoolean(change_price.EditValue);
            Properties.Settings.Default.Save();

            //SqlParameter[] p = new SqlParameter[17];
            //p[0] = new SqlParameter("@main_account",cmb_mainaccount.EditValue);
            //p[1] = new SqlParameter("@main_store",cmb_mainstore.EditValue);
            //p[2] = new SqlParameter("@main_cashier",cmb_maincashier.EditValue);
            //p[3] = new SqlParameter("@auto_add",auto_add.EditValue);
            //p[4] = new SqlParameter("@use_barcode",use_barcode.EditValue);
            //p[5] = new SqlParameter("@product_repeat",product_repaet.EditValue);
            //p[6] = new SqlParameter("@sales_type",sales_type.EditValue.ToString());
            //p[7] = new SqlParameter("@sales_Rtype",sales_returntype.EditValue.ToString());
            //p[8] = new SqlParameter("@purchase_type",purchase_type.EditValue.ToString());
            //p[9] = new SqlParameter("@purchase_Rtype",purchaseruturntype.EditValue.ToString());
            //p[10] = new SqlParameter("@sales_printer",cmb_salesprinter.Text);
            //p[11] = new SqlParameter("@sales_Rprinter",cmb_salesreturnprinter.Text);
            //p[12] = new SqlParameter("@purchase_printer",cmb_purchaseprinter.Text);
            //p[13] = new SqlParameter("@purcahse_Rprinter", cmb_purcashereturnprinter.Text);
            //p[14] = new SqlParameter("@change_price", change_price.EditValue);
            //p[15] = new SqlParameter("@recipet_notes", txt_notes.Text);
            //p[16] = new SqlParameter("@backup_path", txt_backup.Text);
            //cd.runproc("sp_updatesetting", p);
            MSg.showmsg("تم حفظ الأعدادات", MSg.msgbutton.ok, MSg.msgicon.information);
            XtraForm1.getmain.dt_setting = cd.getdata("sp_getsetting", null);
        }
Ejemplo n.º 30
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            //saving image

            if (string.IsNullOrEmpty(txt_name.Text))
            {
                errorProvider1.SetError(txt_name, "يرجى إدخال أسم المجموعه قبل الحفظ");
                return;
            }
            else
            {
                if (btn_save.Tag.ToString() == "0")
                {
                    if (checkname() == false)
                    {
                        errorProvider1.SetError(txt_name, "لا يمكن تكرار أسم المجموعة");
                    }
                    else
                    {
                        errorProvider1.Dispose();
                        gridView1.ClearColumnsFilter();
                        category_name = txt_name.Text;
                        SqlParameter[] p = new SqlParameter[1];
                        p[0] = new SqlParameter("@category_name", txt_name.Text);

                        cd.runproc("sp_categoryInsert", p);

                        bindingcategory();

                        //select in gridview
                        gridView1.TopRowIndex      = gridView1.RowCount - 1;
                        gridView1.FocusedRowHandle = gridView1.RowCount - 1;
                        txt_name.Text = string.Empty;
                        txt_name.Focus();
                        //check form addproducts is open or no
                        FormCollection fm = Application.OpenForms;
                        foreach (Form item in fm)
                        {
                            if (item.Text == "frm_addproducts")
                            {
                                frm_addproducts.getmain.bindingcatagory();
                                frm_addproducts.getmain.cmb_category.Text = category_name;
                                this.Close();
                                return;
                            }
                        }
                    }
                }
                else
                {
                    if (checkbeforupdate() == false)
                    {
                        MSg.showmsg("أسم الصنف مسجل مسبقا ولا يمكن تكراره ", MSg.msgbutton.ok, MSg.msgicon.information);
                        return;
                    }
                    else
                    {
                        SqlParameter[] p1 = new SqlParameter[2];
                        p1[0] = new SqlParameter("@category_code", category_code);
                        p1[1] = new SqlParameter("@category_name", txt_name.Text);
                        cd.runproc("sp_categoryupdate", p1);
                        bindingcategory();
                        errorProvider1.Dispose();
                        allowupdate = false;
                        allowfilter = true;
                        int filter = gridView1.LocateByValue("category_code", category_code);
                        gridView1.FocusedRowHandle = filter;
                        txt_name.Text = string.Empty;
                        txt_name.Focus();
                    }
                }
            }
        }