示例#1
0
        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();
        }
示例#2
0
        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 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();
        }
示例#4
0
        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 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();
            }
        }
示例#6
0
        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);
            }
        }
示例#7
0
        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);
             */
        }
示例#8
0
        //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();
        }
示例#9
0
        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();
        }
示例#11
0
        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;
                }
            }
        }
示例#14
0
        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();
        }
示例#15
0
        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 GenerateInvoiceXLSFile()
        {
            DataSet   ds    = new DataSet();
            DataTable dvInv = new DataTable();
            String    Sql   = String.Format("SELECT od.OrderID, o.Teacher, o.Student , s.Attention, s.Address,s.City, s.State, s.ZipCode, s.DayPhone,  t.TrackingNumber, od.ProductID,p.Description, od.Quantity,p.Price FROM OrderDetail od Left Join Shortage s On od.OrderID=s.OrderID Left Join Orders o On o.ID=od.OrderID Left Join UPS_TrakingNumber t On s.ShortageID=t.ShortageID Left Join  Product p On od.CompanyID=p.CompanyID and od.ProductID=p.ProductID Where od.CompanyID='{0}' And od.CustomerID='{1}' Group By od.CustomerID, o.Teacher, o.Student, od.ProductID Order By od.CustomerID, o.Teacher, o.Student, od.ProductID", this.CompanyID, this.ID);

            dvInv = oMySql.GetDataTable(String.Format("SELECT o.CustomerID, od.OrderID, o.Teacher, o.Student , s.Attention, s.Address,s.City, s.State, s.ZipCode, s.DayPhone,  t.TrackingNumber, od.ProductID,p.Description, od.Quantity,p.Price FROM OrderDetail od Left Join Shortage s On od.OrderID=s.OrderID Left Join Orders o On o.ID=od.OrderID Left Join UPS_TrakingNumber t On s.ShortageID=t.ShortageID Left Join  Product p On od.CompanyID=p.CompanyID and od.ProductID=p.ProductID Where od.CompanyID='{0}' And od.CustomerID='{1}' Group By od.CustomerID, o.Teacher, o.Student, od.ProductID Order By od.CustomerID, o.Teacher, o.Student, od.ProductID", this.CompanyID, this.ID), "InvoiceDetail");
            ds.Tables.Add(CreateInvoiceGPITable(dvInv)); //Detail

            frmViewReport oViewReport = new frmViewReport();
            //ds.WriteXml("Invoice.xml", XmlWriteMode.WriteSchema);
            CustomerInvoiceXLSFile oRpt = new CustomerInvoiceXLSFile();

            oRpt.SetDataSource(ds);
            //ds.WriteXml("InvoiceXLSFile.xml", XmlWriteMode.WriteSchema);

            //oViewReport.cReport.ReportSource = oRpt;
            //oViewReport.ShowDialog();


            try
            {
                ExportOptions CrExportOptions;

                DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
                ExcelFormatOptions         CrFormatTypeOptions          = new ExcelFormatOptions();
                CrDiskFileDestinationOptions.DiskFileName = "Invoice-" + this.ID + ".xls";
                CrExportOptions = oRpt.ExportOptions;
                CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
                CrExportOptions.ExportFormatType      = ExportFormatType.Excel;
                CrExportOptions.DestinationOptions    = CrDiskFileDestinationOptions;
                CrExportOptions.FormatOptions         = CrFormatTypeOptions;
                oRpt.Export();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }


            ds.Dispose();
            oRpt.Dispose();
        }
        } //Constructor

        public String  PrintPDF()
        {
            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"));

            oRpt.SetDataSource(ds);
            oRpt.SetParameterValue("CompanyName", base.Name);

            PDF oPDF = new PDF();

            oPDF.FileName = Application.StartupPath + "\\" + this.ID + ".pdf";
            oPDF.ExportReport(oRpt, "pdf", Application.StartupPath + "\\", this.ID);
            oRpt.Dispose();
            return(oPDF.FileName);
        }
示例#18
0
        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();
        }
示例#19
0
        public void Print()
        {
            frmViewReport oViewReport = new frmViewReport();

            DataSet ds = new DataSet();

            ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("Select * From OrderTicket Where ID='{0}'", ID), "Ticket"));
            ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("Select * From OrderTicketDetail Where TicketID='{0}'", ID), "TicketDetail"));
            ds.Tables.Add(Global.oMySql.GetDataTable(String.Format("Select * From Product Where Password='******'", this.Password), "Product"));


            TicketReport oRpt = new TicketReport();

            //ds.WriteXml("PrintTicket1.xml", XmlWriteMode.WriteSchema);

            oRpt.SetDataSource(ds);
            oRpt.SetParameterValue("CompanyName", "Signature Fundraising, Inc.");

            oViewReport.cReport.ReportSource = oRpt;
            oViewReport.Show();
            //oViewReport.cReport.PrintReport();
        }
示例#20
0
        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 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 PrintLog()
        {
            frmViewReport oViewReport = new frmViewReport();
            //ReportDocument oRpt=null;
            POReceiptLog oRpt = new POReceiptLog();
            DataSet      ds   = new DataSet();


            ds.Tables.Add(oMySql.GetDataTable("Select * From Vendor Where CompanyID='" + CompanyID + "'", "Vendor"));
            ds.Tables.Add(oMySql.GetDataTable("Select * From Product Where CompanyID='" + CompanyID + "'", "Product"));
            ds.Tables.Add(oMySql.GetDataTable("Select * From Purchase Where CompanyID='" + CompanyID + "' And PurchaseID='" + PurchaseID + "'", "Purchase"));
            ds.Tables.Add(oMySql.GetDataTable(String.Format("SELECT pd.PurchaseID, pd.ProductID, p.Description, p.Cost as Price, p.InvCode, pd.cases*p.size+pd.units as Ordered, sum(rd.Quantity) as Received FROM PurchaseDetail pd  Left Join Product p on pd.CompanyID=p.CompanyID And pd.ProductID=p.ProductID Left Join ReceiveDetail rd on pd.CompanyID=rd.CompanyID and pd.ProductID=rd.ProductID and pd.PurchaseID=rd.PurchaseID Where pd.CompanyID = '{0}' And pd.PurchaseID='{1}' Group by pd.ProductID, rd.ProductID", CompanyID, PurchaseID), "Receipt"));


            foreach (DataRow row in ds.Tables["Receipt"].Rows)
            {
                if (row["Received"] == DBNull.Value)
                {
                    row["Received"] = 0;
                }
            }

            oRpt.SetDataSource(ds);

            //oViewReport.cReport.ReportSource = oRpt;
            //oViewReport.ShowDialog();
            oRpt.PrintToPrinter(1, true, 1, 100);

            POReceipts oRpt_1 = new POReceipts();

            ds.Tables.Remove("Product");
            ds.Tables.Remove("Receipt");
            ds.Tables.Add(oMySql.GetDataTable("Select * From Receive Where CompanyID='" + CompanyID + "' And PurchaseID='" + PurchaseID + "'", "Receipts"));
            //ds.WriteXml("dataset46.xml", XmlWriteMode.WriteSchema);
            oRpt_1.SetDataSource(ds);
            //oViewReport.cReport.ReportSource = oRpt_1;
            //oViewReport.ShowDialog();
            oRpt_1.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();
        }
示例#24
0
        public void Print()
        {
            frmViewReport oViewReport = new frmViewReport();

            DataSet ds = new DataSet();

            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Customer c Left Join Orders o On c.CustomerID=o.CustomerID And c.CompanyID=o.CompanyID  Where o.ID='{0}'", this.OrderID), "Customer"));
            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From OrderTicket Where ID='{0}'", ID), "Ticket"));
            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From OrderTicketDetail Where TicketID='{0}'", ID), "TicketDetail"));
            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Orders Where ID='{0}'", this.OrderID), "Orders"));
            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select * From Product Where ProductID='{0}'", this.ProductID), "Product"));


            TicketReport oRpt = new TicketReport();

            //ds.WriteXml("PrintTicket1.xml", XmlWriteMode.WriteSchema);

            oRpt.SetDataSource(ds);
            oRpt.SetParameterValue("CompanyName", "Signature Fundraising, Inc.");

            oViewReport.cReport.ReportSource = oRpt;
            oViewReport.Show();
            //oViewReport.cReport.PrintReport();
        }
        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;
        }
示例#26
0
        public void Print(Boolean LocalPrint)
        {
            DataSet ds = new DataSet();

            ds.Tables.Add(oMySql.GetDataTable(String.Format("Select *,'Text'  From Shortage Where ShortageID='{0}'", ID), "Shortage"));

            Product oProduct   = new Product(this.CompanyID);
            String  SchoolName = "";

            foreach (DataRow row in ds.Tables["Shortage"].Rows)
            {
                row["Text"]    = Global.ByteToString((Byte[])(row["Detail"]));
                row["Address"] = row["Address"].ToString() + row["Address_2"].ToString();
                foreach (DataRow drow in Items.Detail.Rows)
                {
                    oProduct.Find(drow["ProductID"].ToString());
                    row["Text"] += "\n" + oProduct.InvCode + " - " + drow["ProductID"].ToString() + " - " + drow["Description"].ToString() + " - " + drow["Quantity"].ToString();
                }

                if (row["CustomerID"].ToString().Trim() != "")
                {
                    if (oCustomer.Find(row["CustomerID"].ToString()))
                    {
                        SchoolName = oCustomer.Name;
                    }
                }
            }


            frmViewReport oViewReport = new frmViewReport();

            //ds.WriteXml("dataset72.xml", XmlWriteMode.WriteSchema);
            ShortageReport oRpt = new ShortageReport();

            oRpt.SetDataSource(ds);

            oRpt.SetParameterValue("CompanyName", "Signature Fundraising, Inc.");
            oRpt.SetParameterValue("SchoolName", SchoolName);
            oRpt.SetParameterValue("User", Global.CurrentUser);

            oRpt.SetParameterValue("Dates", "");
            oRpt.SetParameterValue("Chairperson", "");
            oRpt.SetParameterValue("StudentName", "");

            String sType = "Not specified";

            switch (Type)
            {
            case "A":
                sType = "Add";
                break;

            case "O":
                sType = "0verage";
                break;

            case "X":
                sType = "Delete";
                break;

            case "M":
                sType = "Miscellaneous";
                break;

            case "R":
                sType = "Refund";
                break;

            case "D":
                sType = "Damaged";
                break;

            case "B":
                sType = "Missing";
                break;

            case "I":
                sType = "Internet";
                break;

            case "E":
                sType = "Missing Entire Order";
                break;

            case "Y":
                sType = "Discrepancy";
                break;
            }
            oRpt.SetParameterValue("Type", sType);

            oRpt.SetParameterValue("BarCode", (sType != "Add")? "*" + ID + "*":"");


            if (OrderID.Trim() != "")
            {
                if (oCustomer.ShipDate != Global.DNull || oCustomer.DeliveryDate != Global.DNull)
                {
                    String ShipDate     = oCustomer.ShipDate == Global.DNull ? "          " : oCustomer.ShipDate.ToString("MM/dd/yyyy");
                    String DeliveryDate = oCustomer.DeliveryDate == Global.DNull ? "          " : oCustomer.DeliveryDate.ToString("MM/dd/yyyy");
                    oRpt.SetParameterValue("Dates", "Ship Date: " + ShipDate + "   " + "Delivery Date:" + DeliveryDate);
                }
                if (oCustomer.Chairperson.Trim() != "")
                {
                    oRpt.SetParameterValue("Chairperson", "Chairperson:" + oCustomer.Chairperson);
                }

                oOrder = new Order(CompanyID);
                oOrder.Find(Convert.ToInt32(OrderID));
                oRpt.SetParameterValue("StudentName", "Student:      " + oOrder.Student);
            }

            if (Global.CurrentUser == "JOYCE" || Global.CurrentUser == "ALVARO" || LocalPrint || Type == "R")
            {
                oViewReport.cReport.ReportSource = oRpt;
                oViewReport.cReport.PrintReport();
                //oViewReport.ShowDialog();
            }
            else
            {
                oRpt.PrintOptions.PrinterName = "\\\\srv1\\Shortage";
                oRpt.PrintToPrinter(1, false, 1, 100);
            }

            ds.Dispose();
            oRpt.Dispose();
            oViewReport.Dispose();
        }
示例#27
0
        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);
        }