| 98 | | { |
| 99 | | InitializeComponent(); |
| 100 | | |
| | 106 | { |
| | 107 | InitializeComponent(); |
| | 108 | |
| | 109 | |
| | 110 | idFaktury = idFakt; |
| | 111 | this.rodzaj = r; |
| | 112 | |
| | 113 | this.zapiszButton.Click += zapiszButton2_Click; |
| | 114 | |
| | 115 | fakturaTableAdapter1.Connection.ConnectionString = ConnString.getConnString().Value; |
| | 116 | fAKTURA_DETAILS2TableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; |
| | 117 | fAKTURYTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; |
| | 118 | proformaTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; |
| | 119 | |
| | 120 | ds = new DataSet(); |
| | 121 | |
| | 122 | //zczytuje dane z pliku z tlumaczeniami |
| | 123 | Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Baza_Reklam.Raporty.faktura.xml"); |
| | 124 | ds.ReadXml(s); |
| | 125 | |
| | 126 | fAKTURYTableAdapter.FillByIdFaktury(this.rEKLAMADataSet.FAKTURY, idFakt); |
| | 127 | |
| | 128 | //ustawienie parametrów, nowych datasoure dla raportu |
| | 129 | |
| | 130 | //ustawianie danych dla raportu |
| | 131 | typComboBox.Enabled = false; |
| | 132 | |
| | 133 | raporty.FakturaDataTable fakturaDataTable = fakturaTableAdapter1.GetDataByIdFaktury(idFakt); |
| | 134 | raporty.FakturaRow faktura = (raporty.FakturaRow)fakturaDataTable.Rows[0]; |
| | 135 | |
| | 136 | if (IsFakturaPoznanOrKatowice(faktura.NUMER_ROZ, faktura.ID_NABYWCY)) |
| | 137 | reportViewer1.LocalReport.ReportEmbeddedResource = "Baza_Reklam.Raporty.fakturaKatowicePoznan.rdlc"; |
| | 138 | else |
| 102 | | idFaktury = idFakt; |
| 103 | | this.rodzaj = r; |
| 104 | | |
| 105 | | this.zapiszButton.Click += zapiszButton2_Click; |
| 106 | | |
| 107 | | fakturaTableAdapter1.Connection.ConnectionString = ConnString.getConnString().Value; |
| 108 | | fAKTURA_DETAILS2TableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; |
| 109 | | fAKTURYTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; |
| 110 | | proformaTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; |
| 111 | | |
| 112 | | ds = new DataSet(); |
| 113 | | |
| 114 | | //zczytuje dane z pliku z tlumaczeniami |
| 115 | | Stream s = Assembly.GetExecutingAssembly().GetManifestResourceStream("Baza_Reklam.Raporty.faktura.xml"); |
| 116 | | ds.ReadXml(s); |
| 117 | | |
| 118 | | fAKTURYTableAdapter.FillByIdFaktury(this.rEKLAMADataSet.FAKTURY, idFakt); |
| 119 | | |
| 120 | | //ustawienie parametrów, nowych datasoure dla raportu |
| 121 | | |
| 122 | | //ustawianie danych dla raportu |
| 123 | | typComboBox.Enabled = false; |
| 124 | | |
| 125 | | reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Faktura", fakturaTableAdapter1.GetDataByIdFaktury(idFakt))); |
| 126 | | reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("FakturaDetails2", fAKTURA_DETAILS2TableAdapter.GetDataIdFaktury(idFakt))); |
| 127 | | reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("tlumaczenia", ds.Tables[0])); |
| 128 | | |
| 129 | | List<ReportParameter> paramList = new List<ReportParameter>(); |
| 130 | | |
| 131 | | //Produkcja ma domylnie bez podpisu |
| 132 | | if (User.getUser().St_produkcja) |
| 133 | | { |
| 134 | | podpisCheckBox.CheckState = CheckState.Unchecked; |
| 135 | | } |
| 136 | | |
| 137 | | paramList.Add(new ReportParameter("podpis", podpisCheckBox.Checked.ToString(), true)); |
| 138 | | |
| 139 | | if (this.rodzaj) |
| 140 | | { |
| 141 | | paramList.Add(new ReportParameter("proforma", "True", true)); |
| 142 | | } |
| 143 | | else |
| 144 | | { |
| 145 | | paramList.Add(new ReportParameter("proforma", "False", true)); |
| 146 | | } |
| 147 | | |
| 148 | | paramList.Add(new ReportParameter("zaplacono", zaplaconoCheckBox.Checked.ToString(), true)); |
| 149 | | |
| 150 | | this.reportViewer1.LocalReport.SetParameters(paramList); |
| 151 | | |
| 152 | | jezykComboBox.SelectedIndex = 0; |
| 153 | | typComboBox.SelectedIndex = 1; |
| 154 | | } |
| | 140 | |
| | 141 | |
| | 142 | reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("Faktura", fakturaDataTable)); |
| | 143 | reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("FakturaDetails2", |
| | 144 | fAKTURA_DETAILS2TableAdapter.GetDataIdFaktury( |
| | 145 | idFakt))); |
| | 146 | reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("tlumaczenia", ds.Tables[0])); |
| | 147 | |
| | 148 | List<ReportParameter> paramList = new List<ReportParameter>(); |
| | 149 | |
| | 150 | //Produkcja ma domylnie bez podpisu |
| | 151 | if (User.getUser().St_produkcja) |
| | 152 | { |
| | 153 | podpisCheckBox.CheckState = CheckState.Unchecked; |
| | 154 | } |
| | 155 | |
| | 156 | paramList.Add(new ReportParameter("podpis", podpisCheckBox.Checked.ToString(), true)); |
| | 157 | |
| | 158 | if (this.rodzaj) |
| | 159 | { |
| | 160 | paramList.Add(new ReportParameter("proforma", "True", true)); |
| | 161 | } |
| | 162 | else |
| | 163 | { |
| | 164 | paramList.Add(new ReportParameter("proforma", "False", true)); |
| | 165 | } |
| | 166 | |
| | 167 | paramList.Add(new ReportParameter("zaplacono", zaplaconoCheckBox.Checked.ToString(), true)); |
| | 168 | |
| | 169 | this.reportViewer1.LocalReport.SetParameters(paramList); |
| | 170 | |
| | 171 | jezykComboBox.SelectedIndex = 0; |
| | 172 | typComboBox.SelectedIndex = 1; |
| | 173 | } |