コード例 #1
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            CR_Bill_Sale rpt = new CR_Bill_Sale();

            rpt.Site = this.Site;
            return(rpt);
        }
コード例 #2
0
        void CreateReport(string billType)
        {
            DisposeReport();
            string PurchasesOrderNo   = "";
            string PurchasesOrderDate = "";
            string DeliveryNo         = "";
            string DeliveryDate       = "";

            BillDetailDL        objBillDetailDL = new BillDetailDL();
            List <BillDetailEL> lstBillDetail   = objBillDetailDL.GetBillDetailByBillId(billEL.Bill_Id);


            var qurPurchases = from b in lstBillingDelivertDetail
                               join bd in lstBillDetail on b.Delivery_Detail_Id equals bd.Delivery_Detail_Id
                               select new
            {
                b.Purchases_Order_Id,
                b.PURCHASES_ORDER_Date,
                b.Purchases_Order_No
            };

            var qurDelivary = from b in lstBillingDelivertDetail
                              join bd in lstBillDetail on b.Delivery_Detail_Id equals bd.Delivery_Detail_Id
                              select new
            {
                b.Delivery_Id,
                b.Delivery_Date,
                b.Delivery_No
            };

            foreach (var item in qurDelivary.Distinct())
            {
                DeliveryNo   += ", " + item.Delivery_No.Trim();
                DeliveryDate += ", " + item.Delivery_Date.ToString("dd/MM/yyyy").Trim();
            }

            foreach (var item in qurPurchases.Distinct())
            {
                PurchasesOrderNo   += ", " + item.Purchases_Order_No.Trim();
                PurchasesOrderDate += ", " + item.PURCHASES_ORDER_Date.ToString("dd/MM/yyyy").Trim();
            }
            if (qurDelivary.Distinct().Count() > 10)
            {
                DeliveryNo   = ",As per attach challan copy";
                DeliveryDate = ",As per attach challan copy";
            }

            try
            {
                BillDL  objBillDL = new BillDL();
                DataSet ds        = objBillDL.GetBillReportData(companyEL, billEL);


                //if ((int)ds.Tables["GetBillReportHeader"].Rows[0]["Bill_Type_Id"] == (int)enumBillType.RetailInvoice_Jobwork
                //    || (int)ds.Tables["GetBillReportHeader"].Rows[0]["Bill_Type_Id"] == (int)enumBillType.TaxInvoice_Jobwork)
                //{
                //    objRpt = new CR_Bill();
                //    objRpt.SetDataSource(ds);

                //    objRpt.SetParameterValue("Order_No", PurchasesOrderNo.Substring(1));
                //    objRpt.SetParameterValue("Order_Date", PurchasesOrderDate.Substring(1));
                //    objRpt.SetParameterValue("Challan_NO", DeliveryNo.Substring(1));
                //    objRpt.SetParameterValue("Challan_Date", DeliveryDate.Substring(1));
                //    objRpt.SetParameterValue("Bill_Type", billType);

                //    if (companyEL.Company_Type_Id == (int)enumCompanyType.Delhi)
                //    {
                //        objRpt.SetParameterValue("Tin_No", " 07050294694");
                //    }
                //    else if (companyEL.Company_Type_Id == (int)enumCompanyType.Noida)
                //    {
                //        objRpt.SetParameterValue("Tin_No", " 09165703716");
                //    }
                //    crystalReportViewer1.ReportSource = objRpt;
                //}
                //else
                //{
                objRptSale = new CR_Bill_Sale();
                objRptSale.SetDataSource(ds);

                objRptSale.SetParameterValue("Order_No", PurchasesOrderNo.Substring(1));
                objRptSale.SetParameterValue("Order_Date", PurchasesOrderDate.Substring(1));
                objRptSale.SetParameterValue("Challan_NO", DeliveryNo.Substring(1));
                objRptSale.SetParameterValue("Challan_Date", DeliveryDate.Substring(1));
                objRptSale.SetParameterValue("Bill_Type", billType);

                if (companyEL.Company_Type_Id == (int)enumCompanyType.Delhi)
                {
                    objRptSale.SetParameterValue("Tin_No", " 07050294694");
                }
                else if (companyEL.Company_Type_Id == (int)enumCompanyType.Noida)
                {
                    objRptSale.SetParameterValue("Tin_No", " 09165703716");
                }
                crystalReportViewer1.ReportSource = objRptSale;
                //}
            }
            catch (Exception ex)
            {
                string dt = ex.Message;
            }
        }