private void btnPrint_Click(object sender, EventArgs e) { if (dgvPurchase.Rows.Count > 0 || dgvSales.Rows.Count > 0) { try { long id = 0; string selectedValue = string.IsNullOrEmpty(cboProduct.ValueMember) ? string.Empty : Convert.ToString(((DataRowView)(cboProduct.SelectedItem)).Row[cboProduct.ValueMember]);//Convert.ToString( cbSelect.SelectedValue); long.TryParse(selectedValue, out id); ReportInfo info = new ReportInfo(); info.Report = Report.ProductDailySalePurchaseSummaryReport ; info.StartDate = dtpStartDate.Value.Date; info.EndDate = dtpEndDate.Value.Date; if (chkAllDates.Checked) { info.StartDate = null; info.EndDate = null; } info.Options = selectedValue; Report_Viewer viewer = new Report_Viewer(info); viewer.ShowDialog(); } catch (Exception ex) { ExceptionLog.LogException(Modules.SalesPurchaseReportControl, "btnPrint", ex, "SalePurchaseReportControl Exception"); } } else { MessageBox.Show("Error ! No Record Found" + Environment.NewLine + "Please Made a valid transactions for print", "Supplier Transaction", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnPrint_Click(object sender, EventArgs e) { if (dgvStock.Rows.Count > 0) { ReportInfo info = new ReportInfo(); info.Report = Report.Stock; info.Options = GetFilter(true); ReceiptViewer print = new ReceiptViewer(info); print.ShowDialog(); } else if (dgvStock.Rows.Count <= 0) { MessageBox.Show("No Record Found" + Environment.NewLine + "Please make sure that Stock is not empty", "Stock Print Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void btnCustomerListPrint_Click(object sender, EventArgs e) { if (Status_Customer == 0 && dgvData.Rows.Count > 0) { string options = "0,0"; if (chkOnlyActive.Checked) options = "1,0"; ReportInfo info = new ReportInfo() { Options = options, Report = Report.CompanyCustomerList }; ReceiptViewer print = new ReceiptViewer(info); print.ShowDialog(); } else { if (Status_Customer != 0) { Common.ShowInvlaidCodeMessage(cbSearchByCode, Modules.Customer); } else if (dgvData.Rows.Count == 0) { MessageBox.Show("Error ! No Record Found" + Environment.NewLine + "Sorry No Customer Record Found for Print", "Customer Code", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
void MakePayment() { decimal amount = 0; string companyId = string.IsNullOrEmpty(cbCustomersSuppliers.ValueMember) ? string.Empty : cbCustomersSuppliers.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCustomersSuppliers.SelectedItem)).Row[cbCustomersSuppliers.ValueMember]);//cbCustomers.SelectedValue.ToString(); if (!string.IsNullOrEmpty(companyId) && companyId != "0") { if (decimal.TryParse(txtAmount.Text, out amount) & amount != 0) { if (Common.IsMatch(txtAmount.Text)) { if (!string.IsNullOrEmpty(txtComments.Text)) { string strAmount = txtAmount.Text; if (rbDebit.Checked) strAmount = "-" + strAmount; long TransactioId = 0; if (IsCustomer) TransactioId = customer.MakePayment(companyId, Common.FormateDateForDB(dtpDate.Value),strAmount, txtComments.Text); else TransactioId = company.MakePayment(companyId, Common.FormateDateForDB(dtpDate.Value), strAmount, txtComments.Text); if (TransactioId > 0) { //ResetPayment(); string msg = "Payment made successfully." + Environment.NewLine + "Do you want to print?"; if (MessageBox.Show(msg, "Payment Successfully Completed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { ReportInfo info = new ReportInfo() { Id = TransactioId, Report = Report.Payment, Options = "1" }; ReceiptViewer print = new ReceiptViewer(info); print.ShowDialog(); } } else { //MessageBox.Show("Operation could not be completed."); MessageBox.Show("Operation could not be completed", "Operation Failed!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Comments are Mendatory", "Comments ", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtComments.Focus(); } } else { //MessageBox.Show("Comments are Mendatory."); MessageBox.Show("Please Enter the Correct formate for balance" + Environment.NewLine + "It only allow maxmuim two digit decimal like 99.99", "Format Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { //MessageBox.Show("InValid Amount.Please specify a valid amount."); MessageBox.Show("InValid Amount.Please specify a valid amount.", "Invalid Amount", MessageBoxButtons.OK, MessageBoxIcon.Error); txtAmount.Text = "0.00"; txtAmount.Focus(); } } else { if (IsCustomer) MessageBox.Show("Please select a Customer to make a payment.", "Select Customer", MessageBoxButtons.OK, MessageBoxIcon.Error); else MessageBox.Show("Please select a Supplier to make a payment.", "Select Supplier", MessageBoxButtons.OK, MessageBoxIcon.Error); cbCustomersSuppliers.Focus(); } }
public ReceiptViewer(ReportInfo info) { InitializeComponent(); localReportInfo = info; }
private void printToolStripMenuItem_Click(object sender, EventArgs e) { if (dgvReceipts.SelectedRows.Count > 0) { long Id = Convert.ToInt64(dgvReceipts.SelectedRows[0].Cells["Id"].Value); if (Id > 0) { ReportInfo info = new ReportInfo(); info.Id = Id; info.Report = Report.Receipt; ReceiptViewer print = new ReceiptViewer(info); print.ShowDialog(); } } }
private void printToolStripMenuItem1_Click(object sender, EventArgs e) { if (dgvTransactions.SelectedRows.Count > 0) { long Id = Convert.ToInt64(dgvTransactions.SelectedRows[0].Cells["TransactionId"].Value); if (Id > 0) { ReportInfo info = new ReportInfo() { Id = Id, Report = Report.Payment, Options = "1" }; ReceiptViewer print = new ReceiptViewer(info); print.ShowDialog(); } } }
private void btnPrint_Click(object sender, EventArgs e) { if (Status_Customer == 0 && dgvTransactions.Rows.Count > 0) { try { long id; string selectedValue = string.IsNullOrEmpty(cbCustomersTransaction.ValueMember) ? string.Empty : cbCustomersTransaction.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCustomersTransaction.SelectedItem)).Row[cbCustomersTransaction.ValueMember]);//Convert.ToString(cbCustomersTransaction.SelectedValue); long.TryParse(selectedValue, out id); ReportInfo reportInfo = new ReportInfo(); reportInfo.Report = Report.CustomerTransactionsReport; if (chkAllTransactions.Checked) { reportInfo.EndDate = null; reportInfo.StartDate = null; } else { reportInfo.EndDate = dtpTo.Value.Date; reportInfo.StartDate = dtpFrom.Value.Date; } reportInfo.Id = id; EBusiness.Reports.Report_Viewer print = new Reports.Report_Viewer(reportInfo); print.ShowDialog(); } catch (Exception exe) { ExceptionLog.LogException(Modules.TransactionReportControl, "Print Customer Report", exe, "Customer Transaction Report Error"); } } else { if (dgvTransactions.Rows.Count == 0) { MessageBox.Show("Error ! No Record Found" + Environment.NewLine + "Please made a Valid Transaction for Print", "Customer Code", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (Status_Customer != 0) { Common.ShowInvlaidCodeMessage(cbCustomersTransaction, Modules.Customer); } } }
void Save() { if (dgvItems.Rows.Count > 0) { string CompanyId = string.IsNullOrEmpty(cbCompanies.ValueMember) ? string.Empty : cbCompanies.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCompanies.SelectedItem)).Row[cbCompanies.ValueMember]);//Convert.ToString(cbCompanies.SelectedValue); string GrandTotal = lblGrandTotal.Text; string Discount = txtExpenses.Text; string Payment = txtPayment.Text; string Arrears = lblArrears.Text; DataTable dt = item.SelectEmptyInvoiceDetailTable(); foreach (DataGridViewRow row in dgvItems.Rows) { DataRow dr = dt.NewRow(); dr["Id"] = row.Cells["colSerial"].Value; dr["ItemId"] = row.Cells["colItemId"].Value; dr["PurchasePrice"] = row.Cells["colPrice"].Value; dr["Quantity"] = row.Cells["colQuantity"].Value; dr["Total"] = row.Cells["colTotal"].Value; dr["Discount"] = row.Cells["colDiscount"].Value; dr["GrandTotal"] = row.Cells["colGrandTotal"].Value; dt.Rows.Add(dr); } ReportInfo reportInfo = new ReportInfo(); long Id = order.SaveOrder(CompanyId, GrandTotal, Discount, Payment, Arrears, txtComments.Text, dtDeliveryDate.Value, dt, false); MessageBox.Show("Order Saved Sucessfully.....","Save Successfully" ,MessageBoxButtons.OK,MessageBoxIcon.Information); reportInfo.Id = Id; reportInfo.Report = Report.Order; ReceiptViewer receipt = new ReceiptViewer(reportInfo); receipt.ShowDialog(); ResetInvoice(); } else { MessageBox.Show("Error !No Item for Invoice...","Error" ,MessageBoxButtons.OK,MessageBoxIcon.Error); } }
//ITEM LIST PRINT BUTTON private void btnItemListPrint_Click(object sender, EventArgs e) { ReportInfo info = null; if (rbAll.Checked) info = new ReportInfo() { Report = Report.ItemList, Options = chkitemView.Checked ? "1" : "0" }; else { string CompanyId = cbItemSearch.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbItemSearch.SelectedItem)).Row[cbItemSearch.ValueMember]); info = new ReportInfo() { Report = Report.ItemListBySupplier, Options = CompanyId }; } ReceiptViewer print = new ReceiptViewer(info); print.ShowDialog(); }
private void Report_Viewer_Load(object sender, EventArgs e) { if (localReportInfo == null) { localReportInfo = new ReportInfo(); localReportInfo.Report = Report.ProductDailySalePurchaseSummaryReport; localReportInfo.StartDate = DateTime.Now.AddMonths(-1); localReportInfo.EndDate = DateTime.Now; localReportInfo.Id = 5; localReportInfo.Options = "1"; } LoadReport(); this.reportViewer1.RefreshReport(); }
public Report_Viewer(ReportInfo reportInfo) { InitializeComponent(); localReportInfo = reportInfo; }
private void btnCompanyListPrint_Click(object sender, EventArgs e) { if (Status_Supplier == 0) { if (dgvData.Rows.Count > 0) { string options = "0,1"; if (chkOnlyActive.Checked) options = "1,1"; ReportInfo info = new ReportInfo() { Options = options, Report = Report.CompanyCustomerList }; ReceiptViewer print = new ReceiptViewer(info); print.ShowDialog(); } else if (dgvData.Rows.Count == 0) { MessageBox.Show("Error! No Record Found." + Environment.NewLine + "Please Made a valid transactions for print", "Supplier Transaction", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (Status_Supplier != 0) { Common.ShowInvlaidCodeMessage(cbSearchByCode, Modules.Supplier); } }
void MakePayment() { try { decimal amount = 0; string companyId = string.IsNullOrEmpty(cbCompanies.ValueMember) ? string.Empty : cbCompanies.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCompanies.SelectedItem)).Row[cbCompanies.ValueMember]);//= cbCompanies.SelectedValue.ToString(); string companyName = string.IsNullOrEmpty(cbCompanies.ValueMember) ? string.Empty : cbCompanies.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCompanies.SelectedItem)).Row[cbCompanies.DisplayMember]);//= cbCompanies.SelectedValue.ToString(); if (!string.IsNullOrEmpty(companyId)) { if (decimal.TryParse(txtAmount.Text, out amount) & amount != 0) { if (!string.IsNullOrEmpty(txtComments.Text)) { string strAmount = txtAmount.Text; if (rbDebit.Checked) strAmount = "-" + strAmount; long TransactioId = comp.MakePayment(companyId, Common.FormateDateForDB(dtpDate.Value), strAmount, txtComments.Text); if (TransactioId > 0) { UserLog.Log(Common.CURRENT_USER.Id, rbCredit.Checked ? UserActions.Made_Credit_Payment_To_Supplier : UserActions.Made_Debit_Payment_To_Supplier, string.Format("Supplier : {0} , Amount : {1}, TransactionId : {2}", companyName, strAmount, TransactioId)); ResetPayment(); lblTransactionNo.Text = Common.GetNextId(Modules.Payment).ToString(); string msg = "Payment made successfully." + Environment.NewLine + "Do you want to print?"; if (MessageBox.Show(msg, "Payment Successfully Completed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { ReportInfo info = new ReportInfo() { Id = TransactioId, Report = Report.Payment, Options = "0" }; ReceiptViewer print = new ReceiptViewer(info); print.ShowDialog(); } } else { MessageBox.Show("Operation could not be completed.", "Could not compete", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Comments are Mendatory.", "Comments are Mendatory", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtComments.Focus(); } } else { MessageBox.Show("InValid Amount.Please specify a valid amount.", "Invalid Amount", MessageBoxButtons.OK, MessageBoxIcon.Error); txtAmount.Text = "0.00"; txtAmount.Focus(); } } else { MessageBox.Show("Please select a Supplier to make a payment.", "Select Supplier", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { throw ex; } }
void Save() { if (dgvItems.Rows.Count > 0) { string CompanyId = string.IsNullOrEmpty(cbCompanies.ValueMember) ? string.Empty : cbCompanies.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCompanies.SelectedItem)).Row[cbCompanies.ValueMember]);//Convert.ToString(cbCompanies.SelectedValue); string CompanyName = string.IsNullOrEmpty(cbCompanies.ValueMember) ? string.Empty : cbCompanies.SelectedItem == null ? string.Empty : Convert.ToString(((DataRowView)(cbCompanies.SelectedItem)).Row[cbCompanies.DisplayMember]);//Convert.ToString(cbCompanies.SelectedValue); string InvoiceNo = txtInvoiceNo.Text; if (string.IsNullOrEmpty(InvoiceNo)) { MessageBox.Show("Error! Invoice No. is Empty." + Environment.NewLine + "Please Enter a Invoice Number", "Invoice Number", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (item.IsDuplictaeInvoiceNo(InvoiceNo, CompanyId)) { MessageBox.Show(string.Format("Error! Invoice No [{0}] already exists for Supplier [{1}]." + Environment.NewLine + "Please Enter a valid Invoice Number", InvoiceNo, cbCompanies.Text), "Invoice Number", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string GrandTotal = lblGrandTotal.Text; string Discount = txtExpenses.Text; string Payment = txtPayment.Text; string Arrears = lblArrears.Text; DataTable dt = item.SelectEmptyInvoiceDetailTable(); foreach (DataGridViewRow row in dgvItems.Rows) { DataRow dr = dt.NewRow(); dr["Id"] = row.Cells["colSerial"].Value; dr["ItemId"] = row.Cells["colItemId"].Value; dr["PurchasePrice"] = row.Cells["colPrice"].Value; dr["Quantity"] = row.Cells["colQuantity"].Value; dr["Total"] = row.Cells["colTotal"].Value; dr["Discount"] = row.Cells["colDiscount"].Value; dr["GrandTotal"] = row.Cells["colGrandTotal"].Value; dt.Rows.Add(dr); } ReportInfo reportInfo = new ReportInfo(); long OrderNo = 0; long.TryParse(txtOrderNo.Text, out OrderNo); long Id = item.SaveInvoice(CompanyId, InvoiceNo, GrandTotal, Discount, Payment, Arrears, txtComments.Text, OrderNo.ToString(), dt, chkIsReturn.Checked); if (Id > 0) { UserLog.Log(Common.CURRENT_USER.Id, chkIsReturn.Checked ? UserActions.Made_A_Return_Invoice : UserActions.Made_A_Purchase_Invoice, string.Format("Supplier : {0} , Invoice No : {1}", CompanyName, InvoiceNo)); MessageBox.Show("Invoice Saved Sucessfully.....", "Saved Successfully", MessageBoxButtons.OK, MessageBoxIcon.Information); reportInfo.Id = Id; reportInfo.Report = Report.Invoice; ReceiptViewer receipt = new ReceiptViewer(reportInfo); receipt.ShowDialog(); ResetInvoice(); } } else { MessageBox.Show("Error! No Item for Invoice...", "No Item", MessageBoxButtons.OK, MessageBoxIcon.Error); } }