private void buttonPrintitemsGrid_Click(object sender, EventArgs e) { var crp = new Reports.itemsGridReport(); var form = new PrintForm(); if (dataGridView_displayitems.Rows.Count > 0) { crp.SetDataSource(dataGridView_displayitems.DataSource); form.crystalReportViewer1.ReportSource = crp; form.ShowDialog(); } else { MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE"); } }
private void buttonPrintBuyGrid_Click(object sender, EventArgs e) { var crp = new Reports.InvoicesGridReport(); var form = new PrintForm(); if (dataGridViewBuyGridInvoice.Rows.Count > 0) { crp.SetDataSource(dataGridViewBuyGridInvoice.DataSource); TextObject InvoiceType = (TextObject)crp.ReportDefinition.Sections["Section1"].ReportObjects["Text1"]; InvoiceType.Text = "تقرير شامل لكل قوائم البيع مع كافة تفاصيل"; form.crystalReportViewer1.ReportSource = crp; form.ShowDialog(); } else { MessageBox.Show("لا توجد بيانات لعرضها", "MESSAGE"); } }
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"); } } } }
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; } } }