private void buttonShowSaleInvoices_Click(object sender, EventArgs e)
        {
            var usedClass = new BasicClass();
            var dt        = new DataTable();

            if (checkBoxDateSearch.Checked)
            {
                SqlParameter[] param = new SqlParameter[4];
                param[0] = new SqlParameter("@InvoiceType", SqlDbType.NVarChar, 250);
                param[1] = new SqlParameter("@beginDate", SqlDbType.NVarChar, 250);
                param[2] = new SqlParameter("@endDate", SqlDbType.NVarChar, 250);
                param[3] = new SqlParameter("@invoiceStatus", SqlDbType.NVarChar, 150);

                param[0].Value = "شراء";
                param[1].Value = dateTimePickerFrom.Text.ToString();
                param[2].Value = dateTimePickerTo.Text.ToString();
                param[3].Value = "RUN";
                dt             = usedClass.selectdata("Report_Select_invoices_usingDates_and_InvoiceType", param);
                dataGridViewSaleGrid.DataSource = dt;
            }
            else
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0]       = new SqlParameter("@InvoiceType", SqlDbType.NChar, 250);
                param[1]       = new SqlParameter("@InvoiceStatus", SqlDbType.NChar, 250);
                param[0].Value = "شراء";
                param[1].Value = "RUN";
                dt             = usedClass.selectdata("Report_SelectAll_Invoices_usingType", param);
                dataGridViewSaleGrid.DataSource = dt;
            }
        }
        private void textBoxFilterSalesGrid_TextChanged(object sender, EventArgs e)
        {
            var usedClass = new BasicClass();
            var dt        = new DataTable();

            if (textBoxFilterSalesGrid.Text != "")
            {
                SqlParameter[] param = new SqlParameter[3];
                param[0]       = new SqlParameter("@InvoiceType", SqlDbType.NChar, 250);
                param[1]       = new SqlParameter("@Filter", SqlDbType.NVarChar, 250);
                param[2]       = new SqlParameter("@InvoiceStatus", SqlDbType.NVarChar, 250);
                param[0].Value = "شراء";
                param[1].Value = textBoxFilterSalesGrid.Text;
                param[2].Value = "RUN";

                dt = usedClass.selectdata("Report_SelectAll_Invoices_usingTypeAndFilter", param);
                dataGridViewSaleGrid.DataSource = dt;
            }
            else
            {
                SqlParameter[] param = new SqlParameter[2];
                param[0]       = new SqlParameter("@InvoiceType", SqlDbType.NChar, 250);
                param[1]       = new SqlParameter("@InvoiceStatus", SqlDbType.NChar, 250);
                param[0].Value = "شراء";
                param[1].Value = "RUN";
                dt             = usedClass.selectdata("Report_SelectAll_Invoices_usingType", param);
                dataGridViewSaleGrid.DataSource = dt;
            }
        }
        private void dataGridViewSaleGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var crp       = new Reports.SaleInvoiceReport();
            var dt        = new DataTable();
            var usedClass = new BasicClass();
            var form      = new PrintForm();

            if (e.ColumnIndex == 0)
            {
                if (e.RowIndex >= 0)
                {
                    string         InvoiceNo = dataGridViewSaleGrid.Rows[e.RowIndex].Cells["ColumnInvoiceNo"].Value.ToString();
                    SqlParameter[] param     = new SqlParameter[1];
                    param[0]       = new SqlParameter("@InvoiceNo", SqlDbType.Int);
                    param[0].Value = int.Parse(InvoiceNo);
                    dt             = usedClass.selectdata("Report_Select_SaleInvoice_usingInvoiceNo", param);
                    TextObject InvoicePayment = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text7"];
                    InvoicePayment.Text = dataGridViewSaleGrid.Rows[e.RowIndex].Cells["ColumnInvoiceStatus"].Value.ToString();
                    TextObject InvoiceType = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text17"];
                    InvoiceType.Text = "قائمة شراء";
                    crp.SetDataSource(dt);
                    form.crystalReportViewer1.ReportSource = crp;
                    form.ShowDialog();
                }
            }
        }
        private void getAllTransaction(string TransactionType, string TransactionDate)
        {
            var dt        = new DataTable();
            var UsedClass = new BasicClass();

            SqlParameter[] param = new SqlParameter[2];
            param[0]       = new SqlParameter("@TransactionType", SqlDbType.NVarChar, 150);
            param[1]       = new SqlParameter("@TransactionDate", SqlDbType.NVarChar, 100);
            param[0].Value = TransactionType;
            param[1].Value = TransactionDate;
            dt             = UsedClass.selectdata("Casher_SelectTransaction", param);
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    var ID           = dt.Rows[i]["TransactionID"].ToString();
                    var currencyType = dt.Rows[i]["CurrecncyType"].ToString();
                    var payment      = Convert.ToDecimal(dt.Rows[i]["Payment"].ToString());
                    var RateTransfer = Convert.ToDecimal(dt.Rows[i]["TransferPercentage"].ToString());
                    var Total        = Convert.ToDecimal(dt.Rows[i]["PaymentTotal"].ToString());
                    var Customer     = dt.Rows[i]["CutomerPaid"].ToString();
                    var Details      = dt.Rows[i]["TransactionDetails"].ToString();
                    dataGridViewMoney.Rows.Add(ID, currencyType, payment, RateTransfer, Total, Customer, Details);
                }
                dataGridViewMoney.ReadOnly = true;
            }
        }
Exemple #5
0
        private void button_showAllCustomers_Click(object sender, EventArgs e)
        {
            var usedClass = new BasicClass();
            var dt        = new DataTable();

            dt = usedClass.selectdata("Reports_Select_Users", null);
            dataGridView_displayCustomers.DataSource = dt;
        }
        private void button_showAllitems_Click(object sender, EventArgs e)
        {
            var usedClass = new BasicClass();
            var dt        = new DataTable();

            dt = usedClass.selectdata("Report_SelectAllitemsWithPrices", null);
            dataGridView_displayitems.DataSource = dt;
        }
        private void textBoxFilteritemsGrid_TextChanged(object sender, EventArgs e)
        {
            var usedClass = new BasicClass();
            var dt        = new DataTable();

            if (textBoxFilteritemsGrid.Text != "")
            {
                SqlParameter[] param = new SqlParameter[1];
                param[0]       = new SqlParameter("@Filter", SqlDbType.NVarChar, 250);
                param[0].Value = textBoxFilteritemsGrid.Text;
                dt             = usedClass.selectdata("Report_SelectAllitemswithPrices_UsingFilter", param);
                dataGridView_displayitems.DataSource = dt;
            }
            else
            {
                dt = usedClass.selectdata("Report_SelectAllitemsWithPrices", null);
                dataGridView_displayitems.DataSource = dt;
            }
        }
Exemple #8
0
        private void textBoxFilteritemsGrid_TextChanged(object sender, EventArgs e)
        {
            var dt        = new DataTable();
            var UsedClass = new BasicClass();

            SqlParameter[] param = new SqlParameter[1];
            param[0] = new SqlParameter("@Filter", SqlDbType.NVarChar);

            if (textBoxFilteritemsGrid.Text != "")
            {
                param[0].Value = textBoxFilteritemsGrid.Text.Trim();
                dt             = UsedClass.selectdata("Reports_SelectUsers_byFilter", param);
                dataGridView_displayCustomers.DataSource = dt;
            }
            else
            {
                dt = UsedClass.selectdata("Reports_Select_Users", null);
                dataGridView_displayCustomers.DataSource = dt;
            }
        }
        private void buttonEnter_Click(object sender, EventArgs e)
        {
            var dt        = new DataTable();
            var UsedClass = new BasicClass();
            var form      = new ControlingForm();

            SqlParameter[] param = new SqlParameter[2];
            param[0]       = new SqlParameter("@UserName", SqlDbType.NVarChar, 250);
            param[1]       = new SqlParameter("@Passwrod", SqlDbType.NVarChar, 50);
            param[0].Value = textBoxUserName.Text;
            param[1].Value = textBoxPassword.Text;
            dt             = UsedClass.selectdata("Login_Select_Users", param);
            if (dt.Rows.Count > 0)
            {
                BasicClass.UserName = dt.Rows[0]["UserName"].ToString();
                BasicClass.Password = dt.Rows[0]["Password"].ToString();
                if (dt.Rows[0]["ReportPermission"].ToString() == "True")
                {
                    form.btn_PurshaceForm.Enabled = true;
                }

                if (dt.Rows[0]["CasherPermission"].ToString() == "True")
                {
                    form.btn_CasherForm.Enabled = true;
                }

                if (dt.Rows[0]["StorePermission"].ToString() == "True")
                {
                    form.btn_PurshaceForm.Enabled  = true;
                    form.btn_ReportingForm.Enabled = true;
                }

                if (dt.Rows[0]["SuperUser"].ToString() == "True")
                {
                    form.btn_CasherForm.Enabled    = true;
                    form.btn_PurshaceForm.Enabled  = true;
                    form.btn_ReportingForm.Enabled = true;
                    form.btn_SettingForm.Enabled   = true;
                }
                if (dt.Rows[0]["ReportPermission"].ToString() == "False" && dt.Rows[0]["SuperUser"].ToString() == "False" && dt.Rows[0]["StorePermission"].ToString() == "False" && dt.Rows[0]["CasherPermission"].ToString() == "False")
                {
                    MessageBox.Show("هذا المستخدم تم حضره من قبل مدير النظام", "MESSAGE");
                    Application.Exit();
                }
                BasicClass.UserName = textBoxUserName.Text.Trim();
                BasicClass.Password = textBoxPassword.Text.Trim();
                form.ShowDialog();
                this.Close();
            }
            else
            {
                MessageBox.Show("خطا في ادخال اسم المعلومات");
            }
        }
        private void get_TransactionID()
        {
            var dt        = new DataTable();
            var UsedClass = new BasicClass();

            dt = UsedClass.selectdata("Casher_select_all_IDs", null);
            if (dt.Rows.Count > 0)
            {
                dataGridViewMoney.Rows[dataGridViewMoney.Rows.Count - 1].Cells["ColumnTransactionID"].Value    = Convert.ToInt64(dt.Rows[0]["TransactionID"].ToString());
                dataGridViewMoney.Rows[dataGridViewMoney.Rows.Count - 1].Cells["ColumnTransactionID"].Selected = true;
            }
            UsedClass.ExecuteCommand("Casher_IncreaseTrnasactionID", null);
        }
Exemple #11
0
        private void checkBox_all_items_without_price_CheckedChanged_1(object sender, EventArgs e)
        {
            if (!checkBox_all_items_without_price.Checked)
            {
                dt.Rows.Clear();
                dataGridViewPrices_displayitems.DataSource = dt;
            }
            else
            {
                dt.Rows.Clear();

                txtprice_searchByitemName.Text          = "";
                dataGridViewPrices_displayitems.Enabled = true;
                SqlParameter[] param = new SqlParameter[1];
                param[0]       = new SqlParameter("@item", SqlDbType.NVarChar, 150);
                param[0].Value = 0;
                dt             = usedClass.selectdata("Cahser_selectItemsPrices", param);
                dataGridViewPrices_displayitems.DataSource = dt;
            }
        }
Exemple #12
0
        private void dataGridViewBuyGridInvoice_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var crp       = new Reports.SaleInvoiceReport();
            var dt        = new DataTable();
            var usedClass = new BasicClass();
            var form      = new PrintForm();

            if (e.ColumnIndex == 0)
            {
                if (e.RowIndex >= 0)
                {
                    int            InvoiceNo = int.Parse(dataGridViewBuyGridInvoice.Rows[e.RowIndex].Cells["ColumnInvoiceNo"].Value.ToString());
                    SqlParameter[] param     = new SqlParameter[1];
                    param[0]       = new SqlParameter("@InvoiceNo", SqlDbType.Int);
                    param[0].Value = InvoiceNo;
                    dt             = usedClass.selectdata("Report_Select_SaleInvoice_usingInvoiceNo", param);
                    if (dt.Rows.Count > 0)
                    {
                        string y = string.Concat(crp.DataDefinition.FormulaFields["ItemQuantity"].Text, "*-1");
                        crp.DataDefinition.FormulaFields["ItemQuantity"].Text = y;
                        TextObject InvoicePayment = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text7"];
                        InvoicePayment.Text = dataGridViewBuyGridInvoice.Rows[e.RowIndex].Cells["ColumnInvoiceStatus"].Value.ToString();
                        TextObject InvoiceType = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text17"];
                        InvoiceType.Text = "قائمة بيع";

                        crp.SetDataSource(dt);
                        form.crystalReportViewer1.ReportSource = crp;
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                }
            }
        }
Exemple #13
0
        private void dataGridView_displayCustomers_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            var        dt           = new DataTable();
            var        UsedClass    = new BasicClass();
            var        crp          = new Reports.CustomerReports_Sale_buy();
            var        form         = new PrintForm();
            TextObject CustomerName = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text2"];

            SqlParameter[] param = new SqlParameter[3];
            param[0] = new SqlParameter("@CustomerName", SqlDbType.NVarChar, 250);
            param[1] = new SqlParameter("@InvoiceType", SqlDbType.NVarChar, 250);
            param[2] = new SqlParameter("@InvoiceStatus", SqlDbType.NVarChar, 250);


            if (e.RowIndex >= 0)
            {
                param[0].Value    = dataGridView_displayCustomers.Rows[e.RowIndex].Cells["ColumnCustomerName"].Value.ToString();
                CustomerName.Text = dataGridView_displayCustomers.Rows[e.RowIndex].Cells["ColumnCustomerName"].Value.ToString();
                switch (e.ColumnIndex)
                {
                case 0:
                    //invoiceType.Text = "فواتير الشراء";
                    param[1].Value = "شراء";
                    param[2].Value = "Run";
                    dt             = UsedClass.selectdata("Reports_Customers_Select_invoicesDepandonInvoiceType_and_invoiceStatus", param);
                    crp.SetDataSource(dt);
                    form.crystalReportViewer1.ReportSource = crp;
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    else
                    {
                        form.ShowDialog();
                    }
                    break;

                case 1:
                    //invoiceType.Text = "فواتير البيع";
                    param[1].Value = "بيع";
                    param[2].Value = "Run";
                    dt             = UsedClass.selectdata("Reports_Customers_Select_invoicesDepandonInvoiceType_and_invoiceStatus", param);
                    crp.SetDataSource(dt);
                    form.crystalReportViewer1.ReportSource = crp;
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    else
                    {
                        form.ShowDialog();
                    }
                    //crp.SetDataSource ( dt );
                    //form.crystalReportViewer1.ReportSource = crp;
                    //form.ShowDialog ();
                    break;

                case 2:
                    //invoiceType.Text = "فواتير المحجوزة";
                    param[1].Value = "بيع";
                    param[2].Value = "Save";
                    dt             = UsedClass.selectdata("Reports_Customers_Select_invoicesDepandonInvoiceType_and_invoiceStatus", param);
                    crp.SetDataSource(dt);
                    form.crystalReportViewer1.ReportSource = crp;
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    else
                    {
                        form.ShowDialog();
                    }

                    break;

                case 3:
                    param[1].Value = "شراء";
                    param[2].Value = "Save";
                    dt             = UsedClass.selectdata("Reports_Customers_Select_invoicesDepandonInvoiceType_and_invoiceStatus", param);
                    crp.SetDataSource(dt);
                    form.crystalReportViewer1.ReportSource = crp;
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    else
                    {
                        form.ShowDialog();
                    }

                    break;

                case 4:
                    SqlParameter[] parameter = new SqlParameter[1];
                    parameter[0]       = new SqlParameter("@CustomerName", SqlDbType.NVarChar, 150);
                    parameter[0].Value = dataGridView_displayCustomers.Rows[e.RowIndex].Cells["ColumnCustomerName"].Value.ToString();
                    dt = UsedClass.selectdata("Reports_Summery", parameter);
                    var Crp2 = new Reports.SummeryReport();
                    Crp2.SetDataSource(dt);
                    form.crystalReportViewer1.ReportSource = Crp2;
                    if (dt.Rows.Count == 0)
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    else
                    {
                        form.ShowDialog();
                    }

                    break;

                default:
                    break;
                }
            }
        }
        private void dataGridView_displayitems_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                var            dt        = new DataTable();
                var            UsedClass = new BasicClass();
                var            crp       = new Reports.ItemsReport();
                var            form      = new PrintForm();
                string         itemName  = dataGridView_displayitems.Rows[e.RowIndex].Cells["ColumnItemName"].Value.ToString();
                SqlParameter[] param     = new SqlParameter[3];
                param[0] = new SqlParameter("@ItemName", SqlDbType.NVarChar, 250);
                param[1] = new SqlParameter("@InvoiceType", SqlDbType.NVarChar, 250);
                param[2] = new SqlParameter("@InvoiceSatus", SqlDbType.NVarChar, 250);
                TextObject invoiceType    = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text11"];
                TextObject itemNameHeader = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text17"];
                switch (e.ColumnIndex)
                {
                case 0:      //Purshace Invoices
                    param[0].Value = itemName;
                    param[1].Value = "شراء";
                    param[2].Value = "Run";
                    dt             = UsedClass.selectdata("Report_Select_items_using_itemName_and_InvoiceType", param);
                    if (dt.Rows.Count > 0)
                    {
                        invoiceType.Text    = "قائمة مشتريات";
                        itemNameHeader.Text = itemName;
                        crp.SetDataSource(dt);
                        form.crystalReportViewer1.ReportSource = crp;
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    break;

                case 1:     //Sale Invoices
                    param[0].Value = itemName;
                    param[1].Value = "بيع";
                    param[2].Value = "Run";
                    dt             = UsedClass.selectdata("Report_Select_items_using_itemName_and_InvoiceType", param);
                    if (dt.Rows.Count > 0)
                    {
                        invoiceType.Text    = "قائمة مبيعات";
                        itemNameHeader.Text = itemName;
                        crp.SetDataSource(dt);
                        form.crystalReportViewer1.ReportSource = crp;
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    break;

                case 2:     //Save Invoices
                    param[0].Value = itemName;
                    param[1].Value = "بيع";
                    param[2].Value = "SAVE";
                    dt             = UsedClass.selectdata("Report_Select_items_using_itemName_and_InvoiceType", param);
                    if (dt.Rows.Count > 0)
                    {
                        invoiceType.Text    = "قائمة مبيعات";
                        itemNameHeader.Text = itemName;
                        crp.SetDataSource(dt);
                        form.crystalReportViewer1.ReportSource = crp;
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    break;

                case 3:
                    param[0].Value = itemName;
                    param[1].Value = "شراء";
                    param[2].Value = "SAVE";
                    dt             = UsedClass.selectdata("Report_Select_items_using_itemName_and_InvoiceType", param);
                    if (dt.Rows.Count > 0)
                    {
                        invoiceType.Text    = "قائمة مبيعات";
                        itemNameHeader.Text = itemName;
                        crp.SetDataSource(dt);
                        form.crystalReportViewer1.ReportSource = crp;
                        form.ShowDialog();
                    }
                    else
                    {
                        MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE");
                    }
                    break;

                default:
                    break;
                }
            }
        }