public void PrintOverageReport() { DataTable tOverage = GetOverageTable(); if (tOverage == null || tOverage.Rows.Count == 0) { MessageBox.Show("This Customer doesn't have an Invoice"); return; } DataSet ds = new DataSet(); //ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * from OrderOverage Where CompanyID='{0}' And CustomerID='{1}' And Date > Date('{2}')", CompanyID, this.ID, oCharge.Date.ToString("yyyy-MM-dd hh:mm:ss")), "Overage")); ds.Tables.Add(tOverage); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * from Orders Where CompanyID='{0}' And CustomerID='{1}'", CompanyID, ID), "Orders")); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Customer Where CustomerID='{0}' And CompanyID='{1}'", ID, CompanyID), "Customer")); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Product Where CompanyID='{0}'", CompanyID), "Product")); // ds.WriteXml("Overage2.xml"); frmViewReport oViewReport = new frmViewReport(); OverageReport oRpt = new OverageReport(); oRpt.SetDataSource(ds); //oRpt.PrintToPrinter(1, false, 0, 0); oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); }
public void PrintRepSalesByBrochureReport() { frmViewReport oViewReport = new frmViewReport(); //DataSet ds = oMySql.get_summary_reps_sales(this.CompanyID); DataSet ds = new DataSet(); Boolean nView = true; ds.Tables.Add(oMySql.GetDataTable("SELECT * FROM Brochure Where CompanyID ='" + this.CompanyID + "' ", "Brochure")); ds.Tables.Add(oMySql.GetDataTable(String.Format("SELECT c.Rep_ID, c.RepID, r.Name, Avg(bc.Retail/c.Signed) as Average FROM BrochureByCustomer bc Left Join Customer c On bc.CompanyID=c.CompanyID And bc.CustomerID=c.CustomerID Left Join Reps r On c.Rep_ID=r.ID Where bc.CompanyID='{0}' And Rep_ID > 0 Group By c.Rep_ID", this.CompanyID), "Reps")); ds.Tables.Add(oMySql.GetDataTable(String.Format("SELECT c.Rep_ID, c.RepID, bc.BrochureID, Avg(bc.Retail/c.Signed) as Retail,c.Signed FROM BrochureByCustomer bc Left Join Customer c On bc.CompanyID=c.CompanyID And bc.CustomerID=c.CustomerID Where bc.CompanyID='{0}' And Rep_ID > 0 Group By c.Rep_ID, bc.BrochureID", this.CompanyID), "Average")); RepSalesByBrochure oRpt7 = new RepSalesByBrochure(); oRpt7.SetDataSource(ds); // ds.WriteXml("RepSalesByBrochure3.xml", XmlWriteMode.WriteSchema); if (nView) { oViewReport.cReport.ReportSource = oRpt7; oViewReport.ShowDialog(); } else { oRpt7.PrintToPrinter(1, true, 1, 100); } }
public void Print() { frmViewReport oViewReport = new frmViewReport(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable("Select * From States ", "States")); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Tax_By_State Where CompanyID='{0}'", CompanyID), "TaxByState")); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Product Where CompanyID='{0}'", CompanyID), "Product")); // ds.WriteXml("dataset124.xml", XmlWriteMode.WriteSchema); ItemTaxByStateReport oRpt = new ItemTaxByStateReport(); oRpt.SetDataSource(ds); Boolean isToPrinter = false; if (isToPrinter) { //oRpt.PrintOptions.PrinterName = "\\\\srv1\\Plain"; //oRpt.PrintOptions.PrinterName = PrinterName; oRpt.PrintToPrinter(1, false, 0, 0); //oViewReport.cReport.ReportSource = oRpt; //oViewReport.cReport.PrintReport(); } else { oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); } }
public void PrintProductSizes() { frmViewReport oViewReport = new frmViewReport(); BrochureListingSizes oRpt = new BrochureListingSizes(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable("Select * From Product Where CompanyID='" + CompanyID + "'", "Product")); ds.Tables.Add(oMySql.GetDataTable("Select * From BrochureDetail Where CompanyID='" + CompanyID + "' And BrochureID='" + ID + "'", "BrochureDetail")); ds.WriteXml("PrintProductSizes.xml", XmlWriteMode.WriteSchema); foreach (DataRow row in ds.Tables["Product"].Rows) { if (row["ProductID"].ToString().Trim() == "0001") { row.Delete(); continue; } } ds.Tables["Product"].AcceptChanges(); oRpt.SetDataSource(ds); oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); /* * oViewReport.sParameter_1 = ID; * oViewReport.SetReport((int)Report.PurchaseOrder, CompanyID, "", true); */ }
public void PrintCommissionChargesReport(String PrinterName, PrinterDevice Device) { frmViewReport oViewReport = new frmViewReport(); DataSet ds = new DataSet(); ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("SELECT c.Rep_ID, c.RepID, rs.Name FROM Customer c Left Join Reps rs On rs.ID=c.Rep_ID Where c.CompanyID='{0}' And Rep_ID>0 Group By c.Rep_ID Order By rs.Name", this.CompanyID), "Rep")); ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("SELECT Rep_ID, sum(Charge) as Charge FROM rep_charges r Where Rep_ID > 0 Group By Rep_ID"), "Charge")); ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("SELECT c.CustomerID, bc.BrochureID, r.ID as Rep_ID, rs.Name, sum(bc.InvoiceAmount) as InvoiceAmount, sum(bc.TaxAmount) as TaxAmount,sum(bc.TaxAmount) as TaxAmount,if(c.Retail>=2500,sum(bc.InvoiceAmount - bc.TaxAmount),sum(bc.InvoiceAmount*(100-(bc.ProfitPercent+5))/(100-bc.ProfitPercent) -bc.TaxAmount)) as InvoiceableAmount, sum(if(c.Retail>=2500,(bc.InvoiceAmount - bc.TaxAmount),(bc.InvoiceAmount*(100-(bc.ProfitPercent+5))/(100-bc.ProfitPercent) -bc.TaxAmount))*bc.CODE/100) as Commission FROM Rep r Left Join Reps rs On r.ID=rs.ID Left Join Customer c On r.ID=c.Rep_ID and r.CompanyID=c.CompanyID Left Join BrochureByCustomer bc On c.CompanyID=bc.CompanyID and c.CustomerID=bc.CustomerID Where r.CompanyID='{0}' And rs.Name is not Null Group By c.Rep_ID Order By rs.ID", this.CompanyID), "Commission")); CommissionChargesRep oRpt = new CommissionChargesRep(); oRpt.SetDataSource(ds); // ds.WriteXml("CommissionChargesReport1.xml", XmlWriteMode.WriteSchema); if (Device == PrinterDevice.Printer) { //oRpt.PrintOptions.PrinterName = "\\\\srv1\\Plain"; oRpt.PrintOptions.PrinterName = PrinterName; oRpt.PrintToPrinter(1, true, 1, 100); //oViewReport.cReport.ReportSource = oRpt; //oViewReport.cReport.PrintReport(); } else { oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); } }
public void PrintSummaryReport() { Company oCompany = new Company(); oCompany.CalculateAllCustomerTotalsByBrochure(); frmViewReport oViewReport = new frmViewReport(); BrochureSummaryReport oRpt = new BrochureSummaryReport(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable("Select bc.CustomerID,b.Description,bc.BrochureID,sum(c.Signed) as Signed, sum(bc.Retail) as Retail,bc.Code,bc.ProfitPercent, Sum(bc.NoItems) as NoItems, Sum(bc.NoSellers) as NoSellers, count(bc.CustomerID) as Customers FROM BrochureByCustomer bc Left Join Customer c On bc.CustomerID=c.CustomerID And bc.CompanyID=c.CompanyID Left Join Brochure b On bc.BrochureID=b.BrochureID And bc.CompanyID=b.CompanyID Where bc.CompanyID='" + CompanyID + "' And b.Description is not null And bc.Retail >0 And Upper(Name) not like '%INTERNET%' Group By bc.BrochureID Order by bc.BrochureID", "Summary")); ds.Tables.Add(oMySql.GetDataTable("Select bc.CustomerID,b.Description,bc.BrochureID,sum(c.Signed) as Signed, sum(bc.Retail) as Retail,bc.Code,bc.ProfitPercent, Sum(bc.NoItems) as NoItems, Sum(bc.NoSellers) as NoSellers, count(bc.CustomerID) as Customers FROM BrochureByCustomer bc Left Join Customer c On bc.CustomerID=c.CustomerID And bc.CompanyID=c.CompanyID Left Join Brochure b On bc.BrochureID=b.BrochureID And bc.CompanyID=b.CompanyID Where bc.CompanyID='" + CompanyID + "' And b.Description is not null And Upper(Name) not like '%INTERNET%' Group By bc.BrochureID Order by bc.BrochureID", "SummaryTotal")); //Console.Write("Select bc.CustomerID,b.Description,bc.BrochureID,sum(c.Signed) as Signed, sum(bc.Retail) as Retail,bc.Code,bc.ProfitPercent, Sum(bc.NoItems) as NoItems, Sum(bc.NoSellers) as NoSellers FROM BrochureByCustomer bc Left Join Customer c On bc.CustomerID=c.CustomerID And bc.CompanyID=c.CompanyID Left Join Brochure b On bc.BrochureID=b.BrochureID And bc.CompanyID=b.CompanyID Where bc.CompanyID='" + CompanyID + "' And b.Description is not null Group By bc.BrochureID Order by bc.BrochureID"); //ds.Tables.Add(oMySql.GetDataTable("Select * From Customer Where CompanyID='" + CompanyID + "' And CustomerID='" + ID + "'", "Customer")); ds.Tables.Add(oMySql.GetDataTable("Select * From Brochure Where CompanyID='" + CompanyID + "'", "Brochure")); // ds.WriteXml("PrintSummaryReport", XmlWriteMode.WriteSchema); oRpt.SetDataSource(ds); oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); /* * oViewReport.sParameter_1 = ID; * oViewReport.SetReport((int)Report.PurchaseOrder, CompanyID, "", true); */ ds.Dispose(); oRpt.Dispose(); oViewReport.Dispose(); }
public void Print2Brochures(String BrochureID_1, String BrochureID_2) { frmViewReport oViewReport = new frmViewReport(); Brochure2Listing oRpt = new Brochure2Listing(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable("Select * From Brochure Where CompanyID='" + CompanyID + "' And (BrochureID='" + BrochureID_1 + "')", "Brochure")); ds.Tables.Add(oMySql.GetDataTable("Select * From Brochure Where CompanyID='" + CompanyID + "' And (BrochureID='" + BrochureID_2 + "')", "Brochure_2")); ds.Tables.Add(oMySql.GetDataTable("CALL sp_brochure_listing('" + CompanyID + "','" + BrochureID_1 + "')", "Product")); ds.Tables.Add(oMySql.GetDataTable("CALL sp_brochure_listing('" + CompanyID + "','" + BrochureID_2 + "')", "Product_2")); ds.Tables.Add(oMySql.GetDataTable("Select bd.*, p.Description From BrochureDetail bd Left Join Product p On bd.CompanyID=p.CompanyID and bd.ProductID=p.ProductID Where bd.CompanyID='" + CompanyID + "' And (BrochureID='" + BrochureID_1 + "' OR BrochureID='" + BrochureID_2 + "') Group By bd.ProductID Order By bd.ProductID ", "BrochureDetail")); //ds.Tables.Add(oMySql.GetDataTable("Select * From BrochureDetail Where CompanyID='" + CompanyID + "' And BrochureID='" + BrochureID_2 + "'", "BrochureDetail_2")); //Console.WriteLine("Select * From BrochureDetail Where bd.CompanyID='" + CompanyID + "' And (BrochureID='" + BrochureID_1 + "' OR BrochureID='" + BrochureID_2 + "') Group By bd.ProductID"); //ds.WriteXml("d:\\.Print2Brochures3.xml", XmlWriteMode.WriteSchema); Int32 TSold = 0; foreach (DataRow row in ds.Tables["Product"].Rows) { if (row["ProductID"].ToString().Trim() == "0001") { row.Delete(); continue; } TSold += row["Commited"] == DBNull.Value ? 0 : Convert.ToInt32(row["Commited"].ToString()); } ds.Tables["Product"].AcceptChanges(); Int32 TSold_2 = 0; foreach (DataRow row in ds.Tables["Product_2"].Rows) { if (row["ProductID"].ToString().Trim() == "0001") { row.Delete(); continue; } TSold_2 += row["Commited"] == DBNull.Value ? 0 : Convert.ToInt32(row["Commited"].ToString()); } ds.Tables["Product_2"].AcceptChanges(); oRpt.SetDataSource(ds); oRpt.SetParameterValue("TSold", TSold); oRpt.SetParameterValue("TSold_2", TSold_2); oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); /* * oViewReport.sParameter_1 = ID; * oViewReport.SetReport((int)Report.PurchaseOrder, CompanyID, "", true); */ }
//sự kiện click cha //private void Element_Click(object sender, EventArgs e) //{ // var button = sender as AccordionControlElement; // if (sLoad == button.Name) return; // Commons.Modules.ObjSystems.ShowWaitForm(this); // sLoad = button.Name; // lab_Link.Text = slinkcha + "/" + button.Text; // switch (button.Name) // { // case "mnuBCDonVi": // { // if (!panel2.Controls.Contains(ucKeHoachNghiPhep.Instance)) // { // panel2.Controls.Clear(); // panel2.Controls.Add(ucKeHoachNghiPhep.Instance); // ucKeHoachNghiPhep.Instance.Dock = DockStyle.Fill; // ucKeHoachNghiPhep.Instance.BringToFront(); // } // break; // } // case "mnuBCXiNghiep": // { // if (!panel2.Controls.Contains(ucDaoTao.Instance)) // { // panel2.Controls.Clear(); // panel2.Controls.Add(ucDaoTao.Instance); // ucDaoTao.Instance.Dock = DockStyle.Fill; // ucDaoTao.Instance.BringToFront(); // } // break; // } // case "mnuBCTo": // { // ucQuyetDinhThoiViec thoiviec = new ucQuyetDinhThoiViec(); // panel2.Controls.Clear(); // panel2.Controls.Add(thoiviec); // thoiviec.Dock = DockStyle.Fill; // break; // } // default: // break; // } // Commons.Modules.ObjSystems.HideWaitForm(); //} //sự kiện click con private void Elementchill_Click(object sender, EventArgs e) { var button = sender as AccordionControlElement; if (sLoad == button.Name) { return; } Commons.Modules.ObjSystems.ShowWaitForm(this); sLoad = button.Name; lab_Link.Text = slinkcha + "/" + button.Text; switch (button.Name) { case "mnuBCDonVi": { frmViewReport frm = new frmViewReport(); frm.rpt = new rptDSDonVi(); DataTable dt = new DataTable(); dt.Load(SqlHelper.ExecuteReader(Commons.IConnections.CNStr, "rptDSDonVi", Commons.Modules.UserName, Commons.Modules.TypeLanguage)); dt.TableName = "DATA"; frm.AddDataSource(dt); //frm.AddDataSource(dt); frm.ShowDialog(); break; } case "mnuBCXiNghiep": { //if (!panel2.Controls.Contains(ucDaoTao.Instance)) //{ // panel2.Controls.Clear(); // panel2.Controls.Add(ucDaoTao.Instance); // ucDaoTao.Instance.Dock = DockStyle.Fill; // ucDaoTao.Instance.BringToFront(); //} //break; ucDaoTao daotao = new ucDaoTao(); panel2.Controls.Clear(); panel2.Controls.Add(daotao); daotao.Dock = DockStyle.Fill; break; } case "mnuBCTo": { ucQuyetDinhThoiViec thoiviec = new ucQuyetDinhThoiViec(); panel2.Controls.Clear(); panel2.Controls.Add(thoiviec); thoiviec.Dock = DockStyle.Fill; break; } default: break; } Commons.Modules.ObjSystems.HideWaitForm(); }
public void PrintCommissionReport(String Rep_From, String Rep_To, String PrinterName, Boolean isToPrinter) { frmViewReport oViewReport = new frmViewReport(); DataSet ds = new DataSet(); if (Rep_From.Trim() == "" && Rep_To.Trim() == "") { ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("Select * from Rep r Left Join Reps rs On rs.ID=r.ID Where CompanyID='{0}'", this.CompanyID), "Rep")); ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("SELECT * FROM Customer Where CompanyID='{0}' And LastInvoiceAmount > 0 ", CompanyID), "Customer")); } else { ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("Select * from Rep r Left Join Reps rs On rs.ID=r.ID Where r.CompanyID='{0}' And RepID >= '{1}' And RepID <='{2}'", this.CompanyID, Rep_From, Rep_To), "Rep")); ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("SELECT * FROM Customer Where CompanyID='{0}' And LastInvoiceAmount > 0 And RepID >= '{1}' And RepID<='{2}'", CompanyID, Rep_From, Rep_To), "Customer")); } ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("Select * from BrochureByCustomer Where CompanyID='{0}'", CompanyID), "BrochureByCustomer")); ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("Select * from Brochure Where CompanyID='{0}'", CompanyID), "Brochure")); foreach (DataRow row in ds.Tables["Customer"].Rows) { if ((Double)row["FormerLastInvoicedAmount"] > 0) { row["LastInvoiceAmount"] = row["FormerLastInvoicedAmount"]; } } ds.Tables["Customer"].AcceptChanges(); // ds.WriteXml("PrintCommissionReport.xml", XmlWriteMode.WriteSchema); CommissionSalesRep oRpt = new CommissionSalesRep(); oRpt.SetDataSource(ds); // oRpt.PrintOptions.PrinterName = ""; // oRpt.PrintToPrinter(1, false, 0, 0); //oViewReport.cReport.ReportSource = oRpt; //oViewReport.ShowDialog(); if (isToPrinter) { //oRpt.PrintOptions.PrinterName = "\\\\srv1\\Plain"; oRpt.PrintOptions.PrinterName = PrinterName; oRpt.PrintToPrinter(1, true, 1, 100); //oViewReport.cReport.ReportSource = oRpt; //oViewReport.cReport.PrintReport(); } else { oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); } }
public void Print(String ProductID, String ProductID_2, Boolean isLanded) // Product Listing Report { String Sql = ""; if (ProductID.Trim().Length > 0 && ProductID_2.Trim().Length > 0) { Sql = String.Format(" And ProductID >='{0}' And ProductID<='{1}' ", ProductID, ProductID_2); } if (ProductID.Trim().Length > 0 && ProductID_2.Trim().Length == 0) { Sql = String.Format(" And ProductID ='{0}'", ProductID); } frmViewReport oViewReport = new frmViewReport(); ItemListing oRpt = new ItemListing(); ItemListingLandedCost oRpt_1 = new ItemListingLandedCost(); DataSet ds = new DataSet(); if (isLanded) { ds.Tables.Add(oMySql.GetDataTable("Select ProductID, Description, Size,VendorItem,ONPO,Commited,Sold,Received,p.UnitCost as Cost From Product p Where CompanyID='" + CompanyID + "'" + Sql, "Product")); } else { ds.Tables.Add(oMySql.GetDataTable("Select p.*,p.Cost as FinalCost From Product p Where CompanyID='" + CompanyID + "'" + Sql, "Product")); } // ds.WriteXml("dataset1002.xml", XmlWriteMode.WriteSchema); oRpt.SetDataSource(ds); //oRpt.PrintToPrinter(1, true, 1, 100); if (isLanded) { oRpt.SetParameterValue("Title", "ITEM LISTING LANDED COST"); oViewReport.cReport.ReportSource = oRpt; } else { oRpt.SetParameterValue("Title", "ITEM LISTING"); oViewReport.cReport.ReportSource = oRpt; } oViewReport.ShowDialog(); }
private void InDuLieu() { frmViewReport frm = new frmViewReport(); frm.rpt = new rptThamGiaBHXH(Convert.ToInt64(grvCongNhan.GetFocusedRowCellValue("ID_CN"))); DataTable dt = new DataTable(); dt = Commons.Modules.ObjSystems.ConvertDatatable(grvThamGiaBHXH); dt.TableName = "DATA"; frm.AddDataSource(dt); frm.AddDataSource(dt); frm.ShowDialog(); }
public void PrintAcknowledgement() { String InvoiceNote = ""; Double AllPositive = this.GetPositiveAmount(); Double AllNegative = this.GetNegativeAmount(); Double DropPercentageCustomer = 0.00; Double DropPercentageItem = 0.00; this.Note = InvoiceNote; this.Note += "\n" + GetStringOverageInvoice(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Customer Where CompanyID='{0}' And CustomerID='{1}'", CompanyID, ID), "Customer")); DataTable dvInv = new DataTable(); dvInv = GetTotalDataTableGPI("ProductID", DropPercentageCustomer, DropPercentageItem); ds.Tables.Add(CreateDetailTableGPI(dvInv)); //Detail //DataTable dtTotals = GetTotalDataTableGPI("CustomerID", DropPercentageCustomer, DropPercentageItem); frmViewReport oViewReport = new frmViewReport(); //GetCurrentTotalsByBrochure(); // if (dtTotals != null) { // ds.Tables.Add(dtTotals); //Detail // ds.WriteXml("InvoiceGPI_1.xml", XmlWriteMode.WriteSchema); InvoiceDetailGPI oRpt = new InvoiceDetailGPI(); oRpt.SetDataSource(ds); Company oCompany = new Company(this.CompanyID); oRpt.SetParameterValue("CompanyName", oCompany.Name); oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); ds.Dispose(); oRpt.Dispose(); } return; }
public void Print(PrinterDevice Printo, String PrinterName) { frmViewReport oViewReport = new frmViewReport(); PurchaseOrder oRpt = new PurchaseOrder(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable("Select * From Vendor Where CompanyID='" + CompanyID + "'", "Vendor")); ds.Tables.Add(oMySql.GetDataTable("Select * From Purchase Where CompanyID='" + CompanyID + "' And PurchaseID='" + ID + "'", "Purchase")); ds.Tables.Add(oMySql.GetDataTable("Select * From Product Where CompanyID='" + CompanyID + "'", "Product")); ds.Tables.Add(oMySql.GetDataTable("Select * From PurchaseDetail Where CompanyID='" + CompanyID + "' And PurchaseID='" + ID + "'", "PurchaseDetail")); // ds.WriteXml("Purchase11.xml", XmlWriteMode.WriteSchema); oRpt.SetDataSource(ds); oRpt.SetParameterValue("CompanyName", base.Name); if (Printo == PrinterDevice.Viewer) { oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); } else if (Printo == PrinterDevice.Printer) { oRpt.PrintOptions.PrinterName = PrinterName; oRpt.PrintToPrinter(1, true, 1, 100); } else if (Printo == PrinterDevice.PDF) { PDF oPDF = new PDF(); oPDF.FileName = Application.StartupPath + "\\" + this.ID + ".pdf"; oPDF.ExportReport(oRpt, "pdf", Application.StartupPath + "\\", this.ID); Smtp oSmtp = new Smtp(); oSmtp.Subject = "Purchase Order : " + this.ID + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); oSmtp.To = "<" + "*****@*****.**" + ">"; //this.eMail + ">"; oSmtp.From = "\"Signature Fundraising Customer Service\" <*****@*****.**>"; String strTitle = "Purchase Order\n\r"; oSmtp.Body = strTitle; oSmtp.Attachment = oPDF.FileName; if (!oSmtp.Send()) { return; } } }
public void PrintBrochureProjected(Int32 ProjectedAmount) { frmViewReport oViewReport = new frmViewReport(); ItemListingProjected oRpt = new ItemListingProjected(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable("Select * From Product Where CompanyID='" + CompanyID + "'", "Product")); ds.Tables.Add(oMySql.GetDataTable("Select * From Brochure Where CompanyID='" + CompanyID + "' And BrochureID='" + ID + "'", "Brochure")); ds.Tables.Add(oMySql.GetDataTable("Select * From BrochureDetail Where CompanyID='" + CompanyID + "' And BrochureID='" + ID + "' And Excluded='0'", "BrochureDetail")); Product oProduct = new Product(CompanyID); Int32 TSold = 0; foreach (DataRow row in ds.Tables["BrochureDetail"].Rows) { if (row["ProductID"].ToString().Trim() == "0001") { row.Delete(); continue; } if (!oProduct.Find(row["ProductID"].ToString())) { MessageBox.Show("Item not found " + row["ProductID"].ToString()); } TSold += (oProduct.Committed + oProduct.Sold); } ds.Tables["BrochureDetail"].AcceptChanges(); foreach (DataRow row in ds.Tables["Product"].Rows) { row["Length"] = row["Received"]; } ds.Tables["Product"].AcceptChanges(); oRpt.SetDataSource(ds); oRpt.SetParameterValue("TotalCommited", TSold); oRpt.SetParameterValue("TotalProjected", ProjectedAmount); // ds.WriteXml("dataset80.xml", XmlWriteMode.WriteSchema); //oRpt.PrintToPrinter(1, true, 1, 100); oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); }
public void PrintBrochureListingCost() { frmViewReport oViewReport = new frmViewReport(); BrochureListingCost oRpt = new BrochureListingCost(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable("Select * From Brochure Where CompanyID='" + CompanyID + "' And BrochureID='" + ID + "'", "Brochure")); // ds.Tables.Add(oMySql.GetDataTable("Select * From Product Where CompanyID='" + CompanyID + "'", "Product")); //ds.Tables.Add(oMySql.GetDataTable("Select distinct(od.ProductID), p.Description, sum(od.Quantity) as Commited, p.InvCode FROM OrderDetail od Join BrochureDetail bd On od.CompanyID=bd.CompanyID And od.ProductID=bd.ProductID Join Product p On od.CompanyID=p.CompanyID And od.ProductID=p.ProductID Where od.CompanyID='"+CompanyID+"' And bd.BrochureID='"+ID+"' Group By od.ProductID", "Product")); ds.Tables.Add(oMySql.GetDataTable("CALL sp_brochure_listing_cost('" + CompanyID + "','" + ID + "')", "Product")); ds.Tables.Add(oMySql.GetDataTable("Select * From BrochureDetail Where CompanyID='" + CompanyID + "' And BrochureID='" + ID + "'", "BrochureDetail")); // ds.WriteXml("brochure_listing_cost3.xml", XmlWriteMode.WriteSchema); Int32 TSold = 0; foreach (DataRow row in ds.Tables["Product"].Rows) { /*if (row["ProductID"].ToString() == "0001") * { * row.Delete(); * continue; * }*/ TSold += row["Sold"] == DBNull.Value ? 0 : Convert.ToInt32(row["Sold"].ToString()); row["Cost"] = row["UnitCost"]; } ds.Tables["Product"].AcceptChanges(); oRpt.SetDataSource(ds); oRpt.SetParameterValue("TSold", TSold); oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); /* * oViewReport.sParameter_1 = ID; * oViewReport.SetReport((int)Report.PurchaseOrder, CompanyID, "", true); */ }
public void Print(PrinterDevice Printo, String PrinterName) { DataSet ds = this.GetPOReceive(this.CompanyID, this.ID); POReceive oRpt = new POReceive(); frmViewReport oViewReport = new frmViewReport(); oRpt.SetDataSource(ds); //oViewReport.cReport.ReportSource = oRpt; //oViewReport.Show(); // oRpt.PrintToPrinter(1, true, 1, 100); if (Printo == PrinterDevice.Viewer) { oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); } else if (Printo == PrinterDevice.Printer) { oRpt.PrintOptions.PrinterName = PrinterName; oRpt.PrintToPrinter(1, true, 1, 100); } }
public void PrintGACommissionReport() { // DataSet ds = Global.oMySql.GetDataset(String.Format("CALL GARepCommissions('{0}');", this.CompanyID)); DataSet ds = new DataSet(); DataTable table = Global.oMySql.GetDataTable(String.Format(@"Select c.RepID, r.Name as RepName, c.CustomerID, c.Name, c.SalesTax, sum(bc.Amount)*-1 aS TotalPayment, sum(bc.Amount)*-1*(1-c.SalesTax/100) as TotalNoTax, if(sum(bc.Amount)*-1*(1-c.SalesTax/100)<=1000,0,if(sum(bc.Amount)*-1*(1-c.SalesTax/100)>=1001 And sum(bc.Amount)*-1*(1-c.SalesTax/100)<25000 ,10, if(sum(bc.Amount)*-1*(1-c.SalesTax/100)>=25000 And sum(bc.Amount)*-1*(1-c.SalesTax/100)<75000 ,15, if(sum(bc.Amount)*-1*(1-c.SalesTax/100)>=75000 And sum(bc.Amount)*-1*(1-c.SalesTax/100)<125000 ,17, if(sum(bc.Amount)*-1*(1-c.SalesTax/100)>=12500 And sum(bc.Amount)*-1*(1-c.SalesTax/100)<250000 ,20,22 ))))) as CommPercent, if(sum(bc.Amount)*-1*(1-c.SalesTax/100)<=1000,0,if(sum(bc.Amount)*-1*(1-c.SalesTax/100)>=1001 And sum(bc.Amount)*-1*(1-c.SalesTax/100)<25000 ,10, if(sum(bc.Amount)*-1*(1-c.SalesTax/100)>=25000 And sum(bc.Amount)*-1*(1-c.SalesTax/100)<75000 ,15, if(sum(bc.Amount)*-1*(1-c.SalesTax/100)>=75000 And sum(bc.Amount)*-1*(1-c.SalesTax/100)<125000 ,17, if(sum(bc.Amount)*-1*(1-c.SalesTax/100)>=12500 And sum(bc.Amount)*-1*(1-c.SalesTax/100)<250000 ,20,22 )))))/100*sum(bc.Amount)*-1*(1-c.SalesTax/100) as Commission from Customer c Left Join Reps r On c.Rep_ID=r.ID Left Join Payment bc On c.CompanyID=bc.CompanyID And c.CustomerID=bc.CustomerID Where c.CompanyID='{0}' And bc.Type='P' Group By c.RepID, c.CustomerID", this.CompanyID), "Commissions"); ds.Tables.Add(table); frmViewReport oViewReport = new frmViewReport(); ds.WriteXml("GARepCommissionsReport.xml", XmlWriteMode.WriteSchema); GARepCommissions oRpt = new GARepCommissions(); oRpt.SetDataSource(ds); oRpt.SetParameterValue("CompanyName", "Signature Fundraising, Inc."); oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); ds.Dispose(); oRpt.Dispose(); oViewReport.Dispose(); }
public void PrintRepSalesReport() { frmViewReport oViewReport = new frmViewReport(); //DataSet ds = oMySql.get_summary_reps_sales(this.CompanyID); DataSet ds = new DataSet(); Boolean nView = true; /* * ds.Tables.Add(oMySql.GetDataTable(String.Format("SELECT *, c.Retail/c.NoSellers as Avg_Retail, c.NoItems/c.NoSellers as Av_Units FROM Customer c Where c.CompanyID='{0}'", this.CompanyID), "Summary")); * ds.Tables.Add(oMySql.GetDataTable(String.Format("SELECT * from BrochureByCustomer Where CompanyID='{0}' ", this.CompanyID), "BrochureByCustomer")); * ds.Tables.Add(oMySql.GetDataTable("SELECT * FROM Brochure Where CompanyID ='" + this.CompanyID + "' ", "Brochure")); * ds.Tables.Add(oMySql.GetDataTable("SELECT * FROM Prizes Where CompanyID ='" + this.CompanyID + "' ", "Prize")); * ds.Tables.Add(oMySql.GetDataTable(String.Format("SELECT * FROM Rep r Left Join Reps rs On r.ID = rs.ID Where r.CompanyID ='{0}' and rs.Name is not null Order By rs.Name", this.CompanyID), "Reps")); */ ds.Tables.Add(oMySql.GetDataTable(String.Format("SELECT *, c.Retail/c.NoSellers as Avg_Retail, c.NoItems/c.NoSellers as Av_Units FROM Customer c Left Join BrochureByCustomer bc On c.CompanyID=bc.CompanyID AND c.CustomerID=bc.CustomerID Left Join Reps r On c.Rep_ID=r.ID Where c.CompanyID='{0}' ORDER BY r.Name,c.CustomerID", this.CompanyID), "Summary")); ds.Tables.Add(oMySql.GetDataTable("SELECT * FROM Brochure Where CompanyID ='" + this.CompanyID + "' ", "Brochure")); ds.Tables.Add(oMySql.GetDataTable("SELECT * FROM Prizes Where CompanyID ='" + this.CompanyID + "' ", "Prize")); ds.Tables.Add(oMySql.GetDataTable(String.Format("SELECT r.*,rs.*,sum(c.Retail) as Retail, sum(Signed) as Signed, sum(NoSellers) as NoSellers, sum(NoItems) as NoItems, count(c.CustomerID) as NoCustomers FROM Rep r Left Join Customer c On c.CompanyID=r.CompanyID And r.ID=c.Rep_ID Left Join Reps rs On r.ID = rs.ID Where r.CompanyID ='{0}' Group By c.Rep_ID", this.CompanyID), "Reps")); ds.Tables.Add(oMySql.GetDataTable(String.Format("SELECT c.Rep_ID, c.RepID, bc.BrochureID, Avg(bc.Retail/c.Signed) as Retail FROM BrochureByCustomer bc Left Join Customer c On bc.CompanyID=c.CompanyID And bc.CustomerID=c.CustomerID Where bc.CompanyID='{0}' And Rep_ID > 0 Group By c.Rep_ID, bc.BrochureID", this.CompanyID), "Average")); summary_reps_sales oRpt7 = new summary_reps_sales(); oRpt7.SetDataSource(ds); // ds.WriteXml("RepSalesReport300.xml", XmlWriteMode.WriteSchema); if (nView) { oViewReport.cReport.ReportSource = oRpt7; oViewReport.ShowDialog(); } else { oRpt7.PrintToPrinter(1, true, 1, 100); } }
public void PrintLandedChecked() { frmViewReport oViewReport = new frmViewReport(); ItemLandedCostCheckedListing oRpt = new ItemLandedCostCheckedListing(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable("Select p.* From Product p Where CompanyID='" + CompanyID + "' And IsLandedCost='0'", "Product")); // ds.WriteXml("PrintLandedChecked.xml", XmlWriteMode.WriteSchema); oRpt.SetDataSource(ds); //oRpt.PrintToPrinter(1, true, 1, 100); oRpt.SetParameterValue("Title", "ITEM LANDED COST CHECKED LISTING"); oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); }
public void PrintGPI(PrintTo ToPrint, String PrinterName, String InvoiceNote, Boolean IsPreInvoice) { Double AllPositive = this.GetPositiveAmount(); Double AllNegative = this.GetNegativeAmount(); Double DropPercentageCustomer = 0.00; Double DropPercentageItem = 0.00; if (Retail < 2500 && !this.IsGiftAvenue && !this.IsGPI) { DataTable dtInv = GetCurrentTotalsByBrochure(); if (dtInv != null) { if (LastInvoicedAmount == 0 && Retail < 2500 && Retail > 0) { if (!IsPreInvoice) { SubtractBrochureProfitPercent(InvoicedAmount, dtInv); } else { DropPercentageCustomer = -5.00; } } DropPercentageItem = -5.00; } else { return; } } this.Note = InvoiceNote; this.Note += "\n" + GetStringOverageInvoice(); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Customer Where CompanyID='{0}' And CustomerID='{1}'", CompanyID, ID), "Customer")); DataTable dvInv = new DataTable(); dvInv = GetTotalDataTableGPI("ProductID", DropPercentageCustomer, DropPercentageItem); ds.Tables.Add(CreateDetailTable(dvInv)); //Detail DataTable dtTotals = GetCurrentTotalsGPI(DropPercentageCustomer, DropPercentageItem); //GetTotalDataTable("CustomerID"); //GetCurrentTotalsByBrochure(); if (dtTotals != null) { ds.Tables.Add(dtTotals); //Detail frmViewReport oViewReport = new frmViewReport(); //ds.WriteXml("Invoice.xml", XmlWriteMode.WriteSchema); InvoiceHeaderDetailGPI oRpt = new InvoiceHeaderDetailGPI(); oRpt.SetDataSource(ds); oRpt.SetParameterValue("PrevInvoice", AllPositive); //LastInvoicedAmount); oRpt.SetParameterValue("Payments", AllNegative); //PaymentsAmount+Charges); oRpt.SetParameterValue("AddedAmount", AddedAmount); oRpt.SetParameterValue("BalanceDue", AllPositive + AllNegative + AddedAmount); //AmountDue); oRpt.SetParameterValue("InvoiceNote", this.Note); Company oCompany = new Company(this.CompanyID); oRpt.SetParameterValue("CompanyName", oCompany.Name); if (this.BrochureID == "C" || this.BrochureID_2 == "C" || this.BrochureID_3 == "C") { oRpt.SetParameterValue("txtFee", "E Card Ship Fee".ToUpper()); } else { oRpt.SetParameterValue("txtFee", "IMPRINT FEE"); } if (this.IsPostPay) { oRpt.SetParameterValue("Terms", ""); } else { oRpt.SetParameterValue("Terms", "TERMS: NET DUE UPON DELIVERY"); } if (ToPrint == PrintTo.File) { PDF oPDF = new PDF(); oPDF.FileName = Application.StartupPath + "\\" + this.Name + ".pdf"; oPDF.ExportReport(oRpt, "pdf", Application.StartupPath + "\\", this.Name); Smtp oSmtp = new Smtp(); oSmtp.Subject = "Invoice for " + this.Name + " " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); oSmtp.To = "<" + "*****@*****.**" + ">"; //this.eMail + ">"; oSmtp.From = "\"Signature Fundraising Customer Service\" <*****@*****.**>"; String strTitle = "Invoice\n\r"; oSmtp.Body = strTitle; oSmtp.Attachment = oPDF.FileName; if (!oSmtp.Send()) { return; } } else if (ToPrint == PrintTo.Printer) { oRpt.PrintOptions.PrinterName = PrinterName; oRpt.PrintToPrinter(1, true, 1, 100); } else if (ToPrint == PrintTo.Viewer) { oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); //oViewReport.cReport.PrintReport(); } if (!IsPreInvoice) { UpdateInventory(); //Update Statement if (LastInvoicedAmount != InvoicedAmount) { UpdateInvoicedAmount(InvoicedAmount - LastInvoicedAmount); //Adding Line ,,,, AddedAmount = 0.00; } } this.UpdateCurrentTotals(); ds.Dispose(); oRpt.Dispose(); } return; }
private void PrintData() { if (grvChung.RowCount == 0 || grdChung.DataSource == null) { Commons.Modules.ObjSystems.msgChung(Commons.ThongBao.msgKhongCoDuLieuIn); return; } frmViewReport frm = new frmViewReport(); frm.rpt = new rptTienThuongXepLoai(); DataTable dt = new DataTable(); DateTime dThang = Convert.ToDateTime("01/01/1900"); try { dThang = Convert.ToDateTime(cboThang.Text.ToString()); } catch { } System.Data.SqlClient.SqlConnection conn; try { conn = new System.Data.SqlClient.SqlConnection(Commons.IConnections.CNStr); conn.Open(); System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand("spTienThuongXepLoai", conn); //dt.Load(SqlHelper.ExecuteReader(Commons.IConnections.CNStr, "spTienThuongXepLoai", dThang, "01/01/1900", // (cboDV.EditValue.ToString() == "" ? -1 : cboDV.EditValue), // (cboXN.EditValue.ToString() == "" ? -1 : cboXN.EditValue), // (cboTo.EditValue.ToString() == "" ? -1 : cboTo.EditValue), Commons.Modules.UserName, // Commons.Modules.TypeLanguage, "", "Print")); cmd.Parameters.Add("@NgayTTXL", SqlDbType.Date).Value = dThang; cmd.Parameters.Add("@DVi", SqlDbType.BigInt).Value = (cboDV.EditValue.ToString() == "" ? -1 : cboDV.EditValue); cmd.Parameters.Add("@XNghiep", SqlDbType.BigInt).Value = (cboXN.EditValue.ToString() == "" ? -1 : cboXN.EditValue); cmd.Parameters.Add("@To", SqlDbType.BigInt).Value = (cboTo.EditValue.ToString() == "" ? -1 : cboTo.EditValue); cmd.Parameters.Add("@UName", SqlDbType.NVarChar, 50).Value = Commons.Modules.UserName; cmd.Parameters.Add("@NNgu", SqlDbType.Int).Value = Commons.Modules.TypeLanguage; cmd.Parameters.Add("@sBT", SqlDbType.NVarChar, 50).Value = "rptTienThuongXepLoai"; cmd.Parameters.Add("@Loai", SqlDbType.NVarChar, 50).Value = "Print"; cmd.CommandType = CommandType.StoredProcedure; System.Data.SqlClient.SqlDataAdapter adp = new System.Data.SqlClient.SqlDataAdapter(cmd); DataSet ds = new DataSet(); adp.Fill(ds); dt = new DataTable(); dt = ds.Tables[0].Copy(); dt.TableName = "DATA_REPORT"; frm.AddDataSource(dt); dt = new DataTable(); dt = ds.Tables[1].Copy(); dt.TableName = "DATA_NNGU"; frm.AddDataSource(dt); } catch {} frm.rpt = new rptTienThuongXepLoai(); frm.ShowDialog(); }
public Boolean PrintStatement(String PrinterName, PrinterDevice Device) { if (_Total == 0) { Total = GetTotal(); Update(); } frmViewReport oViewReport = new frmViewReport(); //DataSet ds1 = oMySql.GetCustomerStatement(CompanyID, ID); DataSet ds = new DataSet(); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Vendor Where CompanyID='{0}' And VendorID='{1}'", CompanyID, this.VendID), "Vendor")); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Purchase Where CompanyID='{0}' And PurchaseID='{1}'", CompanyID, this.ID), "Purchase")); ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From PaymentProvider Where CompanyID='{0}' And PurchaseID='{1}' Order by Date", CompanyID, ID), "Statement")); PurchaseStatement oRpt = new PurchaseStatement(); // ds.WriteXml("PrintStatement1.xml", XmlWriteMode.WriteSchema); oRpt.SetDataSource(ds); oRpt.SetParameterValue("CompanyName", base.Name); if (Device == PrinterDevice.Printer) { oRpt.PrintOptions.PrinterName = PrinterName; oRpt.PrintToPrinter(1, true, 1, 100); } else if (Device == PrinterDevice.eMail) { PDF oPDF = new PDF(); oPDF.FileName = Application.StartupPath + "\\" + this.ID + ".pdf"; oPDF.ExportReport(oRpt, "pdf", Application.StartupPath + "\\", this.ID); Smtp oSmtp = new Smtp(); oSmtp.Subject = base.ID + " - Statement " + DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + "(" + this.ID + " - " + this.Name + ")"; if (PrinterName != "") { oSmtp.To = "\"" + this.Name + "\" <" + PrinterName + ">"; //this.eMail + ">"; } /* * else if (this.isEmail(this.eMail) && File.Exists(oPDF.FileName)) * { * * oSmtp.To = "\"" + this.Chairperson + "\" <" + this.eMail + ">"; * if (this.isEmail(this.oCustomerExtra.eMail)) * { * oSmtp.To = "\"" + this.Chairperson + "\" <" + this.oCustomerExtra.eMail + ">"; * } * * oSmtp.To = "\"" + "Scott Elsbree" + "\" <" + "*****@*****.**" + ">"; //this.eMail + ">"; * } */ else { oSmtp.To = "\"" + "Scott Elsbree" + "\" <" + "*****@*****.**" + ">"; //this.eMail + ">"; } oSmtp.From = "\"Signature Fundraising Customer Service\" <*****@*****.**>"; String strTitle = "\n\r"; strTitle += "Thank you for choosing Signature Fundraising. As of today we have not received complete payment for your account.\n\r"; strTitle += "We have attached a copy of your most recent statement showing the balance due. Please remember that according to\n\r"; strTitle += "the agreement we have with your organization interest will accrue on any unpaid balance after 20 days of delivery.\n\r"; strTitle += "We have also attached a check by fax form that will enable you to send payment to us right away. If you have any \n\r"; strTitle += "questions, you may reply to this e-mail or call us at 1-800-645-3863.\n\r"; strTitle += "\n\nThank you.\n\r"; strTitle += "Signature Fundraising\n\r"; //String strTitle = "This statement amount due is for a total of :\n\r $ " + this.StatementAmountDue.ToString() + " \n\r" ; //This invoice is for a total of ::invoice amount::, of which ::payment amount:: has already been received. /* * if (PrinterName == "" && !this.isEmail(this.eMail)) * strTitle += " WRONG EMAIL ADDRESS: " + this.eMail + " of " + this.ID + " : " + this.Name; * * if (PrinterName == "" && !File.Exists(oPDF.FileName)) * strTitle += " NO PDF FILE : " + this.eMail + " of " + this.ID + " : " + this.Name; * else * oSmtp.Attachment = oPDF.FileName; */ oSmtp.Body = strTitle; oSmtp.Attachment = "Check by Fax Form.pdf"; oSmtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "sigfund"); // oSmtp.BCC = "*****@*****.**"; if (!oSmtp.Send()) { Console.WriteLine(oSmtp.Error); oRpt.Dispose(); oViewReport.Dispose(); return(false); } //while (File.GetAttributes(oPDF.FileName) == FileAttributes.ReadOnly) ; /* * ReadFile: * try * { * if (File.Exists(oPDF.FileName)) * File.Delete(oPDF.FileName); * } * catch (IOException ex) * { * Console.WriteLine(ex.Message); * goto ReadFile; * } */ } else { oViewReport.cReport.ReportSource = oRpt; oViewReport.ShowDialog(); } oRpt.Dispose(); oViewReport.Dispose(); return(true); }