private void mnuUserRegister_Click(object sender, EventArgs e) { try { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptUserRegister.rpt")) { //dtblUser.TableName = "UserRegister"; //dtblUser.WriteXmlSchema(@"D:\Project_Info\Report\UserRegister.xsd"); DataView DVReport; DVReport = dtblUser.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptUserRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "User Register", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "User Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("User - Register", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } }
private void rptExpenseRegister_Click(object sender, EventArgs e) { try { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptExpenseRegister.rpt")) { //dtblExpense .TableName = "PORegister"; //dtblExpense.WriteXmlSchema(@"D:\Report\PORegister.xsd"); DataView DVReport; DVReport = dtblExpense.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptExpenseRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Expense Register", true, true, true, true, false, true, true, false, false, false, true); //rptDoc.SetParameterValue("pFromDate", txtFromDate.Text); //rptDoc.SetParameterValue("pToDate", txtTodate.Text); //if (DataValidator.IsDate(txtFromDate.Text.Trim()) && DataValidator.IsDate(txtTodate.Text.Trim())) //{ // rptDoc.SetParameterValue("pPassDate", true); //} //else //{ // rptDoc.SetParameterValue("pPassDate", false); //} Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Expense Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Expense - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { try { if (cmbreports.SelectedIndex == 1) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptPurchaseIndentRegister.rpt")) { //dtblLead.TableName = "LeadRegister"; //dtblLead.WriteXmlSchema(@"E:\SharedFile\LeadRegister.xsd"); DataView DVReport; DVReport = dtblLead.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptPurchaseIndentRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "rptPurchaseIndent Register", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "rptPurchaseIndent Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath."); } } cmbreports.SelectedIndex = 0; } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("User - Register", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { DataTable dtReport = new DataTable(); dtReport = objList.ListOfRecord("rpt_CustomerReceipt", null, "CustomerPayment - Report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptCustomerPaymentRegister.rpt")) { //ObjDataTable.TableName = "PaymentRegister"; //ObjDataTable.WriteXmlSchema(@"D:\PaymentRegister.xsd"); DataView DVReport; DVReport = ObjDataTable.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptCustomerPaymentRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Customer Payment Register", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Customer Payment Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Customer Payment - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 2) { try { DataTable dtReport = new DataTable(); NameValueCollection PARA1 = new NameValueCollection(); PARA1.Add("@i_ReceiptID", dgvCustomerPayment.CurrentRow.Cells["ReceiptID"].Value.ToString()); dtReport = objList.ListOfRecord("rpt_Customer_Payment_Receipt", PARA1, "CustomerPayment - Report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptCustomerPendingPaymentReceipt.rpt")) { //dtReport.TableName = "PaymentReceipt"; //dtReport.WriteXmlSchema(@"D:\PaymentReceipt.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptCustomerPendingPaymentReceipt.rpt"); CurrentUser.AddReportParameters(rptDoc, dtReport, "Payment Receipt", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Payment Receipt - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Customer Payment - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } cmbreports.SelectedIndex = 0; }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptCustomerRegister.rpt")) { //dtblCustomer.TableName = "CustomerRegister"; //dtblCustomer.WriteXmlSchema(@"D:\report\CustomerRegister.xsd"); DataView DVReport; DVReport = dtblLead.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptCustomerRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Customer Register", true, true, true, true, false, true, false, false, false, false, false); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Customer Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Customer- Register", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } if (cmbreports.SelectedIndex == 2) { try { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptCustomerMailingLabel.rpt")) { //dtblCustomer.TableName = "CustomerRegister"; //dtblCustomer.WriteXmlSchema(@"D:\report\CustomerRegister.xsd"); DataView DVReport; DVReport = dtblLead.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptCustomerMailingLabel.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Customer Mailing Label", true, true, true, true, false, true, false, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Customer Mailing Label - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Customer- Mailing Label", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } //------------------------ //try //{ // if (cmbreports.SelectedIndex > 0) // { // if (System.IO.File.Exists(CurrentUser.ReportPath + "rptLeadRegister.rpt")) // { // //dtblLead.TableName = "LeadRegister"; // //dtblLead.WriteXmlSchema(@"E:\SharedFile\LeadRegister.xsd"); // DataView DVReport; // DVReport = dtblLead.DefaultView; // DVReport.RowFilter = StrFilter; // CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); // rptDoc.Load(CurrentUser.ReportPath + "rptLeadRegister.rpt"); // CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Inquiry Register", true, true, true, true, false, true, true, false, false, false, true); // Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); // fRptView.Text = "Inquiry Register - [Page Size: A4]"; // fRptView.crViewer.ReportSource = rptDoc; // fRptView.ShowDialog(); // } // else // { // MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath."); // } // } // cmbreports.SelectedIndex = 0; //} //catch (Exception exc) //{ // Utill.Common.ExceptionLogger.writeException("User - Register", exc.StackTrace); // MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); //} }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_FYID", CurrentUser.FYID.ToString()); dtReport = objList.ListOfRecord("rpt_SalesInvoiceRegister", para, "SalesInvoice - Report"); DataView DVReport; DVReport = dtReport.DefaultView; DVReport.RowFilter = StrFilter; if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptSalesInvoiceRegister.rpt")) { //dtblSalesInvoice .TableName = "PORegister"; //dtblSalesInvoice.WriteXmlSchema(@"D:\Report\PORegister.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptSalesInvoiceRegister.rpt"); //rptDoc.BlankRecords.Height -= (ds.tblItems.Count * 136); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Sales Invoice Register", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Sales Invoice Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Sales Invoice - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 2) { rptSalesInvoice_Click(sender, e); } else if (cmbreports.SelectedIndex == 3) { if (dgvSalesInvoice.CurrentRow.Cells["SalesCode"].Value.ToString().Substring(0, 2) == "RI") { salesInvoiceToolStripMenuItem_Click(sender, e); } else { MessageBox.Show("Retail Invoice not generated for this sale."); } } else if (cmbreports.SelectedIndex == 4) { if (dgvSalesInvoice.CurrentRow.Cells["SalesCode"].Value.ToString().Substring(0, 2) == "TI") { taxInvoiceToolStripMenuItem_Click(sender, e); } else { MessageBox.Show("Tax Invoice not generated for this sale."); } } //////////////////////// else if (cmbreports.SelectedIndex == 5) { if (dgvSalesInvoice.CurrentRow.Cells["SalesCode"].Value.ToString().Substring(0, 2) == "ES") { try { DataTable dt = new DataTable(); LogoBind(dt); if (dgvSalesInvoice.CurrentRow != null) { DataTable dtTNC = new DataTable(); NameValueCollection para2 = new NameValueCollection(); para2.Add("@i_Code", dgvSalesInvoice.CurrentRow.Cells["SalesCode"].Value.ToString()); para2.Add("@i_TNC_Sub", "SALES"); dtTNC = objDA.ExecuteDataTableSP("rpt_Sales_TNC", para2, false, ref mException, ref mErrorMsg, "Quotation TNC"); DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_RecID", Convert.ToInt64(dgvSalesInvoice.CurrentRow.Cells["SIID"].Value).ToString()); dtReport = objList.ListOfRecord("rpt_SalesInvoice", para, "SalesInvoice - Report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptSalesInvoice.rpt")) { //dtReport.TableName = "PurchaseOrder"; //dtReport.WriteXmlSchema(@"D:\PurchaseOrder.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptSalesInvoice.rpt"); rptDoc.Subreports[0].DataSourceConnections.Clear(); rptDoc.Subreports[0].Database.Tables[0].SetDataSource(dtTNC); rptDoc.Database.Tables[1].SetDataSource(dt); rptDoc.Refresh(); CurrentUser.AddReportParameters(rptDoc, dtReport, "Estimate", true, true, true, true, true, true, true, true, true, true, true); CurrentUser.AddExtraParameter(rptDoc); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Estimate - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Sales Invoice", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else { MessageBox.Show("Estimate not generated for this sale."); } } /////////////////// //else if (cmbreports.SelectedIndex == 6) //{ // try // { // DataTable dt = new DataTable(); // LogoBind(dt); // if (dgvSalesInvoice.CurrentRow != null) // { // DataTable dtTNC = new DataTable(); // NameValueCollection para2 = new NameValueCollection(); // para2.Add("@i_Code", dgvSalesInvoice.CurrentRow.Cells["SalesCode"].Value.ToString()); // para2.Add("@i_TNC_Sub", "SALES"); // dtTNC = objDA.ExecuteDataTableSP("rpt_Sales_TNC", para2, false, ref mException, ref mErrorMsg, "Quotation TNC"); // DataTable dtReport = new DataTable(); // NameValueCollection para = new NameValueCollection(); // para.Add("@i_RecID", Convert.ToInt64(dgvSalesInvoice.CurrentRow.Cells["SIID"].Value).ToString()); // dtReport = objList.ListOfRecord("rpt_SalesInvoice", para, "SalesInvoice - Report"); // if (objList.Exception == null) // { // if (System.IO.File.Exists(CurrentUser.ReportPath + "rptDeliveryChallan.rpt")) // { // //dtReport.TableName = "Logo"; // //dtReport.WriteXmlSchema(@"D:\ERP-CRM\CRM_ICON\Logo.xsd"); // CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); // rptDoc.Load(CurrentUser.ReportPath + "rptDeliveryChallan.rpt"); // rptDoc.Subreports[0].DataSourceConnections.Clear(); // rptDoc.Subreports[0].Database.Tables[0].SetDataSource(dtTNC); // //rptDoc.Refresh(); // rptDoc.Database.Tables[1].SetDataSource(dt); // rptDoc.Refresh(); // CurrentUser.AddReportParameters(rptDoc, dtReport, "Delivery Challan", true, true, true, true, true, true, true, true, true, true, true); // CurrentUser.AddExtraParameter(rptDoc); // Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); // fRptView.Text = "Delivery Challan - [Page Size: A4]"; // fRptView.crViewer.ReportSource = rptDoc; // fRptView.ShowDialog(); // } // else // { // MessageBox.Show("File is not exist..."); // } // } // else // { // MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); // } // } // } // catch (Exception exc) // { // Utill.Common.ExceptionLogger.writeException("Sales Invoice", exc.StackTrace); // MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); // } //} else if (cmbreports.SelectedIndex == 6) { try { DataTable dt = new DataTable(); LogoBind(dt); if (dgvSalesInvoice.CurrentRow != null) { DataTable dtTNC = new DataTable(); NameValueCollection para2 = new NameValueCollection(); para2.Add("@i_Code", dgvSalesInvoice.CurrentRow.Cells["SalesCode"].Value.ToString()); para2.Add("@i_TNC_Sub", "SALES"); dtTNC = objDA.ExecuteDataTableSP("rpt_Sales_TNC", para2, false, ref mException, ref mErrorMsg, "Quotation TNC"); DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_RecID", Convert.ToInt64(dgvSalesInvoice.CurrentRow.Cells["SIID"].Value).ToString()); dtReport = objList.ListOfRecord("rpt_SalesInvoice", para, "SalesInvoice - Report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptSalesInvoice.rpt")) { //dtReport.TableName = "PurchaseOrder"; //dtReport.WriteXmlSchema(@"D:\PurchaseOrder.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptSalesInvoice.rpt"); rptDoc.Subreports[0].DataSourceConnections.Clear(); rptDoc.Subreports[0].Database.Tables[0].SetDataSource(dtTNC); rptDoc.Database.Tables[1].SetDataSource(dt); rptDoc.Refresh(); CurrentUser.AddReportParameters(rptDoc, dtReport, "Proforma Invoice", true, true, true, true, true, true, true, true, true, true, true); CurrentUser.AddExtraParameter(rptDoc); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Proforma Invoice - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Sales Invoice", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 7) { try { if (dgvSalesInvoice.CurrentRow != null) { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_RecID", Convert.ToInt64(dgvSalesInvoice.CurrentRow.Cells["SIID"].Value).ToString()); dtReport = objList.ListOfRecord("rpt_ChallanCumTaxInvoice", para, "SalesInvoice - Report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptChallanCumTaxInvoice.rpt")) { //dtReport.TableName = "ChallanCumTaxInvoice"; //dtReport.WriteXmlSchema(@"D:\ChallanCumTaxInvoice.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptChallanCumTaxInvoice.rpt"); CurrentUser.AddReportParameters(rptDoc, dtReport, "Challan Cum Tax Invoice", true, true, true, true, true, true, true, true, true, true, true); CurrentUser.AddExtraParameter(rptDoc); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Challan Cum Tax Invoice - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Sales Invoice", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } cmbreports.SelectedIndex = 0; }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptItemStockRegister.rpt")) { //dtblItemStock .TableName = "ItemStockRegister"; //dtblItemStock.WriteXmlSchema(@"D:\ItemStockRegister.xsd"); DataView DVReport; DVReport = dtblItemStock.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptItemStockRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Item Stock Register", true, true, true, true, false, true, true, false, false, false, false); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Item Stock Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("ItemStock - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 2) { try { if (dgvItemStock.CurrentRow != null) { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_StockID", dgvItemStock.CurrentRow.Cells["StockID"].Value.ToString()); dtReport = objList.ListOfRecord("rpt_ItemBeanCard", para, "ItemStock - Bean Card report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptItemBeanCard.rpt")) { //dtReport .TableName = "ItemBeanCard"; //dtReport.WriteXmlSchema(@"D:\Report\ItemBeanCard.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptItemBeanCard.rpt"); CurrentUser.AddReportParameters(rptDoc, dtReport, "Item Bean Card", true, true, true, true, false, true, true, false, false, false, false); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Item Bean Card - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("ItemStock - Bean Card Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 3) { try { DataTable dt = new DataTable(); LogoBind(dt); if (System.IO.File.Exists(CurrentUser.ReportPath + "rptItemStockValuationRegister.rpt")) { //dtblItemStock .TableName = "ItemStockValuationRegister"; //dtblItemStock.WriteXmlSchema(@"D:\ItemStockValuationRegister.xsd"); DataView DVReport; DVReport = dtblItemStock.DefaultView; DVReport.RowFilter = filter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptItemStockValuationRegister.rpt"); rptDoc.Database.Tables[1].SetDataSource(dt); rptDoc.Refresh(); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Item Stock Valuation Register", true, true, true, true, false, true, true, false, false, false, false); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Item Stock Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("ItemStock - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } cmbreports.SelectedIndex = 0; }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_FYID", CurrentUser.FYID.ToString()); para.Add("@i_CompId", CurrentUser.CompId.ToString()); dtReport = objList.ListOfRecord("rpt_POGST_Register", para, "PurchaseInvoice - Report"); DataView DVReport; DVReport = dtReport.DefaultView; DVReport.RowFilter = StrFilter; if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptPurchaseInvoiceRegisterGST.rpt")) { //dtblPurchaseInvoice .TableName = "PORegister"; //dtblPurchaseInvoice.WriteXmlSchema(@"D:\Report\PORegister.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptPurchaseInvoiceRegisterGST.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Purchase Order Register", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Purchase Order Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Purchase Order - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 2) { try { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_FYID", CurrentUser.FYID.ToString()); para.Add("@i_CompId", CurrentUser.CompId.ToString()); para.Add("@i_UserId", CurrentUser.UserID.ToString()); dtReport = objList.ListOfRecord("rpt_PORegister", para, "PurchaseInvoice - Report"); DataView DVReport; DVReport = dtReport.DefaultView; DVReport.RowFilter = StrFilter; if (dtReport.Rows.Count > 0) { for (int i = 0; i < dtReport.Rows.Count; i++) { string ItemCode = dtReport.Rows[i]["ItemCode"].ToString(); int OrderBookingID = Convert.ToInt16(dtReport.Rows[i]["PIID"].ToString()); int CompId = Convert.ToInt16(dtReport.Rows[i]["CompId"].ToString()); DataTable dtSQty = new DataTable(); if (ItemCode != "") { NameValueCollection para1 = new NameValueCollection(); para1.Add("@i_ItemCode", ItemCode.ToString()); para1.Add("@i_POID", OrderBookingID.ToString()); para1.Add("@i_CompId", CompId.ToString()); dtSQty = objList.ListOfRecord("rpt_Get_ReceivedQty", para1, "PurchaseInvoice - Reports"); decimal SQty = 0; if (dtSQty.Rows[0][0].ToString().Trim() == "") { SQty = 0; } else { SQty = Convert.ToDecimal(dtSQty.Rows[0][0]); } dtReport.Rows[i]["DQty"] = SQty; dtReport.Rows[i]["Diff"] = Convert.ToDecimal(dtReport.Rows[i]["OQty"]) - SQty; dtReport.Rows[i]["OrdValue"] = Convert.ToDecimal(dtReport.Rows[i]["OQty"]) * Convert.ToDecimal(dtReport.Rows[i]["Rate"]); dtReport.Rows[i]["SupplyValue"] = SQty * Convert.ToDecimal(dtReport.Rows[i]["Rate"]); dtReport.Rows[i]["diff1"] = Convert.ToDecimal(dtReport.Rows[i]["OrdValue"]) - Convert.ToDecimal(dtReport.Rows[i]["SupplyValue"]); string Difference = dtReport.Rows[i]["Diff"].ToString(); } else { } } //StrFilter = " Diff <> 0"; DVReport = dtReport.DefaultView; DVReport.RowFilter = StrFilter; } if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptPurchaseInvoiceRegisterold.rpt")) { //dtblPurchaseInvoice .TableName = "PORegister"; //dtblPurchaseInvoice.WriteXmlSchema(@"D:\Report\PORegister.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptPurchaseInvoiceRegisterold.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Purchase Order Register", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Purchase Order Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Purchase Order - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 3) { try { if (dgvPurchaseInvoice.CurrentRow != null) { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_PIID", Convert.ToInt64(dgvPurchaseInvoice.CurrentRow.Cells["PIID"].Value).ToString()); dtReport = objList.ListOfRecord("rpt_PODetail", para, "PurchaseInvoice - Report"); DataView DVReport; DVReport = dtReport.DefaultView; DVReport.RowFilter = StrFilter; if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptPurchaseInvoiceRegisterWithDetail.rpt")) { //dtblPurchaseInvoice .TableName = "PORegister"; //dtblPurchaseInvoice.WriteXmlSchema(@"D:\Report\PORegister.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptPurchaseInvoiceRegisterWithDetail.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Purchase Order Detail", true, true, true, true, false, true, true, false, false, false, false); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Purchase Order Detail - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Purchase Invoice - Detail Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 4) { try { RPT_Sub(Convert.ToInt64(dgvPurchaseInvoice.CurrentRow.Cells["PIID"].Value), dgvPurchaseInvoice.CurrentRow.Cells["PurchaseCode"].Value.ToString(), true); } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Purchase Invoice", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } //else if (cmbreports.SelectedIndex == 4) //{ // try // { // DataTable dtReport = new DataTable(); // NameValueCollection para = new NameValueCollection(); // para.Add("@i_FYID", CurrentUser.FYID.ToString()); // dtReport = objList.ListOfRecord("rpt_POVsGRN_Register", para, "PurchaseInvoice - Report"); // DataView DVReport; // DVReport = dtReport.DefaultView; // DVReport.RowFilter = StrFilter; // if (objList.Exception == null) // { // if (System.IO.File.Exists(CurrentUser.ReportPath + "rptPOVsGRNRegister.rpt")) // { // //dtblPurchaseInvoice .TableName = "PORegister"; // //dtblPurchaseInvoice.WriteXmlSchema(@"D:\Report\PORegister.xsd"); // CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); // rptDoc.Load(CurrentUser.ReportPath + "rptPOVsGRNRegister.rpt"); // CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "PO Vs GRN Register", true, true, true, true, false, true, true, false, false, false, false); // Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); // fRptView.Text = "PO Vs GRN Register - [Page Size: A4]"; // fRptView.crViewer.ReportSource = rptDoc; // fRptView.ShowDialog(); // } // else // { // MessageBox.Show("File is not exist..."); // } // } // else // { // MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); // } // } // catch (Exception exc) // { // Utill.Common.ExceptionLogger.writeException("Purchase Invoice - Register Report", exc.StackTrace); // MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); // } //} cmbreports.SelectedIndex = 0; }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptItemRegister.rpt")) { dtblItem.TableName = "ItemRegister"; dtblItem.WriteXmlSchema(@"D:\ItemRegister.xsd"); DataView DVReport; DVReport = dtblItem.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptItemRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Item Register", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Item Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath."); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Item Register", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 2) { try { DataTable dtReport = new DataTable(); dtReport = objList.ListOfRecord("rpt_Sales_Service_Quotation", null, "Item - Report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptItemSales.rpt")) { //dtReport.TableName = "ItemSales"; //dtReport.WriteXmlSchema(@"D:\ItemSales.xsd"); DataView DVReport; //rooja DVReport = dtReport.DefaultView; //rooja if (StrFilter != "") { StrFilter = StrFilter + " And "; StrFilter = StrFilter + " TYPE = 'QUOTATION' And "; if (StrFilter != "") { StrFilter = StrFilter.Substring(0, StrFilter.Length - 4); } DVReport.RowFilter = StrFilter;//rooja CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptItemSales.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Item Quotation Report", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Item Sales Report - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("Please filter data with Customer name and/or Item name.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); btnfilter.Focus(); } } else { MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Sales Invoice - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 3) { try { DataTable dtReport = new DataTable(); dtReport = objList.ListOfRecord("rpt_Sales_Service_Quotation", null, "Item - Report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptItemSales.rpt")) { //dtReport.TableName = "ItemSales"; //dtReport.WriteXmlSchema(@"D:\ItemSales.xsd"); DataView DVReport; //rooja DVReport = dtReport.DefaultView; //rooja if (StrFilter != "") { StrFilter = StrFilter + " And "; StrFilter = StrFilter + " TYPE = 'Sales' And "; if (StrFilter != "") { StrFilter = StrFilter.Substring(0, StrFilter.Length - 4); } DVReport.RowFilter = StrFilter;//rooja CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptItemSales.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Item Quotation Report", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Item Sales Report - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("Please filter data with Customer name and/or Item name.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); btnfilter.Focus(); } } else { MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Sales Invoice - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 4) { try { DataTable dtReport = new DataTable(); dtReport = objList.ListOfRecord("rpt_Sales_Service_Quotation", null, "Item - Report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptItemSales.rpt")) { //dtReport.TableName = "ItemSales"; //dtReport.WriteXmlSchema(@"D:\ItemSales.xsd"); DataView DVReport; //rooja DVReport = dtReport.DefaultView; //rooja if (StrFilter != "") { StrFilter = StrFilter + " And "; StrFilter = StrFilter + " TYPE = 'Service' And "; if (StrFilter != "") { StrFilter = StrFilter.Substring(0, StrFilter.Length - 4); } DVReport.RowFilter = StrFilter;//rooja CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptItemSales.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Item Quotation Report", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Item Sales Report - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("Please filter data with Customer name and/or Item name.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); btnfilter.Focus(); } } else { MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Sales Invoice - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } cmbreports.SelectedIndex = 0; }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { if (dgvServiceModule.CurrentRow == null) { return; } DataTable dtReport = new DataTable(); NameValueCollection Paralist = new NameValueCollection(); Paralist.Add("@i_ServiceId", dgvServiceModule.CurrentRow.Cells["ServiceId"].Value.ToString()); dtReport = objList.ListOfRecord("rpt_ServiceModule", Paralist, "ServiceModule - Report"); //if (objList.Exception == null) //{ //dtReport.TableName = "ServiceModuleRegister"; //dtReport.WriteXmlSchema(@"D:\ServiceModuleRegister.xsd"); if (System.IO.File.Exists(CurrentUser.ReportPath + "rptServiceModuleRegister.rpt")) { DataView DVReport; DVReport = dtblItem.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptServiceModuleRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Service Module", true, true, true, true, false, true, true, false, false, false, true); //CurrentUser.AddExtraParameter(rptDoc); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Service Module - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath."); } //} } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Service Module", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 2) { try { if (dgvServiceModule.CurrentRow == null) { return; } DataTable dt = new DataTable(); // LogoBind(dt); DataSet dtReport = new DataSet(); NameValueCollection Paralist = new NameValueCollection(); Paralist.Add("@i_RecID", dgvServiceModule.CurrentRow.Cells["ServiceId"].Value.ToString()); dtReport = objList.ListOfDataSetRecordwithPara("rpt_Service_Order", Paralist, "Service Invoice - Report"); if (objList.Exception == null) { //dtReport.Tables[0].TableName = "ServiceOrder"; //dtReport.Tables[0].WriteXmlSchema(@"D:\ServiceOrder.xsd"); if (System.IO.File.Exists(CurrentUser.ReportPath + "rptServiceOrder.rpt")) { CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptServiceOrder.rpt"); // rptDoc.Database.Tables[1].SetDataSource(dt); rptDoc.Refresh(); CurrentUser.AddReportParameters(rptDoc, dtReport.Tables[0], "Service Order", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Service Order - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath."); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Service Invoice", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMessage, "Exception"); } } else if (cmbreports.SelectedIndex == 3) { try { DataTable dt = new DataTable(); LogoBind(dt); if (dgvServiceModule.CurrentRow != null) { DataTable dtTNC = new DataTable(); NameValueCollection para2 = new NameValueCollection(); para2.Add("@i_Code", dgvServiceModule.CurrentRow.Cells["RequestNo"].Value.ToString()); para2.Add("@i_TNC_Sub", "SERVICE"); para2.Add("@i_CompId", CurrentCompany.CompId.ToString()); dtTNC = objDA.ExecuteDataTableSP("rpt_Service_TNC", para2, false, ref mException, ref mErrorMsg, "Quotation TNC"); DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_RecID", Convert.ToInt64(dgvServiceModule.CurrentRow.Cells["ServiceId"].Value).ToString()); dtReport = objList.ListOfRecord("rpt_ServiceInvoice", para, "ServiceInvoice - Report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptServiceInvoice.rpt")) { //dtReport.TableName = "ServiceInvoice"; //dtReport.WriteXmlSchema(@"D:\ServiceInvoice.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptServiceInvoice.rpt"); rptDoc.Subreports[0].DataSourceConnections.Clear(); rptDoc.Subreports[0].Database.Tables[0].SetDataSource(dtTNC); rptDoc.Database.Tables[1].SetDataSource(dt); rptDoc.Refresh(); CurrentUser.AddReportParameters(rptDoc, dtReport, "Service Invoice", true, true, true, true, true, true, true, true, true, true, true); CurrentUser.AddExtraParameter(rptDoc); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Labour Invoice - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("Please check Company Details,\n Go to the Master->Edit->Company Details->ReportPath/DocPath."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Sales Invoice", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMessage, "Exception"); } } else if (cmbreports.SelectedIndex == 4) { try { if (dgvServiceModule.CurrentRow == null) { return; } DataTable dtReport = new DataTable(); NameValueCollection Paralist = new NameValueCollection(); Paralist.Add("@i_ServiceId", dgvServiceModule.CurrentRow.Cells["ServiceId"].Value.ToString()); dtReport = objList.ListOfRecord("rpt_ServiceModule", Paralist, "ServiceModule - Report"); //if (objList.Exception == null) //{ //dtReport.TableName = "ServiceModuleRegister"; //dtReport.WriteXmlSchema(@"D:\ServiceModuleRegister.xsd"); if (System.IO.File.Exists(CurrentUser.ReportPath + "rptServiceVouchar.rpt")) { DataView DVReport; DVReport = dtblItem.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptServiceVouchar.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Service Module", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Service Module - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } //} } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Service Module", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } cmbreports.SelectedIndex = 0; }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_FYID", CurrentUser.FYID.ToString()); para.Add("@i_UserId", CurrentUser.UserID.ToString()); para.Add("@i_CompId", CurrentCompany.CompId.ToString()); dtReport = objList.ListOfRecord("rpt_IndentRegister", para, "Indent - Report"); DataView DVReport; DVReport = dtReport.DefaultView; DVReport.RowFilter = StrFilter; if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptGRNRegister.rpt")) { //dtblPurchaseInvoice .TableName = "PORegister"; //dtblPurchaseInvoice.WriteXmlSchema(@"D:\Report\PORegister.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptGRNRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Indent Register", true, true, true, true, false, true, true, false, false, false, false); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Indent Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Indent - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 2) { try { if (dgvPurchaseInvoice.CurrentRow != null) { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_PIID", Convert.ToInt64(dgvPurchaseInvoice.CurrentRow.Cells["PIID"].Value).ToString()); dtReport = objList.ListOfRecord("rpt_IndentDetail", para, "Indent - Report"); DataView DVReport; DVReport = dtReport.DefaultView; DVReport.RowFilter = StrFilter; if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptPurchaseInvoiceRegisterWithDetail.rpt")) { //dtblPurchaseInvoice .TableName = "PORegister"; //dtblPurchaseInvoice.WriteXmlSchema(@"D:\Report\PORegister.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptPurchaseInvoiceRegisterWithDetail.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Indent Detail", true, true, true, true, false, true, true, false, false, false, false); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Indent Detail - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Indent - Detail Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 3) { try { DataTable dt = new DataTable(); LogoBind(dt); if (dgvPurchaseInvoice.CurrentRow != null) { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_RecID", Convert.ToInt64(dgvPurchaseInvoice.CurrentRow.Cells["PIID"].Value).ToString()); dtReport = objList.ListOfRecord("rpt_Indent", para, "Indent - Report"); if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptIndent.rpt")) { //dtblPurchaseInvoice .TableName = "PORegister"; //dtblPurchaseInvoice.WriteXmlSchema(@"D:\Report\PORegister.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptIndent.rpt"); rptDoc.Database.Tables[1].SetDataSource(dt); rptDoc.Refresh(); CurrentUser.AddReportParameters(rptDoc, dtReport, "Indent", true, true, true, true, true, true, true, true, true, true, false); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Indent - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Indent", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 4) { try { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_FYID", CurrentUser.FYID.ToString()); para.Add("@i_UserId", CurrentUser.UserID.ToString()); para.Add("@i_CompId", CurrentCompany.CompId.ToString()); dtReport = objList.ListOfRecord("rpt_IndentRegister", para, "Indent - Report"); DataView DVReport; DVReport = dtReport.DefaultView; DVReport.RowFilter = StrFilter; if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptGRNRegister.rpt")) { //dtblPurchaseInvoice .TableName = "PORegister"; //dtblPurchaseInvoice.WriteXmlSchema(@"D:\Report\PORegister.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptGRNRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Indent Register", true, true, true, true, false, true, true, false, false, false, false); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Indent Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Indent - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } cmbreports.SelectedIndex = 0; }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptVendorRegister.rpt")) { //dtblVendor.TableName = "VendorRegister"; //dtblVendor.WriteXmlSchema(@"D:\Report\VendorRegister.xsd"); DataView DVReport; DVReport = dtblVendor.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptVendorRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Vendor Register", true, true, true, true, false, true, true, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Vendor Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); // DataTable dt = new DataTable(); //// dt = dgvVendor.DataSource(); // for (int i = 0; i < dgvVendor.Rows.Count; i++) // { // DataRow dr = dt.NewRow(); // dr["Col1"] = dgvVendor.rows[i]["Col1"].text; // dt.Rows.Add(dr); // } } else { MessageBox.Show("File is not exist..."); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Vendor - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 2) { try { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptVendorMailingLabel.rpt")) { //dtblVendor.TableName = "VendorRegister"; //dtblVendor.WriteXmlSchema(@"D:\Report\VendorRegister.xsd"); DataView DVReport; DVReport = dtblVendor.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptVendorMailingLabel.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Vendor Mailing Label", true, true, true, true, false, true, false, false, false, false, true); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Vendor Mailing Label - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Vendor - Mailing Label Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } cmbreports.SelectedIndex = 0; }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { DataTable dtReport = new DataTable(); NameValueCollection para = new NameValueCollection(); para.Add("@i_FYID", CurrentUser.FYID.ToString()); dtReport = objList.ListOfRecord("rpt_SalesInvoiceRegister", para, "SalesInvoice - Report"); DataView DVReport; DVReport = dtReport.DefaultView; DVReport.RowFilter = StrFilter; if (objList.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptSalesInvoiceRegister.rpt")) { //dtblSalesInvoice .TableName = "PORegister"; //dtblSalesInvoice.WriteXmlSchema(@"D:\Report\PORegister.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptSalesInvoiceRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Sales Invoice Register", true, false, false, false, false, false, true, false, false, false, false); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Sales Invoice Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(objList.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Sales Invoice - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } else if (cmbreports.SelectedIndex == 2) { rptSalesInvoice_Click(sender, e); } else if (cmbreports.SelectedIndex == 3) { salesInvoiceToolStripMenuItem_Click(sender, e); } else if (cmbreports.SelectedIndex == 4) { taxInvoiceToolStripMenuItem_Click(sender, e); } cmbreports.SelectedIndex = 0; }
private void cmbreports_SelectedIndexChanged(object sender, EventArgs e) { if (cmbreports.SelectedIndex == 1) { try { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptExpenseRegister.rpt")) { //dtblExpense .TableName = "PORegister"; //dtblExpense.WriteXmlSchema(@"D:\Report\PORegister.xsd"); DataView DVReport; DVReport = dtblExpense.DefaultView; DVReport.RowFilter = StrFilter; CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptExpenseRegister.rpt"); CurrentUser.AddReportParameters(rptDoc, DVReport.ToTable(), "Expense Register", true, true, true, true, false, true, true, false, false, false, true); //rptDoc.SetParameterValue("pFromDate", txtFromDate.Text); //rptDoc.SetParameterValue("pToDate", txtTodate.Text); //if (DataValidator.IsDate(txtFromDate.Text.Trim()) && DataValidator.IsDate(txtTodate.Text.Trim())) //{ // rptDoc.SetParameterValue("pPassDate", true); //} //else //{ // rptDoc.SetParameterValue("pPassDate", false); //} Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Expense Register - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Expense - Register Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } if (cmbreports.SelectedIndex == 2) { try { if (dgvExpense.CurrentRow != null) { DataTable dtReport = new DataTable(); dtReport = CommSelect.SelectRecord(Convert.ToInt64(dgvExpense.CurrentRow.Cells["ExpenseID"].Value), "rpt_Expense", "Expense - Report"); if (CommSelect.Exception == null) { if (System.IO.File.Exists(CurrentUser.ReportPath + "rptExpense.rpt")) { //dtReport.TableName = "Expense"; //dtReport.WriteXmlSchema(@"D:\Report\Expense.xsd"); CrystalDecisions.CrystalReports.Engine.ReportDocument rptDoc = new CrystalDecisions.CrystalReports.Engine.ReportDocument(); rptDoc.Load(CurrentUser.ReportPath + "rptExpense.rpt"); CurrentUser.AddReportParameters(rptDoc, dtReport, "Expense", true, true, true, true, true, true, true, false, false, false, false); rptDoc.SetParameterValue("pBusinessLine", CurrentCompany.BusinessLine); rptDoc.SetParameterValue("pCST", CurrentCompany.CST); rptDoc.SetParameterValue("pEmail", CurrentCompany.Email); rptDoc.SetParameterValue("pFax", CurrentCompany.Fax); rptDoc.SetParameterValue("pPhone2", CurrentCompany.Phone2); rptDoc.SetParameterValue("PState", CurrentCompany.State); rptDoc.SetParameterValue("pTin", CurrentCompany.TIN); rptDoc.SetParameterValue("pRegAddress1", CurrentCompany.RegAddress1); rptDoc.SetParameterValue("pRegAddress2", CurrentCompany.RegAddress2); rptDoc.SetParameterValue("pRegCity", CurrentCompany.RegCity); rptDoc.SetParameterValue("pRegFax", CurrentCompany.RegFax); rptDoc.SetParameterValue("pRegPhone", CurrentCompany.RegPhone); Reports.frmReportViewer fRptView = new Reports.frmReportViewer(); fRptView.Text = "Expense - [Page Size: A4]"; fRptView.crViewer.ReportSource = rptDoc; fRptView.ShowDialog(); } else { MessageBox.Show("File is not exist..."); } } else { MessageBox.Show(CommSelect.Exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } catch (Exception exc) { Utill.Common.ExceptionLogger.writeException("Expense - Report", exc.StackTrace); MessageBox.Show(Utill.Common.CommonMessage.ExceptionMesg, "Exception"); } } }