public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CsrSaleOrderQuantity rpt = new CsrSaleOrderQuantity();

            rpt.Site = this.Site;
            return(rpt);
        }
Ejemplo n.º 2
0
        private void RefreshReportSale()
        {
            if (chbShowBenefit.Checked)
            {
                if (!UserService.AllowToPerform(Resources.PermissionViewSaleDetailReport))
                {
                    const string briefMsg = "អំពី​សិទ្ឋិ​ប្រើ​ប្រាស់";
                    var detailMsg = Resources.MsgUserPermissionDeny;
                    using (var frmMessageBox = new FrmExtendedMessageBox())
                    {
                        frmMessageBox.BriefMsgStr = briefMsg;
                        frmMessageBox.DetailMsgStr = detailMsg;
                        frmMessageBox.IsCanceledOnly = true;
                        frmMessageBox.ShowDialog(this);
                        return;
                    }
                }
            }
            else
            {
                if (!UserService.AllowToPerform(Resources.PermissionViewSaleReport))
                {
                    const string briefMsg = "អំពី​សិទ្ឋិ​ប្រើ​ប្រាស់";
                    var detailMsg = Resources.MsgUserPermissionDeny;
                    using (var frmMessageBox = new FrmExtendedMessageBox())
                    {
                        frmMessageBox.BriefMsgStr = briefMsg;
                        frmMessageBox.DetailMsgStr = detailMsg;
                        frmMessageBox.IsCanceledOnly = true;
                        frmMessageBox.ShowDialog(this);
                        return;
                    }
                }
            }

            var searchCriteria =
                new List<string>
                {
                    "SaleOrderNumber IN (SELECT SaleOrderNumber FROM TSaleOrders WHERE SaleOrderTypeId = 0)",
                    "SaleOrderDate BETWEEN CONVERT(DATETIME, '" +
                    dtpStartDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) +
                    "', 103) AND CONVERT(DATETIME, '" +
                    dtpStopDate.Value.ToString("dd/MM/yyyy", AppContext.CultureInfo) +
                    " 23:59', 103)"
                };
            var saleList = _SaleOrderService.GetSaleHistories(searchCriteria);

            DataSet dtsModel = new DtsModels();
            var propertyInfos = typeof (SaleOrderReport).GetProperties();
            foreach (var objInstance in saleList)
            {
                var dataRow = dtsModel.Tables[1].NewRow();
                foreach (var propertyInfo in propertyInfos)
                    dataRow[propertyInfo.Name] = propertyInfo.GetValue(objInstance, null);
                dtsModel.Tables[1].Rows.Add(dataRow);
            }

            if (chbShowQuantity.Checked)
            {
                var rptSaleOrderQuantity = new CsrSaleOrderQuantity();
                rptSaleOrderQuantity.SetDataSource(dtsModel);
                crvReport.ReportSource = rptSaleOrderQuantity;
            }
            else if(chbShowBenefit.Checked)
            {
                var rptSaleBenefit = new CsrSaleBenefit();
                rptSaleBenefit.SetDataSource(dtsModel);
                crvReport.ReportSource = rptSaleBenefit;
            }
            else
            {
                var rptSaleOrder = new CsrSaleOrder();
                rptSaleOrder.SetDataSource(dtsModel);
                crvReport.ReportSource = rptSaleOrder;
            }
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     CsrSaleOrderQuantity rpt = new CsrSaleOrderQuantity();
     rpt.Site = this.Site;
     return rpt;
 }