示例#1
0
        public void OtvoriObracun_Za_Mjesec()
        {
            SqlConnection connection = new SqlConnection {
                ConnectionString = Configuration.ConnectionString
            };
            frmPreglediGodinaObracuna obracuna = new frmPreglediGodinaObracuna();

            obracuna.ShowDialog();
            if (obracuna.DialogResult != DialogResult.Cancel)
            {
                string str  = string.Empty;
                string str2 = string.Empty;
                string str3 = string.Empty;
                string str4 = string.Empty;
                if (obracuna.OdabraniGodinaObracuna != null)
                {
                    this.ds.Clear();
                    this.godinaisplate = Conversions.ToString(obracuna.OdabraniGodinaObracuna);
                    this.da.Fill(this.ds, Conversions.ToString(obracuna.OdabraniGodinaObracuna));
                }
                KORISNIKDataSet dataSet = new KORISNIKDataSet();
                new KORISNIKDataAdapter().Fill(dataSet);
                ReportDocument document = new ReportDocument();
                document.Load(System.Windows.Forms.Application.StartupPath + @"\Izvjestaji\RPTTABLICA018.rpt");
                document.SetDataSource(this.ds);
                if (dataSet.KORISNIK.Rows.Count > 0)
                {
                    str2 = "NAZIV OBVEZNIKA PLAĆANJA DOPRINOSA:" + Conversions.ToString(dataSet.KORISNIK.Rows[0]["KORISNIK1NAZIV"]);
                    str  = "MATIČNI BROJ POSLOVNOG SUBJEKTA:" + Conversions.ToString(dataSet.KORISNIK.Rows[0]["MBKORISNIK"]);
                    str4 = "REGISTARSKI BROJ:________________________________________________";
                    str3 = "RAČUN: ________________________________________________________________";
                }
                document.SetParameterValue("firmanaziv", str2);
                document.SetParameterValue("firmamb", str);
                document.SetParameterValue("REGISTARSKI", str4);
                document.SetParameterValue("RACUN", str3);
                document.SetParameterValue("NASLOV", "REKAPITULACIJA OSNOVICA ZA OBRAČUNAVANJE I UPLATU OBVEZNIH DOPRINOSA ZA MIROVINSKO OSIGURANJE NA TEMELJU GENERACIJSKE SOLIDARNOSTI " + this.godinaisplate + ". GODINE");
                this.CrystalReportViewer1.ReportSource = document;
            }
        }
示例#2
0
        public void OtvoriObracun_Za_Mjesec()
        {
            SqlConnection connection = new SqlConnection {
                ConnectionString = Configuration.ConnectionString
            };
            frmPreglediGodinaObracuna obracuna = new frmPreglediGodinaObracuna();

            obracuna.ShowDialog();
            if (obracuna.DialogResult != DialogResult.Cancel)
            {
                string str  = string.Empty;
                string str1 = string.Empty;
                string str2 = string.Empty;
                string str3 = string.Empty;
                if (obracuna.OdabraniGodinaObracuna != null)
                {
                    this.ds.Clear();
                    this.godinaisplate = Conversions.ToString(obracuna.OdabraniGodinaObracuna);
                    this.da.Fill(this.ds, Conversions.ToString(obracuna.OdabraniGodinaObracuna));
                }
                KORISNIKDataSet dataSet = new KORISNIKDataSet();
                new KORISNIKDataAdapter().Fill(dataSet);
                ReportDocument document = new ReportDocument();

                SqlClient  client     = new SqlClient();
                SqlCommand sqlCommand = new SqlCommand();
                sqlCommand.Connection  = client.sqlConnection;
                sqlCommand.CommandType = CommandType.StoredProcedure;
                System.Data.DataTable tbl  = new System.Data.DataTable();
                System.Data.DataTable tbl2 = new System.Data.DataTable();

                document.Load(System.Windows.Forms.Application.StartupPath + @"\Izvjestaji\TABLICA01-11.rpt");

                sqlCommand.CommandText = "S_OD_TABLICA011";

                sqlCommand.Parameters.AddWithValue("@GODINA", godinaisplate);

                SqlDataAdapter da = new SqlDataAdapter();
                da.SelectCommand = sqlCommand;
                da.Fill(tbl);

                //naradu
                sqlCommand.CommandText = "S_OD_TABLICA01";
                da.SelectCommand       = sqlCommand;
                da.Fill(tbl2);

                foreach (DataRow row in tbl.Rows)
                {
                    foreach (DataRow row2 in tbl2.Rows)
                    {
                        if (row["MJESECOBRACUNA"].ToString() == row2["MJESECOBRACUNA"].ToString())
                        {
                            row["naradu"] = row2["naradu"];
                        }
                    }
                }

                // Set connection string from config in existing LogonProperties
                document.DataSourceConnections[0].SetConnection(Mipsed7.Core.ApplicationDatabaseInformation.ServerName, Mipsed7.Core.ApplicationDatabaseInformation.DatabaseName, true);
                document.DataSourceConnections[0].SetLogon(Mipsed7.Core.ApplicationDatabaseInformation.SqlUserName, Mipsed7.Core.ApplicationDatabaseInformation.SqlPassword);
                document.DataSourceConnections[0].IntegratedSecurity = false;

                document.SetDataSource(tbl);

                if (dataSet.KORISNIK.Rows.Count > 0)
                {
                    str2 = "NAZIV OBVEZNIKA PLAĆANJA DOPRINOSA:" + Conversions.ToString(dataSet.KORISNIK.Rows[0]["KORISNIK1NAZIV"]);
                    str  = "MATIČNI BROJ POSLOVNOG SUBJEKTA:" + Conversions.ToString(dataSet.KORISNIK.Rows[0]["MBKORISNIK"]);
                    str1 = "REGISTARSKI BROJ:________________________________________________";
                    str3 = "RAČUN: ________________________________________________________________";
                }
                document.SetParameterValue("firmanaziv", str2);
                document.SetParameterValue("firmamb", str);
                document.SetParameterValue("REGISTARSKI", str1);
                document.SetParameterValue("RACUN", str3);
                document.SetParameterValue("NASLOV", "REKAPITULACIJA PODATAKA ZA POSTUPAK KONTROLE " + this.godinaisplate + ". GODINE");
                this.CrystalReportViewer1.ReportSource = document;
            }
        }