Пример #1
0
        public void PrintGACommissionReport(CrystalReportViewer oViewer)
        {
            DataSet ds = Global.oMySql.GetDataset(String.Format("CALL GARepCommissions('{0}');", this.CompanyID));



            ds.Tables[0].TableName = "Customer";
            ds.Tables[1].TableName = "Reps";
            ds.Tables[2].TableName = "Payments";

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

            GARepCommissions oRpt = new GARepCommissions();

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

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

            oViewer.ReportSource = oRpt;


            //ds.Dispose();
            //oRpt.Dispose();
            //oViewReport.Dispose();
        }
Пример #2
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();
        }