private void printReceipt(object sender, EventArgs e)
        {
            ReportDataSource source = new ReportDataSource();
            ReportViewer reportViewer = new ReportViewer();

            source.Name = "DataSet1";
            source.Value = null;

            ReportParameter p1 = new ReportParameter("test1", "ASV");
             //   reportViewer.Reset();
               // reportViewer.LocalReport.DataSources.Clear();
              reportViewer.LocalReport.ReportPath = "../../Reports/ReportReceipts.rdlc";
              ReportParameter rp = new ReportParameter();
              rp.Name = "id";
              rp.Values.Add(objectReceipt.Id);
              ReportParameter rp1 = new ReportParameter("contractid", objectReceipt.Contractid, true);
              ReportParameter rp2 = new ReportParameter("dateestablish", this.objectReceipt.Dateestablish, true);
              ReportParameter rp3 = new ReportParameter("billid", this.objectReceipt.Billid, true);
              ReportParameter rp4 = new ReportParameter("customername", this.objectReceipt.Customername, true);
              ReportParameter rp5 = new ReportParameter("total", this.objectReceipt.Total.ToString(), true);
              ReportParameter rp6 = new ReportParameter("reason", this.objectReceipt.Reason, true);
              ReportParameter rp7 = new ReportParameter("note", this.objectReceipt.Contents, true);
              ReportParameter[] parameter = new ReportParameter[] { rp, rp2, rp1, rp3, rp4, rp5, rp6, rp7 };
             // reportViewer.LocalReport.SetParameters(p);
              // reportViewer.LocalReport.DataSources.Add(source);

              ReportReceipts form = new ReportReceipts(parameter);
            form.Show();
        }
        private void geraRelatorio()
        {
            lDtPesquisa = (DataTable)Session["ldsRel"];
            if (lDtPesquisa.Rows.Count > 0)
            {

                string periodo = Request.QueryString["periodo"].ToString();
                InstituicoesBL instBL = new InstituicoesBL();
                Instituicoes inst = new Instituicoes();

                InstituicoesLogoBL instLogoBL = new InstituicoesLogoBL();
                InstituicoesLogo instLogo = new InstituicoesLogo();

                ReportDataSource rptDatasourceInstituicao = new ReportDataSource("DataSet_Instituicao", instBL.PesquisarDsBL().Tables[0]);
                ReportDataSource rptDatasourceInstituicaoLogo = new ReportDataSource("DataSet_InstituicaoLogo", instLogoBL.PesquisarDsBL().Tables[0]);
                ReportDataSource rptDatasourceMovEstoque = new ReportDataSource("DataSet_MovimentacaoEstoque", lDtPesquisa);

                ReportParameter[] param = new ReportParameter[1];
                param[0] = new ReportParameter("periodo", periodo);

                rptMovestoque.LocalReport.SetParameters(param);
                rptMovestoque.LocalReport.DataSources.Add(rptDatasourceInstituicao);
                rptMovestoque.LocalReport.DataSources.Add(rptDatasourceInstituicaoLogo);
                rptMovestoque.LocalReport.DataSources.Add(rptDatasourceMovEstoque);

                rptMovestoque.LocalReport.Refresh();
                //Session["ldsRel"] = null;
            }
            else
            {
                divRelatorio.Visible = false;
                divMensagem.Visible = true;
                lblMensagem.Text = "Este relatorio não possui dados.";
            }
        }
    private void CargarReporte(int id_remate)
    {
      try
      {
        if (id_remate != 0)
        {
          DataSet ds = new bf_re_remates().GetActaRemateReport(id_remate);
          if (ds.Tables.Count != 0)
          {
            ReportDataSource data = new ReportDataSource("ds_acta_remate", ds.Tables[0]);
            ReportDataSource datasource = data;

            //rpt_acta_remate.LocalReport.DataSources.Clear();
            rpt_acta_remate.LocalReport.DataSources.Add(datasource);
          }
          else
          {
            Mensajes.Error("No se encontraron Registros.");
          }
        }
        else
        {
          Mensajes.Error("No se encuentra el ID para este Remate");
        }
      }
      catch (Exception ex)
      {
        Mensajes.Error(ex.Message);
      }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt;
                if (Request.QueryString["sdt"] != null || Request.QueryString["edt"] != null)
                {
                    DateTime Sdt = Convert.ToDateTime(Request.QueryString["sdt"].ToString());
                    DateTime Edt = Convert.ToDateTime(Request.QueryString["edt"].ToString());

                    dt = DAL.DbHelper.ExecuteDataTable("P_AssessmentWeek_ByAllseller", Sdt, Edt);
                    ReportDataSource rds = new ReportDataSource("sellerAssessment_Data_DataTable1", dt);
                    ReportViewer1.LocalReport.DataSources.Clear();
                    ReportViewer1.LocalReport.DataSources.Add(rds);
                    ReportViewer1.LocalReport.Refresh();
                    if (dt.Rows.Count == 0)
                    {
                        ReportViewer1.Visible = false;
                        div_nodata.Visible = true;
                    }
                    else
                    {
                        div_nodata.Visible = false;
                    }
                }
                else
                {
                    Library.Script.ClientMsgUrl("错误的参数。", "reportCustomer.aspx");
                }
            }
        }
Example #5
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            int year = Convert.ToInt32(DropDownList2.SelectedValue);
            int month=Convert.ToInt32(DropDownList1.SelectedValue);
            var dt = new DataTable();
            dt.Columns.Add("TagDate", typeof(DateTime));
            dt.Columns.Add("TagName");
            dt.Columns.Add("TagVal", typeof(float));
            var datasource = NyData.Getdata(year, month);
            foreach (var source in datasource)
            {
                DataRow dr = dt.NewRow();
                dr[0] = source.TagDate;
                dr[1] = source.TagName;
                // dr[2] = string.IsNullOrEmpty(source.Tagval)?"0":source.Tagval;
                dr[2] = source.Tagval;
                dt.Rows.Add(dr);
            }

            var hh = new ReportDataSource("Message", dt);
            var localreport = this.ReportViewer1.LocalReport;
            localreport.DataSources.Clear();
            localreport.DataSources.Add(hh);
            //localreport.SetParameters(new ReportParameter("rDate",new DateTime(2015,8,1).ToShortDateString()));

            localreport.Refresh();
        }
Example #6
0
        private void Frm_KategorijeReport_Load(object sender, EventArgs e)
        {
            ReportDataSource rds = new ReportDataSource("Kategorije", DSKategorijeBindingSource);
            reportViewer1.LocalReport.DataSources.Add(rds);

            this.reportViewer1.RefreshReport();
        }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.IsPostBack == false)
     {
         txtFechaInicial.Text = DateTime.Now.ToShortDateString();
         txtFechaFinal.Text = DateTime.Now.ToShortDateString();
         lblFechaInicial.Text = DateTime.Parse(txtFechaInicial.Text).Year.ToString("0000") + DateTime.Parse(txtFechaInicial.Text).Month.ToString("00") + DateTime.Parse(txtFechaInicial.Text).Day.ToString("00");
         lblFechaFinal.Text = DateTime.Parse(txtFechaFinal.Text).Year.ToString("0000") + DateTime.Parse(txtFechaFinal.Text).Month.ToString("00") + DateTime.Parse(txtFechaFinal.Text).Day.ToString("00");
         ListarSucursal();
         if (ddlAlmacen.SelectedIndex == 0)
         {
             lblAlmacen.Text = "";
         }
         else
         {
             lblAlmacen.Text = ddlAlmacen.SelectedItem.Text;
         }
         ReportViewer1.LocalReport.ReportPath = "VentasPorCategoria.rdlc";
         ReportViewer1.LocalReport.DataSources.Clear();
         ReportDataSource rds = new ReportDataSource();
         rds.Name = "DataSet1";
         SqlDataAdapter da = new SqlDataAdapter("Play_VentasxCategoria_Reporte '" + lblFechaInicial.Text + "','" + lblFechaFinal.Text + "','" + lblAlmacen.Text + "'", conexion);
         DataTable dt = new DataTable();
         da.Fill(dt);
         rds.Value = dt;
         ReportViewer1.LocalReport.DataSources.Add(rds);
         ReportViewer1.LocalReport.Refresh();
     }
 }
Example #8
0
 public void setRptXraySummaryView(DateTime dateStart, DateTime dateEnd)
 {
     try
     {
         ReportDataSource rds = new ReportDataSource("xraySummary", getXraySummaryView(dateStart, dateEnd));
         //MessageBox.Show("bbbb");
         rV1.LocalReport.DataSources.Add(rds);
         //rV1.LocalReport.ReportPath = "d:\\source\\reportBangna\\reportBangna\\report\\xraysummary.rdlc";
         rV1.LocalReport.ReportPath = System.Environment.CurrentDirectory + "\\report\\xraysummary.rdlc";
         ReportParameter reportParaHeader1 = new ReportParameter();
         reportParaHeader1.Name = "header1";
         reportParaHeader1.Values.Add("aaaaaa");
         rV1.LocalReport.SetParameters(reportParaHeader1);
         ReportParameter reportParaHeader2 = new ReportParameter();
         reportParaHeader2.Name = "header2";
         reportParaHeader2.Values.Add("bbbbbbbb");
         rV1.LocalReport.SetParameters(reportParaHeader2);
         ReportParameter reportParaHeader3 = new ReportParameter();
         reportParaHeader3.Name = "header3";
         reportParaHeader3.Values.Add("cccccccc");
         rV1.LocalReport.SetParameters(reportParaHeader3);
     }
     catch (Exception ex)
     {
         MessageBox.Show("error " + ex.Message);
     }
 }
Example #9
0
        private void btnGenerar_Click(object sender, EventArgs e)
        {
            objDetalleReservaBL = new DetalleReservaBL();
            DateTime fechaInicio = dtpInicio.Value.Date;
            DateTime fechaFin = dtpFin.Value.Date.Add(TimeSpan.Parse("23:59:59"));

            try
            {
                reportViewer1.ProcessingMode = ProcessingMode.Local;

                reportViewer1.LocalReport.DataSources.Clear();

                ReportDataSource Reporte = new ReportDataSource("DataSet1", objDetalleReservaBL.ListarFacturacion(fechaInicio, fechaFin));

                reportViewer1.LocalReport.DataSources.Add(Reporte);

                reportViewer1.LocalReport.ReportEmbeddedResource = "MadScienceGUI.reportFacturacion.rdlc";

                List<ReportParameter> parametros = new List<ReportParameter>();
                parametros.Add(new ReportParameter("FechaInicio", "" + fechaInicio));
                parametros.Add(new ReportParameter("FechaFin", "" + fechaFin));
                //Añado parametros al reportviewer
                this.reportViewer1.LocalReport.SetParameters(parametros);

                reportViewer1.RefreshReport();

                reportViewer1.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        private void Payments_Report_Load(object sender, EventArgs e)
        {
            ReportDataSource ds = new ReportDataSource();
            ds.Name = "DataSet1";
            ds.Value = GenerateData();

               /* ReportDataSource ds1 = new ReportDataSource();
            ds1.Name = "DataSet2";
            ds1.Value = GeneratePaymentData();*/

              /*  ReportDataSource ds2 = new ReportDataSource();
            ds2.Name = "DataSet3";
            ds2.Value = GenerateData();*/

            this.reportViewer1.ProcessingMode = ProcessingMode.Local;
            this.reportViewer1.LocalReport.ReportPath = "Report4.rdlc";
            this.reportViewer1.LocalReport.DataSources.Add(ds);
            //this.reportViewer1.LocalReport.DataSources.Add(ds1);
               // this.reportViewer1.LocalReport.DataSources.Add(ds2);

            System.Drawing.Printing.PageSettings pg = new System.Drawing.Printing.PageSettings();
            pg.Margins.Top = 0;
            pg.Landscape = true;
            pg.Margins.Bottom = 0;
            // pg.Margins.Left = 1;
            // pg.Margins.Right = 1;

            //System.Drawing.Printing.PaperSize size = new PaperSize();
            //size.RawKind = (int)PaperKind.A5;
            //pg.PaperSize = size;
            this.reportViewer1.SetPageSettings(pg);
            this.reportViewer1.RefreshReport();
        }
Example #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //提取数据
                string queryWord = "";

                if (Request.QueryString["queryWord"] != null && Request.QueryString["queryWord"].Trim() != "" && Request.QueryString["queryWord"].Trim() != "null")
                    queryWord = Request.QueryString["queryWord"].Trim();

                YnBaseDal.YnPage ynPage = new YnBaseDal.YnPage();
                ynPage.SetPageSize(500); //pageRows;
                ynPage.SetCurrentPage(1); //pageNumber;

                List<AscmSupplier> listAscmSupplier = AscmSupplierService.GetInstance().GetList(ynPage, "", "", queryWord, null);
                ReportViewer1.ProcessingMode = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                ReportViewer1.LocalReport.ReportPath = Server.MapPath("SupplierReport.rdlc");
                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name = "DataSet1";
                rds1.Value = listAscmSupplier;
                ReportViewer1.LocalReport.DataSources.Clear();//好像不clear也可以
                ReportViewer1.LocalReport.DataSources.Add(rds1);

                string companpyTitle = "美的中央空调";
                string title = companpyTitle + "供应商";

                ReportParameter[] reportParameters = new ReportParameter[] {
                    new ReportParameter("ReportParameter_Title", title),
                    new ReportParameter("ReportParameter_ReportTime", "打印时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss"))
                };
                ReportViewer1.LocalReport.SetParameters(reportParameters);
                ReportViewer1.LocalReport.Refresh();
            }
        }
    public void LoadReport(int agentId, int month)
    {
        //Reset report viewer control
        reportViewer.Reset();

        //Initializes report viewer and set report as embedded resource
        Common.SetReportEmbeddedResource(reportViewer, "TCESS.ESales.CommonLayer.Reports.DistrictWiseSalesReport.rdlc");

        //Set datasource for cash collection report
        IList<SalesReportDTO> lstDistrictWiseSalesRpt = ESalesUnityContainer.Container.Resolve<IReportService>()
            .GetDistrictWiseSalesReport(Convert.ToInt32(agentId), month);
        ReportDataSource CashCollectionDataSource = new ReportDataSource("dsDistrictWiseSalesReport", lstDistrictWiseSalesRpt);
        reportViewer.LocalReport.DataSources.Add(CashCollectionDataSource);
        string agentName = "";
        if (base.GetAgentByUserId().UAM_Agent_Id != 0)
        {
            agentName = base.GetAgentByUserId().UAM_Agent_Name;
        }
        else
        {
            agentName = "ALL";
        }
        //Set report parameters
        string smonth = TCESS.ESales.CommonLayer.CommonLibrary.MasterList.GetMonthName(month);
        //Set report parameters
        ReportParameter tmonth = new ReportParameter("Month", smonth);
        ReportParameter agent = new ReportParameter("agent", Convert.ToString(agentName));
        reportViewer.LocalReport.SetParameters(new ReportParameter[] { tmonth, agent });
    }
        protected void btnCreateReport_Click(object sender, EventArgs e)
        {
            /*
            TreasureLandDataClassesDataContext db = new TreasureLandDataClassesDataContext();
            IEnumerable <reportData> ds = from l in db.LineItems
                     join rd in db.ReservationDetailBillings
                     on l.ReservationDetailBillingID equals rd.ReservationDetailBillingID
                     join m in db.MenuItems
                     on l.MenuItemID equals m.MenuItemID
                     join d in db.FoodDrinkCategories
                     on m.MenuItemID equals d.FoodDrinkCategoryID
                     where rd.ReservationDetailBillingID == Convert.ToInt16(ddlTransactions.SelectedValue)
                     select new reportData{ LineItemAmount = l.LineItemAmount, LineItemTransactionID = l.LineItemTransactionID, MenuItemName = m.MenuItemName};
            */
            if(ddlTransactions.SelectedIndex>-1)
            {
            ReportViewer1.Visible = true;
            ReportDataSource rds = new ReportDataSource("reportDatasource", sdsReport);

            //Resets the ReportViewer, adds the new datasource, and changes the name of the report

            ReportViewer1.LocalReport.DataSources.Add(rds);
            ReportViewer1.LocalReport.DisplayName = "reportDatasource";
            ReportViewer1.DataBind();
            }
        }
         public void GetRptAmountRecvByProjectId(int ProjID)
       {
           var q = AmountsReceivedsCmd.GetAllAmountsReceivedBypro(ProjID);
           ReportDataSource rs = new ReportDataSource();
           List<AmountRecvtReportObj> ls = new List<AmountRecvtReportObj>();
          
           foreach (var item in q)
           {
             
               ls.Add(new AmountRecvtReportObj()
               {
               
                 ProjectName=item.ProjectProfile.ProjectName,
                  Coin=item.ProjectProfile.Coin,
                  DonerName=item.TheDonorsProject.TheDonor.Name,
                  Date=item.Date.Value,
                  Cost=item.Cost.Value,
                  
               }); 
           }
           rs.Name = "AmountsReceivedDataSet";
           rs.Value = ls;
           frmReportViewer frm = new frmReportViewer();
           frm.reportViewer1.LocalReport.DataSources.Clear();
           frm.reportViewer1.LocalReport.DataSources.Add(rs);
           frm.reportViewer1.LocalReport.ReportEmbeddedResource = "UcasProWindowsForm.Reports.rptAmountsReceived.rdlc";
           frm.ShowDialog();


       }
Example #15
0
        private void btnGenerar_Click(object sender, EventArgs e)
        {
            DateTime fechaInicio = dtpInicio.Value.Date;
            DateTime fechaFin = dtpFin.Value.Date.Add(TimeSpan.Parse("23:59:59"));
            int codigoTrabajador = Convert.ToInt16(cboTrabajador.SelectedValue.ToString());
            asiginacionBL = new AsignacionBL();

            try
            {
                reportViewer1.ProcessingMode = ProcessingMode.Local;

                reportViewer1.LocalReport.DataSources.Clear();

                ReportDataSource Reporte = new ReportDataSource("dataPagoDetalle", asiginacionBL.ReportePagoDetalle(fechaInicio, fechaFin, codigoTrabajador));

                reportViewer1.LocalReport.DataSources.Add(Reporte);

                reportViewer1.LocalReport.ReportEmbeddedResource = "MadScienceGUI.reportPagoDetalle.rdlc";

                List<ReportParameter> parametros = new List<ReportParameter>();
                parametros.Add(new ReportParameter("FechaInicio", "" + fechaInicio));
                parametros.Add(new ReportParameter("FechaFin", "" + fechaFin));
                //Añado parametros al reportviewer
                this.reportViewer1.LocalReport.SetParameters(parametros);

                reportViewer1.RefreshReport();

                reportViewer1.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #16
0
        public void GetAllSupplier()
        {
            var q = SuppliersCmd.GetAll();
            ReportDataSource rs = new ReportDataSource();
            List<SupplierReportObj> ls = new List<SupplierReportObj>();
            int counter = 0;
            foreach (var item in q)
            {
                counter++;
                ls.Add(new SupplierReportObj()
                {
                    SupplierID = counter,
                    SupplierName = item.Name,
                    SuppliersNatural = item.SuppliersNatural,
                    Faxnumber = item.Fax,
                    Address = item.Adderss,
                    PhoneNumber = item.PhoneNumber,
                    Email = item.Email


                });
            }
            rs.Name = "SupplierDataSet";
            rs.Value = ls;
            frmReportViewer frm = new frmReportViewer();
            frm.reportViewer1.LocalReport.DataSources.Clear();
            frm.reportViewer1.LocalReport.DataSources.Add(rs);
            frm.reportViewer1.LocalReport.ReportEmbeddedResource = "UcasProWindowsForm.Reports.rptSupplier.rdlc";
            frm.ShowDialog();

        }
 private void CandidateRDLSReportPrint_Load(object sender, EventArgs e)
 {
     ReportDataSource rds = new ReportDataSource();
     reportViewer1.LocalReport.DataSources.Clear();
     reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("UNIRecruitmentSoft_CandidateDetail", _candidatesFroPrint.ToList()));
     this.reportViewer1.RefreshReport();
 }
Example #18
0
       public void GetRptContractByProjectId(int ProjID)
       {
           var q = ContractCmd.GetAllContractsByproID(ProjID);
           ReportDataSource rs = new ReportDataSource();
           List<ContractReportObj> ls = new List<ContractReportObj>();
           int counter = 0;
           foreach (var item in q)
           {
               counter++;
               ls.Add(new ContractReportObj()
               {
                 ContractID=counter,
                 ProjectName=item.ProjectProfile.ProjectName,
                 EmployeeName=item.Employee.EmployeeName,
                 EmployeeJobNumber=item.Employee.EmployeejobNumber,
                 StartDate=item.StartDate.Value,
                 EndDate=item.EndDate.Value,
                 MonthlySalary =item.SelaryAmount.Value,
                 TotalSalary=item.TotalSalary.Value,
                 Coin=item.ProjectProfile.Coin,
                 
                  
               }); 
           }
           rs.Name = "ContractDataSet";
           rs.Value = ls;
           frmReportViewer frm = new frmReportViewer();
           frm.reportViewer1.LocalReport.DataSources.Clear();
           frm.reportViewer1.LocalReport.DataSources.Add(rs);
           frm.reportViewer1.LocalReport.ReportEmbeddedResource = "UcasProWindowsForm.Reports.rptContract.rdlc";
           frm.ShowDialog();


       }
    public void ShowCustomerDetails(int customerId)
    {
        ViewState[Globals.StateMgmtVariables.CUSTOMERID] = customerId;

        ReportDataSource customerDocDataSource = new ReportDataSource("dsCustomerDocDetails",
            GetCustomerDocDetails(Convert.ToInt32(ViewState[Globals.StateMgmtVariables.CUSTOMERID])));

        ReportDataSource truckDataSource = new ReportDataSource("dsTruckDetails",
            GetTruckDetails(Convert.ToInt32(ViewState[Globals.StateMgmtVariables.CUSTOMERID])));

        ReportDataSource authRepDataSource = new ReportDataSource("dsAuthRepDetails",
            GetAuthRepDetails(Convert.ToInt32(ViewState[Globals.StateMgmtVariables.CUSTOMERID])));

        ReportDataSource materialTypeDataSource = new ReportDataSource("dsMaterialTypeDetails",
            GetMaterialTypeDetails(Convert.ToInt32(ViewState[Globals.StateMgmtVariables.CUSTOMERID])));

        SetReportParametersForCustomers(GetCustomerDetails(customerId), ReportViewer);

        ReportViewer.LocalReport.DataSources.Add(materialTypeDataSource);
        ReportViewer.LocalReport.DataSources.Add(customerDocDataSource);
        ReportViewer.LocalReport.DataSources.Add(truckDataSource);
        ReportViewer.LocalReport.DataSources.Add(authRepDataSource);

        ReportViewer.LocalReport.Refresh();
    }
Example #20
0
        public void GetAllDonor()
        {
            var q = TheDonorCmd.GetAllDonors();
            ReportDataSource rs = new ReportDataSource();
            List<DonaorReportObj> ls = new List<DonaorReportObj>();
            int counter = 0;
            foreach (var item in q)
            {
                counter++;
                ls.Add(new DonaorReportObj()
                {
                    DonorID = counter,
                    DonorName = item.Name,
                    DonorAgentname = item.agentName,
                    DonorFaxnumber = item.Fax,
                    DonorAddress = item.Adderss,
                    DonorPhoneNumber = item.PhoneNumber,
                    DonorEmail = item.Email


                });
            }
            rs.Name = "DonorDataSet";
            rs.Value = ls;
            frmReportViewer frm = new frmReportViewer();
            frm.reportViewer1.LocalReport.DataSources.Clear();
            frm.reportViewer1.LocalReport.DataSources.Add(rs);
            frm.reportViewer1.LocalReport.ReportEmbeddedResource = "UcasProWindowsForm.Reports.rptDonor.rdlc";
            frm.ShowDialog();

        }
    protected void GenerateReport(object sender, CommandEventArgs e)
    {
        string style = string.Empty;
        string strain = ucBBStrainHerdYearSelector.StrainCode;
        //int herdSN = ucBBStrainHerdYearSelector.HerdSN;
        int yearBorn = ucBBStrainHerdYearSelector.YearNumber;

        rptHelper = new Rpt302_DataObject(yearBorn, strain, ucBBStrainHerdYearSelector.HerdSN, style);

        rv.LocalReport.ReportPath = "ReportDefinitions/302_BullPerformance.rdlc";
        rv.LocalReport.DataSources.Clear();

        // retrieve all data into a list of Rpt302_DataItem objects
        IList<Rpt302_DataItem> lst = rptHelper.GetData();

        LocalReport lrpt = rv.LocalReport;

        // set this report's data source
        ReportDataSource Rpt302DataSource = new ReportDataSource("Rpt302_DataItem", lst);
        lrpt.DataSources.Add(Rpt302DataSource);

        IList<ReportParameter> Rpt302ParameterList = new List<ReportParameter>();
        Rpt302ParameterList.Add(new ReportParameter("rpYearBorn", rptHelper.YearBorn.ToString()));
        Rpt302ParameterList.Add(new ReportParameter("rpStrainCode", rptHelper.Strain));
        Rpt302ParameterList.Add(new ReportParameter("rpReportStyle", rptHelper.ReportStyle));
        Rpt302ParameterList.Add(new ReportParameter("rpReportYear", rptHelper.ReportYear));
        if (rptHelper.Herd != null)
        {
            Rpt302ParameterList.Add(new ReportParameter("rpHerdCode", rptHelper.Herd.Code));
            Rpt302ParameterList.Add(new ReportParameter("rpHerdDescription", rptHelper.Herd.Description));
            Rpt302ParameterList.Add(new ReportParameter("rpBreederName", rptHelper.Herd.BreederName));
        }
        else
        {
            Rpt302ParameterList.Add(new ReportParameter("rpHerdCode", ""));
            Rpt302ParameterList.Add(new ReportParameter("rpHerdDescription", ""));
            Rpt302ParameterList.Add(new ReportParameter("rpBreederName", ""));
        }

        // set all parameter values at once
        lrpt.SetParameters(Rpt302ParameterList);

        // show the report
        rv.DataBind();

        string rptName;
        if (rptHelper.Herd != null)
            rptName = rptHelper.YearBorn + "_" + rptHelper.Strain + "_" + rptHelper.Herd.Code + "_BullPerformance";
        else
            rptName = rptHelper.YearBorn + "_" + rptHelper.Strain + "_BullPerformance";

        if (rdoOutputType.SelectedValue == "PDF")
        {
            BBWebUtility.OutputToPDF(lrpt, rptName, true, true, Response);
        }
        else
        {
            BBWebUtility.OutputToExcel(lrpt, rptName, Response);
        }
    }
        protected void ProcesarReporteClick(object sender, EventArgs e)
        {
            ReportDataSource reporteData = null;

            switch (Reportes.SelectedValue)
            {
                case "1":
                    if (this.periodos.SelectedValue != "Todos los periodos")
                        reporteData = new ReportDataSource("myDataSet", Avaruz.Artemisa.DAL.ViewResultadoGlobalDb.SelectByPeriodo(this.periodos.Text));
                    else
                        reporteData = new ReportDataSource("myDataSet", Avaruz.Artemisa.DAL.ViewResultadoGlobalDb.SelectAll());
                    break;
                case "2":
                    reporteData = this.periodos.SelectedValue != "Todos los periodos" ? new ReportDataSource("myDataSet", Avaruz.Artemisa.DAL.ViewResultadoAuditoriaTipoDb.SelectByPeriodo(Convert.ToInt32(this.tipoAuditoria.SelectedValue), this.periodos.Text)) : new ReportDataSource("myDataSet", Avaruz.Artemisa.DAL.ViewResultadoAuditoriaTipoDb.Select(Convert.ToInt32(this.tipoAuditoria.SelectedValue)));
                    break;
                case "3":
                case "4":
                    if (this.periodos.SelectedValue == "Todos los periodos")
                        reporteData = this.estatus.SelectedValue == "Todos" ? new ReportDataSource("myDataSet", Avaruz.Artemisa.DAL.ViewNoConformidadDb.SelectAll()) : new ReportDataSource("myDataSet", Avaruz.Artemisa.DAL.ViewNoConformidadDb.SelectByEstatus(this.estatus.SelectedValue));
                    else
                        reporteData = this.estatus.SelectedValue == "Todos"
                                          ? new ReportDataSource("myDataSet",
                                                                 Avaruz.Artemisa.DAL.ViewNoConformidadDb.SelectByPeriodo(
                                                                     this.periodos.SelectedValue))
                                          : new ReportDataSource("myDataSet",
                                                                 Avaruz.Artemisa.DAL.ViewNoConformidadDb.
                                                                     SelectByPeriodoEstatus(
                                                                         this.periodos.SelectedValue,
                                                                         this.estatus.SelectedValue));
                    break;
                case "5":
                    if (this.periodos.SelectedValue == "Todos los periodos")
                        reporteData = this.estatus.SelectedValue == "Todos" ? new ReportDataSource("myDataSet", Avaruz.Artemisa.DAL.ViewCalidadPlanTrabajoDb.SelectAll()) : new ReportDataSource("myDataSet", Avaruz.Artemisa.DAL.ViewCalidadPlanTrabajoDb.SelectByEstatus(this.estatus.SelectedValue));
                    else
                        reporteData = this.estatus.SelectedValue == "Todos"
                                          ? new ReportDataSource("myDataSet",
                                                                 Avaruz.Artemisa.DAL.ViewCalidadPlanTrabajoDb.SelectByPeriodo(
                                                                     this.periodos.SelectedValue))
                                          : new ReportDataSource("myDataSet",
                                                                 Avaruz.Artemisa.DAL.ViewCalidadPlanTrabajoDb.
                                                                     SelectByPeriodoEstatus(
                                                                         this.periodos.SelectedValue,
                                                                         this.estatus.SelectedValue));
                    break;
                case "6":
                    int periodoInt = 0;
                    string estatus2 = this.estatus.SelectedValue == "Todos" ? "%" : this.estatus.SelectedValue;
                    reporteData = new ReportDataSource("myDataSet",
                                                       Avaruz.Artemisa.DAL.ViewDentroFueraCerradasDb.SelectAll(
                                                           DateTime.Now, estatus2,
                                                           periodoInt));
                    break;

            }

            this.ReportViewer1.LocalReport.DataSources.Clear();
            this.ReportViewer1.LocalReport.ReportPath = GetReportName(Reportes.SelectedValue);
            this.ReportViewer1.LocalReport.DataSources.Add(reporteData);
            this.ReportViewer1.LocalReport.Refresh();
        }
        private void bindReport()
        {
            int clientID = Core.SessionHelper.getClientId();
            List<CRM.Data.Entities.vw_OpenClaimsListing> reportData = null;

            using (RerportManager report = new RerportManager()) {
                reportData = report.claimsOpenListing(clientID);
            }

            if (reportData != null) {
                reportViewer.Reset();
                reportViewer.ProcessingMode = ProcessingMode.Local;

                reportViewer.LocalReport.DataSources.Clear();

                reportViewer.LocalReport.EnableExternalImages = true;

                ReportDataSource reportDataSource = new ReportDataSource();
                reportDataSource.Name = "DataSet1";
                reportDataSource.Value = reportData;

                reportViewer.LocalReport.DataSources.Add(reportDataSource);

                reportViewer.LocalReport.ReportPath = Server.MapPath("~/Protected/Reports/ClaimOpen/ClaimsOpenListing.rdlc");
            }
        }
Example #24
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                string actividadid = Request.QueryString["id"].ToString();

                ReportDataSource rds = new ReportDataSource();
                rptActividades.LocalReport.DataSources.Clear();

                rptActividades.LocalReport.ReportPath = "Actividades_Valores_PlanOperativo.rdlc";
                rds.Name = "DataSet1";

                var actividad = (from i in new Model.ESMBDDataContext().Actividades
                                 where i.Id == Convert.ToInt32(actividadid)
                                 select i).Single();

                rptActividades.LocalReport.SetParameters(new ReportParameter("indicador", actividad.Actividad));
                rptActividades.LocalReport.SetParameters(new ReportParameter("meta", actividad.Presupuesto.ToString()));

                odsActividadesMetas.FilterExpression = "actividad_id = " + actividadid;

                rds.DataSourceId = "odsActividadesMetas";

                rptActividades.LocalReport.DataSources.Add(rds);
                rptActividades.LocalReport.Refresh();
            }
        }
 public frmRelatorios(DataTable pSource, eStatusForm tipo)
 {
     InitializeComponent();
     ReportDataSource report = new ReportDataSource();
     report.Name = "DataSet1";
     report.Value = pSource;
     rpwViewer.LocalReport.DataSources.Add(report);
     statusForm = tipo;
     switch (statusForm)
     {
         case eStatusForm.alunos:
             rpwViewer.LocalReport.ReportEmbeddedResource = "matriculasControl.rptListaAlunos.rdlc";
             break;
         case eStatusForm.disciplinas:
             rpwViewer.LocalReport.ReportEmbeddedResource = "matriculasControl.rptListaDisciplinas.rdlc";
             break;
         case eStatusForm.matriculas:
             rpwViewer.LocalReport.ReportEmbeddedResource = "matriculasControl.rptListaMatriculados.rdlc";
             break;
         case eStatusForm.semestres:
             break;
         default:
             break;
     }
     rpwViewer.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
     rpwViewer.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.PageWidth;
     this.rpwViewer.RefreshReport();
 }
    public void LoadReport(int agentId, DateTime fromDate, DateTime toDate)
    {
        //Reset report viewer control
        reportViewer.Reset();

        //Initializes report viewer and set report as embedded resource
        Common.SetReportEmbeddedResource(reportViewer, "TCESS.ESales.CommonLayer.Reports.ConsolidatedBookingandSaleReport.rdlc");

        //Set datasource for cash collection report
        IList<DispatchReportDTO> lstDispatchReportRpt = ESalesUnityContainer.Container.Resolve<IReportService>()
            .GetDispatchReport(Convert.ToInt32(agentId), Convert.ToDateTime(fromDate),
            Convert.ToDateTime(toDate));
        ReportDataSource CashCollectionDataSource = new ReportDataSource("dsConsBookingSale", lstDispatchReportRpt);
        reportViewer.LocalReport.DataSources.Add(CashCollectionDataSource);
        string agentName = "";
        if (agentId > 0)
        {
            AgentDTO _agentName = ESalesUnityContainer.Container.Resolve<IAgentService>().GetAgentByAgentId(agentId);
            agentName = _agentName.Agent_Name;
        }
        else
        {
            agentName = "ALL";
        }
        //Set report parameters
        ReportParameter fromDt = new ReportParameter("FromDate", Convert.ToDateTime(fromDate).ToString("dd/MM/yyyy"));
        ReportParameter toDt = new ReportParameter("ToDate", Convert.ToDateTime(toDate).ToString("dd/MM/yyyy"));
        ReportParameter agent = new ReportParameter("agent", Convert.ToString(agentName));
        reportViewer.LocalReport.SetParameters(new ReportParameter[] { fromDt, toDt, agent });
    }
        private void Form1_Load(object sender, EventArgs e)
        {
            int idprov = _idver;
            String vehiculo = _vehiculo;

            Conexion conectar = new Conexion();
            Ordenes ordenes = new Ordenes();

            this.reportViewer1.LocalReport.DataSources.Clear();
            ReportDataSource source = new ReportDataSource();

            if (vehiculo.Equals(""))
            {
                source = new ReportDataSource("ConReporteTabla", ordenes.getOrdenesDetallesProveedorDG(idprov, conectar.con));
            }
            else
            {
                source = new ReportDataSource("ConReporteTabla", ordenes.getOrdenesDetallesProveedorVehiculo(idprov, vehiculo, conectar.con));
            }

            reportViewer1.LocalReport.DataSources.Add(source);

            source = new ReportDataSource("Proveedor", ordenes.getProveedoresRep(idprov, conectar.con));
            reportViewer1.LocalReport.DataSources.Add(source);

            this.reportViewer1.RefreshReport();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable dt;
                if (Request.QueryString["sellerId"] != null || Request.QueryString["tag"] != null || Request.QueryString["id"] != null)
                {
                    int sellerId = Convert.ToInt32(Request.QueryString["sellerId"].ToString());
                    int tag = Convert.ToInt32(Request.QueryString["tag"].ToString());
                    int id = Convert.ToInt32(Request.QueryString["id"].ToString());

                    dt = logic.assessmentWeek.P_AssessmentWeek(sellerId, tag, id);
                    ReportDataSource rds = new ReportDataSource("sellerAssessment_Data_DataTable1", dt);
                    ReportViewer1.LocalReport.DataSources.Clear();
                    ReportViewer1.LocalReport.DataSources.Add(rds);
                    ReportViewer1.LocalReport.Refresh();
                    if (dt.Rows.Count == 0)
                    {
                        ReportViewer1.Visible = false;
                        div_nodata.Visible = true;
                    }
                    else
                    {
                        div_nodata.Visible = false;
                    }
                }
                else
                {
                    Library.Script.ClientMsgUrl("错误的参数。", "sellerAssessment_Allist.aspx");
                }
            }
        }
    private void RenderStatement(int penaltyID, int loanID)
    {
        try
        {
            ReportParameter rpPenaltyID = new ReportParameter("PenaltyID", penaltyID.ToString());
            ReportParameter[] parameters = new ReportParameter[] { };

            DataTable dtPenalty = LoansBLL.GetPenalty(penaltyID, loanID).Tables[0];
            ReportDataSource rdsPenalty = new ReportDataSource("PenaltyDS", dtPenalty);
            ReportDataSource[] sources = new ReportDataSource[] { rdsPenalty };
            byte[] bytes = Statements.RenderStatement("PenaltyNotice.rdlc", sources, parameters);

            // Variables
            string mimeType = string.Empty;

            // Now that you have all the bytes representing the PDF report, buffer it and send it to the client.
            Response.Buffer = true;
            Response.Clear();
            Response.ContentType = mimeType;
            Response.AddHeader("content-disposition", "attachment; filename=" + "PenaltyNotice_" + penaltyID.ToString() + ".pdf");
            Response.BinaryWrite(bytes); // create the file
            Response.Flush(); // send it to the client to download
        }
        catch (Exception ex)
        {
        }
    }
Example #30
0
        public ActionResult Export(string type)
        {
            LocalReport lr = new LocalReport();
            int TotalRow;
            string path = Path.Combine(Server.MapPath("~/Rdlc"), "rdlcOrders.rdlc");
            lr.ReportPath = path;
            var list = serivce.Get(out TotalRow);

            ReportDataSource rd = new ReportDataSource("DataSet1", list);
            lr.DataSources.Add(rd);

            string reportType = type;
            string mimeType;
            string encoding;
            string fileNameExtension;
            string deviceInfo;

            deviceInfo = "<DeviceInfo>" +
            "  <OutputFormat>" + type + "</OutputFormat>" +
            "  <PageWidth>8.5in</PageWidth>" +
            "  <PageHeight>11in</PageHeight>" +
            "  <MarginTop>0.5in</MarginTop>" +
            "  <MarginLeft>1in</MarginLeft>" +
            "  <MarginRight>1in</MarginRight>" +
            "  <MarginBottom>0.5in</MarginBottom>" +
            "</DeviceInfo>";

            Warning[] warnings;
            string[] stream;
            byte[] renderBytes;

            renderBytes = lr.Render(reportType, deviceInfo, out mimeType, out encoding, out fileNameExtension, out stream, out warnings);

            return File(renderBytes, mimeType, "Report");
        }
        /// <summary>
        /// Получение/формирование параметров отчёта, DataSource (список сущностей для таблицы), пути файла и заголовка
        /// </summary>
        /// <inheritdoc />
        public void AdditionalInitializeComponent()
        {
            _reportFile = Common.GetReportFilePath(ReportFileName);             // Путь к файлу отчёта

            // Запрос параметров отчёта в отдельном окне

            const bool   isPeriod         = false;
            const bool   isMounthOrYeath  = false;
            const bool   isWarehouse      = false;
            const bool   isWorkGuild      = false;
            const bool   isDate           = false;
            const bool   isDatePeriod     = true;
            const bool   isMonthYear      = false;
            const bool   isProduct        = false;
            const bool   isCompany        = false;
            const bool   isTypeProduct    = false;
            const bool   isFormaPayment   = false;
            const bool   isAbroad         = false;
            const string message          = "Выберите дату";
            var          parametersWindow = new ReportParametersWindow(isPeriod, isMounthOrYeath, isWarehouse,
                                                                       isWorkGuild, isDate, isDatePeriod, isMonthYear, isProduct, isCompany, isTypeProduct, isFormaPayment,
                                                                       isAbroad, message)
            {
                Owner = Common.GetOwnerWindow()
            };

            parametersWindow.ShowDialog();
            if (!parametersWindow.DialogResult.HasValue || parametersWindow.DialogResult != true)
            {
                return;
            }

            // Получение введённых пользователем параметров
            var nullableStartDateTime = parametersWindow.SelectedDateTimeStart();
            var nullableEndDateTime   = parametersWindow.SelectedDateTimeEnd();

            if (nullableStartDateTime == null || nullableEndDateTime == null)
            {
                const string           errorMessage = "Дата не указана";
                const MessageBoxButton buttons      = MessageBoxButton.OK;
                const MessageBoxImage  messageType  = MessageBoxImage.Error;
                MessageBox.Show(errorMessage, PageLiterals.HeaderValidation, buttons, messageType);
                return;
            }

            var endDate   = (DateTime)nullableEndDateTime;
            var startDate = (DateTime)nullableStartDateTime;

            try
            {
                var resultReportList = ShipmentInRussiaService.GetShipmentInRussia(startDate, endDate);

                var summRusPerriod = 0M;
                var summUsdPerriod = 0M;

                foreach (var item in resultReportList)
                {
                    summRusPerriod += item.Cost * item.Count;
                    summUsdPerriod += item.CostUsd * item.Count;
                }

                // Формирование одиночных строковых параметров отчёта
                _reportParameters = new[]
                {
                    new ReportParameter("StartDate", startDate.ToShortDateString()),
                    new ReportParameter("EndDate", endDate.ToShortDateString()),
                    new ReportParameter("SummUsdYear", resultReportList.Count != 0 ?
                                        $"{resultReportList[0].YearSummaUsd:N2}" : "0"),
                    new ReportParameter("SummRusYear", resultReportList.Count != 0 ?
                                        $"{resultReportList[0].YearSumma:N2}" : "0"),
                    new ReportParameter("SummRusPeriod", $"{summRusPerriod:N2}"),
                    new ReportParameter("SummUsdPeriod", $"{summUsdPerriod:N2}")
                };

                const string dataSourceName = "ShipmentInRussia";
                _reportDataSource  = new ReportDataSource(dataSourceName, resultReportList);
                ReportViewer.Load += ReportViewer_Load;                 // Подписка на метод загрузки и отображения отчёта
            }
            catch (StorageException ex)
            {
                Common.ShowDetailExceptionMessage(ex);
            }
        }
Example #32
0
        public ActionResult invoiceWise(string bDate, string eDate, Nullable <int> wId, Nullable <int> trID, string st)
        {
            DateTime d1 = Convert.ToDateTime(bDate);
            DateTime d2 = Convert.ToDateTime(eDate);
            //if (wId == 0)
            //{
            //    getwID = wId.GetValueOrDefault(); ;
            //}
            ReportViewer reportViewer = new ReportViewer
            {
                ProcessingMode      = ProcessingMode.Local,
                SizeToReportContent = true,
                Width  = Unit.Percentage(50),
                Height = Unit.Percentage(50)
            };
            // var v = (from x in db.Warehouses where x.WarehouseID ==wId select x).FirstOrDefault();
            string ReportName;

            if (st == "No")
            {
                ReportName = "Hire Truck Supporting Report";
            }
            else
            {
                ReportName = "Hire Truck BILL Report";
            }
            if (trID == 0)
            {
                List <spRPTHreTruckFare_Result> htFareData = db.spRPTHreTruckFare(d1, d2, wId, null, st).ToList();
                reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\HireTruck\HireTruckFareReport.rdlc";
                ReportParameter rp1 = new ReportParameter("DateParameter", d1.ToString("dd-MMM-yy") + " to " + d2.ToString("dd-MMM-yy"));
                ReportParameter rp2 = new ReportParameter("rptName", ReportName);

                reportViewer.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2 });

                ReportDataSource rdc = new ReportDataSource("HireTruckFareReportDataSet", htFareData);
                reportViewer.LocalReport.DataSources.Add(rdc);

                reportViewer.LocalReport.Refresh();
                reportViewer.Visible = true;

                ViewBag.ReportViewer = reportViewer;
                return(PartialView("invoiceWise"));
            }

            else
            {
                //var v = (from x in db.Warehouses where x.WarehouseID == wId select x).FirstOrDefault();
                List <spRPTHreTruckFare_Result> htFareData = db.spRPTHreTruckFare(d1, d2, wId, trID, st).ToList();
                reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Reports\HireTruck\HireTruckFareReport.rdlc";
                ReportParameter rp1 = new ReportParameter("DateParameter", d1.ToString("dd-MMM-yy") + " to " + d2.ToString("dd-MMM-yy"));

                ReportParameter rp2 = new ReportParameter("rptName", ReportName);

                reportViewer.LocalReport.SetParameters(new ReportParameter[] { rp1, rp2 });
                ReportDataSource rdc = new ReportDataSource("HireTruckFareReportDataSet", htFareData);
                reportViewer.LocalReport.DataSources.Add(rdc);

                reportViewer.LocalReport.Refresh();
                reportViewer.Visible = true;

                ViewBag.ReportViewer = reportViewer;
                return(PartialView("invoiceWise"));
            }
        }
        //public void FillProductName()
        //{

        //    if (Convert.ToInt32(ddlItemGroup.SelectedValue) > 0)
        //    {
        //        ddlItemName.DataSource = productBll.GetProductListByGroup(Convert.ToInt32(ddlItemGroup.SelectedValue));
        //        ddlItemName.DataValueField = "ProductId";
        //        ddlItemName.DataTextField = "ProductName";
        //        ddlItemName.DataBind();
        //        ddlItemName.Items.Insert(0, new ListItem("Select One", "0"));
        //    }

        //}

        protected void btnViewReport_Click(object sender, EventArgs e)
        {
            try
            {
                ReportViewer1.LocalReport.DataSources.Clear();
                List <productsDetails> Product = new List <productsDetails>();

                string OCODE = ((SessionUser)Session["SessionUser"]).OCode;
                if (RadioButtonList1.SelectedValue == "AllProduct")
                {
                    if (ddlItemGroup.SelectedItem.Text != "Select One")
                    {
                        Product = aReportsBll.GetAllProductByGroupId(Convert.ToInt32(ddlItemGroup.SelectedValue), ((SessionUser)Session["SessionUser"]).OCode).ToList();
                        if (Product.Count > 0)
                        {
                            ReportViewer1.LocalReport.DataSources.Clear();
                            ReportDataSource Datasource = new ReportDataSource("ALL_ProductsReports_DS", Product);
                            ReportViewer1.LocalReport.DataSources.Add(Datasource);
                            ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_AllProductByGroupID.rdlc");
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true);
                            ReportViewer1.Reset();
                            ReportViewer1.LocalReport.Refresh();
                        }
                    }

                    else
                    {
                        Product = aReportsBll.Rpt_GetAllProducts().ToList();
                        if (Product.Count > 0)
                        {
                            ReportViewer1.LocalReport.DataSources.Clear();
                            ReportDataSource Datasource = new ReportDataSource("ALL_ProductsReports_DS", Product);
                            ReportViewer1.LocalReport.DataSources.Add(Datasource);
                            ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_ProductRepots.rdlc");
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true);
                            ReportViewer1.Reset();
                            ReportViewer1.LocalReport.Refresh();
                        }
                    }
                }
                else if (RadioButtonList1.SelectedValue == "AllSupplier")
                {
                    List <SuplierDetails> Supplier = new List <SuplierDetails>();
                    Supplier = aReportsBll.Rpt_GetAllSupplier().ToList();
                    if (Supplier.Count > 0)
                    {
                        ReportViewer1.LocalReport.DataSources.Clear();
                        ReportDataSource Datasource = new ReportDataSource("RPT_Supplier_Ds", Supplier);
                        ReportViewer1.LocalReport.DataSources.Add(Datasource);
                        ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_SuplierRepots.rdlc");
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true);
                        ReportViewer1.Reset();
                        ReportViewer1.LocalReport.Refresh();
                    }
                }
                else if (RadioButtonList1.SelectedValue == "ItemUpdateLog")
                {
                    List <ProductLog> product = new List <ProductLog>();
                    product = aReportsBll.Rpt_GetAllProduct(OCODE).ToList();
                    if (product.Count > 0)
                    {
                        ReportViewer1.LocalReport.DataSources.Clear();
                        ReportDataSource Datasource = new ReportDataSource("Item_Update_Log_ds", product);
                        ReportViewer1.LocalReport.DataSources.Add(Datasource);
                        ReportViewer1.LocalReport.ReportPath = Server.MapPath("Reports/RPT_ItemUpdateLog.rdlc");
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No data found!')", true);
                        ReportViewer1.Reset();
                        ReportViewer1.LocalReport.Refresh();
                    }
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #34
0
        // reporte cotizacion
        public ActionResult ReporteCotizacion(string id_user, string id_venta)
        {
            if (id_user == null || id_venta == null)
            {
                return(RedirectToAction("Login", "Usuario"));
            }
            else
            {
                LocalReport lr   = new LocalReport();
                string      path = Path.Combine(Server.MapPath("~/Reportes"), "DetalleCotizacion.rdlc");
                if (System.IO.File.Exists(path))
                {
                    lr.ReportPath = path;
                }
                else
                {
                    return(View("Index"));
                }
                List <Cotizacion_Detalle_Result> cm = new List <Cotizacion_Detalle_Result>();

                using (MenajesbdEntities6 dc = new MenajesbdEntities6())
                {
                    cm = dc.Cotizacion_Detalle(int.Parse(id_user), int.Parse(id_venta)).ToList();
                }
                ReportDataSource rd = new ReportDataSource("DataSet1", cm);
                string           id = "PDF";
                lr.DataSources.Add(rd);
                string reportType = id;
                string mimeType;
                string encoding;
                string fileNameExtension;



                string deviceInfo =

                    "<DeviceInfo>" +
                    "  <OutputFormat>" + id + "</OutputFormat>" +
                    "  <PageWidth>8.5in</PageWidth>" +
                    "  <PageHeight>11in</PageHeight>" +
                    "  <MarginTop>0.5in</MarginTop>" +
                    "  <MarginLeft>0.5in</MarginLeft>" +
                    "  <MarginRight>0.5in</MarginRight>" +
                    "  <MarginBottom>0.5in</MarginBottom>" +
                    "</DeviceInfo>";

                Warning[] warnings;
                string[]  streams;
                byte[]    renderedBytes;

                renderedBytes = lr.Render(
                    reportType,
                    deviceInfo,
                    out mimeType,
                    out encoding,
                    out fileNameExtension,
                    out streams,
                    out warnings);


                return(File(renderedBytes, mimeType));
            }
        }
    protected void btnView_Click(object sender, EventArgs e)
    {
        try
        {
            _strpath          = @"Reports/ActivityNotEnteredReport.rdlc";
            _strDatatablename = "DataSet1_UserNotEnteredActivityForDesign";


            // Create an instance for exception.
            ValidationException exception = new ValidationException(VALIDATIONERROR);

            if (txtFromDate.Text == "")
            {
                exception.Data.Add("ACIVITY_SUMMARY_FROMDATE", FROMDATE);
            }

            if (txtToDate.Text == "")
            {
                exception.Data.Add("ACIVITY_SUMMARY_TODATE", TODATE);
            }

            DateTime date;
            if (txtFromDate.Text != string.Empty)
            {
                if ((DateTime.TryParse(txtFromDate.Text, out date)) == false)
                {
                    exception.Data.Add("ACTIVITY_INVALID_FROMDATE", INVALIDE_DATE);
                }
            }

            if (txtToDate.Text != string.Empty)
            {
                if ((DateTime.TryParse(txtToDate.Text, out date)) == false)
                {
                    exception.Data.Add("ACTIVITY_INVALID_TODATE", INVALIDE_DATE);
                }
            }

            if ((txtFromDate.Text != string.Empty) && (txtToDate.Text != string.Empty))
            {
                if ((DateTime.TryParse(txtFromDate.Text, out date)) == true && (DateTime.TryParse(txtToDate.Text, out date)) == true)
                {
                    DateTime fromDate = DateTime.Parse(txtFromDate.Text);
                    DateTime toDate   = DateTime.Parse(txtToDate.Text);

                    if (DateTime.Compare(fromDate, toDate) > 0)
                    {
                        exception.Data.Add("ACIVITY_SUMMARY_FROMDATETODATE", DATE_RANGE);
                    }
                }
            }


            // Retrieve Userid.
            int[]  iUserIds = new int[0];
            string getUserId;

            getUserId = GetCheckBoxListUserIds();
            // Retrieve Userid.
            if (getUserId != "")
            {
                iUserIds = this.RetrievetUserIds(getUserId);
            }



            // Retrieve LocationIds.
            int[]  iLocationIds  = new int[0];
            string getLocationId = "";

            getLocationId = GetCheckBoxListLocationIds();
            if (getLocationId != "")
            {
                iLocationIds = this.RetrieveLocationIds(getLocationId);
            }


            this.DisplayMessage(string.Empty, false);

            if (exception.Data.Count > 0)
            {
                throw exception;
            }

            int ddvalue;
            ddvalue                  = Convert.ToInt32(DDreptype.SelectedValue);
            reportService            = AppService.Create <IReportService>();
            reportService.AppManager = this.mAppManager;

            DataTable dtAcivitySummary = new DataTable();
            // Retrieve activity summary.
            dtAcivitySummary = reportService.RetrieveUserNotEnteredAcitvity(DateTime.Parse(txtFromDate.Text), DateTime.Parse(txtToDate.Text), mAppManager.LoginUser.Id, iUserIds, iLocationIds, ddvalue);

            //if (dtAcivitySummary.Rows[0]["FirstName"].ToString() == string.Empty && dtAcivitySummary.Rows[0]["LastName"].ToString() == string.Empty)
            //    dtAcivitySummary.Rows[0]["LastName"] = "Data's not found.";

            // Bind into report control.
            // ReportViewer ReportViewer1 = new ReportViewer();
            ReportViewer1.Visible = true;
            ReportViewer1.LocalReport.ReportPath = this.Request.PhysicalApplicationPath + _strpath;
            ReportViewer1.LocalReport.Refresh();


            // Check the condition whether datatable is value or not.
            if (dtAcivitySummary != null)
            {
                divReport.Visible = true;
                divData.Visible   = false;

                ReportViewer1.Height = Unit.Parse("350px");

                ReportViewer1.Width       = Unit.Parse("100%");
                ReportViewer1.BorderColor = System.Drawing.Color.Black;
                ReportViewer1.BorderWidth = Unit.Parse("1px");
                ReportViewer1.BackColor   = System.Drawing.Color.LightSkyBlue;

                ReportDataSource rds = new ReportDataSource(_strDatatablename, dtAcivitySummary);


                ReportParameter rp1  = new ReportParameter("EmployeeId", lblEmpNo.Text);
                ReportParameter rp2  = new ReportParameter("FirstName", lblFirstName.Text);
                ReportParameter rp3  = new ReportParameter("LastName", lblLastName.Text);
                ReportParameter rp4  = new ReportParameter("UserRole", lblUserRole.Text);
                ReportParameter rp5  = new ReportParameter("Department", lblDepartment.Text);
                ReportParameter rp6  = new ReportParameter("ActivityDate", lblActivityDate.Text);
                ReportParameter rp7  = new ReportParameter("EmailId", lblEmailId.Text);
                ReportParameter rp8  = new ReportParameter("ContractDays", lblContractDays.Text);
                ReportParameter rp9  = new ReportParameter("lblFromDate", lblFromDate.Text);
                ReportParameter rp10 = new ReportParameter("lblToDate", lblToDate.Text);
                ReportParameter rp11 = new ReportParameter("ActivityNotEnteredReport", lblActivityNotEnteredReport.Text);


                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp1 });
                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp2 });
                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp3 });
                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp4 });
                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp5 });
                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp6 });
                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp7 });
                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp8 });
                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp9 });
                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp10 });
                this.ReportViewer1.LocalReport.SetParameters(new ReportParameter[] { rp11 });

                ReportViewer1.LocalReport.DataSources.Clear();
                ReportViewer1.LocalReport.DataSources.Add(rds);
                ReportViewer1.LocalReport.Refresh();

                Session.Add("ActivityNotEnteredReportView_ActivitySummaryDataSource", rds);
                // divReport.Controls.Clear();
                // divReport.Controls.Add(ReportViewer1);
            }
            else
            {
                ClearReport();

                ReportViewer1.LocalReport.Refresh();

                divReport.Visible = false;

                divData.Style.Add("display", "block");
                divData.Visible = true;
            }
        }
        catch (ValidationException ve)
        {
            ClearReport();
            DisplayValiationMessage(ve);
            return;
        }

        catch { throw; }
    }
Example #36
0
        public bool LoadReport()
        {
            string invoiceID = Session["InvoiceID"].ToString();
            string PartyID   = Session["PartyID"].ToString();
            string IGST      = Session["IGST"].ToString();

            //string invoiceID = "108";
            //string PartyID = "12";
            //string IGST = "0";


            //string invoiceID = "3";
            //string PartyID = "1";
            //string IGST = "0";

            Invoicing_Application.Invoicing_Service.Invoicing_ServiceSoapClient ObjClient = new Invoicing_Service.Invoicing_ServiceSoapClient();

            try
            {
                ReportViewer1.ProcessingMode = ProcessingMode.Local;
                if (IGST == "1")
                {
                    ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report/RDLC_Files/InvoiceReport_IGST.rdlc");
                }
                else
                {
                    ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Report/RDLC_Files/InvoiceReport.rdlc");
                }

                DataSet dsReportData = ObjClient.GetReportData(invoiceID, PartyID);

                DataTable dtInvoiceMaster = dsReportData.Tables[0];
                DataTable dtSalesDetails  = dsReportData.Tables[1];
                DataTable dtInvoiceOther  = dsReportData.Tables[2];
                DataTable dtPartyDetails  = dsReportData.Tables[3];
                DataTable dtMyprofile     = dsReportData.Tables[4];

                DataTable dtBankDetails = dsReportData.Tables[5];

                strInvoiceID = dtInvoiceMaster.Rows[0]["InvoiceNumber"].ToString();
                InvoiceDate  = Convert.ToDateTime(dtInvoiceMaster.Rows[0]["InvoiceDate"]);

                ReportParameter pCGST_Percent = new ReportParameter("pCGST_Percent", "(" + dtInvoiceMaster.Rows[0]["CGST_Percent"].ToString() + "%)");
                ReportParameter pSGST_Percent = new ReportParameter("pSGST_Percent", "(" + dtInvoiceMaster.Rows[0]["SGST_Percent"].ToString() + "%)");
                ReportParameter pIGST_Percent = new ReportParameter("pIGST_Percent", "(" + dtInvoiceMaster.Rows[0]["IGST_Percent"].ToString() + "%)");

                ReportParameter pAddress = new ReportParameter("pAddress", "" + dtMyprofile.Rows[0]["Address"].ToString());
                ReportParameter pEmail   = new ReportParameter("pEmail", "Email :" + dtMyprofile.Rows[0]["EmailID"].ToString());
                ReportParameter pMobile  = new ReportParameter("pMobile", "Mobile: " + dtMyprofile.Rows[0]["MobileNo"].ToString());
                ReportParameter pGST     = new ReportParameter("pGST", "GSTIN :" + dtMyprofile.Rows[0]["GSTNO"].ToString());

                ReportParameter pInvoiceNo         = new ReportParameter("pInvoiceNo", dtInvoiceMaster.Rows[0]["InvoiceNumber"].ToString());
                ReportParameter pInvoiceDate       = new ReportParameter("pInvoiceDate", InvoiceDate.ToString("dd-MM-yyyy"));
                ReportParameter pOwnerState        = new ReportParameter("pOwnerState", dtMyprofile.Rows[0]["StateName"].ToString());
                ReportParameter parmOwnerStateCode = new ReportParameter("parmOwnerStateCode", dtInvoiceMaster.Rows[0]["GSTStateCode"].ToString());

                ReportParameter pPartyState = new ReportParameter("pPartyState", dtPartyDetails.Rows[0]["StateName"].ToString());

                ReportParameter parmNote = new ReportParameter("parmNote", dtMyprofile.Rows[0]["TermCondition"].ToString());

                ReportParameter pReverseCharge;
                ReportParameter pTransportationMode;
                ReportParameter pVechicleNo;
                ReportParameter pDateofSupply;
                ReportParameter pPlaceofSupply;

                ReportParameter pConName;
                ReportParameter pConAddress;
                ReportParameter pConGST;
                ReportParameter pConStateCode;
                ReportParameter pConState;


                ReportParameter parmBankName  = null;
                ReportParameter parmAccountNo = null;;
                ReportParameter parmIFSCCode  = null;;
                ReportParameter ParmBranch    = null;;

                if (dtBankDetails.Rows.Count > 0)
                {
                    parmBankName  = new ReportParameter("parmBankName", "Bank Name: " + dtBankDetails.Rows[0]["BankName"].ToString());
                    parmAccountNo = new ReportParameter("parmAccountNo", "Account No: " + dtBankDetails.Rows[0]["AccountNo"].ToString());
                    parmIFSCCode  = new ReportParameter("parmIFSCCode", "IFSC Code: " + dtBankDetails.Rows[0]["IFSC_Code"].ToString());
                    ParmBranch    = new ReportParameter("ParmBranch", "Branch : " + dtBankDetails.Rows[0]["Branch"].ToString());
                }



                if (dtInvoiceOther.Rows.Count > 0)
                {
                    pReverseCharge      = new ReportParameter("pReverseCharge", dtInvoiceOther.Rows[0]["ReverseCharge"].ToString());
                    pTransportationMode = new ReportParameter("pTransportationMode", dtInvoiceOther.Rows[0]["Transportation_Mode"].ToString());
                    pVechicleNo         = new ReportParameter("pVechicleNo", dtInvoiceOther.Rows[0]["Vehicle_Number"].ToString());
                    pDateofSupply       = new ReportParameter("pDateofSupply", Convert.ToDateTime(dtInvoiceOther.Rows[0]["SupplyDate"]).ToString("dd-MM-yyyy"));
                    pPlaceofSupply      = new ReportParameter("pPlaceofSupply", dtInvoiceOther.Rows[0]["SupplyPlace"].ToString());

                    pConName      = new ReportParameter("pConName", dtInvoiceOther.Rows[0]["Consignee_Name"].ToString());
                    pConAddress   = new ReportParameter("pConAddress", dtInvoiceOther.Rows[0]["Consignee_Address"].ToString());
                    pConGST       = new ReportParameter("pConGST", dtInvoiceOther.Rows[0]["Consignee_GST"].ToString());
                    pConStateCode = new ReportParameter("pConStateCode", dtInvoiceOther.Rows[0]["GSTStateCode"].ToString());
                    pConState     = new ReportParameter("pConState", dtInvoiceOther.Rows[0]["StateName"].ToString());
                }
                else
                {
                    pReverseCharge      = new ReportParameter("pReverseCharge", "");
                    pTransportationMode = new ReportParameter("pTransportationMode", "");
                    pVechicleNo         = new ReportParameter("pVechicleNo", "");
                    pDateofSupply       = new ReportParameter("pDateofSupply", "");
                    pPlaceofSupply      = new ReportParameter("pPlaceofSupply", "");

                    pConName      = new ReportParameter("pConName", "");
                    pConAddress   = new ReportParameter("pConAddress", "");
                    pConGST       = new ReportParameter("pConGST", "");
                    pConStateCode = new ReportParameter("pConStateCode", "");

                    pConState = new ReportParameter("pConStateCode", "");
                }

                string GrandTotal = dtInvoiceMaster.Rows[0]["AmountAfterGST"].ToString();
                string NetAmt     = new NumberToEnglish().changeCurrencyToWords(GrandTotal) + "/-";

                ReportParameter pNetAmount = new ReportParameter("pNetAmount", NetAmt);

                ReportParameter pPartyName      = new ReportParameter("pPartyName", dtPartyDetails.Rows[0]["CustomerName"].ToString());
                ReportParameter pPartyAddress   = new ReportParameter("pPartyAddress", dtPartyDetails.Rows[0]["Address"].ToString());
                ReportParameter pPartyGST       = new ReportParameter("pPartyGST", dtPartyDetails.Rows[0]["GSTNO"].ToString());
                ReportParameter pPartyStateCode = new ReportParameter("pPartyStateCode", dtPartyDetails.Rows[0]["GSTStateCode"].ToString());

                strpartyName = dtPartyDetails.Rows[0]["CustomerName"].ToString();

                ReportViewer1.LocalReport.DataSources.Clear();

                ReportViewer1.LocalReport.SetParameters(pAddress);
                ReportViewer1.LocalReport.SetParameters(pEmail);
                ReportViewer1.LocalReport.SetParameters(pMobile);
                ReportViewer1.LocalReport.SetParameters(pGST);

                ReportViewer1.LocalReport.SetParameters(pInvoiceNo);
                ReportViewer1.LocalReport.SetParameters(pInvoiceDate);
                ReportViewer1.LocalReport.SetParameters(pOwnerState);
                ReportViewer1.LocalReport.SetParameters(pPartyState);
                ReportViewer1.LocalReport.SetParameters(pReverseCharge);
                ReportViewer1.LocalReport.SetParameters(pTransportationMode);
                ReportViewer1.LocalReport.SetParameters(pVechicleNo);
                ReportViewer1.LocalReport.SetParameters(pDateofSupply);

                ReportViewer1.LocalReport.SetParameters(pPlaceofSupply);
                ReportViewer1.LocalReport.SetParameters(pPartyName);
                ReportViewer1.LocalReport.SetParameters(pPartyAddress);
                ReportViewer1.LocalReport.SetParameters(pPartyGST);
                ReportViewer1.LocalReport.SetParameters(pPartyStateCode);
                ReportViewer1.LocalReport.SetParameters(pConName);
                ReportViewer1.LocalReport.SetParameters(pConAddress);
                ReportViewer1.LocalReport.SetParameters(pConGST);
                ReportViewer1.LocalReport.SetParameters(pConState);
                ReportViewer1.LocalReport.SetParameters(pConStateCode);
                ReportViewer1.LocalReport.SetParameters(pNetAmount);
                ReportViewer1.LocalReport.SetParameters(parmBankName);
                ReportViewer1.LocalReport.SetParameters(parmAccountNo);
                ReportViewer1.LocalReport.SetParameters(parmIFSCCode);
                ReportViewer1.LocalReport.SetParameters(ParmBranch);
                ReportViewer1.LocalReport.SetParameters(parmNote);

                ReportViewer1.LocalReport.SetParameters(pCGST_Percent);
                ReportViewer1.LocalReport.SetParameters(pSGST_Percent);
                ReportViewer1.LocalReport.SetParameters(pIGST_Percent);
                ReportViewer1.LocalReport.SetParameters(parmOwnerStateCode);

                DataTable dtGST = new DataTable();
                dtGST.Columns.Add("Percent");
                dtGST.Columns.Add("Amount");

                DataRow dRow = dtGST.NewRow();
                dRow["Percent"] = "Percent";
                dRow["Amount"]  = "Amount";

                dtGST.Rows.Add(dRow);

                ReportDataSource datasource1 = new ReportDataSource("ds_SalesDetails", dtSalesDetails);
                ReportDataSource datasource2 = new ReportDataSource("ds_TaxCalculation", dtInvoiceMaster);
                ReportDataSource datasource3 = new ReportDataSource("ds_GST", dtGST);

                ReportViewer1.LocalReport.DataSources.Add(datasource1);
                ReportViewer1.LocalReport.DataSources.Add(datasource2);
                ReportViewer1.LocalReport.DataSources.Add(datasource3);

                return(true);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('" + ex.ToString() + "');", true);;
                Response.Write(ex.ToString());
                return(false);
            }
        }
        public ActionResult SummaryReport(string dateFrom, string dateTo, int?companyTo)
        {
            DateTime dtDateFrom = DateTime.Now.Date;
            DateTime dtDateTo   = DateTime.Now;

            if (companyTo == null)
            {
                companyTo = 0;
            }

            if (!String.IsNullOrEmpty(dateFrom))
            {
                dtDateFrom = Convert.ToDateTime(dateFrom);
            }

            if (!String.IsNullOrEmpty(dateTo))
            {
                dtDateTo = Convert.ToDateTime(dateTo);
            }


            int comp = Convert.ToInt32(Sessions.CompanyId.Value);

            var lstSt = from st in stRepo.List().Where(st => st.CompanyId == comp &&
                                                       (System.Data.Entity.DbFunctions.TruncateTime(st.Date) <= dtDateTo &&
                                                        System.Data.Entity.DbFunctions.TruncateTime(st.Date) >= dtDateFrom) &&
                                                       st.CompanyTo == companyTo).ToList()
                        join stItem in stItemRepo.List() on st.Id equals stItem.StockTransferId
                        into r
                        select new
            {
                Date     = st.Date.ToString("MM/dd/yyyy"),
                PlateNo  = st.UnitPlateNo,
                No       = st.No,
                ItemDesc = r.FirstOrDefault().Item.Description,
                Quantity = r.FirstOrDefault().Quantity,
                UnitCost = r.FirstOrDefault().Item.UnitCost,
                Amount   = r.FirstOrDefault().Quantity *r.FirstOrDefault().Item.UnitCost
            };


            ReportViewer reportViewer = new ReportViewer();

            reportViewer.ProcessingMode = ProcessingMode.Local;

            ReportDataSource _rds = new ReportDataSource();

            _rds.Name  = "DataSet1";
            _rds.Value = lstSt;

            reportViewer.KeepSessionAlive = false;
            reportViewer.LocalReport.DataSources.Clear();
            reportViewer.LocalReport.ReportPath = Request.MapPath(Request.ApplicationPath) + @"Views\StockTransfer\Report\rptSummaryReport.rdlc";

            reportViewer.LocalReport.DataSources.Add(_rds);

            List <ReportParameter> _parameter = new List <ReportParameter>();

            _parameter.Add(new ReportParameter("DateRange", dtDateFrom.ToString("MMMM dd, yyyy") + " - " + dtDateTo.ToString("MMMM dd, yyyy")));
            _parameter.Add(new ReportParameter("CompanyName", companyRepo.GetById(Sessions.CompanyId.Value).Name));
            _parameter.Add(new ReportParameter("CompanyAddress", companyRepo.GetById(Sessions.CompanyId.Value).Address));
            if (companyTo == 0)
            {
                _parameter.Add(new ReportParameter("CompanyTo", ""));
            }
            else
            {
                _parameter.Add(new ReportParameter("CompanyTo", companyRepo.GetById(Convert.ToInt32(companyTo)).Name));
            }
            reportViewer.LocalReport.SetParameters(_parameter);

            reportViewer.LocalReport.Refresh();


            ViewBag.ReportViewer = reportViewer;

            ViewBag.DateFrom = dtDateFrom.ToString("MM/dd/yyyy");
            ViewBag.DateTo   = dtDateTo.ToString("MM/dd/yyyy");

            ViewBag.CompanyName = companyRepo.GetById(Sessions.CompanyId.Value).Name;

            ViewBag.Companies = new SelectList(companyRepo.List().Where(p => p.Id != Sessions.CompanyId.Value), "Id", "Name");

            return(View());
        }
Example #38
0
        /// <summary>
        /// 基于RDLC的报表数据操作
        /// </summary>
        /// <param name="format">图片格式</param>
        /// <returns></returns>
        public ActionResult UserRdlcReport(string format)
        {
            LocalReport localReport = new LocalReport();

            localReport.ReportPath = Server.MapPath("~/Report/WHC.UserReport.rdlc");
            var dt = baseBLL.GetAll();

            ReportDataSource reportDataSource = new ReportDataSource("DataSet1", dt);

            localReport.DataSources.Add(reportDataSource);

            if (string.IsNullOrEmpty(format))
            {
                format = "Image";
            }

            string reportType = format;
            string deviceType = (format.ToLower() == "image") ? "jpeg" : format;
            string mimeType;
            string encoding;
            string fileNameExtension;

            //The DeviceInfo settings should be changed based on the reportType
            //http://msdn2.microsoft.com/en-us/library/ms155397.aspx
            string deviceInfo =
                "<DeviceInfo>" +
                "  <OutputFormat>" + deviceType + "</OutputFormat>" +
                "  <PageWidth>8.5in</PageWidth>" +
                //"  <PageHeight>11in</PageHeight>" +
                "  <MarginTop>0.5in</MarginTop>" +
                "  <MarginLeft>1in</MarginLeft>" +
                "  <MarginRight>1in</MarginRight>" +
                "  <MarginBottom>0.5in</MarginBottom>";

            if (format.ToLower() == "image")
            {
                //deviceInfo += string.Format("<StartPage>{0}</StartPage>", 0);
                //deviceInfo += string.Format("<EndPage>{0}</EndPage>", int.MaxValue);
                double inchValue = (dt.Count / 37.0) * 11;
                deviceInfo += string.Format("  <PageHeight>{0}in</PageHeight>", inchValue);
            }
            else
            {
                deviceInfo += "  <PageHeight>11in</PageHeight>";
            }

            deviceInfo += "</DeviceInfo>";

            Warning[] warnings;
            string[]  streams;
            byte[]    renderedBytes;

            renderedBytes = localReport.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);

            return(File(renderedBytes, (format.ToLower() == "image") ? "image/jpeg" : mimeType));
            //return new ReportsResult(renderedBytes, mimeType);

            //Response.AddHeader("content-disposition", "attachment; filename=NorthWindCustomers." + fileNameExtension);

            //return File(renderedBytes, "pdf");
            //return File(renderedBytes, "image/jpeg");
        }
        private void PreviewReportDetail()
        {
            var periode = string.Empty;

            IReportPembayaranPiutangJualProdukBll reportBll = new ReportPembayaranPiutangJualProdukBll(_log);

            IList <ReportPembayaranPiutangPenjualanProdukDetail> listOfReportPiutangPenjualan = new List <ReportPembayaranPiutangPenjualanProdukDetail>();

            IList <string> listOfCustomerId = new List <string>();

            if (chkBoxTitle.Checked)
            {
                listOfCustomerId = base.GetCustomerId(_listOfCustomer);

                if (listOfCustomerId.Count == 0)
                {
                    MsgHelper.MsgWarning("Minimal 1 customer harus dipilih");
                    return;
                }
            }

            if (rdoTanggal.Checked)
            {
                if (!DateTimeHelper.IsValidRangeTanggal(dtpTanggalMulai.Value, dtpTanggalSelesai.Value))
                {
                    MsgHelper.MsgNotValidRangeTanggal();
                    return;
                }

                var tanggalMulai   = DateTimeHelper.DateToString(dtpTanggalMulai.Value);
                var tanggalSelesai = DateTimeHelper.DateToString(dtpTanggalSelesai.Value);

                periode = dtpTanggalMulai.Value == dtpTanggalSelesai.Value ? string.Format("Periode : {0}", tanggalMulai) : string.Format("Periode : {0} s.d {1}", tanggalMulai, tanggalSelesai);

                listOfReportPiutangPenjualan = reportBll.DetailGetByTanggal(dtpTanggalMulai.Value, dtpTanggalSelesai.Value);
            }
            else
            {
                periode = string.Format("Periode : {0} {1}", cmbBulan.Text, cmbTahun.Text);

                var bulan = cmbBulan.SelectedIndex + 1;
                var tahun = int.Parse(cmbTahun.Text);

                listOfReportPiutangPenjualan = reportBll.DetailGetByBulan(bulan, tahun);
            }

            if (listOfCustomerId.Count > 0 && listOfReportPiutangPenjualan.Count > 0)
            {
                listOfReportPiutangPenjualan = listOfReportPiutangPenjualan.Where(f => listOfCustomerId.Contains(f.customer_id))
                                               .ToList();
            }

            if (listOfReportPiutangPenjualan.Count > 0)
            {
                var reportDataSource = new ReportDataSource
                {
                    Name  = "ReportPembayaranPiutangPenjualanProdukDetail",
                    Value = listOfReportPiutangPenjualan
                };

                var parameters = new List <ReportParameter>();
                parameters.Add(new ReportParameter("periode", periode));

                base.ShowReport(this.Text, "RvPembayaranPiutangPenjualanProdukDetail", reportDataSource, parameters);
            }
            else
            {
                MsgHelper.MsgInfo("Maaf laporan data pembayaran piutang penjualan tidak ditemukan");
            }
        }
Example #40
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            try
            {
                //DataTable dt = (DataTable)dgvAccountLedger.DataSource;
                //bool isinduvisualCustomer = false;
                //if (cmbAccountName.SelectedIndex == 0)
                //{
                //    isinduvisualCustomer = false;
                //}
                //else
                //{
                //    isinduvisualCustomer = true;
                //}
                //Report rp = new Report();
                //crpAccountLedger crReportDocument = new crpAccountLedger();
                ////crReportDocument.SetDataSource(dt);
                //crReportDocument.Database.Tables[0].SetDataSource(dt);
                //crReportDocument.Database.Tables[1].SetDataSource(Utility.dtGenericBillInfo);
                //crReportDocument.SetParameterValue(0, isinduvisualCustomer);
                //rp.crystalReportViewer1.ReportSource = crReportDocument;
                //rp.crystalReportViewer1.ReportSource = crReportDocument;
                //rp.crystalReportViewer1.Refresh();
                //rp.Refresh();
                //rp.Show();

                if (dgvAccountLedger.Rows.Count > 0)
                {
                    DataTable dt = (dgvAccountLedger.DataSource as DataTable).Copy();
                    // DataTable dt = (DataTable)dgvAccountLedger.DataSource;
                    bool isinduvisualCustomer = false;
                    if (cmbAccountName.SelectedIndex == 0)
                    {
                        isinduvisualCustomer = false;
                    }
                    else
                    {
                        isinduvisualCustomer = true;
                    }

                    if (dt.Rows.Count > 0)
                    {
                        frmRptAccountLedger rpt = new frmRptAccountLedger();
                        rpt.rptAccountLedger.LocalReport.DataSources.Clear();
                        rpt.rptAccountLedger.ProcessingMode = ProcessingMode.Local;
                        ReportDataSource datasource  = new ReportDataSource("DSBillingInfo", Utility.dtGenericBillInfo);
                        ReportDataSource datasource1 = new ReportDataSource("DSAccountLedger", dt);
                        rpt.rptAccountLedger.LocalReport.ReportEmbeddedResource = "Dlogic_Wholesaler.RDLCReport.rptAccountLedger.rdlc";
                        rpt.rptAccountLedger.LocalReport.DataSources.Add(datasource);
                        rpt.rptAccountLedger.LocalReport.DataSources.Add(datasource1);
                        ReportParameter[] parmeters = new ReportParameter[1];
                        parmeters[0] = new ReportParameter("isinduvisualCustomer", isinduvisualCustomer.ToString());
                        rpt.rptAccountLedger.LocalReport.SetParameters(parmeters);
                        if (isinduvisualCustomer)
                        {
                            rpt.Text = cmbAccountName.Text;
                        }
                        else
                        {
                            rpt.Text = "Account Ledger Report";
                        }

                        rpt.rptAccountLedger.RefreshReport();
                        rpt.Show();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Example #41
0
        public void GenerateReport()
        {
            try
            {
                reportViewer1.LocalReport.EnableExternalImages = true;



                Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[26];

                string address = AppVars.objSubCompany.Address;
                string telNo   = string.Empty;



                string sortCode     = AppVars.objSubCompany.SortCode.ToStr();
                string accountNo    = AppVars.objSubCompany.AccountNo.ToStr();
                string accountTitle = AppVars.objSubCompany.AccountTitle.ToStr();
                string bank         = AppVars.objSubCompany.BankName.ToStr();

                string hasBankDetails = "1";
                if (string.IsNullOrEmpty(sortCode) && string.IsNullOrEmpty(accountNo) && string.IsNullOrEmpty(accountTitle) &&
                    string.IsNullOrEmpty(bank))
                {
                    hasBankDetails = "0";
                }

                if (!string.IsNullOrEmpty(sortCode))
                {
                    sortCode = "Sort Code : " + sortCode;
                }



                if (!string.IsNullOrEmpty(accountTitle))
                {
                    accountTitle = "Account Title : " + accountTitle;
                }



                string website = AppVars.objSubCompany.WebsiteUrl.ToStr();
                if (!string.IsNullOrEmpty(website))
                {
                    website += " , ";
                }

                website += "Email:" + AppVars.objSubCompany.EmailAddress.ToStr();


                string companyNumber = AppVars.objSubCompany.CompanyNumber.ToStr();
                if (!string.IsNullOrEmpty(companyNumber))
                {
                    companyNumber = "Company Number: " + companyNumber;
                }

                string vatNumber = AppVars.objSubCompany.CompanyVatNumber.ToStr();
                if (!string.IsNullOrEmpty(vatNumber))
                {
                    vatNumber = "VAT Number: " + vatNumber;
                }


                param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address);

                param[18] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Footer", AppVars.objSubCompany.WebsiteUrl.ToStr());

                param[14] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_MobileNo", "Mobile: " + AppVars.objSubCompany.EmergencyNo.ToStr());
                param[15] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Website", website);
                param[16] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Email", "Email: " + AppVars.objSubCompany.EmailAddress.ToStr());

                param[20] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyNumber", companyNumber);
                param[21] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_VATNumber", vatNumber);


                param[7]  = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_SortCode", sortCode);
                param[9]  = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountTitle", accountTitle);
                param[10] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Bank", bank);



                List <ClsLogo> objLogo = new List <ClsLogo>();
                objLogo.Add(new ClsLogo {
                    ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null
                });
                ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo);
                this.reportViewer1.LocalReport.DataSources.Add(imageDataSource);

                string path = @"File:";
                param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Path", path);
                param[6] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyHeader", AppVars.objSubCompany.CompanyName.ToStr());



                int?driverId = this.DataSource.FirstOrDefault().DefaultIfEmpty().DriverId;

                var data = this.DataSource.FirstOrDefault().DefaultIfEmpty();


                telNo = "Tel No. " + AppVars.objSubCompany.TelephoneNo;

                if (!string.IsNullOrEmpty(accountNo))
                {
                    accountNo = "Account No : " + accountNo;
                }

                param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo);


                param[8] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountNo", accountNo);



                string  vat            = "0";
                decimal discountAmount = 0.00m;
                decimal valueAddedTax  = 0.0m;



                string discount = string.Format("{0:c}", discountAmount);
                discount = discount.Substring(1);

                string grandTotal = "";

                param[17] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Discount", discount);


                param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_InvoiceTotal", grandTotal);

                param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasVat", vat);

                param[5]  = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_VAT", valueAddedTax.ToStr());
                param[11] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasDepartment", "0");

                param[12] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Net", "0");

                param[13] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasCostCenter", "0");

                param[19] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasBankDetails", hasBankDetails);

                string AccountBooking = string.Format("{0:£ #.##}", this.DataSource.Where(c => c.CompanyId != null).Sum(c => c.FareRate.Value.ToDecimal()));

                string CashBooking = string.Format("{0:£ #.##}", this.DataSource.Where(c => c.CompanyId == null).Sum(c => c.FareRate.Value.ToDecimal()));

                param[22] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountJobTotal", AccountBooking);
                param[23] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CashJobTotal", CashBooking);


                Fleet_Driver obj             = General.GetObject <Fleet_Driver>(c => c.Id == driverId);
                decimal      DriverCommision = obj.DriverCommissionPerBooking.ToDecimal();

                decimal JobTotal  = this.DataSource.Sum(c => c.FareRate.Value.ToDecimal());
                string  Commision = (JobTotal * DriverCommision / 100).ToStr();


                param[24] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Commision", Commision);

                string DriverGrandTotal = "";
                if (this.DataSource != null)
                {
                    DriverGrandTotal = (this.DataSource[0].DriverCommision + this.DataSource[0].Extra + this.DataSource[0].fuel + this.DataSource[0].OldBalance).ToStr();
                }

                param[25] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_GrandTotal", DriverGrandTotal);

                reportViewer1.LocalReport.SetParameters(param);


                int cnt = this.DataSource.Count;



                this.vu_DriverCommisionBindingSource.DataSource = this.DataSource;

                this.reportViewer1.ZoomPercent = 100;
                this.reportViewer1.ZoomMode    = Microsoft.Reporting.WinForms.ZoomMode.Percent;
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
        private void GenerarReporte()
        {
            try
            {
                var mes = Fechas.GetFechaDateServer.Month;
                switch (OrdenarPor)
                {
                case 1:    //expediente
                    mes = 1;
                    break;

                case 2:    //nombre
                    mes = 2;
                    break;

                case 3:    //Ubicacion
                    mes = 3;
                    break;

                case 4:    //expediente
                    mes = 4;
                    break;

                case 5:    //nombre
                    mes = 5;
                    break;

                case 6:    //Ubicacion
                    mes = 6;
                    break;

                case 7:    //expediente
                    mes = 7;
                    break;

                case 8:    //nombre
                    mes = 8;
                    break;

                case 9:    //Ubicacion
                    mes = 9;
                    break;

                case 10:    //expediente
                    mes = 10;
                    break;

                case 11:    //nombre
                    mes = 11;
                    break;

                case 12:    //Ubicacion
                    mes = 12;
                    break;
                }
                var anio         = Fechas.GetFechaDateServer.Year;
                var datosReporte = new List <cReporteDatos>();
                datosReporte.Add(new cReporteDatos()
                {
                    Encabezado1 = Parametro.ENCABEZADO1,
                    Encabezado2 = Parametro.ENCABEZADO2,
                    Encabezado3 = Parametro.ENCABEZADO3,
                    Logo1       = Parametro.REPORTE_LOGO1,
                    Logo2       = Parametro.REPORTE_LOGO2,
                    Titulo      = "Altas-Bajas"
                });
                var lst_internos_causa_penal_delito = new cCausaPenalDelito().ObtenerTodos().ToList();
                var internos_lista            = new cIngreso().ObtenerIngresosActivos(GlobalVar.gCentro).ToList();//.Where(w => w.FEC_INGRESO_CERESO.Value.Year == anio && w.FEC_INGRESO_CERESO.Value.Month == mes).ToList();
                var lst_imp_altas             = new List <cPoblacionAltasBajas>();
                var lst_imp_bajas             = new List <cPoblacionAltasBajas>();
                var lst_total_sexo            = new List <cTotalSexo>();
                var lst_imp_grafica_alta_masc = new List <cGraficaAltaBaja>();
                var lst_imp_grafica_baja_masc = new List <cGraficaAltaBaja>();
                var lst_imp_grafica_alta_fem  = new List <cGraficaAltaBaja>();
                var lst_imp_grafica_baja_fem  = new List <cGraficaAltaBaja>();

                foreach (var item in internos_lista)
                {
                    if (item.FEC_INGRESO_CERESO != null)
                    {
                        if ((item.FEC_INGRESO_CERESO.Value.Year == anio && item.FEC_INGRESO_CERESO.Value.Month == mes) || (item.FEC_INGRESO_CERESO >= FechaInicio && item.FEC_INGRESO_CERESO <= FechaFin))
                        {
                            var interno = lst_internos_causa_penal_delito.Where(w => w.ID_CENTRO == item.ID_CENTRO && w.ID_ANIO == item.ID_ANIO && w.ID_IMPUTADO == item.ID_IMPUTADO && w.ID_INGRESO == w.ID_INGRESO).FirstOrDefault();
                            if (interno == null)
                            {
                                var obj = new cPoblacionAltasBajas();
                                var row = new cTotalSexo();
                                obj.Fuero     = "Sin Fuero";//item.CAUSA_PENAL == null ? string.Empty : item.IMPUTADO.ENTIDAD.DESCR;
                                obj.Tipo      = "Alta";
                                row.Masculino = item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                row.Femenino  = item.IMPUTADO.SEXO == "F" ? 1 : 0;
                                row.SinSexo   = item.IMPUTADO.SEXO == null ? 1 : 0;
                                obj.DiscFem   = item.ID_CLASIFICACION_JURIDICA == "4" && item.IMPUTADO.SEXO == "F" ? 1 : 0;
                                obj.DiscMasc  = item.ID_CLASIFICACION_JURIDICA == "4" && item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                obj.IndicFem  = item.ID_CLASIFICACION_JURIDICA == "I" && item.IMPUTADO.SEXO == "F" ? 1 : 0;
                                obj.IndicMasc = item.ID_CLASIFICACION_JURIDICA == "I" && item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                obj.ProcFem   = item.ID_CLASIFICACION_JURIDICA == "2" && item.IMPUTADO.SEXO == "F" ? 1 : 0;
                                obj.ProcMasc  = item.ID_CLASIFICACION_JURIDICA == "2" && item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                obj.SentFem   = item.ID_CLASIFICACION_JURIDICA == "3" && item.IMPUTADO.SEXO == "F" ? 1 : 0;
                                obj.SentMasc  = item.ID_CLASIFICACION_JURIDICA == "3" && item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                lst_total_sexo.Add(row);
                                lst_imp_altas.Add(obj);
                            }
                        }
                    }
                    if (item.FEC_SALIDA_CERESO != null)
                    {
                        if ((item.FEC_SALIDA_CERESO.Value.Year == anio && item.FEC_SALIDA_CERESO.Value.Month == mes) || (item.FEC_SALIDA_CERESO >= FechaInicio && item.FEC_SALIDA_CERESO <= FechaFin))
                        {
                            var interno = lst_internos_causa_penal_delito.Where(w => w.ID_CENTRO == item.ID_CENTRO && w.ID_ANIO == item.ID_ANIO && w.ID_IMPUTADO == item.ID_IMPUTADO && w.ID_INGRESO == w.ID_INGRESO).FirstOrDefault();
                            if (interno == null)
                            {
                                var obj = new cPoblacionAltasBajas();
                                var row = new cTotalSexo();
                                obj.Fuero     = "Sin Fuero";//item.CAUSA_PENAL == null ? string.Empty : item.IMPUTADO.ENTIDAD.DESCR;
                                obj.Tipo      = "Baja";
                                row.Masculino = item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                row.Femenino  = item.IMPUTADO.SEXO == "F" ? 1 : 0;
                                row.SinSexo   = item.IMPUTADO.SEXO == null ? 1 : 0;
                                obj.DiscFem   = item.ID_CLASIFICACION_JURIDICA == "4" && item.IMPUTADO.SEXO == "F" ? 1 : 0;
                                obj.DiscMasc  = item.ID_CLASIFICACION_JURIDICA == "4" && item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                obj.ImpMasc   = item.ID_CLASIFICACION_JURIDICA == "1" && item.NUC == null && item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                obj.IndicFem  = item.ID_CLASIFICACION_JURIDICA == "I" && item.IMPUTADO.SEXO == "F" ? 1 : 0;
                                obj.IndicMasc = item.ID_CLASIFICACION_JURIDICA == "I" && item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                obj.ProcFem   = item.ID_CLASIFICACION_JURIDICA == "2" && item.IMPUTADO.SEXO == "F" ? 1 : 0;
                                obj.ProcMasc  = item.ID_CLASIFICACION_JURIDICA == "2" && item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                obj.SentFem   = item.ID_CLASIFICACION_JURIDICA == "3" && item.IMPUTADO.SEXO == "F" ? 1 : 0;
                                obj.SentMasc  = item.ID_CLASIFICACION_JURIDICA == "3" && item.IMPUTADO.SEXO == "M" ? 1 : 0;
                                lst_total_sexo.Add(row);
                                lst_imp_bajas.Add(obj);
                            }
                        }
                    }
                }

                foreach (var item in lst_internos_causa_penal_delito)
                {
                    var interno = internos_lista.Where(w => w.ID_CENTRO == item.ID_CENTRO && w.ID_ANIO == item.ID_ANIO && w.ID_IMPUTADO == item.ID_IMPUTADO && w.ID_INGRESO == w.ID_INGRESO).FirstOrDefault();
                    if (interno != null)
                    {
                        if (item.CAUSA_PENAL.INGRESO.FEC_INGRESO_CERESO != null)
                        {
                            if ((item.CAUSA_PENAL.INGRESO.FEC_INGRESO_CERESO.Value.Year == anio && item.CAUSA_PENAL.INGRESO.FEC_INGRESO_CERESO.Value.Month == mes) || (item.CAUSA_PENAL.INGRESO.FEC_INGRESO_CERESO >= FechaInicio && item.CAUSA_PENAL.INGRESO.FEC_INGRESO_CERESO <= FechaFin))
                            {
                                if (item.CAUSA_PENAL.ID_ESTATUS_CP.Value == 1 && item.ID_FUERO == "C")
                                {
                                    var obj = new cPoblacionAltasBajas();
                                    var row = new cTotalSexo();
                                    obj.Fuero     = "Comun";//item.CAUSA_PENAL.INGRESO.IMPUTADO.ENTIDAD.DESCR;
                                    obj.Tipo      = "Alta";
                                    row.Masculino = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    row.Femenino  = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    row.SinSexo   = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == null ? 1 : 0;
                                    obj.DiscFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "4" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.DiscMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "4" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.IndicFem  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "I" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.IndicMasc = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "I" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.ProcFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "2" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.ProcMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "2" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.SentFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "3" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.SentMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "3" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    lst_total_sexo.Add(row);
                                    lst_imp_altas.Add(obj);
                                }
                                else if (item.CAUSA_PENAL.ID_ESTATUS_CP.Value == 1 && item.ID_FUERO == "F")
                                {
                                    var obj = new cPoblacionAltasBajas();
                                    var row = new cTotalSexo();
                                    obj.Fuero     = "Federal";
                                    obj.Tipo      = "Alta";
                                    row.Masculino = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    row.Femenino  = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    row.SinSexo   = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == null ? 1 : 0;
                                    obj.DiscFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "4" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.DiscMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "4" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.IndicFem  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "I" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.IndicMasc = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "I" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.ProcFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "2" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.ProcMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "2" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.SentFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "3" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.SentMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "3" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    lst_total_sexo.Add(row);
                                    lst_imp_altas.Add(obj);
                                }
                            }
                        }
                        if (item.CAUSA_PENAL.INGRESO.FEC_SALIDA_CERESO != null)
                        {
                            if ((item.CAUSA_PENAL.INGRESO.FEC_SALIDA_CERESO.Value.Year == anio && item.CAUSA_PENAL.INGRESO.FEC_SALIDA_CERESO.Value.Month == mes) || (item.CAUSA_PENAL.INGRESO.FEC_SALIDA_CERESO >= FechaInicio && item.CAUSA_PENAL.INGRESO.FEC_SALIDA_CERESO <= FechaFin))
                            {
                                if (item.CAUSA_PENAL.ID_ESTATUS_CP.Value == 1 && item.ID_FUERO == "C")
                                {
                                    var obj = new cPoblacionAltasBajas();
                                    var row = new cTotalSexo();
                                    obj.Fuero     = "Comun";//item.CAUSA_PENAL.INGRESO.IMPUTADO.ENTIDAD.DESCR;
                                    obj.Tipo      = "Baja";
                                    row.Masculino = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    row.Femenino  = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    row.SinSexo   = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == null ? 1 : 0;
                                    obj.DiscFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "4" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.DiscMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "4" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.ImpMasc   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "1" && item.CAUSA_PENAL.INGRESO.NUC == null && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.IndicFem  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "I" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.IndicMasc = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "I" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.ProcFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "2" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.ProcMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "2" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.SentFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "3" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.SentMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "3" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    lst_total_sexo.Add(row);
                                    lst_imp_bajas.Add(obj);
                                }
                                else if (item.CAUSA_PENAL.ID_ESTATUS_CP.Value == 1 && item.ID_FUERO == "F")
                                {
                                    var obj = new cPoblacionAltasBajas();
                                    var row = new cTotalSexo();
                                    obj.Fuero     = "Federal";
                                    obj.Tipo      = "Baja";
                                    row.Masculino = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    row.Femenino  = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    row.SinSexo   = item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == null ? 1 : 0;
                                    obj.DiscFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "4" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.DiscMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "4" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.ImpMasc   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "1" && item.CAUSA_PENAL.INGRESO.NUC == null && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.IndicFem  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "I" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.IndicMasc = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "I" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.ProcFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "2" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.ProcMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "2" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    obj.SentFem   = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "3" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "F" ? 1 : 0;
                                    obj.SentMasc  = item.CAUSA_PENAL.INGRESO.ID_CLASIFICACION_JURIDICA == "3" && item.CAUSA_PENAL.INGRESO.IMPUTADO.SEXO == "M" ? 1 : 0;
                                    lst_total_sexo.Add(row);
                                    lst_imp_bajas.Add(obj);
                                }
                            }
                        }
                    }
                }
                //Para alimentar grafica Alta masculino
                foreach (var item in lst_imp_altas)
                {
                    if (item.Fuero == "Comun" && item.Tipo == "Alta")
                    {
                        if (item.DiscMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                        if (item.IndicMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                        if (item.ProcMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                        if (item.SentMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                    }
                    if (item.Fuero == "Federal" && item.Tipo == "Alta")
                    {
                        if (item.DiscMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                        if (item.IndicMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                        if (item.ProcMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                        if (item.SentMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                    }
                    if (item.Fuero == "Sin Fuero" && item.Tipo == "Alta")
                    {
                        if (item.DiscMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                        if (item.IndicMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                        if (item.ProcMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                        if (item.SentMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentMasc;
                            lst_imp_grafica_alta_masc.Add(obj);
                        }
                    }
                }
                //Para alimentar grafica alta femenino
                foreach (var item in lst_imp_altas)
                {
                    if (item.Fuero == "Comun" && item.Tipo == "Alta")
                    {
                        if (item.DiscFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                        if (item.IndicFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                        if (item.ProcFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                        if (item.SentFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                    }
                    if (item.Fuero == "Federal" && item.Tipo == "Alta")
                    {
                        if (item.DiscFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                        if (item.IndicFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                        if (item.ProcFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                        if (item.SentFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                    }
                    if (item.Fuero == "Sin Fuero" && item.Tipo == "Alta")
                    {
                        if (item.DiscFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                        if (item.IndicFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                        if (item.ProcFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                        if (item.SentFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentFem;
                            lst_imp_grafica_alta_fem.Add(obj);
                        }
                    }
                }
                //Para alimentar grafica baja masculino
                foreach (var item in lst_imp_bajas)
                {
                    if (item.Fuero == "Comun" && item.Tipo == "Baja")
                    {
                        if (item.DiscMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.ImpMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Imputado";
                            obj.Comun += item.ImpMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.IndicMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.ProcMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.SentMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                    }
                    if (item.Fuero == "Federal" && item.Tipo == "Baja")
                    {
                        if (item.DiscMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.ImpMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Imputado";
                            obj.Comun += item.ImpMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.IndicMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.ProcMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.SentMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                    }
                    if (item.Fuero == "Sin Fuero" && item.Tipo == "Baja")
                    {
                        if (item.DiscMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.ImpMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Imputado";
                            obj.Comun += item.ImpMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.IndicMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.ProcMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                        if (item.SentMasc > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentMasc;
                            lst_imp_grafica_baja_masc.Add(obj);
                        }
                    }
                }
                //Para alimentar grafica Baja femenino
                foreach (var item in lst_imp_bajas)
                {
                    if (item.Fuero == "Comun" && item.Tipo == "Baja")
                    {
                        if (item.DiscFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                        if (item.IndicFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                        if (item.ProcFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                        if (item.SentFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                    }
                    if (item.Fuero == "Federal" && item.Tipo == "Baja")
                    {
                        if (item.DiscFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                        if (item.IndicFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                        if (item.ProcFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                        if (item.SentFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                    }
                    if (item.Fuero == "Sin Fuero" && item.Tipo == "Baja")
                    {
                        if (item.DiscFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Discrecional";
                            obj.Comun += item.DiscFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                        if (item.IndicFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Indiciado";
                            obj.Comun += item.IndicFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                        if (item.ProcFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Procesado";
                            obj.Comun += item.ProcFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                        if (item.SentFem > 0)
                        {
                            var obj = new cGraficaAltaBaja();
                            obj.Fuero  = item.Fuero;
                            obj.Causa  = "Sentenciado";
                            obj.Comun += item.SentFem;
                            lst_imp_grafica_baja_fem.Add(obj);
                        }
                    }
                }
                var results_altas = lst_imp_altas.GroupBy(n => n.Fuero).
                                    Select(group =>
                                           new
                {
                    Fuero = group.Key,
                    Sexo  = group.ToList(),
                });

                var lst_imp_altas2 = new List <cPoblacionAltasBajas>();
                foreach (var row in results_altas)
                {
                    var obj = new cPoblacionAltasBajas();
                    obj.Fuero = row.Fuero;
                    foreach (var item in row.Sexo)
                    {
                        obj.DiscFem   += item.DiscFem;
                        obj.DiscMasc  += item.DiscMasc;
                        obj.IndicFem  += item.IndicFem;
                        obj.IndicMasc += item.IndicMasc;
                        obj.ProcFem   += item.ProcFem;
                        obj.ProcMasc  += item.ProcMasc;
                        obj.SentFem   += item.SentFem;
                        obj.SentMasc  += item.SentMasc;
                    }
                    lst_imp_altas2.Add(obj);
                }

                var results_bajas = lst_imp_bajas.GroupBy(n => n.Fuero).
                                    Select(group =>
                                           new
                {
                    Fuero = group.Key,
                    Sexo  = group.ToList(),
                });

                var lst_imp_bajas2 = new List <cPoblacionAltasBajas>();
                foreach (var row in results_bajas)
                {
                    var obj = new cPoblacionAltasBajas();
                    obj.Fuero = row.Fuero;
                    foreach (var item in row.Sexo)
                    {
                        obj.DiscFem   += item.DiscFem;
                        obj.DiscMasc  += item.DiscMasc;
                        obj.ImpMasc   += item.ImpMasc;
                        obj.IndicFem  += item.IndicFem;
                        obj.IndicMasc += item.IndicMasc;
                        obj.ProcFem   += item.ProcFem;
                        obj.ProcMasc  += item.ProcMasc;
                        obj.SentFem   += item.SentFem;
                        obj.SentMasc  += item.SentMasc;
                    }
                    lst_imp_bajas2.Add(obj);
                }
                Reporte.LocalReport.ReportPath = "../../Reportes/rPoblacionAltasBajas.rdlc";
                Reporte.LocalReport.DataSources.Clear();

                ReportDataSource rds1 = new ReportDataSource();
                rds1.Name  = "DataSet1";
                rds1.Value = datosReporte;
                Reporte.LocalReport.DataSources.Add(rds1);

                ReportDataSource rds2 = new ReportDataSource();
                rds2.Name  = "DataSet2";
                rds2.Value = lst_imp_altas2.OrderBy(o => o.Fuero);
                Reporte.LocalReport.DataSources.Add(rds2);

                ReportDataSource rds3 = new ReportDataSource();
                rds3.Name  = "DataSet3";
                rds3.Value = lst_imp_bajas2.OrderBy(o => o.Fuero);
                Reporte.LocalReport.DataSources.Add(rds3);

                ReportDataSource rds4 = new ReportDataSource();
                rds4.Name  = "DataSet4";
                rds4.Value = lst_imp_grafica_alta_masc;
                Reporte.LocalReport.DataSources.Add(rds4);

                ReportDataSource rds5 = new ReportDataSource();
                rds5.Name  = "DataSet5";
                rds5.Value = lst_imp_grafica_alta_fem;
                Reporte.LocalReport.DataSources.Add(rds5);

                ReportDataSource rds6 = new ReportDataSource();
                rds6.Name  = "DataSet6";
                rds6.Value = lst_imp_grafica_baja_masc;
                Reporte.LocalReport.DataSources.Add(rds6);

                ReportDataSource rds7 = new ReportDataSource();
                rds7.Name  = "DataSet7";
                rds7.Value = lst_imp_grafica_baja_fem;
                Reporte.LocalReport.DataSources.Add(rds7);

                ReportDataSource rds8 = new ReportDataSource();
                rds8.Name  = "DataSet8";
                rds8.Value = lst_total_sexo;
                Reporte.LocalReport.DataSources.Add(rds8);

                Application.Current.Dispatcher.Invoke((Action)(delegate
                {
                    Reporte.Refresh();
                    Reporte.RefreshReport();
                }));
            }
            catch (Exception ex)
            {
                StaticSourcesViewModel.ShowMessageError("Algo pasó...", "Ocurrió un error al generar reporte.", ex);
            }
        }
Example #43
0
        public ActionResult ShowReport(string fileType, string reportType, int?cid, int?receivedBy, int?collectedBy, bool?isActive, int?zoneId, string fromDate = "", string toDate = "", string ctype = "", string month = "", int year = 0, int pageNo = 0)
        {
            LocalReport lr = new LocalReport();

            if (reportType == "AllDishCustomerDetails")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "AllDishCustomerDetails.rdlc");
                lr.ReportPath = path;
                ReportParameterCollection reportParameters = new ReportParameterCollection();
                reportParameters.Add(new ReportParameter("isActive", isActive == null ? null : isActive.ToString()));
                reportParameters.Add(new ReportParameter("zoneId", zoneId + ""));
                lr.SetParameters(reportParameters);
                var dataList = _da.GetDishCustomerList(isActive, zoneId ?? 0, 0) ?? new List <CustomerVM>();
                rd = new ReportDataSource("CustomerDataSet", dataList);
                lr.DataSources.Add(rd);
            }
            else if (reportType == "AllInternetCustomerDetails")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "AllInternetCustomerDetails.rdlc");
                lr.ReportPath = path;
                ReportParameterCollection reportParameters = new ReportParameterCollection();
                reportParameters.Add(new ReportParameter("isActive", isActive == null ? null : isActive.ToString()));
                reportParameters.Add(new ReportParameter("zoneId", zoneId + ""));
                lr.SetParameters(reportParameters);
                var dataList = _da.GetInternetCustomerList(isActive, zoneId ?? 0, 0) ?? new List <CustomerVM>();
                rd = new ReportDataSource("CustomerDataSet", dataList);
                lr.DataSources.Add(rd);
            }
            else if (reportType == "DishBillDetails")
            {
                DateTime rptFromDate = DateTime.ParseExact(fromDate, "dd/MM/yyyy", null);
                DateTime rptToDate   = DateTime.ParseExact(toDate, "dd/MM/yyyy", null);
                string   path        = System.IO.Path.Combine(Server.MapPath("~/Reports"), ctype == "0" ? "AllDishBillDetails.rdlc" : "AllDishBillDetailsByType.rdlc");
                lr.ReportPath = path;


                ReportParameterCollection reportParameters = new ReportParameterCollection();
                reportParameters.Add(new ReportParameter("fromDate", rptFromDate.ToString()));
                reportParameters.Add(new ReportParameter("toDate", rptToDate.ToString()));
                reportParameters.Add(new ReportParameter("cid", cid.ToString()));
                reportParameters.Add(new ReportParameter("receivedBy", receivedBy.ToString()));
                reportParameters.Add(new ReportParameter("collectedBy", collectedBy.ToString()));
                if (ctype != "0")
                {
                    reportParameters.Add(new ReportParameter("ctype", ctype));
                }
                lr.SetParameters(reportParameters);
                if (ctype == "0")
                {
                    var dataList         = _da.GetDishBillCollections(rptFromDate, rptToDate, cid ?? 0, receivedBy ?? 0, collectedBy ?? 0) ?? new List <PCOHRApp.Models.BillCollectionVM>();
                    ReportDataSource rds = new ReportDataSource("CollectionDataSet", dataList);
                    lr.DataSources.Add(rds);
                }
                else
                {
                    var dataList         = _da.GetDishBillCollectionByType(rptFromDate, rptToDate, cid ?? 0, receivedBy ?? 0, collectedBy ?? 0, ctype) ?? new List <PCOHRApp.Models.BillCollectionVM>();
                    ReportDataSource rds = new ReportDataSource("CollectionDataSet", dataList);
                    lr.DataSources.Add(rds);
                }
            }
            else if (reportType == "InternetBillDetails")
            {
                DateTime rptFromDate = DateTime.ParseExact(fromDate, "dd/MM/yyyy", null);
                DateTime rptToDate   = DateTime.ParseExact(toDate, "dd/MM/yyyy", null);
                string   path        = System.IO.Path.Combine(Server.MapPath("~/Reports"), ctype == "0" ? "AllInternetBillDetails.rdlc" : "AllInternetBillDetailsByType.rdlc");
                lr.ReportPath = path;


                ReportParameterCollection reportParameters = new ReportParameterCollection();
                reportParameters.Add(new ReportParameter("fromDate", rptFromDate.ToString()));
                reportParameters.Add(new ReportParameter("toDate", rptToDate.ToString()));
                reportParameters.Add(new ReportParameter("cid", cid.ToString()));
                reportParameters.Add(new ReportParameter("receivedBy", receivedBy.ToString()));
                reportParameters.Add(new ReportParameter("collectedBy", collectedBy.ToString()));
                if (ctype != "0")
                {
                    reportParameters.Add(new ReportParameter("ctype", ctype));
                }
                lr.SetParameters(reportParameters);
                if (ctype == "0")
                {
                    var dataList         = _da.GetInternetBillCollections(rptFromDate, rptToDate, cid ?? 0, receivedBy ?? 0, collectedBy ?? 0) ?? new List <PCOHRApp.Models.BillCollectionVM>();
                    ReportDataSource rds = new ReportDataSource("CollectionDataSet", dataList);
                    lr.DataSources.Add(rds);
                }
                else
                {
                    var dataList         = _da.GetInternetBillCollectionByType(rptFromDate, rptToDate, cid ?? 0, receivedBy ?? 0, collectedBy ?? 0, ctype) ?? new List <PCOHRApp.Models.BillCollectionVM>();
                    ReportDataSource rds = new ReportDataSource("CollectionDataSet", dataList);
                    lr.DataSources.Add(rds);
                }
            }
            else if (reportType == "DishBillDue")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "DishCustomerDue.rdlc");
                lr.ReportPath = path;
                ReportParameterCollection reportParameters = new ReportParameterCollection();
                reportParameters.Add(new ReportParameter("zoneId", zoneId + ""));

                lr.SetParameters(reportParameters);
                var dataList = _da.GetDishCustomerDue(zoneId ?? 0) ?? new List <PCOHRApp.Models.BillCollectionVM>();

                lr.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("CollectionDataSet", dataList);
                lr.DataSources.Add(rds);
                lr.Refresh();
            }
            else if (reportType == "InternetBillDue")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "InternetCustomerDue.rdlc");
                lr.ReportPath = path;
                ReportParameterCollection reportParameters = new ReportParameterCollection();
                reportParameters.Add(new ReportParameter("zoneId", zoneId + ""));

                lr.SetParameters(reportParameters);
                var dataList = _da.GetInternetCustomerDue(zoneId ?? 0) ?? new List <PCOHRApp.Models.BillCollectionVM>();

                lr.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("CollectionDataSet", dataList);
                lr.DataSources.Add(rds);
                lr.Refresh();
            }
            else if (reportType == "DishPaymentHistory")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "DishPaymentHistory.rdlc");
                lr.ReportPath = path;
                ReportParameterCollection reportParameters = new ReportParameterCollection();
                reportParameters.Add(new ReportParameter("cid", cid + ""));

                lr.SetParameters(reportParameters);
                var dataList = _da.GetDishPaymentHistory(cid ?? 0) ?? new List <PCOHRApp.Models.BillCollectionVM>();

                lr.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("CollectionDataSet", dataList);
                lr.DataSources.Add(rds);
            }
            else if (reportType == "InternetPaymentHistory")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "InternetPaymentHistory.rdlc");
                lr.ReportPath = path;
                ReportParameterCollection reportParameters = new ReportParameterCollection();
                reportParameters.Add(new ReportParameter("cid", cid + ""));

                lr.SetParameters(reportParameters);
                var dataList = _da.GetInternetPaymentHistory(cid ?? 0) ?? new List <PCOHRApp.Models.BillCollectionVM>();

                lr.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("CollectionDataSet", dataList);
                lr.DataSources.Add(rds);
            }
            else if (reportType == "HostList")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "HostList.rdlc");
                lr.ReportPath = path;
                var dataList = _hostDa.GetHostList() ?? new List <HostVM>();
                lr.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("HostDataSet", dataList);
                lr.DataSources.Add(rds);
            }
            else if (reportType == "MonthWiseDishBillGenerate")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "MonthWiseDishBillGenerate.rdlc");
                lr.ReportPath = path;
                ReportParameterCollection reportParameters = new ReportParameterCollection();
                reportParameters.Add(new ReportParameter("month", month));
                reportParameters.Add(new ReportParameter("year", year + ""));
                lr.SetParameters(reportParameters);
                var dataList = _dishBillGenerateDA.GetBillList(month, year) ?? new List <BillGenerateVM>();
                lr.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("BillDataSet", dataList);
                lr.DataSources.Add(rds);
            }
            else if (reportType == "MonthWiseInternetBillGenerate")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "MonthWiseInternetBillGenerate.rdlc");
                lr.ReportPath = path;
                ReportParameterCollection reportParameters = new ReportParameterCollection();
                reportParameters.Add(new ReportParameter("month", month));
                reportParameters.Add(new ReportParameter("year", year + ""));
                lr.SetParameters(reportParameters);
                var dataList = _internetBillGenerateDA.GetBillList(month, year) ?? new List <BillGenerateVM>();
                lr.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("BillDataSet", dataList);
                lr.DataSources.Add(rds);
            }
            else if (reportType == "DishBillCollectionPageWise")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "DishBillDetails.rdlc");
                lr.ReportPath = path;
                ReportParameterCollection reportParameters = new ReportParameterCollection();
                lr.SetParameters(reportParameters);
                var dataList = _da.GetDishCollectionPageWise(year, pageNo, receivedBy ?? 0) ?? new List <BillCollectionVM>();
                lr.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("CollectionDataSet", dataList);
                lr.DataSources.Add(rds);
            }
            else if (reportType == "InternetBillCollectionPageWise")
            {
                string path = System.IO.Path.Combine(Server.MapPath("~/Reports"), "InternetBillDetails.rdlc");
                lr.ReportPath = path;
                ReportParameterCollection reportParameters = new ReportParameterCollection();
                lr.SetParameters(reportParameters);
                var dataList = _da.GetInternetCollectionPageWise(year, pageNo, receivedBy ?? 0) ?? new List <BillCollectionVM>();
                lr.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("CollectionDataSet", dataList);
                lr.DataSources.Add(rds);
            }

            string rptType = fileType;
            string mimeType;
            string encoding;
            string fileNameExtension;
            string deviceInfo =

                "<DeviceInfo>" +
                "  <OutputFormat>" + fileType + "</OutputFormat>" +
                "</DeviceInfo>";

            Warning[] warnings;
            string[]  streams;
            byte[]    renderedBytes;

            renderedBytes = lr.Render(
                rptType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);

            return(File(renderedBytes, mimeType));
        }
Example #44
0
        protected void btnProcess_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime date = Convert.ToDateTime(txtbxFrom.Text);

                //int result = aSalary_Proccess_BLL.DividedParySalaryInfo(date);

                List <Salary_Viewer> empsalaryList = new List <Salary_Viewer>();
                string fromdate = txtbxFrom.Text;

                if (rdbIndividual.Checked)
                {
                    string empId = txtEid_AT.Text;
                    empsalaryList = aSalary_Proccess_BLL.GetIndividualPaySlip(fromdate, empId).ToList();
                    if (empsalaryList.Count > 0)
                    {
                        ReportViewer1.LocalReport.DataSources.Clear();
                        var reportDataset = new ReportDataSource("HRMRptGetSalaryInfoDS", empsalaryList);
                        ReportViewer1.LocalReport.DataSources.Add(reportDataset);
                        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/PAYROLL/reports/HRM_Get_PaySlipAllRPT_Compliance_Bangla.rdlc");
                        ReportViewer1.LocalReport.Refresh();
                    }
                    else
                    {
                        ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true);
                    }
                }
                else if (rdbAll.Checked)
                {
                    if (txtbxFrom.Text != "" && ddlRegion1.SelectedItem.Text == "--Select--")//&& ddlDept1.SelectedItem.Text == "--Select--" && ddlOffice1.SelectedItem.Text == "--Select--" && ddlRegion1.SelectedItem.Text == "--Select--" && ddlSection.SelectedItem.Text == "--Select--" && ddlSubSections.SelectedItem.Text == "--Select--")
                    {
                        List <Salary_Viewer> empsalaryList1 = new List <Salary_Viewer>();

                        empsalaryList1 = aSalary_Proccess_BLL.GetAllPaySlip(fromdate).ToList();

                        if (empsalaryList1.Count > 0)
                        {
                            ReportViewer1.LocalReport.DataSources.Clear();
                            var reportDataset1 = new ReportDataSource("HRMRptGetSalaryInfoDS", empsalaryList1);

                            ReportViewer1.LocalReport.DataSources.Add(reportDataset1);
                            ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/PAYROLL/reports/HRM_Get_PaySlipAllRPT_Compliance_Bangla.rdlc");
                            ReportViewer1.LocalReport.Refresh();
                        }
                        else
                        {
                            ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true);
                        }
                    }
                    else
                    {
                        //Sub section wise
                        if (txtbxFrom.Text != "" && ddlDept1.SelectedItem.Text != "--Select--" && ddlOffice1.SelectedItem.Text != "--Select--" && ddlRegion1.SelectedItem.Text != "--Select--" && ddlSection.SelectedItem.Text != "--Select--" && ddlSubSections.SelectedItem.Text != "--Select--")
                        {
                            List <Salary_Viewer> empsalaryList1 = new List <Salary_Viewer>();

                            int department = Convert.ToInt32(ddlDept1.SelectedValue);
                            int region     = Convert.ToInt32(ddlRegion1.SelectedValue);
                            int office     = Convert.ToInt32(ddlOffice1.SelectedValue);
                            int section    = Convert.ToInt32(ddlSection.SelectedValue);
                            int subsection = Convert.ToInt32(ddlSubSections.SelectedValue);

                            empsalaryList1 = aSalary_Proccess_BLL.GetAllPaySlipBySubsection(department, fromdate, region, office, section, subsection).ToList();

                            if (empsalaryList1.Count > 0)
                            {
                                ReportViewer1.LocalReport.DataSources.Clear();
                                var reportDataset1 = new ReportDataSource("HRMRptGetSalaryInfoDS", empsalaryList1);

                                ReportViewer1.LocalReport.DataSources.Add(reportDataset1);
                                ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/PAYROLL/reports/HRM_Get_PaySlipAllRPT_Compliance_Bangla.rdlc");
                                ReportViewer1.LocalReport.Refresh();
                            }
                            else
                            {
                                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true);
                            }
                        }
                    }

                    //List<Salary_Viewer> empsalaryList1 = new List<Salary_Viewer>();
                    //List<Salary_Viewer> empsalaryList2 = new List<Salary_Viewer>();
                    //empsalaryList1 = aSalary_Proccess_BLL.GetAllPaySlip1(fromdate).ToList();
                    //empsalaryList2 = aSalary_Proccess_BLL.GetAllPaySlip2(fromdate).ToList();
                    //if (empsalaryList1.Count > 0)
                    //{
                    //    ReportViewer1.LocalReport.DataSources.Clear();
                    //    var reportDataset1 = new ReportDataSource("HRMRptGetSalaryInfoDS", empsalaryList1);
                    //    var reportDataset2 = new ReportDataSource("DS_HRM_PaySalary2", empsalaryList2);

                    //    ReportViewer1.LocalReport.DataSources.Add(reportDataset1);
                    //    ReportViewer1.LocalReport.DataSources.Add(reportDataset2);
                    //    ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/PAYROLL/reports/HRM_Get_PaySlipAllRPT.rdlc");
                    //    ReportViewer1.LocalReport.Refresh();
                    //}
                    //else
                    //{
                    //    ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('No Data Found!')", true);
                    //}
                }

                //int result1 = aSalary_Proccess_BLL.truncateTableHRM_PaySalary();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "text", "func('" + ex.Message + "')", true);
            }
        }
Example #45
0
    protected void Button3_Click(object sender, EventArgs e)
    {
        try
        {
            if (Applcn_no.Text != "")
            {
                var ic_count = Applcn_no.Text.Length;
                //Path var ic_count = Applcn_no.Text.Length;
                DataTable app_icno = new DataTable();
                app_icno = DBCon.Ora_Execute_table("select app_applcn_no,isnull(app_current_jbb_ind,'') AS app_current_jbb_ind from jpa_application JA where '" + Applcn_no.Text + "' IN(JA.app_applcn_no, JA.app_new_icno)");
                if (ic_count == 12)
                {
                    cc_no = app_icno.Rows[0]["app_applcn_no"].ToString();
                }
                else
                {
                    cc_no = Applcn_no.Text;
                }

                DataSet   ds = new DataSet();
                DataTable dt = new DataTable();

                //dt = Dblog.Ora_Execute_table("SELECT jn.jno_applcn_no as app_no,FORMAT(jn.jno_pay_date,'dd/MM/yyyy', 'en-us') as p_dt,ISNULL(jn.jno_loan_amt,'') as l_amt,jn.jno_seq_no as seq_no,ISNULL(jn.jno_approve_amt,'') as a_amt,ISNULL(jn.jno_profit_amt,'') as pr_amt,jn.jno_actual_pay_date as ap_dt,ISNULL(jn.jno_pay_amt,'') as p_amt,ISNULL(jn.jno_actual_pay_amt,'') as ap_amt,ISNULL(jn.jno_late_excess_amt,'') as le_amt,ISNULL(jn.jno_saving_amt,'') as sa_amt,ISNULL(jn.jno_actual_saving_amt,'') as as_amt,ISNULL(jn.jno_saving_late_excess_amt,'') as sle_amt,ISNULL(jn.jno_total_pay_amt,'') as tp_amt,ISNULL(jn.jno_balance_amt,'') as bal_amt,ISNULL(jn.jno_total_saving_amt,'') as ts_amt,jn.jno_day_late as dlate,ja.appl_loan_dur as a_dur,ja.app_name as a_name,ja.app_new_icno as a_icno FROM jpa_jbb_normal as jn left join jpa_application as ja on ja.app_applcn_no = jn.jno_applcn_no where jn.jno_applcn_no='" + cc_no + "'");
                dt = Dblog.Ora_Execute_table("select app_applcn_no,convert(varchar,(CONVERT(date,GETDATE(),103)),103)  as cdate,app_loan_type_cd,app_name,app_permnt_address,app_permnt_state_cd,  case  when COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) < 1 and COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) > 0    Then '1 Bulan' when COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) < 2 and COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) > 1    Then '2 Bulan' when COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) < 3 and COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) > 2    Then '3 Bulan' when COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) < 4 and COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) > 3    Then '4 Bulan' when COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) < 5 and COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) > 4    Then '5 Bulan' when COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) < 6 and COALESCE(app_backdated_amt/nullif(app_cumm_installment_amt,0),0) > 5    Then '6 Bulan' else '0 Bulan'  end as Tempoh,app_bal_loan_amt,app_backdated_amt ,gua_name,rjp.Description as loan_type,rn.Decription,ISNULL(app_mailing_address,'') as app_mailing_address  from jpa_application ja left join jpa_guarantor jg on ja.app_applcn_no=jg.gua_applcn_no left join Ref_Jenis_Pelaburan rjp on rjp.Description_Code=ja.app_loan_type_cd left join Ref_Negeri rn on rn.Decription_Code=ja.app_permnt_state_cd  where app_applcn_no='" + cc_no + "' order by gua_name ");


                //dt = DBCon.Ora_Execute_table("select ja.app_name,ja.app_new_icno,ja.app_applcn_no,ja.appl_loan_dur,ISNULL(ja.app_installment_amt,'') as app_installment_amt,ja.app_loan_type_cd,tp.tpj_approve_amt,tp.tpj_profit_amt,tp.tpj_pay_date,tp.tpj_actual_pay_date,tp.tpj_approve_amt,tp.tpj_pay_amt,tp.tpj_actual_pay_amt,tp.tpj_late_excess_amt,tp.tpj_saving_amt,tp.tpj_actual_saving_amt,tp.tpj_saving_late_excess_amt,tp.tpj_total_pay_amt,tp.tpj_balance_amt,tp.tpj_total_saving_amt,tp.tpj_day_late from jpa_jbb_temp_pjs as tp left join jpa_application as ja on ja.app_applcn_no=tp.tpj_applcn_no and ja.app_sts_cd='Y' where tp.tpj_applcn_no='" + cc_no + "'");

                Rptviwer_cetakjbb.Reset();
                ds.Tables.Add(dt);

                Rptviwer_cetakjbb.LocalReport.DataSources.Clear();

                Rptviwer_cetakjbb.LocalReport.ReportPath = "PELABURAN_ANGGOTA/AMARAN TERAKHIR.rdlc";
                ReportDataSource rds = new ReportDataSource("Notis1", dt);

                Rptviwer_cetakjbb.LocalReport.DataSources.Add(rds);
                Rptviwer_cetakjbb.LocalReport.DisplayName = "AMARAN_TERAKHIR_" + DateTime.Now.ToString("ddMMyyyy");
                //Refresh
                Rptviwer_cetakjbb.LocalReport.Refresh();
                Warning[] warnings;

                string[] streamids;

                string mimeType;

                string encoding;

                string extension;

                string fname = DateTime.Now.ToString("dd_MM_yyyy");

                string devinfo = "<DeviceInfo><ColorDepth>32</ColorDepth><DpiX>350</DpiX><DpiY>350</DpiY><OutputFormat>PDF</OutputFormat>" +
                                 "  <PageWidth>12.20in</PageWidth>" +
                                 "  <PageHeight>8.27in</PageHeight>" +
                                 "  <MarginTop>0.1in</MarginTop>" +
                                 "  <MarginLeft>0.5in</MarginLeft>" +
                                 "  <MarginRight>0in</MarginRight>" +
                                 "  <MarginBottom>0in</MarginBottom>" +
                                 "</DeviceInfo>";

                byte[] bytes = Rptviwer_cetakjbb.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings);

                Response.Buffer = true;

                Response.Clear();

                Response.ClearHeaders();

                Response.ClearContent();

                Response.ContentType = "application/pdf";

                Response.AddHeader("content-disposition", "attachment; filename=Cetak_Notis_" + cc_no + "." + extension);

                Response.BinaryWrite(bytes);

                Response.Flush();

                Response.End();
            }
            else
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "alertMessage", "$.Zebra_Dialog('Medan Input Adalah Mandatori',{'type': 'warning','title': 'Warning','auto_close': 2000});", true);
            }
        }
        catch (Exception ex)
        {
            throw ex;
            //Request.Redirect(url, false);
        }
    }
 /// <summary>
 /// Adds report data source for subreport.
 /// </summary>
 /// <param name="dataSource">An instance of <see cref="Microsoft.Reporting.WebForms.ReportDataSource"/> containing the Data Source.</param>
 /// <createdby>Amit Kumar Chandra</createdby>
 /// <createddate>11/06/2012</createddate>
 public void AddSubReportDataSource(ReportDataSource dataSource)
 {
     _lstSubReportDataSource.Add(dataSource);
 }
Example #47
0
        private void FReporteDocumentos_Load(object sender, EventArgs e)
        {
            try
            {
                CContratos cContratos = new CContratos();
                con        contrato   = new con();
                contrato = cContratos.uno(id);
                CConfiguracion cConfiguracion = new CConfiguracion();
                Configuracion  c = new Configuracion();
                c = cConfiguracion.ObtenerConfiguracion();
                string informacion = c.NombreEmpresa + " - " + c.Telefono;
                string titulo      = "CREDITO DE MOTOCICLETA";
                if (contrato.NoEsMoto == 1)
                {
                    titulo = "CREDITO SG";
                }

                string dir = "-";
                if (contrato.DireccionCasa != null)
                {
                    dir = contrato.DireccionCasa;
                }
                string parte1 = "POR MEDIO DE ESTE PAGARÉ SIN PROTESTO ME OBLIGO A PAGAR EN LA CIUDAD DE " + c.municipio.ToUpper() + ", A LA ORDEN DE INVERSIONES SG LA SUMA DE $" + contrato.Financiamiento.Value.ToString("F") + " MÁS INTERESES MENSUALES DISTRIBUIDA EN " + contrato.Meses + " CUOTAS DE $" + contrato.Cuota.Value.ToString("F") + ", EN CONCEPTO DE COMPRA DE " + contrato.DescripcionProducto + ".";
                string parte2 = "ENTREGADO ESTE DIA " + contrato.FechaInicio.Value.Date.ToShortDateString() + ". LA PRIMERA PRIMA DE $" + contrato.PrimaNeta.Value.ToString("F") + ". EL PAGO MENSUAL SE HARA EN EL LUGAR PACTADO.";
                string parte3 = "PARA TODOS LOS EFECTOS DE ESTA OBLIGACION MERCANTIL FIJAMOS COMO DOMICILIO LA CIUDAD DE NUEVA CONCEPCION CHALATENANGO, Y EN CASO DE ACCION JUDICIAL RENUNCIO AL DECRETO DE APELAR DE DERECHO DE EMBARGO, SENTENCIA DE REMATE Y TODA OTRA PROVIDENCIA APELABLE QUE SE DICTARE EN EL JUICIO EJECUTIVO O SUS INCIDENCIAS, SIENDO A MI CARGO TODOS LOS GASTOS QUE INVERSIONES SG HICIERE EN EL NOMBRE DE ESTE PAGARÉ, EN CUALQUIER CONCEPTO, INCLUIDOS LOS DE CANCELACION Y DE COBRANZA JUDICIALES Y EXTRAJUDICIALES.";

                ReportParameter[] p = new ReportParameter[]
                {
                    new ReportParameter("informacion", informacion),
                    new ReportParameter("producto", contrato.DescripcionProducto.ToString().ToUpper()),
                    new ReportParameter("cliente", "CLIENTE: " + contrato.NombreCompleto.ToString().ToUpper()),
                    new ReportParameter("direccion", "DIRECCIÓN: " + dir.ToUpper()),
                    new ReportParameter("financiamiento", "FINANCIAMIENTO: $" + contrato.Financiamiento.ToString()),
                    new ReportParameter("financiamiento2", contrato.Financiamiento.ToString()),
                    new ReportParameter("cuota1", "CUOTA: $" + contrato.Cuota.ToString()),
                    new ReportParameter("fechacredito", "FECHA DE CRÉDITO: " + contrato.FechaInicio.Value.ToShortDateString()),
                    new ReportParameter("precio", contrato.Precio.ToString()),
                    new ReportParameter("prima", contrato.Prima.ToString()),
                    new ReportParameter("meses", contrato.Meses.ToString()),
                    new ReportParameter("titulo", titulo),
                    new ReportParameter("parte1", parte1),
                    new ReportParameter("parte2", parte2),
                    new ReportParameter("parte3", parte3),
                    new ReportParameter("dui", contrato.Dui),
                    new ReportParameter("telefono", contrato.Celular),
                    new ReportParameter("direccion2", dir),
                    new ReportParameter("cliente2", contrato.NombreCompleto)
                };



                List <Cuotas>        listado = new List <Cuotas>();
                Controladores.CCuota cCuota  = new Controladores.CCuota();
                listado = cCuota.Listado(contrato.IdContrato);


                ReportDataSource rds = new ReportDataSource();
                // rds.Name = "Listado";
                // rds.Value = listado;
                //  this.reportViewer1.LocalReport.DataSources.Add(rds);

                generarTabla();
                rds       = new ReportDataSource();
                rds.Name  = "Listadofghfgh";
                rds.Value = lista;
                this.reportViewer1.LocalReport.DataSources.Add(rds);



                this.reportViewer1.LocalReport.SetParameters(p);
                this.reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
                this.reportViewer1.RefreshReport();
            }
            catch (Exception)
            {
            }
        }
        async void LoadPreviousTransactionReport()
        {
            try
            {
                var criteria = txtSearch.Text;
                var dateFrom = DateTime.Now;
                var dateTo   = DateTime.Now;

                await Task.Delay(1000);

                List <PreviousTransactionListModel> prevTransactions = new List <PreviousTransactionListModel>();
                if (radioDailySales.Checked)
                {
                    // range filter selected
                    prevTransactions = await Task.Run(() => Factories.CreatePosTransaction().GetDailyTransactions(criteria));
                }
                else if (radioWeeklySales.Checked)
                {
                    dateFrom         = DateTime.Now.StartOfWeek(DayOfWeek.Monday);
                    dateTo           = dateFrom.AddDays(6);
                    prevTransactions = await Task.Run(() => Factories.CreatePosTransaction().GetWeeklyTransactions(criteria));
                }
                else if (radioMonthlySales.Checked)
                {
                    dateFrom         = DateTime.Now.FirstDayOfMonth();
                    dateTo           = DateTime.Now.LastDayOfMonth();
                    prevTransactions = await Task.Run(() => Factories.CreatePosTransaction().GetMonthlyTransactions(criteria));
                }
                else
                {
                    dateFrom = dtDateFrom.Value;
                    dateTo   = dtDateTo.Value;
                    // range filter selected
                    prevTransactions = await Task.Run(() => Factories.CreatePosTransaction().GetTransactions(criteria, dateFrom, dateTo));
                }
                int count = 0;

                var       ds = new dsReports();
                DataTable t  = ds.Tables["dtPosTransaction"];
                DataRow   r;
                foreach (var item in prevTransactions)
                {
                    count++;
                    r                    = t.NewRow();
                    r["i"]               = count.ToString();
                    r["Date"]            = item.Date;
                    r["TransactionCode"] = item.TransactionCode;
                    r["Quantity"]        = item.Quantity;
                    r["AmountTendered"]  = item.AmountTendered;
                    r["Total"]           = item.Total;

                    t.Rows.Add(r);
                }
                rptViewer.LocalReport.DataSources.Clear();
                ReportDataSource rds = new ReportDataSource("dsPosTransaction", t);

                var p_datefrom = new ReportParameter("DateFrom", dateFrom.ToShortDateString());
                var p_dateTo   = new ReportParameter("DateTo", dateTo.ToShortDateString());

                rptViewer.LocalReport.SetParameters(new ReportParameter[] { p_datefrom, p_dateTo });

                rptViewer.LocalReport.DataSources.Add(rds);
                rptViewer.SetDisplayMode(DisplayMode.PrintLayout);
                rptViewer.ZoomMode = ZoomMode.PageWidth;
                this.rptViewer.RefreshReport();
            }
            catch (Exception)
            {
                throw;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                if (!User.Identity.IsAuthenticated)
                {
                    Response.Redirect("../Login.aspx", false);
                }
                if (Session["user"] != null)
                {
                    usr = (AppUser)Session["user"];
                }
                else
                {
                    Response.Redirect("../Login.aspx", false);
                    return;
                }
                if (!IsPostBack)
                {
                    Utility.BindBudgetYear(ddlbudyr);
                    Utility.BindDept(ddlDept);
                    Utility.BindATCStatus(ddlStatus);
                    lbMsg.Text = "";
                    int      byrID = int.Parse(ddlbudyr.SelectedValue);
                    DBAccess db    = new DBAccess();
                    db.AddParameter("budgetYrId", byrID);
                    rpt    = new ReportParameter[3];
                    rpt[2] = new ReportParameter("status", "1");

                    rpt[1] = new ReportParameter("deptID", "1");
                    rpt[0] = new ReportParameter("budgetYrID", byrID.ToString());
                    if (ddlDept.SelectedValue != "")
                    {
                        rpt[1] = new ReportParameter("deptID", ddlDept.SelectedValue);
                        db.AddParameter("@deptId", int.Parse(ddlDept.SelectedValue));
                    }
                    if (ddlStatus.SelectedValue != "")
                    {
                        rpt[2] = new ReportParameter("status", ddlStatus.SelectedValue);
                        db.AddParameter("@status", int.Parse(ddlStatus.SelectedValue));
                    }
                    DataSet ds = new DataSet();
                    ds = db.ExecuteDataSet("bc_rpt_IndirectATC");

                    ReportDataSource datasource = new
                                                  ReportDataSource("dsBudget",
                                                                   ds.Tables[0]);

                    ReportViewer1.LocalReport.DataSources.Clear();
                    ReportViewer1.LocalReport.SetParameters(rpt);
                    ReportViewer1.LocalReport.DataSources.Add(datasource);

                    if (ds.Tables[0].Rows.Count == 0)
                    {
                        lbMsg.Text = "Sorry, No record found!";
                    }

                    ReportViewer1.LocalReport.Refresh();
                    return;
                }
            }
            catch (Exception ex)
            {
            }
        }
        private void btnGenerarReporte_Click(object sender, EventArgs e)
        {
            ReportDataSource datasource = new ReportDataSource();
            DataSet          ds         = new DataSet();
            List <Microsoft.Reporting.WinForms.ReportParameter> lstParametros = new List <Microsoft.Reporting.WinForms.ReportParameter>();

            Microsoft.Reporting.WinForms.ReportParameter parametroReporte;
            List <SqlParameter> lstParameters = new List <SqlParameter>();
            SqlParameter        parametro;

            this.rptReportesRecibo.Reset();

            switch (this.cboTipoReporte.Text.Substring(0, 2))
            {
            case "01":
                ds = propiedades.ejecutarSp(new List <SqlParameter>(), "spReporteIngresos01RecibosRegistrados");

                datasource = new ReportDataSource("recibosIngresos_spReporteIngresos01RecibosActivos", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de ingresos activos");
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresos.rdlc";
                break;

            case "02":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos02RecibosRegistradoporRangodeFechas");

                datasource = new ReportDataSource("recibosIngresos_spReporteIngresos01RecibosActivos", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de ingresos registrados entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresos.rdlc";
                break;

            case "03":
                parametro       = new SqlParameter("@strCedulaIng", SqlDbType.VarChar);
                parametro.Value = this.txtCedula.Text;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos03RecibosRegistradoporCedula");

                datasource = new ReportDataSource("recibosIngresos_spReporteIngresos01RecibosActivos", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de ingresos registrados a la cédula " + this.txtCedula.Text);
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresos.rdlc";
                break;

            case "04":
                ds = propiedades.ejecutarSp(new List <SqlParameter>(), "spReporteIngresos04RecibosActivos");

                datasource = new ReportDataSource("recibosIngresos_spReporteIngresos01RecibosActivos", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de ingresos activos");
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresos.rdlc";
                break;

            case "05":
                ds = propiedades.ejecutarSp(new List <SqlParameter>(), "spReporteIngresos05RecibosAnulados");

                datasource = new ReportDataSource("recibosIngresos_spReporteIngresos01RecibosActivos", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de ingresos activos");
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresos.rdlc";
                break;

            case "06":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos06RecibosAnuladosporRangodeFechas");

                datasource = new ReportDataSource("recibosIngresos_spReporteIngresos01RecibosActivos", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de ingresos anulados entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresos.rdlc";
                break;

            case "07":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos07RecibosdecuotasexequialesactivosenRangodeFecha");

                datasource = new ReportDataSource("spReporteIngresos07RecibosdecuotasexequialesactivosenRangodeFecha_spReporteIngresos07RecibosdecuotasexequialesactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de cuotas exequiales registrados entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosCuotasExequiales.rdlc";
                break;

            case "08":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos08RecibosdecuotasexequialesanuladosenRangodeFecha");

                datasource = new ReportDataSource("spReporteIngresos07RecibosdecuotasexequialesactivosenRangodeFecha_spReporteIngresos07RecibosdecuotasexequialesactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de cuotas exequiales anuladas entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosCuotasExequiales.rdlc";
                break;

            case "09":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos09RecibosdecuotasexequialesregistradosenRangodeFecha");

                datasource = new ReportDataSource("spReporteIngresos07RecibosdecuotasexequialesactivosenRangodeFecha_spReporteIngresos07RecibosdecuotasexequialesactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de cuotas exequiales registradas entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosCuotasExequiales.rdlc";
                break;

            case "10":
                parametro       = new SqlParameter("@intCodigoSoc", SqlDbType.Int);
                parametro.Value = this.txtCedula.Text;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos10Recibosdecuotasexequialesregistradosaunsocio");

                datasource = new ReportDataSource("spReporteIngresos07RecibosdecuotasexequialesactivosenRangodeFecha_spReporteIngresos07RecibosdecuotasexequialesactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de cuotas exequiales registradas al socio " + this.txtCedula.Text);
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosCuotasExequiales.rdlc";
                break;

            case "11":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha");

                datasource = new ReportDataSource("spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha_spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de cuotas activas de préstamos entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosCuotasPrestamos.rdlc";
                break;

            case "12":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos12RecibosdecuotasdeprestamosanuladosenRangodeFecha");

                datasource = new ReportDataSource("spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha_spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de cuotas anuladas de préstamos entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosCuotasPrestamos.rdlc";
                break;

            case "13":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos13RecibosdecuotasdeprestamosregistradosenRangodeFecha");

                datasource = new ReportDataSource("spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha_spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de cuotas registradas de préstamos entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosCuotasPrestamos.rdlc";
                break;

            case "14":
                parametro       = new SqlParameter("@strCedulaPre", SqlDbType.VarChar);
                parametro.Value = this.txtCedula.Text;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos14Recibosdecuotasdeprestamosregistradosaunapersona");

                datasource = new ReportDataSource("spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha_spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de cuotas registradas a una determinada persona ");
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosCuotasPrestamos.rdlc";
                break;

            case "15":
                parametro       = new SqlParameter("@intCodigoPre", SqlDbType.VarChar);
                parametro.Value = this.txtPrestamo.Text;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos15Recibosdecuotasdeprestamosregistradosauncredito");

                datasource = new ReportDataSource("spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha_spReporteIngresos11RecibosdecuotasdeprestamosactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de cuotas registradas al préstamo " + this.txtPrestamo.Text);
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosCuotasPrestamos.rdlc";
                break;

            case "16":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha");

                datasource = new ReportDataSource("spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha_spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de otros ingresos activos entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosOtrosIngresos.rdlc";
                break;

            case "17":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos17RecibosdeotrosingresosanuladosenRangodeFecha");

                datasource = new ReportDataSource("spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha_spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de otros ingresos anulados entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosOtrosIngresos.rdlc";
                break;

            case "18":
                parametro       = new SqlParameter("@dtmFechaIni", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                parametro       = new SqlParameter("@dtmFechaFin", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaFinal.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos18RecibosdeotrosingresosregistradosenRangodeFecha");

                datasource = new ReportDataSource("spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha_spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de otros ingresos registrados entre el " + this.dtmFechaInicial.Value.ToShortDateString() + " y el " + this.dtmFechaFinal.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosOtrosIngresos.rdlc";
                break;

            case "19":
                parametro       = new SqlParameter("@strCedulaPer", SqlDbType.VarChar);
                parametro.Value = this.txtCedula.Text;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos19Recibosdeotrosingresosdeunapersona");

                datasource = new ReportDataSource("spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha_spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de otros ingresos registrados a " + this.txtCedula.Text);
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosOtrosIngresos.rdlc";
                break;

            case "20":
                parametro       = new SqlParameter("@strCodOtrosIngresos", SqlDbType.VarChar);
                parametro.Value = this.cboOtrosIngresos.SelectedValue.ToString();
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos20Recibosdeotrosingresosdeunitem");

                datasource = new ReportDataSource("spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha_spReporteIngresos16RecibosdeotrosingresosactivosenRangodeFecha", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de otros ingresos registrados a " + this.cboOtrosIngresos.Text);
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosOtrosIngresos.rdlc";
                break;

            case "21":
                parametro       = new SqlParameter("@dtmFechaRec", SqlDbType.DateTime);
                parametro.Value = this.dtmFechaInicial.Value;
                lstParameters.Add(parametro);

                ds = propiedades.ejecutarSp(lstParameters, "spReporteIngresos21RecibosInformeDiario");

                datasource = new ReportDataSource("spReporteIngresos21RecibosInformeDiario_spReporteIngresos21RecibosInformeDiario", ds.Tables[0]);

                parametroReporte = new Microsoft.Reporting.WinForms.ReportParameter("Titulo", "Reporte de recibos del día " + this.dtmFechaInicial.Value.ToShortDateString());
                lstParametros.Add(parametroReporte);
                rptReportesRecibo.LocalReport.ReportEmbeddedResource = "Mutuales2020.Reportes.Recibos.rptRecibosIngresosInformeDiario.rdlc";
                break;
            }

            rptReportesRecibo.ProcessingMode = ProcessingMode.Local;
            rptReportesRecibo.LocalReport.DataSources.Clear();
            rptReportesRecibo.LocalReport.DataSources.Add(datasource);
            rptReportesRecibo.LocalReport.SetParameters(lstParametros);
            rptReportesRecibo.LocalReport.Refresh();

            this.rptReportesRecibo.RefreshReport();
        }
Example #51
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (Request.QueryString["asasdasda"] != null)
                {
                    int _idmes = 6;
                    if (int.TryParse(Request.QueryString["asasdasda"], out _idmes))
                    {
                        /*try
                         * {*/
                        ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Enercable_Folio.rdlc");
                        string         Sp         = "dbo.DatosFolio";
                        SqlParameter[] Parametros = new SqlParameter[1];
                        Parametros[0] = new SqlParameter("@IdFolio", _idmes);
                        System.Data.DataSet _valor = new Datos().RegresaDataSet(Sp, Parametros);
                        ReportDataSource    RDS    = new ReportDataSource("Datos", _valor.Tables[0]);
                        ReportViewer1.LocalReport.DataSources.Add(RDS);


                        Sp     = "dbo.CatalogoServicios";
                        _valor = new Datos().RegresaDataSet(Sp, null);
                        ReportDataSource RDS2 = new ReportDataSource("CatalogoServicios", _valor.Tables[0]);
                        ReportViewer1.LocalReport.DataSources.Add(RDS2);


                        SqlParameter[] Parametros3 = new SqlParameter[1];
                        Parametros3[0] = new SqlParameter("@IdFolio", _idmes);
                        Sp             = "dbo.ServiciosPorFolio";
                        _valor         = new Datos().RegresaDataSet(Sp, Parametros3);
                        ReportDataSource RDS3 = new ReportDataSource("ServiciosPorFolio", _valor.Tables[0]);
                        ReportViewer1.LocalReport.DataSources.Add(RDS3);

                        int            _escroquis  = 1;
                        SqlParameter[] Parametros4 = new SqlParameter[2];
                        Parametros4[0] = new SqlParameter("@IdFolio", _idmes);
                        Parametros4[1] = new SqlParameter("@IdCarpeta", _escroquis);
                        Sp             = "dbo.ArchivosPorFolio";
                        _valor         = new Datos().RegresaDataSet(Sp, Parametros4);
                        ReportDataSource RDS4 = new ReportDataSource("Archivos", _valor.Tables[0]);
                        ReportViewer1.LocalReport.DataSources.Add(RDS4);

                        _escroquis = 2;
                        SqlParameter[] Parametros5 = new SqlParameter[2];
                        Parametros5[0] = new SqlParameter("@IdFolio", _idmes);
                        Parametros5[1] = new SqlParameter("@IdCarpeta", _escroquis);
                        Sp             = "dbo.ArchivosPorFolio";
                        _valor         = new Datos().RegresaDataSet(Sp, Parametros5);
                        ReportDataSource RDS5 = new ReportDataSource("ArchivosCroquis", _valor.Tables[0]);
                        ReportViewer1.LocalReport.DataSources.Add(RDS5);

                        SqlParameter[] Parametros6 = new SqlParameter[1];
                        Parametros6[0] = new SqlParameter("@IdFolio", _idmes);
                        Sp             = "dbo.ArchivosFotograficosPorFolio";
                        _valor         = new Datos().RegresaDataSet(Sp, Parametros6);
                        ReportDataSource RDS6 = new ReportDataSource("DataSet1", _valor.Tables[0]);
                        ReportViewer1.LocalReport.DataSources.Add(RDS6);



                        this.ReportViewer1.LocalReport.EnableExternalImages = true;
                        ReportViewer1.LocalReport.Refresh();



                        /*
                         * }
                         * catch (SqlException sqlex)
                         * {
                         *  Response.Redirect("SinPermiso.html");
                         * }
                         * catch (Exception ex)
                         * {
                         *  Response.Redirect("SinPermiso.html");
                         * } */
                    }
                    else
                    {
                        Response.Redirect("SinPermiso.html");
                    }
                }
                else
                {
                    Response.Redirect("SinPermiso.html");
                }
            }
        }
Example #52
0
        private void f_ReportLoad()
        {
            try
            {
                string p           = Server.MapPath("rdlcreport");
                string strccontact = "";
                objts.empid      = getchkval(dropemployee);
                objts.clientid   = getchkval(dropclient);
                objts.taskid     = "";
                objts.Status     = "";
                objts.CreatedBy  = dropassign.Text;
                objts.managerId  = dropassign.Text;
                objts.from       = txtfromdate.Text;
                objts.to         = txttodate.Text;
                objts.projectid  = getchkval(dropproject);
                objts.isbillable = dropbillable.SelectedValue.ToString();
                objts.isbilled   = dropbilled.SelectedValue.ToString();
                objts.taskStatus = dropTaskStatus.SelectedValue.ToString();
                objts.type       = "";
                objts.id         = "";
                objts.taskType   = "Expense";
                objts.action     = "getallexp";

                ReportViewer1.LocalReport.ReportPath = p + "\\client\\rpt_ExpensesByClient.rdlc";
                ReportParameter[] param = new ReportParameter[5];



                param[0] = new ReportParameter("companyname", Session["companyname"].ToString(), true);
                param[1] = new ReportParameter("companyaddress", Session["companyaddress"].ToString(), true);
                ds       = objts.timesheetrdlcreport();

                if (ds.Tables[0].Rows.Count > 0)
                {
                    if (ds.Tables[1].Rows.Count > 0)
                    {
                        if (ds.Tables[1].Rows[0]["phone"].ToString() != "")
                        {
                            strccontact += "Tel: " + ds.Tables[1].Rows[0]["phone"].ToString() + " ";
                        }
                        if (ds.Tables[1].Rows[0]["fax"].ToString() != "")
                        {
                            strccontact += "Fax: " + ds.Tables[1].Rows[0]["fax"].ToString() + " ";
                        }
                        if (ds.Tables[1].Rows[0]["email"].ToString() != "")
                        {
                            strccontact += "<br/>" + ds.Tables[1].Rows[0]["email"].ToString() + " ";
                        }
                        if (ds.Tables[1].Rows[0]["website"].ToString() != "")
                        {
                            strccontact += "<br/>" + ds.Tables[1].Rows[0]["website"].ToString() + " ";
                        }
                    }

                    param[2] = new ReportParameter("companyphone", strccontact, true);
                    param[3] = new ReportParameter("reportfilter", "Report From: " + txtfromdate.Text + " To: " + txttodate.Text, true);
                    param[4] = new ReportParameter("currency", ds.Tables[1].Rows[0]["symbol"].ToString(), true);

                    ReportDataSource rds1 = new ReportDataSource("DataSet1", ds.Tables[0]);


                    this.ReportViewer1.LocalReport.DataSources.Clear();

                    this.ReportViewer1.LocalReport.EnableExternalImages = true;

                    this.ReportViewer1.LocalReport.DataSources.Add(rds1);
                    this.ReportViewer1.LocalReport.SetParameters(param);


                    this.ReportViewer1.LocalReport.Refresh();



                    ReportViewer1.LocalReport.DisplayName = "Expenses by Client";
                    divreport.Visible = true;
                    divnodata.Visible = false;
                }
                else
                {
                    divreport.Visible = false;
                    divnodata.Visible = true;
                }
            }
            catch (Exception ex)
            {
            }
            upadatepanel.Update();
        }
    protected void rpt_cuadro()
    {
        //ReportViewer1.ProcessingMode = ProcessingMode.Local;
        //ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/OPERACIONES/Reportes/RptMDP.rdlc");
        string           NOMBRE_CORTO = string.Empty;
        string           ANIO         = string.Empty;
        string           MES          = string.Empty;
        DataTable        dsCustomers  = GetData();
        ReportDataSource datasource   = new ReportDataSource("DataSet1", dsCustomers);

        if (dsCustomers.Rows.Count > 0)
        {
            ReportViewer1.LocalReport.DataSources.Clear();



            //ReportParameter param = new ReportParameter("Path", Server.MapPath(@FolderFirmas + "44085236.jpg"), true);
            ////this.ReportViewer1.DataBind(); // Added
            //this.ReportViewer1.LocalReport.SetParameters(param);

            NOMBRE_CORTO = dsCustomers.Rows[0]["Proy_Codigo"].ToString();
            ANIO         = ddlanio.SelectedValue.ToString();
            MES          = ddlMes.SelectedValue.ToString();


            this.ReportViewer1.LocalReport.Refresh();
            this.ReportViewer1.Reset();



            this.ReportViewer1.LocalReport.EnableExternalImages = true;
            this.ReportViewer1.ProcessingMode = ProcessingMode.Local;
            LocalReport rep = ReportViewer1.LocalReport;
            rep.ReportPath = Server.MapPath("~/CAREMENOR/Reportes/RptValorizacion.rdlc");



            ReportViewer1.LocalReport.Refresh();
            ReportViewer1.LocalReport.DataSources.Add(datasource);

            //Warning[] warnings;
            //string[] streamIds;
            //string mimeType = string.Empty;
            //string encoding = string.Empty;
            //string extension = string.Empty;
            //DataSet dsGrpSum, dsActPlan, dsProfitDetails,
            //    dsProfitSum, dsSumHeader, dsDetailsHeader, dsBudCom = null;

            //byte[] bytes = ReportViewer1.LocalReport.Render("PDF", null, out mimeType, out encoding, out extension, out streamIds, out warnings);

            //Response.Buffer = true;
            //Response.Clear();
            //Response.ContentType = mimeType;
            //Response.AddHeader("content-disposition", "attachment; filename=VAL_" + NOMBRE_CORTO + "_ANIO_" + ANIO + "_MES_" + MES + "." + extension);
            //Response.OutputStream.Write(bytes, 0, bytes.Length); // create the file
            //Response.Flush(); // send it to the client to download
            //Response.End();
        }
        else
        {
            string cleanMessage = "No existe registros";
            ScriptManager.RegisterStartupScript(this, typeof(Page), "invocarfuncion", "doAlert('" + cleanMessage + "');", true);
            ReportViewer1.LocalReport.DataSources.Clear();
        }
    }
Example #54
0
        private void FrmVerInforme_Load(object sender, EventArgs e)
        {
            ObjConexion.CadenaCnn = Conexion.CadenaConexion.cadena();
            ObjConexion.Conectar();

            DataTable tablaItemDB = new DataTable();
            string    Query1      = "SELECT [Intem_Codigo] " +
                                    ",[Intem_Descripcion] " +
                                    ",[Intem_Activo]      " +
                                    "FROM [dbo].[ItemActivar]";

            //WHERE Pac_Identificacion=" + Documento;
            tablaItemDB = ObjConexion.LlenarTabla(Query1);

            // TODO: esta línea de código carga datos en la tabla 'HistoriaClinicaDataSet.SP_AntecedentesPersonales' Puede moverla o quitarla según sea necesario.
            //this.SP_AntecedentesPersonalesTableAdapter.
            this.HistoriaClinicaDataSet.EnforceConstraints          = false;
            this.HistoriaClinicaData_Actualizado.EnforceConstraints = false;
            HistoriaClinicaDataSet_FirmaMedico.EnforceConstraints   = false;
            //this.historiaClinicaDataSet_FirmaMedico1
            SP_RecomendacionesTableAdapter.Connection = ObjConexion.conexion;
            //var s =
            DataTable tabla = new DataTable();
            string    sql   = "SELECT	dbo.EntradaHistoria.Entr_Numero, dbo.Recomendacion.Reco_Descripcion,                                                             "+
                              "dbo.RecomendacionDescripcion.RecDes_Descripcion, dbo.Paciente.Pac_Identificacion, dbo.Paciente.Pac_Foto,                            " +
                              "dbo.Paciente.Pac_Huella, dbo.Paciente.Pac_Firma,dbo.Medico.Medic_Huella, dbo.Medico.Medic_Firma                                     " +
                              "FROM	dbo.Paciente INNER JOIN                                                                                                      " +
                              "dbo.EntradaHistoria ON dbo.Paciente.Pac_Identificacion = dbo.EntradaHistoria.Entr_IdPaciente LEFT OUTER JOIN                        " +
                              "dbo.Medico ON dbo.EntradaHistoria.Ent_Medico = dbo.Medico.Medic_Identificacion LEFT OUTER JOIN                                      " +
                              "dbo.RecomendacionDescripcion INNER JOIN                                                                                             " +
                              "dbo.Recomendacion ON dbo.RecomendacionDescripcion.RecDes_Recomendacios_Codigo = dbo.Recomendacion.Reco_Codigo INNER JOIN            " +
                              "dbo.RecomendacionPaciente ON dbo.RecomendacionDescripcion.RecDes_Codigo = dbo.RecomendacionPaciente.RecoPac_Recomendacion_Codigo ON " +
                              "dbo.EntradaHistoria.Entr_Numero = dbo.RecomendacionPaciente.RecoPac_Entrada_Numero " +
                              "WHERE Entr_Numero= " + NumeroAtencion;

            tabla = ObjConexion.LlenarTabla(sql);
            ReportDataSource r = new ReportDataSource("FirmaMedico", tabla);

            //this.SP_RecomendacionesTableAdapter.Fill(HistoriaClinicaDataSet_FirmaMedico.SP_Recomendaciones,NumeroAtencion);
            this.SP_AntecedentesPersonalesTableAdapter.Fill(this.HistoriaClinicaDataSet.SP_AntecedentesPersonales, NumeroAtencion);
            this.SP_AntecedenteFamiliarTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_AntecedenteFamiliar, NumeroAtencion);
            this.SP_HabitosTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_Habitos, NumeroAtencion);
            this.SP_InmunizarTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_Inmunizar, NumeroAtencion);
            this.SP_AccidenteLaboralTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_AccidenteLaboral, NumeroAtencion);
            this.SP_EnfermedadProfesionalTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_EnfermedadProfesional, NumeroAtencion);
            this.SP_RiesgosOcupacionalesTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_RiesgosOcupacionales, NumeroAtencion);
            this.SP_ExamenPracticadosTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_ExamenPracticados, NumeroAtencion);
            this.SP_ExamenFisicoTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_ExamenFisico, NumeroAtencion);
            SP_PruebaEquilibrioTableAdapter.Connection = ObjConexion.conexion;
            this.SP_PruebaEquilibrioTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_PruebaEquilibrio, NumeroAtencion);
            this.SP_RevisionSistemaTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_RevisionSistema, NumeroAtencion);
            this.SP_ReporteRecomendacionesTableAdapter.Fill(this.HistoriaClinicaData_Actualizado.SP_ReporteRecomendaciones, NumeroAtencion);
            this.SP_ActivarItemsTableAdapter.Fill(this.HistoriaClinica_Activar.SP_ActivarItems);

            //Creamos los parametros para la atenciòn
            ReportParameter FechaAtencion   = new ReportParameter();
            ReportParameter TipoExamen      = new ReportParameter();
            ReportParameter Enfasis         = new ReportParameter();
            ReportParameter Concepto        = new ReportParameter();
            ReportParameter Reubicacion     = new ReportParameter();
            ReportParameter ConceptoAptitud = new ReportParameter();
            ReportParameter Diagnostico     = new ReportParameter();
            ReportParameter Descripcion     = new ReportParameter();


            //Creamos los parametros para la informacion del paciente
            ReportParameter NombreCompleto  = new ReportParameter();
            ReportParameter NumeroDocumento = new ReportParameter();
            ReportParameter FechaNacimiento = new ReportParameter();
            ReportParameter Sexo            = new ReportParameter();

            //Creamos los parametros para la informacion Ocupacional
            ReportParameter Empresa      = new ReportParameter();
            ReportParameter Cargo        = new ReportParameter();
            ReportParameter Jornada      = new ReportParameter();
            ReportParameter Area         = new ReportParameter();
            ReportParameter Elementos    = new ReportParameter();
            ReportParameter Funciones    = new ReportParameter();
            ReportParameter Materia      = new ReportParameter();
            ReportParameter Herramientas = new ReportParameter();
            ReportParameter Maquinaria   = new ReportParameter();
            ReportParameter FechaCargo   = new ReportParameter();

            //Creamos los parametros para los Antecedentes Ginecologícos
            ReportParameter FechaRegla    = new ReportParameter();
            ReportParameter Hijos         = new ReportParameter();
            ReportParameter Partos        = new ReportParameter();
            ReportParameter Abortos       = new ReportParameter();
            ReportParameter Sanos         = new ReportParameter();
            ReportParameter Gestaciones   = new ReportParameter();
            ReportParameter Menopausia    = new ReportParameter();
            ReportParameter Menarca       = new ReportParameter();
            ReportParameter Citologia     = new ReportParameter();
            ReportParameter Planificacion = new ReportParameter();

            //Creamos los parametros para los Signos Vitales
            ReportParameter Talla          = new ReportParameter();
            ReportParameter Peso           = new ReportParameter();
            ReportParameter IMC            = new ReportParameter();
            ReportParameter Lateralidad    = new ReportParameter();
            ReportParameter Cardiaca       = new ReportParameter();
            ReportParameter Arterial       = new ReportParameter();
            ReportParameter Cintura        = new ReportParameter();
            ReportParameter Interpretacion = new ReportParameter();

            //Creamos los parametros para prueba de equilibrio
            ReportParameter Marcha  = new ReportParameter();
            ReportParameter Reflejo = new ReportParameter();
            ReportParameter Piel    = new ReportParameter();

            //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
            //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
            //                          VISUALIZAR INFORMACIÓN                           //
            //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
            //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
            ReportParameter INFORMACION_DEL_ASPIRANTE_O_TRABAJADOR = new ReportParameter();
            ReportParameter INFORMACION_DE_LA_ATENCION_DEL_ASPIRANTE_O_TRABAJADOR = new ReportParameter();
            ReportParameter ANTECEDENTES_PERSONALES = new ReportParameter();
            ReportParameter ANTECEDENTES_FAMILIARES = new ReportParameter();
            ReportParameter HABITOS                    = new ReportParameter();
            ReportParameter INMUNIZACION               = new ReportParameter();
            ReportParameter ACCIDENTE_LABORAL          = new ReportParameter();
            ReportParameter ENFERMEDAD_PROFESIONAL     = new ReportParameter();
            ReportParameter RIESGOS_OCUPACIONALES      = new ReportParameter();
            ReportParameter INFORMACION_OCUPACIONAL    = new ReportParameter();
            ReportParameter EXAMENES_PRACTICADOS       = new ReportParameter();
            ReportParameter ANTECEDENTES_GINECOLOGICOS = new ReportParameter();
            ReportParameter EXAMEN_FISICO              = new ReportParameter();
            ReportParameter SIGNOS_VITALES             = new ReportParameter();
            ReportParameter PRUEBA_DE_EQUILIBRIO       = new ReportParameter();
            ReportParameter REVISION_POR_SISTEMA       = new ReportParameter();
            ReportParameter RECOMENDACIONES            = new ReportParameter();

            INFORMACION_DEL_ASPIRANTE_O_TRABAJADOR = new ReportParameter("INFORMACION_DEL_ASPIRANTE_O_TRABAJADOR", TablaItem.Rows[0]["valor"].ToString());
            INFORMACION_DE_LA_ATENCION_DEL_ASPIRANTE_O_TRABAJADOR = new ReportParameter("INFORMACION_DE_LA_ATENCION_DEL_ASPIRANTE_O_TRABAJADOR", TablaItem.Rows[1]["valor"].ToString());
            ANTECEDENTES_PERSONALES = new ReportParameter("ANTECEDENTES_PERSONALES", TablaItem.Rows[2]["valor"].ToString());
            ANTECEDENTES_FAMILIARES = new ReportParameter("ANTECEDENTES_FAMILIARES", TablaItem.Rows[3]["valor"].ToString());
            HABITOS                    = new ReportParameter("HABITOS", TablaItem.Rows[4]["valor"].ToString());
            INMUNIZACION               = new ReportParameter("INMUNIZACION", TablaItem.Rows[5]["valor"].ToString());
            ACCIDENTE_LABORAL          = new ReportParameter("ACCIDENTE_LABORAL", TablaItem.Rows[6]["valor"].ToString());
            ENFERMEDAD_PROFESIONAL     = new ReportParameter("ENFERMEDAD_PROFESIONAL", TablaItem.Rows[7]["valor"].ToString());
            RIESGOS_OCUPACIONALES      = new ReportParameter("RIESGOS_OCUPACIONALES", TablaItem.Rows[8]["valor"].ToString());
            INFORMACION_OCUPACIONAL    = new ReportParameter("INFORMACION_OCUPACIONAL", TablaItem.Rows[9]["valor"].ToString());
            EXAMENES_PRACTICADOS       = new ReportParameter("EXAMENES_PRACTICADOS", TablaItem.Rows[10]["valor"].ToString());
            ANTECEDENTES_GINECOLOGICOS = new ReportParameter("ANTECEDENTES_GINECOLOGICOS", TablaItem.Rows[11]["valor"].ToString());
            SIGNOS_VITALES             = new ReportParameter("SIGNOS_VITALES", TablaItem.Rows[12]["valor"].ToString());
            EXAMEN_FISICO              = new ReportParameter("EXAMEN_FISICO", TablaItem.Rows[13]["valor"].ToString());
            PRUEBA_DE_EQUILIBRIO       = new ReportParameter("PRUEBA_DE_EQUILIBRIO", TablaItem.Rows[14]["valor"].ToString());
            REVISION_POR_SISTEMA       = new ReportParameter("REVISION_POR_SISTEMA", TablaItem.Rows[15]["valor"].ToString());
            RECOMENDACIONES            = new ReportParameter("RECOMENDACIONES", TablaItem.Rows[16]["valor"].ToString());

            DataTable nuevaTabla = new DataTable();

            nuevaTabla.Columns.Add("descripcion", typeof(ReportParameter));

            //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
            //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
            //                          LA ATENCIÓN DEL PACIENTE                         //
            //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
            //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
            //Consultamos los datos de la atención del paciente
            string Query = "SELECT dbo.EntradaHistoria.Entr_FechaEntrada, " +
                           "dbo.Concepto.Conc_Descripcion,              " +
                           "dbo.EntradaHistoria.Entr_Recomendacion,     " +
                           "dbo.EntradaHistoria.Entr_Reubicacion,       " +
                           "dbo.TipoExamen.TipoExam_Descripcion,        " +
                           "dbo.Enfasis.Enfa_Descripcion,               " +
                           "EntradaHistoria.Entr_IdPaciente,            " +
                           "dbo.EntradaHistoria.Ent_Estado,             " +
                           "dbo.EntradaHistoria.Ent_conceptoAptitud     " +
                           "FROM  dbo.EntradaHistoria INNER JOIN        " +
                           "dbo.TipoExamen ON dbo.EntradaHistoria." +
                           "Entr_TipoExamenCodigo =                     " +
                           "dbo.TipoExamen.TipoExam_Codigo AND          " +
                           "dbo.EntradaHistoria.Entr_TipoExamenCodigo = " +
                           "dbo.TipoExamen.TipoExam_Codigo INNER JOIN   " +
                           "dbo.Concepto ON dbo.EntradaHistoria.Entr_Concepto_Codigo " +
                           "= dbo.Concepto.Conc_Codigo INNER JOIN          " +
                           "dbo.Enfasis ON dbo.EntradaHistoria.Ent_Enfasis " +
                           "= dbo.Enfasis.Enfa_Codigo " +
                           "where [Entr_Numero] = " + NumeroAtencion;

            DataTable TablaDatos = new DataTable();

            TablaDatos = ObjConexion.LlenarTabla(Query);
            if (TablaDatos.Rows != null & TablaDatos.Rows.Count > 0)
            {
                string IdPaciente = TablaDatos.Rows[0]["Entr_IdPaciente"].ToString();

                string Variable_FechaAtencion   = TablaDatos.Rows[0]["Entr_FechaEntrada"].ToString().Substring(0, 10);
                string Variable_TipoExamen      = TablaDatos.Rows[0]["TipoExam_Descripcion"].ToString();
                string Variable_Enfasis         = TablaDatos.Rows[0]["Enfa_Descripcion"].ToString();
                string Variable_Concepto        = TablaDatos.Rows[0]["Conc_Descripcion"].ToString();
                string Variable_Reubicacion     = TablaDatos.Rows[0]["Entr_Reubicacion"].ToString();
                string Variable_ConceptoAptitud = TablaDatos.Rows[0]["Ent_conceptoAptitud"].ToString();
                if (Variable_ConceptoAptitud == "")
                {
                    Variable_ConceptoAptitud = "No Aplica";
                }
                string Variable_Descripcion = TablaDatos.Rows[0]["Entr_Recomendacion"].ToString();
                if (Variable_Reubicacion == "True")
                {
                    Variable_Reubicacion = "SI";
                }
                else
                {
                    Variable_Reubicacion = "NO";
                }

                //Consultar Diagnosticos
                Query = "SELECT	dbo.Diagnostico.Diag_Descripcion,        " +
                        "dbo.DiagnosticoPaciente.DiagPaci_NumeroHistoria " +
                        "FROM	dbo.DiagnosticoPaciente INNER JOIN       "+
                        "dbo.Diagnostico ON dbo.DiagnosticoPaciente." +
                        "DiagPaci_CodDiagnostico = dbo.Diagnostico.Diag_Codigo " +
                        "where DiagPaci_NumeroHistoria = " + NumeroAtencion;
                TablaDatos = new DataTable();
                TablaDatos = ObjConexion.LlenarTabla(Query);
                string Variable_Diagnostico = "Pendiente por definir";

                for (int i = 0; i < TablaDatos.Rows.Count; i++)
                {
                    string Valor = TablaDatos.Rows[i]["Diag_Descripcion"].ToString();
                    if (i == 0)
                    {
                        Variable_Diagnostico = Valor;
                    }
                    else
                    {
                        Variable_Diagnostico = Variable_Diagnostico + " - " + Valor;
                    }
                }

                if (TablaDatos.Rows.Count == 0)
                {
                    Variable_Diagnostico = "SIN DIAGNOSTICO";
                }

                ////Establecemos el valor de los parámetros de atenciòn
                FechaAtencion   = new ReportParameter("FechaAtencion", Variable_FechaAtencion);
                TipoExamen      = new ReportParameter("TipoExamen", Variable_TipoExamen);
                Enfasis         = new ReportParameter("Enfasis", Variable_Enfasis);
                Reubicacion     = new ReportParameter("Reubicacion", Variable_Reubicacion);
                Concepto        = new ReportParameter("Concepto", Variable_Concepto);
                Diagnostico     = new ReportParameter("Diagnostico", Variable_Diagnostico);
                ConceptoAptitud = new ReportParameter("ConceptoAptitud", Variable_ConceptoAptitud);
                Descripcion     = new ReportParameter("Descripcion", Variable_Descripcion);

                //Consultamos los datos personales del paciente
                Query = "SELECT	dbo.Paciente.Pac_Nombre1+ ' ' + isnull(dbo.Paciente.Pac_Nombre2,'')                         " +
                        "		+' '+dbo.Paciente.Pac_Apellido1+ ' '+isnull(dbo.Paciente.Pac_Apellido2,'') As Nombres,      "+
                        "		dbo.Paciente.Pac_TipoIdentificacion, dbo.Paciente.Pac_Identificacion,                       "+
                        "		dbo.Paciente.Pac_FechaNacimiento, dbo.Genero.Gen_Descripcion,Pac_FechaNacimiento,                               "+
                        "		dbo.Paciente.Pac_CodCiudad, dbo.Paciente.Pac_Direccion,                               "+
                        "		dbo.Paciente.Pac_CodNivelEducativo, dbo.Paciente.Pac_CodProfesion,                         "+
                        "		dbo.TipoSangre.TipSan_Descripcion, dbo.Paciente.Pac_EstadoCivil,                            "+
                        "		dbo.EstadoCivil.EstCivil_Descripcion,Pac_Telefono,Pac_Foto                                           "+
                        "FROM	dbo.Paciente LEFT OUTER JOIN                                                                "+
                        "		dbo.EstadoCivil ON dbo.Paciente.Pac_EstadoCivil =                                           "+
                        "		dbo.EstadoCivil.EstCivil_Codigo LEFT OUTER JOIN                                             "+
                        "		dbo.TipoSangre ON dbo.Paciente.Pac_TipoSangre =                                             "+
                        "		dbo.TipoSangre.TipSan_Codigo LEFT OUTER JOIN                                                "+
                        "		dbo.Genero ON dbo.Paciente.Pac_CodGenero = dbo.Genero.Gen_Codigo                        "+
                        "WHERE	Pac_Identificacion='"+ IdPaciente + "'";
                TablaDatos = new DataTable();
                TablaDatos = ObjConexion.LlenarTabla(Query);

                string Variable_NombreCompleto = TablaDatos.Rows[0]["Nombres"].ToString();

                string Variable_NumeroDocumento =
                    TablaDatos.Rows[0]["Pac_TipoIdentificacion"].ToString() + ". " +
                    TablaDatos.Rows[0]["Pac_Identificacion"].ToString();

                string Variable_FechaNacimiento = "Fecha de Nacimiento: " + TablaDatos.Rows[0]["Pac_FechaNacimiento"].ToString().Substring(0, 10);
                string Variable_Sexo            = "Sexo: " + TablaDatos.Rows[0]["Gen_Descripcion"].ToString();
                //Cargar Imagen
                //HistoriaClinicaDataSet2.nul
                this.SP_DatosPacienteTableAdapter.Fill(this.HistoriaClinicaDataSet2.SP_DatosPaciente, IdPaciente);
                //Establecemos el valor de los parámetros de la informacion personal
                NombreCompleto  = new ReportParameter("NombreCompleto", Variable_NombreCompleto);
                NumeroDocumento = new ReportParameter("NumeroDocumento", Variable_NumeroDocumento);
                FechaNacimiento = new ReportParameter("FechaNacimiento", Variable_FechaNacimiento);
                Sexo            = new ReportParameter("Sexo", Variable_Sexo);

                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //                          INFORMACIÓN OCUPACIONAL                          //
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //Se consultan la información ocupacional
                Query = "SELECT  dbo.Empresa.Empre_RazonSocial,                      " +
                        "dbo.Cargo.Carg_Descripcion,                                 " +
                        "dbo.InformacionOcupacional.InfOcu_Jornada,                  " +
                        "dbo.InformacionOcupacional.InfOcu_Area,                     " +
                        "dbo.InformacionOcupacional.InfOcu_ElementoProte,            " +
                        "dbo.InformacionOcupacional.InfOcu_DescripcionFunciones,     " +
                        "dbo.InformacionOcupacional.InfOcu_MateriaPrima,             " +
                        "dbo.InformacionOcupacional.InfOcu_Herramienta,              " +
                        "dbo.InformacionOcupacional.InfOcu_Maquinaria,               " +
                        "dbo.InformacionOcupacional.InfOcu_FechaIngreso,             " +
                        "dbo.InformacionOcupacional.InfOcu_FechaCargoActual          " +
                        "FROM    dbo.InformacionOcupacional INNER JOIN               " +
                        "dbo.Empresa ON dbo.InformacionOcupacional.InfOcu_CodEmpresa " +
                        "= dbo.Empresa.Empr_Codigo INNER JOIN                        " +
                        "dbo.Cargo ON dbo.InformacionOcupacional.InfOcu_CodOcupacion " +
                        "= dbo.Cargo.Carg_Codigo                                     " +
                        "where dbo.InformacionOcupacional.InfOcu_Entrada_Numero = " + NumeroAtencion;
                TablaDatos = new DataTable();
                TablaDatos = ObjConexion.LlenarTabla(Query);
                //Se asigna el valor a las variables
                string Variable_Empresa      = TablaDatos.Rows[0]["Empre_RazonSocial"].ToString();
                string Variable_Cargo        = TablaDatos.Rows[0]["Carg_Descripcion"].ToString();
                string Variable_Jornada      = TablaDatos.Rows[0]["InfOcu_Jornada"].ToString();
                string Variable_Area         = TablaDatos.Rows[0]["InfOcu_Area"].ToString();
                string Variable_Elementos    = TablaDatos.Rows[0]["InfOcu_ElementoProte"].ToString();
                string Variable_Funciones    = TablaDatos.Rows[0]["InfOcu_DescripcionFunciones"].ToString();
                string Variable_Materia      = TablaDatos.Rows[0]["InfOcu_MateriaPrima"].ToString();
                string Variable_Herramientas = TablaDatos.Rows[0]["InfOcu_Herramienta"].ToString();
                string Variable_Maquinaria   = TablaDatos.Rows[0]["InfOcu_Maquinaria"].ToString();
                string Variable_FechaCargo   = TablaDatos.Rows[0]["InfOcu_FechaCargoActual"].ToString().Substring(0, 10);

                //Establecemos el valor de los parámetros de la informacion personal
                Empresa      = new ReportParameter("Empresa", Variable_Empresa);
                Cargo        = new ReportParameter("Cargo", Variable_Cargo);
                Jornada      = new ReportParameter("Jornada", Variable_Jornada);
                Area         = new ReportParameter("Area", Variable_Area);
                Elementos    = new ReportParameter("Elementos", Variable_Elementos);
                Funciones    = new ReportParameter("Funciones", Variable_Funciones);
                Materia      = new ReportParameter("Materia", Variable_Materia);
                Herramientas = new ReportParameter("Herramientas", Variable_Herramientas);
                Maquinaria   = new ReportParameter("Maquinaria", Variable_Maquinaria);
                FechaCargo   = new ReportParameter("FechaCargo", Variable_FechaCargo);

                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //                          ANTECEDENTES GINECOLOGICOS                       //
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://

                //Se consultan la información Ginecologica
                Query = "SELECT [CicMens_Entrada_Numero] " +
                        ",[CicMens_FechaUltimaRegla]     " +
                        ",[CicMens_HijosSanos]           " +
                        ",[CicMens_Gestaciones]          " +
                        ",[CicMens_Partos]               " +
                        ",[CicMens_Abortos]              " +
                        ",[CicMens_Hijos]                " +
                        ",[CicMens_ResultadoCitologia]   " +
                        ",[CicMens_Planificacion]        " +
                        ",[CicMens_Edadmenopausia]       " +
                        ",[CicMens_Edadmenarca]          " +
                        ",[CicMens_metodo]               " +
                        "FROM [dbo].[CicloMenstrual]     " +
                        "where CicMens_Entrada_Numero = " + NumeroAtencion;
                TablaDatos = new DataTable();
                TablaDatos = ObjConexion.LlenarTabla(Query);

                //Variables
                if (TablaDatos.Rows.Count > 0)
                {
                    string Variable_FechaRegla    = TablaDatos.Rows[0]["CicMens_FechaUltimaRegla"].ToString().Substring(0, 10);
                    string Variable_Hijos         = TablaDatos.Rows[0]["CicMens_Hijos"].ToString();
                    string Variable_Partos        = TablaDatos.Rows[0]["CicMens_Partos"].ToString();
                    string Variable_Abortos       = TablaDatos.Rows[0]["CicMens_Abortos"].ToString();
                    string Variable_Sanos         = TablaDatos.Rows[0]["CicMens_HijosSanos"].ToString();
                    string Variable_Gestaciones   = TablaDatos.Rows[0]["CicMens_Gestaciones"].ToString();
                    string Variable_Menopausia    = TablaDatos.Rows[0]["CicMens_Edadmenopausia"].ToString();
                    string Variable_Menarca       = TablaDatos.Rows[0]["CicMens_Edadmenarca"].ToString();
                    string Variable_Citologia     = TablaDatos.Rows[0]["CicMens_ResultadoCitologia"].ToString();
                    string Variable_Planificacion = TablaDatos.Rows[0]["CicMens_Planificacion"].ToString();
                    if (Variable_Planificacion == "False")
                    {
                        Variable_Planificacion = "NO";
                    }
                    else
                    {
                        Variable_Planificacion = TablaDatos.Rows[0]["CicMens_metodo"].ToString();
                    }
                    //Establecemos el valor de los parámetros de Gestaciones
                    if (Variable_Sexo == "Sexo: Hombre")
                    {
                        Variable_FechaRegla = "NO APLICA";
                        //Variable_Hijos =        "NO APLICA";
                        Variable_Partos  = "NO APLICA";
                        Variable_Abortos = "NO APLICA";
                        //Variable_Sanos =        "NO APLICA";
                        Variable_Gestaciones = "NO APLICA";
                        Variable_Menopausia  = "NO APLICA";
                        Variable_Menarca     = "NO APLICA";
                        Variable_Citologia   = "NO APLICA";
                        //Variable_Planificacion ="NO APLICA";
                    }
                    FechaRegla    = new ReportParameter("FechaRegla", Variable_FechaRegla);
                    Hijos         = new ReportParameter("Hijos", Variable_Hijos);
                    Partos        = new ReportParameter("Partos", Variable_Partos);
                    Abortos       = new ReportParameter("Abortos", Variable_Abortos);
                    Sanos         = new ReportParameter("Sanos", Variable_Sanos);
                    Gestaciones   = new ReportParameter("Gestaciones", Variable_Gestaciones);
                    Menopausia    = new ReportParameter("Menopausia", Variable_Menopausia);
                    Menarca       = new ReportParameter("Menarca", Variable_Menarca);
                    Citologia     = new ReportParameter("Citologia", Variable_Citologia);
                    Planificacion = new ReportParameter("Planificacion", Variable_Planificacion);
                }

                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //                          SIGNOS VITALES                                   //
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://

                Query = "SELECT [ExaFisi_Entrada_Numero] " +
                        ",[ExaFisi_PresionArterial]    " +
                        ",[ExaFisi_FrecuenciaCardiaca] " +
                        ",[ExaFisi_Lateracidad]        " +
                        ",[ExaFisi_Peso]               " +
                        ",[ExaFisi_Talla]              " +
                        ",[ExaFisi_PerimetroCintura]   " +
                        ",[ExaFisi_IMC]                " +
                        ",[ExaFisi_Interpretacion]     " +
                        "FROM [dbo].[ExamenFisico]     " +
                        "where ExaFisi_Entrada_Numero = " + NumeroAtencion;

                TablaDatos = new DataTable();
                TablaDatos = ObjConexion.LlenarTabla(Query);

                string Variable_Talla          = TablaDatos.Rows[0]["ExaFisi_Talla"].ToString();
                string Variable_Peso           = TablaDatos.Rows[0]["ExaFisi_Peso"].ToString();
                string Variable_IMC            = TablaDatos.Rows[0]["ExaFisi_IMC"].ToString();
                string Variable_Lateralidad    = TablaDatos.Rows[0]["ExaFisi_Lateracidad"].ToString();
                string Variable_Cardiaca       = TablaDatos.Rows[0]["ExaFisi_FrecuenciaCardiaca"].ToString();
                string Variable_Arterial       = TablaDatos.Rows[0]["ExaFisi_PresionArterial"].ToString();
                string Variable_Cintura        = TablaDatos.Rows[0]["ExaFisi_PerimetroCintura"].ToString();
                string Variable_Interpretacion = TablaDatos.Rows[0]["ExaFisi_Interpretacion"].ToString();

                //Establecemos el valor de los parámetros de Gestaciones
                Talla          = new ReportParameter("Talla", Variable_Talla);
                Peso           = new ReportParameter("Peso", Variable_Peso);
                IMC            = new ReportParameter("IMC", Variable_IMC);
                Lateralidad    = new ReportParameter("Lateralidad", Variable_Lateralidad);
                Cardiaca       = new ReportParameter("Cardiaca", Variable_Cardiaca);
                Arterial       = new ReportParameter("Arterial", Variable_Arterial);
                Cintura        = new ReportParameter("Cintura", Variable_Cintura);
                Interpretacion = new ReportParameter("Interpretacion", Variable_Interpretacion);

                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //            PRUEBBA DE EQUILIBRIO (MARCHA, REFLEJO Y PIEL)                 //
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
                Query = "SELECT [EqiPa_Cidigo]            " +
                        ",[EqiPa_Equilibro]             " +
                        ",[EqiPa_HistoriaNumero]        " +
                        ",[EqiPa_Estado]                " +
                        ",[EqiPa_Reflejos]              " +
                        ",[EqiPa_Marcha]                " +
                        ",[EqiPa_Piel]                  " +
                        "FROM [dbo].[EquilibroPaciente] " +
                        "where EqiPa_HistoriaNumero = " + NumeroAtencion;
                TablaDatos = new DataTable();
                TablaDatos = ObjConexion.LlenarTabla(Query);

                string Variable_Marcha  = TablaDatos.Rows[0]["EqiPa_Marcha"].ToString();
                string Variable_Reflejo = TablaDatos.Rows[0]["EqiPa_Reflejos"].ToString();
                string Variable_Piel    = TablaDatos.Rows[0]["EqiPa_Piel"].ToString();

                //Establecemos el valor de los parámetros de Gestaciones
                Marcha  = new ReportParameter("Marcha", Variable_Marcha);
                Reflejo = new ReportParameter("Reflejo", Variable_Reflejo);
                Piel    = new ReportParameter("Piel", Variable_Piel);

                //Se envian los parametros al reporte
                //--(DATOS DE LA ATENCIÓN);
                this.reportViewer1.LocalReport.SetParameters(FechaAtencion);
                this.reportViewer1.LocalReport.SetParameters(Concepto);
                this.reportViewer1.LocalReport.SetParameters(TipoExamen);
                this.reportViewer1.LocalReport.SetParameters(Enfasis);
                this.reportViewer1.LocalReport.SetParameters(ConceptoAptitud);
                this.reportViewer1.LocalReport.SetParameters(Reubicacion);
                this.reportViewer1.LocalReport.SetParameters(Diagnostico);
                this.reportViewer1.LocalReport.SetParameters(Descripcion);

                //--(DATOS PERSONALES)
                this.reportViewer1.LocalReport.SetParameters(NombreCompleto);
                this.reportViewer1.LocalReport.SetParameters(NumeroDocumento);
                this.reportViewer1.LocalReport.SetParameters(FechaNacimiento);
                this.reportViewer1.LocalReport.SetParameters(Sexo);

                //--(DATOS INFORMACION OCUPACIONAL)
                this.reportViewer1.LocalReport.SetParameters(Empresa);
                this.reportViewer1.LocalReport.SetParameters(Cargo);
                this.reportViewer1.LocalReport.SetParameters(Jornada);
                this.reportViewer1.LocalReport.SetParameters(Area);
                this.reportViewer1.LocalReport.SetParameters(Elementos);
                this.reportViewer1.LocalReport.SetParameters(Funciones);
                this.reportViewer1.LocalReport.SetParameters(Materia);
                this.reportViewer1.LocalReport.SetParameters(Herramientas);
                this.reportViewer1.LocalReport.SetParameters(Maquinaria);
                this.reportViewer1.LocalReport.SetParameters(FechaCargo);

                //--(DATOS ANTECEDENTES GINECOLOGICOS)
                this.reportViewer1.LocalReport.SetParameters(FechaRegla);
                this.reportViewer1.LocalReport.SetParameters(Hijos);
                this.reportViewer1.LocalReport.SetParameters(Partos);
                this.reportViewer1.LocalReport.SetParameters(Abortos);
                this.reportViewer1.LocalReport.SetParameters(Sanos);
                this.reportViewer1.LocalReport.SetParameters(Gestaciones);
                this.reportViewer1.LocalReport.SetParameters(Menopausia);
                this.reportViewer1.LocalReport.SetParameters(Menarca);
                this.reportViewer1.LocalReport.SetParameters(Citologia);
                this.reportViewer1.LocalReport.SetParameters(Planificacion);

                //--(DATOS SIGNOS VITALES)
                this.reportViewer1.LocalReport.SetParameters(Talla);
                this.reportViewer1.LocalReport.SetParameters(Peso);
                this.reportViewer1.LocalReport.SetParameters(IMC);
                this.reportViewer1.LocalReport.SetParameters(Lateralidad);
                this.reportViewer1.LocalReport.SetParameters(Cardiaca);
                this.reportViewer1.LocalReport.SetParameters(Arterial);
                this.reportViewer1.LocalReport.SetParameters(Cintura);
                this.reportViewer1.LocalReport.SetParameters(Interpretacion);

                //--(DATOS PRUEBA DE EQUILIBRIO)
                this.reportViewer1.LocalReport.SetParameters(Marcha);
                this.reportViewer1.LocalReport.SetParameters(Reflejo);
                this.reportViewer1.LocalReport.SetParameters(Piel);

                //--(DATOS PRUEBA DE EQUILIBRIO)
                this.reportViewer1.LocalReport.SetParameters(INFORMACION_DEL_ASPIRANTE_O_TRABAJADOR);
                this.reportViewer1.LocalReport.SetParameters(INFORMACION_DE_LA_ATENCION_DEL_ASPIRANTE_O_TRABAJADOR);
                this.reportViewer1.LocalReport.SetParameters(ANTECEDENTES_PERSONALES);
                this.reportViewer1.LocalReport.SetParameters(ANTECEDENTES_FAMILIARES);
                this.reportViewer1.LocalReport.SetParameters(HABITOS);
                this.reportViewer1.LocalReport.SetParameters(INMUNIZACION);
                this.reportViewer1.LocalReport.SetParameters(ACCIDENTE_LABORAL);
                this.reportViewer1.LocalReport.SetParameters(ENFERMEDAD_PROFESIONAL);
                this.reportViewer1.LocalReport.SetParameters(RIESGOS_OCUPACIONALES);
                this.reportViewer1.LocalReport.SetParameters(INFORMACION_OCUPACIONAL);
                this.reportViewer1.LocalReport.SetParameters(EXAMENES_PRACTICADOS);
                this.reportViewer1.LocalReport.SetParameters(ANTECEDENTES_GINECOLOGICOS);
                this.reportViewer1.LocalReport.SetParameters(EXAMEN_FISICO);
                this.reportViewer1.LocalReport.SetParameters(SIGNOS_VITALES);
                this.reportViewer1.LocalReport.SetParameters(PRUEBA_DE_EQUILIBRIO);
                this.reportViewer1.LocalReport.SetParameters(REVISION_POR_SISTEMA);
                this.reportViewer1.LocalReport.SetParameters(RECOMENDACIONES);
                this.reportViewer1.LocalReport.DataSources.Add(r);
                this.reportViewer1.RefreshReport();

                reportViewer1.SetDisplayMode(DisplayMode.PrintLayout);
                reportViewer1.ZoomMode = ZoomMode.Percent;
                //Seleccionamos el zoom que deseamos utilizar. En este caso un 100%
                reportViewer1.ZoomPercent = 100;
            }
            else
            {
                MessageBox.Show("No hay resoltados para la informacion de la atencion");
            }
        }
        public void GenerateReport()
        {
            try
            {
                //if (ddlCompany.SelectedValue == null)
                //    pnlCriteria.Visible = false;

                reportViewer1.LocalReport.EnableExternalImages = true;

                Microsoft.Reporting.WinForms.ReportParameter[] param = new Microsoft.Reporting.WinForms.ReportParameter[16];

                string address = AppVars.objSubCompany.Address;
                string telNo   = string.Empty;



                string sortCode     = AppVars.objSubCompany.SortCode.ToStr();
                string accountNo    = AppVars.objSubCompany.AccountNo.ToStr();
                string accountTitle = AppVars.objSubCompany.AccountTitle.ToStr();
                string bank         = AppVars.objSubCompany.BankName.ToStr();

                string hasBankDetails = "1";
                if (string.IsNullOrEmpty(sortCode) && string.IsNullOrEmpty(accountNo) && string.IsNullOrEmpty(accountTitle) &&
                    string.IsNullOrEmpty(bank))
                {
                    hasBankDetails = "0";
                }

                if (!string.IsNullOrEmpty(sortCode))
                {
                    sortCode = "Sort Code : " + sortCode;
                }



                if (!string.IsNullOrEmpty(accountTitle))
                {
                    accountTitle = "Account Title : " + accountTitle;
                }

                //   if (!string.IsNullOrEmpty(bank))
                //       bank = "Bank : " + bank;



                string website = AppVars.objSubCompany.WebsiteUrl.ToStr();
                if (!string.IsNullOrEmpty(website))
                {
                    website += " , ";
                }

                website += "Email:" + AppVars.objSubCompany.EmailAddress.ToStr();


                string companyNumber = AppVars.objSubCompany.CompanyNumber.ToStr();
                if (!string.IsNullOrEmpty(companyNumber))
                {
                    companyNumber = "Company Number: " + companyNumber;
                }

                string vatNumber = AppVars.objSubCompany.CompanyVatNumber.ToStr();
                if (!string.IsNullOrEmpty(vatNumber))
                {
                    vatNumber = "VAT Number: " + vatNumber;
                }



                param[0] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Address", address);

                param[1] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Footer", AppVars.objSubCompany.WebsiteUrl.ToStr());

                param[2] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_MobileNo", "Mobile: " + AppVars.objSubCompany.EmergencyNo.ToStr());
                param[3] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Website", website);
                param[4] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Email", "Email: " + AppVars.objSubCompany.EmailAddress.ToStr());

                param[5] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyNumber", companyNumber);
                param[6] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_VATNumber", vatNumber);


                param[7] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_SortCode", sortCode);
                param[8] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountTitle", accountTitle);
                param[9] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Bank", bank);



                List <ClsLogo> objLogo = new List <ClsLogo>();
                objLogo.Add(new ClsLogo {
                    ImageInBytes = AppVars.objSubCompany.CompanyLogo != null ? AppVars.objSubCompany.CompanyLogo.ToArray() : null
                });
                ReportDataSource imageDataSource = new ReportDataSource("Taxi_AppMain_Classes_ClsLogo", objLogo);
                this.reportViewer1.LocalReport.DataSources.Add(imageDataSource);

                string path = @"File:";
                param[10] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Path", path);

                param[11] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyHeader", AppVars.objSubCompany.CompanyName.ToStr());

                int?companyId = this.DataSource.FirstOrDefault().DefaultIfEmpty().CompanyId;

                //decimal invoiceGrandTotal = this.DataSource.FirstOrDefault().DefaultIfEmpty().InvoiceTotal.ToDecimal() + this.DataSource.FirstOrDefault().DefaultIfEmpty().AdminFees.ToDecimal();
                var data = this.DataSource.FirstOrDefault().DefaultIfEmpty();

                telNo = "Tel No. " + AppVars.objSubCompany.TelephoneNo;

                if (!string.IsNullOrEmpty(accountNo))
                {
                    accountNo = "Account No : " + accountNo;
                }



                param[12] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_Telephone", telNo);

                param[13] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_AccountNo", accountNo);


                param[14] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_HasBankDetails", hasBankDetails);
                param[15] = new Microsoft.Reporting.WinForms.ReportParameter("Report_Parameter_CompanyWise", ddlCompany.SelectedValue != null ? "1" : "0");


                reportViewer1.LocalReport.SetParameters(param);


                int cnt = this.DataSource.Count;

                int minRows = 8;

                if (cnt < minRows)
                {
                    for (int i = 0; i < minRows - cnt; i++)
                    {
                        this.DataSource.Add(new  Vu_BookingBase {
                            Id = data.Id, CompanyId = data.CompanyId
                        });
                    }
                }


                this.Vu_BookingBaseBindingSource.DataSource = this.DataSource;

                this.reportViewer1.ZoomPercent = 100;
                this.reportViewer1.ZoomMode    = Microsoft.Reporting.WinForms.ZoomMode.Percent;
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
                ENUtils.ShowMessage(ex.Message);
            }
        }
Example #56
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            string ReportName = string.Empty;

            db   = new SteinbachEntities();
            host = new WindowsFormsHost();


            var query = from p in db.projekte
                        where p.id == pID
                        select p;
            var Merge = new Temp.MergeData_DataSorce();

            var q = query.FirstOrDefault();

            //Merge.SetValue(String.Format("{0} - {1}", q.projektnummer, q.type.Substring(0, 1)), 0);
            Merge.SetValue(String.Format("{0} {1}", q.projektnummer, GetTypesString(q.projektnummer)), 0);

            if (q.lager == 0 || q.lager == null)
            {
                if (q.ersatzteilebestellt.HasValue)
                {
                    DateTime s1 = (DateTime)q.ersatzteilebestellt;
                    Merge.SetValue(s1.ToString("d"), 1);
                }

                if (q.ersatzteileerhalten.HasValue)
                {
                    DateTime s2 = (DateTime)q.ersatzteileerhalten;
                    Merge.SetValue(s2.ToString("d"), 2);
                }
            }
            else
            {
                Merge.SetValue("Lager", 1);
                Merge.SetValue("Lager", 2);
            }

            reportViewer = new Microsoft.Reporting.WinForms.ReportViewer();
            reportViewer.ProcessingMode = ProcessingMode.Local;
            reportViewer.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);

            switch (Firmennummer)
            {
            case 10177:
            {
                if (Type == "Ersatzteile" && bSI)
                {
                    ReportName = "ProjektDB.Reports.Jets.Jets_ETeile_SI.rdlc";
                    break;
                }
                if (bSI)
                {
                    ReportName = "ProjektDB.Reports.Jets.Jets_Auftrag_SI.rdlc";
                    break;
                }
                if (bAuftrag)
                {
                    ReportName = "ProjektDB.Reports.Jets.Jets_Auftrag.rdlc";
                    break;
                }

                ReportName = "ProjektDB.Reports.Jets.Jets_Angebot.rdlc";

                break;
            }

            case 10014:
            {
                //if (Type == "Service")
                //{
                //     ReportName = "ProjektDB.Reports.Alle_Angebot.rdlc";
                //     break;
                //}

                if (bSI)
                {
                    ReportName = "ProjektDB.Reports.Alle_Auftrag_SI.rdlc";
                    break;
                }

                if (bAuftrag)
                {
                    ReportName = "ProjektDB.Reports.Brunvoll.Brunvoll_Auftrag.rdlc";
                    break;
                }


                ReportName = "ProjektDB.Reports.Alle_Angebot.rdlc";

                break;
            }

            default:
            {
                if (bSI)
                {
                    ReportName = "ProjektDB.Reports.Alle_Auftrag_SI.rdlc";
                    break;
                }
                if (bAuftrag)
                {
                    ReportName = "ProjektDB.Reports.Alle_Angebot.rdlc";
                    break;
                }

                ReportName = "ProjektDB.Reports.Alle_Angebot.rdlc";

                break;
            }
            }
            reportViewer.LocalReport.ReportEmbeddedResource = ReportName;       //"ProjektDB.Reports.Jets_Auftrag_SI.rdlc";
            ReportDataSource ds  = new ReportDataSource("dsDeckblattTest", query);
            ReportDataSource MeD = new ReportDataSource("MergeData", Merge.MergedData);

            reportViewer.LocalReport.DataSources.Add(ds);
            reportViewer.LocalReport.DataSources.Add(MeD);



            reportViewer.RefreshReport();


            host.Child = reportViewer;
            this.GridDisplay.Children.Add(host);
        }
        private void BindReport()
        {
            SHIPPING_FinalEntities entity = new SHIPPING_FinalEntities();

            int InvoiceId = 0;

            InvoiceId = Convert.ToInt32(Request.QueryString["id"].ToString());

            DateTime fromdate = new DateTime(2016, 01, 01);
            DateTime todate   = new DateTime(2016, 04, 25);

            ReportViewer1.SizeToReportContent    = true;
            ReportViewer1.LocalReport.ReportPath = Server.MapPath("~/Reports/SalesInvoiceReport.rdlc");
            ReportViewer1.LocalReport.DataSources.Clear();

            DataTable dtcompany = new DataTable();

            dtcompany.Columns.Add("CompanyName");
            dtcompany.Columns.Add("Address1");
            dtcompany.Columns.Add("Address2");
            dtcompany.Columns.Add("Address3");
            dtcompany.Columns.Add("Phone");
            dtcompany.Columns.Add("AcHead");
            dtcompany.Columns.Add("Todate");

            var company = entity.AcCompanies.FirstOrDefault();

            DataRow dr = dtcompany.NewRow();

            dr[0] = company.AcCompany1;
            dr[1] = company.Address1;
            dr[2] = company.Address2;
            dr[3] = company.Address3;
            dr[4] = company.Phone;
            dr[5] = "";
            dr[6] = DateTime.Now;

            dtcompany.Rows.Add(dr);
            ReportDataSource _rsourceInvoice;

            var invoice     = entity.SalesInvoices.Where(d => d.SalesInvoiceID == InvoiceId).FirstOrDefault();
            var getCustomer = entity.CUSTOMERs.Where(d => d.CustomerID == invoice.CustomerID).FirstOrDefault();

            DataTable dtsupplier = new DataTable();

            dtsupplier.Columns.Add("SupplierName");
            dtsupplier.Columns.Add("Address1");
            dtsupplier.Columns.Add("Address2");
            dtsupplier.Columns.Add("Address3");
            dtsupplier.Columns.Add("Phone");
            dtsupplier.Columns.Add("Country");
            dtsupplier.Columns.Add("City");

            DataRow dr2 = dtsupplier.NewRow();

            dr2[0] = getCustomer.Customer1;
            dr2[1] = getCustomer.Address1;
            dr2[2] = getCustomer.Address2;
            dr2[3] = getCustomer.Address3;
            dr2[4] = getCustomer.Phone;
            dr2[5] = getCustomer.CountryID;
            dr2[6] = invoice.ExchangeRate;

            dtsupplier.Rows.Add(dr2);

            ReportDataSource _resourceSupplier = new ReportDataSource("Supplier", dtsupplier);

            DataSet ds = DAL.SP_GetSalesInvoiceReport(InvoiceId);

            _rsourceInvoice = new ReportDataSource("SalesInvoice", ds.Tables[0]);

            ReportDataSource _rsourceCompany        = new ReportDataSource("Company", dtcompany);
            ReportDataSource _rsourceInvoiceDetails = new ReportDataSource("SalesInvoiceDetails", ds.Tables[1]);

            ReportViewer1.LocalReport.DataSources.Add(_rsourceInvoice);
            ReportViewer1.LocalReport.DataSources.Add(_rsourceCompany);
            ReportViewer1.LocalReport.DataSources.Add(_rsourceInvoiceDetails);
            ReportViewer1.LocalReport.DataSources.Add(_resourceSupplier);

            DataTable dtuser = new DataTable();

            dtuser.Columns.Add("UserName");

            DataRow dr1 = dtuser.NewRow();
            int     uid = Convert.ToInt32(Session["UserID"].ToString());

            dr1[0] = (from c in entity.UserRegistrations where c.UserID == uid select c.UserName).FirstOrDefault();
            dtuser.Rows.Add(dr1);
            ReportDataSource _rsource2 = new ReportDataSource("User", dtuser);

            ReportViewer1.LocalReport.DataSources.Add(_rsource2);



            ReportViewer1.LocalReport.Refresh();
        }
Example #58
0
        private void button1_Click(object sender, EventArgs e)
        {
            int[]           mdays     = new int[] { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
            string          re        = cmbRep.SelectedValue.ToString();
            ReportParameter rep       = new ReportParameter("rep", re);
            string          condition = "";

            if (re != "All")
            {
                condition = " where cp.CkRep = '" + re + "' ";
            }
            reportViewer1.LocalReport.SetParameters(new ReportParameter[] { rep });
            string       sql   = @"select cp.AccNum, cp.Entity as 'Name', cp.PayType, cp.PayFreq, 
	                            case when ccd.FirstCheckDate='' then CONVERT(VARCHAR(20), DATEADD(year, DATEDIFF(year, '', getdate()), ''), 101) 
		                             when ccd.FirstCheckDate is null then CONVERT(VARCHAR(20), DATEADD(year, DATEDIFF(year, '', getdate()), ''), 101) 
		                             else ccd.FirstCheckDate end as 'CkDate',FedTaxFreq, DateIn as 'Datain', DateOut as 'Dataout', PhilaTaxFreq, StateTaxFreq
                            from ClientPayroll cp 
                            inner join ClientDetail cd on cp.AccNum=cd.AccountNo and cd.JobStatus='Current' and cp.PayType in ('Actual Check', 'Paper Check', 'PDF', 'No Check', 'Check Register', 'Tax Deposit')
                            left join ClientCheckDate ccd on cp.AccNum=ccd.AccNum" + condition + " order by cp.AccNum";
            DataTable    dt    = DBOperator.QuerySql(sql);
            List <CkRep> items = DBOperator.getListFromTable <CkRep>(dt);

            for (int i = 0; i < items.Count; i++)
            {
                string   payFreq   = items[i].PayFreq;
                DateTime date      = DateTime.Parse(items[i].CkDate);
                int      day       = date.Day;
                string   checkDate = "";
                DateTime cMonth    = new DateTime(DateTime.Now.Year - comYear.SelectedIndex, comMonth.SelectedIndex + 1, 1);
                switch (payFreq)
                {
                case "Monthly":
                    if (day > mdays[comMonth.SelectedIndex])
                    {
                        day = mdays[comMonth.SelectedIndex];
                    }
                    date      = new DateTime(DateTime.Now.Year - comYear.SelectedIndex, comMonth.SelectedIndex + 1, day);
                    checkDate = date.ToString("M/d");
                    break;

                case "Semi-monthly":
                    if (day > mdays[comMonth.SelectedIndex])
                    {
                        day = mdays[comMonth.SelectedIndex];
                    }
                    if (day > 15)
                    {
                        day -= 15;
                    }
                    date      = new DateTime(DateTime.Now.Year - comYear.SelectedIndex, comMonth.SelectedIndex + 1, day);
                    checkDate = date.ToString("M/d");
                    if (day == 15)
                    {
                        date = date.AddDays(mdays[comMonth.SelectedIndex] - 15);
                    }
                    else
                    {
                        date = date.AddDays(15);
                    }
                    checkDate += ", " + date.ToString("M/d");
                    break;

                case "Bi-Weekly":
                case "Biweekly":
                    while (date < cMonth)
                    {
                        date = date.AddDays(14);
                    }
                    cMonth = cMonth.AddMonths(1);
                    while (date < cMonth)
                    {
                        checkDate += date.ToString("M/d") + ", ";
                        date       = date.AddDays(14);
                    }
                    if (checkDate.Length > 2)
                    {
                        checkDate = checkDate.Substring(0, checkDate.Length - 2);
                    }
                    break;

                case "Weekly":
                    if (date < cMonth)
                    {
                        while (date.Year != cMonth.Year && date.Month != cMonth.Month)
                        {
                            date = date.AddDays(7);
                        }
                        while (date.Month == cMonth.Month)
                        {
                            checkDate += date.ToString("M/d") + ", ";
                            date       = date.AddDays(7);
                        }
                    }
                    else
                    {
                        while (date.Year != cMonth.Year && date.Month != cMonth.Month)
                        {
                            date = date.AddDays(-7);
                        }
                        while (date.Month == cMonth.Month)
                        {
                            checkDate = date.ToString("M/d") + ", " + checkDate;
                            date      = date.AddDays(-7);
                        }
                    }
                    if (checkDate.Length > 2)
                    {
                        checkDate = checkDate.Substring(0, checkDate.Length - 2);
                    }
                    break;
                }
                items[i].CkDate = checkDate;
            }
            reportViewer1.LocalReport.DataSources.Clear();
            ReportDataSource rds = new ReportDataSource("dsCkRep", items);

            reportViewer1.LocalReport.DataSources.Add(rds);
            reportViewer1.RefreshReport();
        }
        /*protected void btnCombineInvoice_Click(object sender, EventArgs e)
         * {
         *  int id = int.Parse(((System.Web.UI.WebControls.WebControl)(sender)).Attributes["qid"].ToString());
         *  //int id = int.Parse(this.hdnSelectedID.Value);
         *
         *  if (id > 0)
         *  {
         *      try
         *      {
         *          string pdfFilePath = Common.GenerateOdsPdf.CombinedInvoice(id);
         *
         *          this.DownloadPDFFile(pdfFilePath);
         *      }
         *      catch (Exception ex)
         *      {
         *          IndicoLogging.log.Error("Error occured while printing JKCombineInvoice from ViewInvoices.aspx", ex);
         *      }
         *  }
         * }*/

        //protected void btnIndimanInvoice_Click(object sender, EventArgs e)
        //{
        //    int id = int.Parse(((System.Web.UI.WebControls.WebControl)(sender)).Attributes["qid"].ToString());
        //    //int id = int.Parse(this.hdnSelectedID.Value);

        //    if (id > 0)
        //    {
        //        try
        //        {
        //            string pdfFilePath = Common.GenerateOdsPdf.GenerateIndimanInvoice(id);

        //            this.DownloadPDFFile(pdfFilePath);
        //        }
        //        catch (Exception ex)
        //        {
        //            IndicoLogging.log.Error("Error occured while printing Indiman Invoice from ViewInvoices.aspx", ex);
        //        }
        //    }
        //}

        protected void btnIndimanInvoice_Click(object sender, EventArgs e)
        {
            int id = int.Parse(((System.Web.UI.WebControls.WebControl)(sender)).Attributes["qid"].ToString());

            using (ReportViewer rpt = new ReportViewer())
            {
                bool   IsFileOpen = false;
                string reportName = "Indiman_Detail_Summary" + DateTime.Now.Ticks.ToString();
                //string dataFolder = @"~\IndicoData\Temp";
                //string rdlFileName = "Sales Report";

                //rpt.ProcessingMode = ProcessingMode.Local;
                //rpt.LocalReport.ReportPath = Server.MapPath("~/Reports/JK_Detail_Invoice.rdl");

                //DateTime? selecteddate1 = null;
                //DateTime? selecteddate2 = null;

                //if (!string.IsNullOrEmpty(this.txtCheckin.Value) && !string.IsNullOrEmpty(this.txtCheckout.Value))
                //{
                //    selecteddate1 = Convert.ToDateTime(this.txtCheckin.Value);
                //    selecteddate2 = Convert.ToDateTime(this.txtCheckout.Value);
                //}

                rpt.ShowToolBar            = false;
                rpt.SizeToReportContent    = true;
                rpt.ProcessingMode         = Microsoft.Reporting.WebForms.ProcessingMode.Local;
                rpt.LocalReport.ReportPath = Server.MapPath("~/Reports/Indiman_Invoice.rdl");
                rpt.Visible = true;

                List <ReportParameter> parameters = new List <ReportParameter>();
                ReportParameter        parameter  = new ReportParameter();
                parameter.Name = "P_InvoiceId";
                parameter.Values.Add(id.ToString());
                parameters.Add(parameter);
                rpt.LocalReport.SetParameters(parameters);

                ReportDataSource dataSource = new ReportDataSource("DataSet1", DB.GetIndimanDetailInvoiceInfo(id));

                rpt.LocalReport.DataSources.Clear();
                rpt.LocalReport.DataSources.Add(dataSource);
                rpt.LocalReport.Refresh();

                string    mimeType, encoding, extension, deviceInfo;
                string[]  streamids;
                Warning[] warnings;
                string    format = "PDF";

                deviceInfo = "<DeviceInfo>" + "<SimplePageHeaders>True</SimplePageHeaders>" + "</DeviceInfo>";

                byte[] bytes = rpt.LocalReport.Render(format, deviceInfo, out mimeType, out encoding, out extension, out streamids, out warnings);

                string temppath = IndicoConfiguration.AppConfiguration.PathToDataFolder + @"\Temp\" + reportName + ".pdf";

                FileStream stream = null;

                if (File.Exists(temppath))
                {
                    try
                    {
                        stream = File.Open(temppath, FileMode.Open, FileAccess.ReadWrite, FileShare.None);
                    }
                    catch (IOException)
                    {
                        IsFileOpen = true;
                    }
                    finally
                    {
                        if (stream != null)
                        {
                            stream.Close();
                        }
                    }
                }

                if (File.Exists(temppath) && !IsFileOpen)
                {
                    File.Delete(temppath);
                }

                if (!IsFileOpen)
                {
                    using (FileStream fs = new FileStream(temppath, FileMode.Create))
                    {
                        fs.Write(bytes, 0, bytes.Length);
                    }
                }

                while (File.Exists(temppath))
                {
                    Thread.Sleep(1000);
                    System.Diagnostics.Process.Start(temppath);
                    break;
                }

                if (File.Exists(temppath))
                {
                    try
                    {
                        this.DownloadPDFFile(temppath);
                    }
                    catch (Exception ex)
                    {
                        IndicoLogging.log.Error("Error occured while printing JKInvoiceOrderDetail from AddEditInvoice.aspx", ex);
                    }
                }
            }
        }
        internal static void PrintWithFormActionTwoSource(string title, ReportDataSource dataHeader, ReportDataSource items, string layout, ReportParameter[] parameters)
        {
            var content = new ReportContent(dataHeader, items, layout, parameters);
            var dlg     = new Window
            {
                Content            = content,
                AllowsTransparency = false,
                Title       = "",
                ResizeMode  = System.Windows.ResizeMode.CanResizeWithGrip,
                WindowState = WindowState.Maximized,
            };

            content.WindowClose = dlg.Close;
            var vm = new BaseNotify();

            vm.MyTitle      = title;
            dlg.DataContext = vm;
            dlg.ShowDialog();
        }