private void btnSave_Click(object sender, EventArgs e) { if (click == 0) { Save(); click += 1; } else { if (MessageBox.Show("تم الحفظ بالفعل , هل تريد طباعة الفاتورة ؟ ", "الحفظ", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes) { try { Report.invoice rpt = new Report.invoice(); Report.ReportForm frm = new Report.ReportForm(); rpt.SetDataSource(order.printinvoice(Convert.ToInt32(this.txtID.Text))); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); //frm.crystalReportViewer1.PrintReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } }
private void button2_Click(object sender, EventArgs e) { BL.Reports.FullStatement FullState = new BL.Reports.FullStatement(); Report.StatOfAccount rpt = new Report.StatOfAccount(); Report.ReportForm frm = new Report.ReportForm(); rpt.SetDataSource(FullState.GetStatement(this.CustomerNo)); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); }
private void bunifuThinButton21_Click_1(object sender, EventArgs e) { try { Report.ReportForm frm = new Report.ReportForm(); Report.PrintDebts rpt = new Report.PrintDebts(); rpt.SetDataSource(DRpt.GetDebtInfoforPrint(id)); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); //frm.crystalReportViewer1.PrintReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnPrint_Click(object sender, EventArgs e) { try { Report.UnpaidDocuments rpt = new Report.UnpaidDocuments(); Report.ReportForm frm = new Report.ReportForm(); rpt.SetDataSource(doc.unPaidDoc(Convert.ToInt32(id))); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); frm.crystalReportViewer1.PrintReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnPrint_Click(object sender, EventArgs e) { try { Report.invoice rpt = new Report.invoice(); Report.ReportForm frm = new Report.ReportForm(); rpt.SetDataSource(order.printinvoice(Convert.ToInt32(this.txtID.Text))); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); //frm.crystalReportViewer1.PrintReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void BtnAllDebt_Click(object sender, EventArgs e) { try { Report.ReturnAllDebt rpt = new Report.ReturnAllDebt(); Report.ReportForm frm = new Report.ReportForm(); rpt.SetDataSource(debt.ReturnAllDebt()); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); //frm.crystalReportViewer1.PrintReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void bunifuThinButton24_Click(object sender, EventArgs e) { //for (int i = 0; i < this.invoDataGrid1.Rows.Count - 1; i++) //{ try { Report.unpaidInvoice rpt = new Report.unpaidInvoice(); Report.ReportForm frm = new Report.ReportForm(); rpt.SetDataSource(order.notPaidInCash(Convert.ToInt32(id))); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); //frm.crystalReportViewer1.PrintReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } //} }
private void BtnPrintSatatentByDate_Click(object sender, EventArgs e) { BL.Reports.SearchStatement SearchState = new BL.Reports.SearchStatement(); //Report.statOdAccByDate rpt = new Report.statOdAccByDate(); //Report.ReportForm frm = new Report.ReportForm(); //DataSet ds = new DataSet(); //ds.Tables.Add(SearchState.GetStatementPeriod(this.CustomerNo, this.DateTime1.Value.Date, this.DateTime2.Value.Date)); ////ds.Tables[0].Merge(SearchState.GetStatementPeriod(this.CustomerNo, this.DateTime1.Value.Date, this.DateTime2.Value.Date)); //rpt.SetDataSource(ds.Tables[0]); //frm.crystalReportViewer1.ReportSource = rpt; //frm.ShowDialog(); //BL.Reports.SearchStatement SearchState = new BL.Reports.SearchStatement(); BL.Customer.statementOFAcount soa = new BL.Customer.statementOFAcount(); Report.SStatement rpt = new Report.SStatement(); Report.ReportForm frm = new Report.ReportForm(); //DataSet ds = new DataSet(); //ds.Tables.Add(SearchState.GetStatementPeriod(this.CustomerNo, this.DateTime1.Value.Date, this.DateTime2.Value.Date)); //ds.Tables[0].Merge(SearchState.GetStatementPeriod(this.CustomerNo, this.DateTime1.Value.Date, this.DateTime2.Value.Date)); //rpt.SetDataSource(soa.getOrderOfCustomerP(this.CustomerNo,this.DateTime1.Value,DateTime2.Value)); rpt.SetDataSource(SearchState.GetStatementPeriod(this.CustomerNo, this.DateTime1.Value, DateTime2.Value)); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); }
public void Save() { try { txtID.Text = order.getIDforInvoice().Rows[0][0].ToString(); int rAmount; int.TryParse(txtAmountReceived.Text, out rAmount); int total; int.TryParse(txtTotal.Text, out total); if (txtName.Text == string.Empty) { MessageBox.Show("الرجاء ادخال اسم الزبون"); } else if (txtAmountReceived.Text == string.Empty) { MessageBox.Show("الرجاء ادخال المبلغ الواصل"); } else if ((totalMoney - rAmount) == 0) // If the invoice is paid { //insert the informations of invoive order.add_order(Convert.ToInt32(txtCusID.Text), txtID.Text, txtNote.Text, Convert.ToDouble(txtTotal.Text), Convert.ToDouble(rAmount), "YES", bunifuDatepicker1.Value, "Service"); //insert the detiles of invoive for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { order.add_order_detail(Convert.ToInt32(0), dataGridView1.Rows[i].Cells[0].Value.ToString(), txtID.Text , Convert.ToInt32(dataGridView1.Rows[i].Cells[2].Value), Convert.ToDouble(dataGridView1.Rows[i].Cells[1].Value) , Convert.ToDouble(dataGridView1.Rows[i].Cells[3].Value) ); } if (MessageBox.Show("تم الحفظ بنجاح هل تريد طباعة الفاتورة ", "الطباعه", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { Report.invoice rpt = new Report.invoice(); Report.ReportForm frm = new Report.ReportForm(); rpt.SetDataSource(order.printinvoice(Convert.ToInt32(this.txtID.Text))); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); //frm.crystalReportViewer1.PrintReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } //if there are debt else if ((totalMoney - rAmount) > 1) { //insert the informations of invoive order.add_order(Convert.ToInt32(txtCusID.Text), txtID.Text, txtNote.Text, Convert.ToDouble(txtTotal.Text), Convert.ToDouble(rAmount), "NO", bunifuDatepicker1.Value, "Service"); //insert the detiles of invoive for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { order.add_order_detail(Convert.ToInt32(0), dataGridView1.Rows[i].Cells[0].Value.ToString(), txtID.Text , Convert.ToInt32(dataGridView1.Rows[i].Cells[2].Value), Convert.ToDouble(dataGridView1.Rows[i].Cells[1].Value) , Convert.ToDouble(dataGridView1.Rows[i].Cells[3].Value) ); } BL.debtClass debt = new BL.debtClass(); debt.add_debt_detail(txtID.Text, Convert.ToInt32(txtCusID.Text) , Convert.ToDouble(totalMoney - rAmount)); if (MessageBox.Show("تم حفظ الفاتورة و الدين هل تريد طباعة الفاتورة", "الطباعه", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { Report.invoice rpt = new Report.invoice(); Report.ReportForm frm = new Report.ReportForm(); rpt.SetDataSource(order.printinvoice(Convert.ToInt32(this.txtID.Text))); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); //frm.crystalReportViewer1.PrintReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } //// set Seasonal_revenue from invoice //rpt.set_Seasonal_revenue_from_invoice(totalMoney); //// coumput Prices of articles //for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) //{ // Seasonal_disbursements += Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value) * // Convert.ToDouble(rpt.get_purchasing_price(Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value)).Rows[0][0]); //} //// set Seasonal_disbursements //rpt.set_seasonal_disbursements_invo_sal_dis(Seasonal_disbursements); //Seasonal_disbursements = 0.0; BL.CashBox.Months mnth = new BL.CashBox.Months(); mnth.set_new_month(); DataTable LastMonth = mnth.sel_last_month(); BL.CashBox.BoxInsertion insrt = new BL.CashBox.BoxInsertion(); insrt.SetCash(Convert.ToInt32(txtAmountReceived.Text), "Service", this.bunifuDatepicker1.Value, this.txtID.Text, LastMonth.Rows[0][0].ToString()); txtID.Text = order.getIDforInvoice().Rows[0][0].ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void btnSave_Click(object sender, EventArgs e) { try { int rAmount; int.TryParse(txtAmountReceived.Text, out rAmount); int total; int.TryParse(txtTotal.Text, out total); if (txtName.Text == string.Empty) { MessageBox.Show("الرجاء ادخال اسم الزبون"); } else if (txtAmountReceived.Text == string.Empty) { MessageBox.Show("الرجاء ادخال المبلغ الواصل"); } else if ((totalMoney - rAmount) == 0) // If the invoice is paid { //insert the informations of invoive ord.add_order(Convert.ToInt32(txtCusID.Text), txtID.Text, txtNote.Text, Convert.ToDouble(txtTotal.Text), Convert.ToDouble(rAmount), "YES", bunifuDatepicker1.Value); //insert the detiles of invoive for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { ord.add_order_detail(Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value), dataGridView1.Rows[i].Cells[1].Value.ToString(), Convert.ToInt32(txtID.Text) , Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value), Convert.ToDouble(dataGridView1.Rows[i].Cells[2].Value) , Convert.ToDouble(dataGridView1.Rows[i].Cells[4].Value) ); } if (MessageBox.Show("تم الحفظ بنجاح هل تريد طباعة الفاتورة ", "الطباعه", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { Report.invoice rpt = new Report.invoice(); Report.ReportForm frm = new Report.ReportForm(); rpt.SetDataSource(ord.printinvoice(Convert.ToInt32( ord.getLastInvoiceForPrint().Rows[0][0]))); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); //frm.crystalReportViewer1.PrintReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } //if there are debt else if ((totalMoney - rAmount) > 1) { //insert the informations of invoive ord.add_order(Convert.ToInt32(txtCusID.Text), txtID.Text, txtNote.Text, Convert.ToDouble(txtTotal.Text), Convert.ToDouble(rAmount), "NO", bunifuDatepicker1.Value); //insert the detiles of invoive for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { ord.add_order_detail(Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value), dataGridView1.Rows[i].Cells[1].Value.ToString(), Convert.ToInt32(txtID.Text) , Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value), Convert.ToDouble(dataGridView1.Rows[i].Cells[2].Value) , Convert.ToDouble(dataGridView1.Rows[i].Cells[4].Value) ); } BL.debtClass debt = new BL.debtClass(); debt.add_debt_detail(Convert.ToInt32(txtID.Text), Convert.ToInt32(txtCusID.Text) , Convert.ToDouble(totalMoney - rAmount)); if (MessageBox.Show("تم حفظ الفاتورة و الدين هل تريد طباعة الفاتورة", "الطباعه", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { Report.invoice rpt = new Report.invoice(); Report.ReportForm frm = new Report.ReportForm(); rpt.SetDataSource(ord.printinvoice(Convert.ToInt32( ord.getLastInvoiceForPrint().Rows[0][0]))); frm.crystalReportViewer1.ReportSource = rpt; frm.ShowDialog(); //frm.crystalReportViewer1.PrintReport(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } // set Seasonal_revenue from invoice rpt.set_Seasonal_revenue_from_invoice(totalMoney); // coumput Prices of articles for (int i = 0; i < dataGridView1.Rows.Count - 1; i++) { Seasonal_disbursements += Convert.ToInt32(dataGridView1.Rows[i].Cells[3].Value) * Convert.ToDouble(rpt.get_purchasing_price(Convert.ToInt32(dataGridView1.Rows[i].Cells[0].Value)).Rows[0][0]); } // set Seasonal_disbursements rpt.set_seasonal_disbursements_invo_sal_dis(Seasonal_disbursements); Seasonal_disbursements = 0.0; } catch (Exception ex) { MessageBox.Show(ex.Message); } }