| [65] | 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 | using System.ComponentModel;
|
|---|
| 4 | using System.Data;
|
|---|
| 5 | using System.Data.SqlClient;
|
|---|
| 6 | using System.Drawing;
|
|---|
| 7 | using System.Text;
|
|---|
| 8 | using System.Windows.Forms;
|
|---|
| 9 | using System.IO;
|
|---|
| 10 |
|
|---|
| 11 | namespace Baza_Reklam
|
|---|
| 12 | {
|
|---|
| 13 | public partial class OrdersForm : Form
|
|---|
| 14 | {
|
|---|
| 15 | private static OrdersForm orderForm;
|
|---|
| 16 | private SqlDataAdapter sqlDataAdapter;
|
|---|
| 17 | private SqlCommand command;
|
|---|
| 18 |
|
|---|
| 19 | bool commandExecuted = false;
|
|---|
| 20 |
|
|---|
| 21 | /// <summary>
|
|---|
| 22 | /// Do ka¿dego filtrowania musi byæ dodany warunek (r.SZER * r.WYS)<>0 !!!
|
|---|
| 23 | /// </summary>
|
|---|
| 24 | private string query = " select TOP 1000 R.*, O.OD, O.DO, datepart(year,NR.DATA_W), datepart(month,NR.DATA_W)," +
|
|---|
| 25 | " NR.DATA_W AS '1emisja', A.Symbol AS agencja, (r.[CENA JEDN] - r.[RABAT WARTOÆ]) / r.SZER * r.WYS AS [CENA MODU£U],NM.CENA_MIN, NM.CENA, K.firstname " +
|
|---|
| 26 | " fROM dbo.AGENCI A2 JOIN dbo.AGENCJE A ON A.Id_agencji = A2.ID_AGENCJI " +
|
|---|
| 27 | " right JOIN REKLAMA R ON A2.Symbol = R.[SYMBOL AKWIZYTORA] " +
|
|---|
| 28 | " left JOIN dbo.VIEW_REKLAMA_OD_DO O ON R.ReklamaID = O.ReklamaId" +
|
|---|
| 29 | " left JOIN NR ON R.TYTU£ = NR.TYT AND O.OD = NR.NRW " +
|
|---|
| 30 | " LEFT OUTER JOIN [NAZWY MODU£ÓW] NM ON r.MOD_TYP = NM.MOD_TYP" +
|
|---|
| 31 | " left outer join dbo.KLIENCI AS K on R.customerId=K.CustomerId ";
|
|---|
| 32 |
|
|---|
| 33 | public static OrdersForm getOrderForm(MDIBazaReklam parent)
|
|---|
| 34 | {
|
|---|
| 35 | if (orderForm == null) {
|
|---|
| 36 | orderForm = new OrdersForm(parent);
|
|---|
| 37 | }
|
|---|
| 38 | return orderForm;
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
| 41 | private OrdersForm(MDIBazaReklam parent)
|
|---|
| 42 | {
|
|---|
| 43 | InitializeComponent();
|
|---|
| 44 |
|
|---|
| 45 | this.MdiParent = parent;
|
|---|
| 46 |
|
|---|
| 47 | reklamaTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| 48 | reklamyZestawienieTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| 49 | fAKTURYTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| 50 | kONTATableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| 51 | kLIENCITableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| 52 |
|
|---|
| 53 | SqlConnection conn = new SqlConnection(ConnString.getConnString().Value);
|
|---|
| 54 |
|
|---|
| 55 | command = new SqlCommand();
|
|---|
| 56 | command.CommandType = CommandType.Text;
|
|---|
| 57 | command.CommandText = query;
|
|---|
| 58 | command.Connection = conn;
|
|---|
| 59 |
|
|---|
| 60 | this.sqlDataAdapter = new SqlDataAdapter();
|
|---|
| 61 | this.sqlDataAdapter.SelectCommand = command;
|
|---|
| 62 |
|
|---|
| 63 | szukajToolStrip.Items.Insert(13, new ToolStripLabel("DR"));
|
|---|
| 64 | szukajToolStrip.Items.Insert(14, new ToolStripControlHost(new CheckBox(), "DRCheckBox"));
|
|---|
| 65 |
|
|---|
| 66 | szukajToolStrip.Items.Insert(15, new ToolStripLabel("FW"));
|
|---|
| 67 | szukajToolStrip.Items.Insert(16, new ToolStripControlHost(new CheckBox(), "FWCheckBox"));
|
|---|
| 68 |
|
|---|
| 69 | szukajToolStrip.Items.Insert(17, new ToolStripLabel("KZ"));
|
|---|
| 70 | szukajToolStrip.Items.Insert(18, new ToolStripControlHost(new CheckBox(), "KZCheckBox"));
|
|---|
| 71 |
|
|---|
| 72 | szukajToolStrip.Items.Insert(19, new ToolStripLabel("PR"));
|
|---|
| 73 | szukajToolStrip.Items.Insert(20, new ToolStripControlHost(new CheckBox(), "PRCheckBox"));
|
|---|
| 74 |
|
|---|
| 75 | szukajToolStrip.Items.Insert(21, new ToolStripLabel("ZP"));
|
|---|
| 76 | szukajToolStrip.Items.Insert(22, new ToolStripControlHost(new CheckBox(), "ZPCheckBox"));
|
|---|
| 77 |
|
|---|
| 78 | szukajToolStrip.Items.Insert(23, new ToolStripLabel("WYR"));
|
|---|
| 79 | szukajToolStrip.Items.Insert(24, new ToolStripControlHost(new CheckBox(), "WyrCheckBox"));
|
|---|
| 80 |
|
|---|
| 81 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["DRCheckBox"]).Control).ThreeState = true;
|
|---|
| 82 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["FWCheckBox"]).Control).ThreeState = true;
|
|---|
| 83 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["KZCheckBox"]).Control).ThreeState = true;
|
|---|
| 84 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["PRCheckBox"]).Control).ThreeState = true;
|
|---|
| 85 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["ZPCheckBox"]).Control).ThreeState = true;
|
|---|
| 86 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["WyrCheckBox"]).Control).ThreeState = true;
|
|---|
| 87 |
|
|---|
| 88 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["DRCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 89 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["FWCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 90 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["KZCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 91 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["PRCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 92 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["ZPCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 93 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["WyrCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 94 |
|
|---|
| 95 | generateNodes();
|
|---|
| 96 |
|
|---|
| 97 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 98 |
|
|---|
| 99 | command.CommandText = query;
|
|---|
| 100 | }
|
|---|
| 101 |
|
|---|
| 102 | private void OrdersForm_Load(object sender, EventArgs e)
|
|---|
| 103 | {
|
|---|
| 104 | this.kONTATableAdapter.FillByIdAgencji(this.sLOWNIKDataSet.KONTA,User.getUser().IdAgencji);
|
|---|
| 105 | this.WindowState = FormWindowState.Maximized;
|
|---|
| 106 |
|
|---|
| 107 | DBBindings.bindujAgencje(agencjaToolStripComboBox);
|
|---|
| 108 | DBBindings.bindujAgentow(agentToolStripComboBox);
|
|---|
| 109 | DBBindings.bindujTytuly(tytToolStripComboBox);
|
|---|
| 110 | DBBindings.bindujTypyReklam(typToolStripComboBox);
|
|---|
| 111 |
|
|---|
| 112 | }
|
|---|
| 113 |
|
|---|
| 114 | private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
|
|---|
| 115 | {
|
|---|
| 116 | if (e.Node != null)
|
|---|
| 117 | {
|
|---|
| 118 | command.CommandText = query;
|
|---|
| 119 | command.Parameters.Clear();
|
|---|
| 120 |
|
|---|
| 121 | switch (e.Node.Level)
|
|---|
| 122 | {
|
|---|
| 123 | case 0:
|
|---|
| 124 | break;
|
|---|
| 125 | case 1:
|
|---|
| 126 | switch (e.Node.Parent.Name)
|
|---|
| 127 | {
|
|---|
| 128 | case "Tytuly":
|
|---|
| 129 |
|
|---|
| 130 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 131 |
|
|---|
| 132 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 133 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 134 | command.CommandText += " where R.[Tytu³]=@tytul aND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 135 | command.Parameters.AddWithValue("@tytul", e.Node.Name);
|
|---|
| 136 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 137 | commandExecuted = true;
|
|---|
| 138 | reklamaDataGridView.Refresh();
|
|---|
| 139 |
|
|---|
| 140 | this.Cursor = Cursors.Default;
|
|---|
| 141 |
|
|---|
| 142 | break;
|
|---|
| 143 | case "ZatwierdzoneNiezaplacone":
|
|---|
| 144 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 145 |
|
|---|
| 146 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 147 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 148 | command.CommandText += " where A.symbol=@agencja AND R.[typ]!='BEZP£ATNA' AND R.[typ]!='REKLAMACJA' AND R.[ZATWIERDZONO DO DRUKU]=1 AND R.[ZAP£ACONO]=0 aND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 149 | command.Parameters.AddWithValue("@agencja", e.Node.Text);
|
|---|
| 150 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 151 | commandExecuted = true;
|
|---|
| 152 | reklamaDataGridView.Refresh();
|
|---|
| 153 |
|
|---|
| 154 | this.Cursor = Cursors.Default;
|
|---|
| 155 |
|
|---|
| 156 | break;
|
|---|
| 157 | case "ZmodyfikowaneDzisiaj":
|
|---|
| 158 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 159 |
|
|---|
| 160 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 161 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 162 | command.CommandText += " where A.symbol=@agencja AND [DATA OSTATNIEJ MODYFIKACJI]>@dzis aND [DATA OSTATNIEJ MODYFIKACJI]< @jutro AND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 163 | command.Parameters.AddWithValue("@agencja", e.Node.Text);
|
|---|
| 164 | command.Parameters.AddWithValue("@dzis", DateTime.Today.ToShortDateString());
|
|---|
| 165 | command.Parameters.AddWithValue("@jutro", DateTime.Today.AddDays(1).ToShortDateString());
|
|---|
| 166 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 167 | commandExecuted = true;
|
|---|
| 168 | reklamaDataGridView.Refresh();
|
|---|
| 169 |
|
|---|
| 170 | this.Cursor = Cursors.Default;
|
|---|
| 171 |
|
|---|
| 172 | break;
|
|---|
| 173 | case "DodaneDzisiaj":
|
|---|
| 174 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 175 |
|
|---|
| 176 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 177 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 178 | command.CommandText += " where A.symbol=@agencja AND [DATA ZAMÓWIENIA]>@dzis aND [DATA ZAMÓWIENIA]<@jutro AND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 179 | command.Parameters.AddWithValue("@agencja", e.Node.Text);
|
|---|
| 180 | command.Parameters.AddWithValue("@dzis", DateTime.Today.ToShortDateString());
|
|---|
| 181 | command.Parameters.AddWithValue("@jutro", DateTime.Today.AddDays(1).ToShortDateString());
|
|---|
| 182 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 183 | commandExecuted = true;
|
|---|
| 184 | reklamaDataGridView.Refresh();
|
|---|
| 185 |
|
|---|
| 186 | this.Cursor = Cursors.Default;
|
|---|
| 187 |
|
|---|
| 188 | break;
|
|---|
| 189 | case "MojeZamowienia":
|
|---|
| 190 |
|
|---|
| 191 | switch (e.Node.Name)
|
|---|
| 192 | {
|
|---|
| 193 | case "ZatwierdzoneNiezaplacone":
|
|---|
| 194 |
|
|---|
| 195 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 196 |
|
|---|
| 197 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 198 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 199 | command.CommandText += " where R.[symbol akwizytora]=@agent AND R.[typ]!='BEZP£ATNA' AND R.[typ]!='REKLAMACJA' AND R.[ZATWIERDZONO DO DRUKU]=1 AND R.[ZAP£ACONO]=0 aND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 200 | command.Parameters.AddWithValue("@agent", User.getUser().Symbol_agenta);
|
|---|
| 201 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 202 | commandExecuted = true;
|
|---|
| 203 | reklamaDataGridView.Refresh();
|
|---|
| 204 |
|
|---|
| 205 | this.Cursor = Cursors.Default;
|
|---|
| 206 |
|
|---|
| 207 | break;
|
|---|
| 208 | default:
|
|---|
| 209 |
|
|---|
| 210 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 211 |
|
|---|
| 212 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 213 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 214 | command.CommandText += " where R.[symbol akwizytora]=@agent AND R.[Tytu³]=@tytul aND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 215 | command.Parameters.AddWithValue("@agent", User.getUser().Symbol_agenta);
|
|---|
| 216 | command.Parameters.AddWithValue("@tytul", e.Node.Name);
|
|---|
| 217 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 218 | commandExecuted = true;
|
|---|
| 219 | reklamaDataGridView.Refresh();
|
|---|
| 220 |
|
|---|
| 221 | this.Cursor = Cursors.Default;
|
|---|
| 222 |
|
|---|
| 223 | break;
|
|---|
| 224 | }
|
|---|
| 225 | break;
|
|---|
| 226 | case "Bledy":
|
|---|
| 227 | switch (e.Node.Name)
|
|---|
| 228 | {
|
|---|
| 229 | case "BledyWreklamach":
|
|---|
| 230 |
|
|---|
| 231 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 232 |
|
|---|
| 233 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 234 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 235 | command.CommandText += "WHERE ((r.MOD_TYP LIKE 'GS%' AND r.[TYTU£] LIKE 'AMT%') OR (r.MOD_TYP LIKE 'AMT%' AND " +
|
|---|
| 236 | "r.[TYTU£] LIKE 'GS%') OR (r.TYP = 'P£ATNA' AND r.NETTO = 0) OR (r.TYP = 'BEZP£ATNA' AND r.NETTO > 0)) " +
|
|---|
| 237 | " aND (r.SZER * r.WYS)<>0 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 238 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 239 | commandExecuted = true;
|
|---|
| 240 | reklamaDataGridView.Refresh();
|
|---|
| 241 |
|
|---|
| 242 | this.Cursor = Cursors.Default;
|
|---|
| 243 |
|
|---|
| 244 | break;
|
|---|
| 245 | case "PowtorzeniaReklam":
|
|---|
| 246 |
|
|---|
| 247 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 248 |
|
|---|
| 249 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 250 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 251 | command.CommandText += "WHERE R.[ID REKLAMY] in (select [ID REKLAMY] from (SELECT [ID REKLAMY]," +
|
|---|
| 252 | "COUNT([ID REKLAMY]) AS NumOccurrences FROM dbo.REKLAMA GROUP BY [ID REKLAMY] " +
|
|---|
| 253 | "HAVING ( COUNT([ID REKLAMY]) > 1 ) ) as d) AND datediff(month,R.[DATA ZAMÓWIENIA],getdate()) <= 3 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 254 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 255 | commandExecuted = true;
|
|---|
| 256 | reklamaDataGridView.Refresh();
|
|---|
| 257 |
|
|---|
| 258 | this.Cursor = Cursors.Default;
|
|---|
| 259 |
|
|---|
| 260 | break;
|
|---|
| 261 | case "Moduly":
|
|---|
| 262 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 263 |
|
|---|
| 264 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 265 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 266 | command.CommandText = command.CommandText.Replace("(r.[CENA JEDN] - r.[RABAT WARTOÆ]) / r.SZER * r.WYS AS [CENA MODU£U]", "0");
|
|---|
| 267 | command.CommandText += "WHERE (r.SZER =0 or r.WYS=0) and year(R.[DATA ZAMÓWIENIA])>=2007 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 268 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 269 | commandExecuted = true;
|
|---|
| 270 | reklamaDataGridView.Refresh();
|
|---|
| 271 |
|
|---|
| 272 | this.Cursor = Cursors.Default;
|
|---|
| 273 |
|
|---|
| 274 | break;
|
|---|
| 275 | default:
|
|---|
| 276 | break;
|
|---|
| 277 | }
|
|---|
| 278 | break;
|
|---|
| 279 | case "AnalizaCenyModulu":
|
|---|
| 280 | switch (e.Node.Name)
|
|---|
| 281 | {
|
|---|
| 282 | case "ZaTani50":
|
|---|
| 283 |
|
|---|
| 284 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 285 |
|
|---|
| 286 | analizaCenyModuluColumns();
|
|---|
| 287 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 288 | command.CommandText += "WHERE (R.SZER * R.WYS <> 0) AND (((R.[CENA JEDN] - R.[RABAT WARTOÆ]) " +
|
|---|
| 289 | "/ (R.SZER * R.WYS))<NM.[CENA]/2) AND datediff(month,R.[DATA ZAMÓWIENIA],getdate()) <= 3 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 290 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 291 | commandExecuted = true;
|
|---|
| 292 | reklamaDataGridView.Refresh();
|
|---|
| 293 |
|
|---|
| 294 | this.Cursor = Cursors.Default;
|
|---|
| 295 |
|
|---|
| 296 | break;
|
|---|
| 297 | case "ZaTani30":
|
|---|
| 298 |
|
|---|
| 299 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 300 |
|
|---|
| 301 | analizaCenyModuluColumns();
|
|---|
| 302 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 303 | command.CommandText += "WHERE (R.SZER * R.WYS <> 0) AND (((R.[CENA JEDN] - R.[RABAT WARTOÆ]) " +
|
|---|
| 304 | "/ (R.SZER * R.WYS))<NM.[CENA_MIN]) AND datediff(month,R.[DATA ZAMÓWIENIA],getdate()) <= 3 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 305 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 306 | commandExecuted = true;
|
|---|
| 307 | reklamaDataGridView.Refresh();
|
|---|
| 308 |
|
|---|
| 309 | this.Cursor = Cursors.Default;
|
|---|
| 310 |
|
|---|
| 311 | break;
|
|---|
| 312 | case "ZaDrogi":
|
|---|
| 313 |
|
|---|
| 314 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 315 |
|
|---|
| 316 | analizaCenyModuluColumns();
|
|---|
| 317 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 318 | command.CommandText += "WHERE (R.SZER * R.WYS <> 0) AND (((R.[CENA JEDN] - R.[RABAT WARTOÆ]) " +
|
|---|
| 319 | "/( R.SZER * R.WYS))>NM.[CENA]) AND datediff(month,R.[DATA ZAMÓWIENIA],getdate()) <= 3 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 320 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 321 | commandExecuted = true;
|
|---|
| 322 | reklamaDataGridView.Refresh();
|
|---|
| 323 |
|
|---|
| 324 | this.Cursor = Cursors.Default;
|
|---|
| 325 |
|
|---|
| 326 | break;
|
|---|
| 327 | default:
|
|---|
| 328 | break;
|
|---|
| 329 | }
|
|---|
| 330 | break;
|
|---|
| 331 | default:
|
|---|
| 332 | break;
|
|---|
| 333 | }
|
|---|
| 334 | break;
|
|---|
| 335 | case 2:
|
|---|
| 336 | switch (e.Node.Parent.Parent.Name)
|
|---|
| 337 | {
|
|---|
| 338 | case "Tytuly":
|
|---|
| 339 |
|
|---|
| 340 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 341 |
|
|---|
| 342 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 343 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 344 | command.CommandText += " where R.[Tytu³]=@tytul and datepart(year,NR.DATA_W)=@rok aND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 345 | command.Parameters.AddWithValue("@tytul", e.Node.Parent.Name);
|
|---|
| 346 | command.Parameters.AddWithValue("@rok", e.Node.Name);
|
|---|
| 347 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 348 | commandExecuted = true;
|
|---|
| 349 | reklamaDataGridView.Refresh();
|
|---|
| 350 |
|
|---|
| 351 | this.Cursor = Cursors.Default;
|
|---|
| 352 |
|
|---|
| 353 | break;
|
|---|
| 354 | case "MojeZamowienia":
|
|---|
| 355 |
|
|---|
| 356 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 357 |
|
|---|
| 358 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 359 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 360 | command.CommandText += " where R.[symbol akwizytora]=@agent AND R.[Tytu³]=@tytul and datepart(year,NR.DATA_W)=@rok aND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 361 | command.Parameters.AddWithValue("@agent", User.getUser().Symbol_agenta);
|
|---|
| 362 | command.Parameters.AddWithValue("@tytul", e.Node.Parent.Name);
|
|---|
| 363 | command.Parameters.AddWithValue("@rok", e.Node.Name);
|
|---|
| 364 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 365 | commandExecuted = true;
|
|---|
| 366 | reklamaDataGridView.Refresh();
|
|---|
| 367 |
|
|---|
| 368 | this.Cursor = Cursors.Default;
|
|---|
| 369 |
|
|---|
| 370 | break;
|
|---|
| 371 | case "KoniecEmisji":
|
|---|
| 372 |
|
|---|
| 373 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 374 |
|
|---|
| 375 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 376 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 377 | command.CommandText += " where R.[Tytu³]=@tytul and O.DO=@nrWyd aND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 378 | command.Parameters.AddWithValue("@tytul", e.Node.Parent.Name);
|
|---|
| 379 | command.Parameters.AddWithValue("@nrWyd", e.Node.Name);
|
|---|
| 380 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 381 | commandExecuted = true;
|
|---|
| 382 | reklamaDataGridView.Refresh();
|
|---|
| 383 |
|
|---|
| 384 | this.Cursor = Cursors.Default;
|
|---|
| 385 |
|
|---|
| 386 | break;
|
|---|
| 387 | case "ZatwierdzoneNiezaplacone":
|
|---|
| 388 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 389 |
|
|---|
| 390 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 391 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 392 | command.CommandText += " where R.[symbol akwizytora]=@agent AND R.[typ]!='BEZP£ATNA' AND R.[typ]!='REKLAMACJA' AND R.[ZATWIERDZONO DO DRUKU]=1 AND R.[ZAP£ACONO]=0 aND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 393 | command.Parameters.AddWithValue("@agent", e.Node.Name);
|
|---|
| 394 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 395 | commandExecuted = true;
|
|---|
| 396 | reklamaDataGridView.Refresh();
|
|---|
| 397 |
|
|---|
| 398 | this.Cursor = Cursors.Default;
|
|---|
| 399 |
|
|---|
| 400 | break;
|
|---|
| 401 | case "ZmodyfikowaneDzisiaj":
|
|---|
| 402 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 403 |
|
|---|
| 404 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 405 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 406 | command.CommandText += " where R.[symbol akwizytora]=@agent aND [DATA OSTATNIEJ MODYFIKACJI]>@dzis aND [DATA OSTATNIEJ MODYFIKACJI]< @jutro AND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 407 | command.Parameters.AddWithValue("@agent", e.Node.Name);
|
|---|
| 408 | command.Parameters.AddWithValue("@dzis", DateTime.Today.ToShortDateString());
|
|---|
| 409 | command.Parameters.AddWithValue("@jutro", DateTime.Today.AddDays(1).ToShortDateString());
|
|---|
| 410 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 411 | commandExecuted = true;
|
|---|
| 412 | reklamaDataGridView.Refresh();
|
|---|
| 413 |
|
|---|
| 414 | this.Cursor = Cursors.Default;
|
|---|
| 415 |
|
|---|
| 416 | break;
|
|---|
| 417 | case "DodaneDzisiaj":
|
|---|
| 418 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 419 |
|
|---|
| 420 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 421 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 422 | command.CommandText += " where R.[symbol akwizytora]=@agent aND [DATA ZAMÓWIENIA]>@dzis aND [DATA ZAMÓWIENIA]<@jutro AND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 423 | command.Parameters.AddWithValue("@agent", e.Node.Name);
|
|---|
| 424 | command.Parameters.AddWithValue("@dzis", DateTime.Today.ToShortDateString());
|
|---|
| 425 | command.Parameters.AddWithValue("@jutro", DateTime.Today.AddDays(1).ToShortDateString());
|
|---|
| 426 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 427 | commandExecuted = true;
|
|---|
| 428 | reklamaDataGridView.Refresh();
|
|---|
| 429 |
|
|---|
| 430 | this.Cursor = Cursors.Default;
|
|---|
| 431 |
|
|---|
| 432 | break;
|
|---|
| 433 | case "AnalizaCenyModulu":
|
|---|
| 434 | switch (e.Node.Parent.Name)
|
|---|
| 435 | {
|
|---|
| 436 | case "ZaTani50":
|
|---|
| 437 |
|
|---|
| 438 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 439 |
|
|---|
| 440 | analizaCenyModuluColumns();
|
|---|
| 441 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 442 | command.CommandText += "WHERE (R.SZER * R.WYS <> 0) AND (((R.[CENA JEDN] - R.[RABAT WARTOÆ]) " +
|
|---|
| 443 | "/ (R.SZER * R.WYS))<NM.[CENA]/2) AND A.symbol=@agencja AND datediff(month,R.[DATA ZAMÓWIENIA],getdate()) <= 3 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 444 | command.Parameters.AddWithValue("@agencja", e.Node.Text);
|
|---|
| 445 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 446 | commandExecuted = true;
|
|---|
| 447 | reklamaDataGridView.Refresh();
|
|---|
| 448 |
|
|---|
| 449 | this.Cursor = Cursors.Default;
|
|---|
| 450 |
|
|---|
| 451 | break;
|
|---|
| 452 | case "ZaTani30":
|
|---|
| 453 |
|
|---|
| 454 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 455 |
|
|---|
| 456 | analizaCenyModuluColumns();
|
|---|
| 457 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 458 | command.CommandText += "WHERE (R.SZER * R.WYS <> 0) AND (((R.[CENA JEDN] - R.[RABAT WARTOÆ]) " +
|
|---|
| 459 | "/ (R.SZER * R.WYS))<NM.[CENA_MIN]) AND A.symbol=@agencja AND datediff(month,R.[DATA ZAMÓWIENIA],getdate()) <= 3 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 460 | command.Parameters.AddWithValue("@agencja", e.Node.Text);
|
|---|
| 461 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 462 | commandExecuted = true;
|
|---|
| 463 | reklamaDataGridView.Refresh();
|
|---|
| 464 |
|
|---|
| 465 | this.Cursor = Cursors.Default;
|
|---|
| 466 |
|
|---|
| 467 | break;
|
|---|
| 468 | case "ZaDrogi":
|
|---|
| 469 |
|
|---|
| 470 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 471 |
|
|---|
| 472 | analizaCenyModuluColumns();
|
|---|
| 473 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 474 | command.CommandText += "WHERE (R.SZER * R.WYS <> 0) AND (((R.[CENA JEDN] - R.[RABAT WARTOÆ]) " +
|
|---|
| 475 | "/( R.SZER * R.WYS))>NM.[CENA]) AND A.symbol=@agencja AND datediff(month,R.[DATA ZAMÓWIENIA],getdate()) <= 3 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 476 | command.Parameters.AddWithValue("@agencja", e.Node.Text);
|
|---|
| 477 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 478 | commandExecuted = true;
|
|---|
| 479 | reklamaDataGridView.Refresh();
|
|---|
| 480 |
|
|---|
| 481 | this.Cursor = Cursors.Default;
|
|---|
| 482 |
|
|---|
| 483 | break;
|
|---|
| 484 |
|
|---|
| 485 | default:
|
|---|
| 486 | break;
|
|---|
| 487 | }
|
|---|
| 488 | break;
|
|---|
| 489 | default:
|
|---|
| 490 | break;
|
|---|
| 491 | }
|
|---|
| 492 | break;
|
|---|
| 493 |
|
|---|
| 494 | case 3:
|
|---|
| 495 | switch (e.Node.Parent.Parent.Parent.Name)
|
|---|
| 496 | {
|
|---|
| 497 | case "Tytuly":
|
|---|
| 498 |
|
|---|
| 499 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 500 |
|
|---|
| 501 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 502 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 503 | command.CommandText += " where R.[Tytu³]=@tytul and datepart(year,NR.DATA_W)=@rok and datepart(month,NR.DATA_W)=@miesiac aND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 504 | command.Parameters.AddWithValue("@tytul", e.Node.Parent.Parent.Name);
|
|---|
| 505 | command.Parameters.AddWithValue("@rok", e.Node.Parent.Name);
|
|---|
| 506 | command.Parameters.AddWithValue("@miesiac", e.Node.Name);
|
|---|
| 507 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 508 | commandExecuted = true;
|
|---|
| 509 | reklamaDataGridView.Refresh();
|
|---|
| 510 |
|
|---|
| 511 | this.Cursor = Cursors.Default;
|
|---|
| 512 |
|
|---|
| 513 | break;
|
|---|
| 514 | case "MojeZamowienia":
|
|---|
| 515 |
|
|---|
| 516 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 517 |
|
|---|
| 518 | zatwierdzoneNiezaplaconeColumns();
|
|---|
| 519 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 520 | command.CommandText += " where R.[symbol akwizytora]=@agent AND R.[Tytu³]=@tytul and datepart(year,NR.DATA_W)=@rok and datepart(month,NR.DATA_W)=@miesiac aND (r.SZER * r.WYS)<>0 order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 521 | command.Parameters.AddWithValue("@agent", User.getUser().Symbol_agenta);
|
|---|
| 522 | command.Parameters.AddWithValue("@tytul", e.Node.Parent.Parent.Name);
|
|---|
| 523 | command.Parameters.AddWithValue("@rok", e.Node.Parent.Name);
|
|---|
| 524 | command.Parameters.AddWithValue("@miesiac", e.Node.Name);
|
|---|
| 525 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 526 | commandExecuted = true;
|
|---|
| 527 | reklamaDataGridView.Refresh();
|
|---|
| 528 |
|
|---|
| 529 | this.Cursor = Cursors.Default;
|
|---|
| 530 |
|
|---|
| 531 | break;
|
|---|
| 532 | case "AnalizaCenyModulu":
|
|---|
| 533 | switch (e.Node.Parent.Parent.Name)
|
|---|
| 534 | {
|
|---|
| 535 | case "ZaTani50":
|
|---|
| 536 |
|
|---|
| 537 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 538 |
|
|---|
| 539 | analizaCenyModuluColumns();
|
|---|
| 540 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 541 | command.CommandText += "WHERE (R.SZER * R.WYS <> 0) AND (((R.[CENA JEDN] - R.[RABAT WARTOÆ]) " +
|
|---|
| 542 | "/ (R.SZER * R.WYS))<NM.[CENA]/2) AND A.symbol=@agencja AND R.[symbol akwizytora]=@agent AND datediff(month,R.[DATA ZAMÓWIENIA],getdate()) <= 3 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 543 | command.Parameters.AddWithValue("@agencja", e.Node.Parent.Text);
|
|---|
| 544 | command.Parameters.AddWithValue("@agent", e.Node.Name);
|
|---|
| 545 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 546 | commandExecuted = true;
|
|---|
| 547 | reklamaDataGridView.Refresh();
|
|---|
| 548 |
|
|---|
| 549 | this.Cursor = Cursors.Default;
|
|---|
| 550 |
|
|---|
| 551 | break;
|
|---|
| 552 | case "ZaTani30":
|
|---|
| 553 |
|
|---|
| 554 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 555 |
|
|---|
| 556 | analizaCenyModuluColumns();
|
|---|
| 557 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 558 | command.CommandText += "WHERE (R.SZER * R.WYS <> 0) AND (((R.[CENA JEDN] - R.[RABAT WARTOÆ]) " +
|
|---|
| 559 | "/ (R.SZER * R.WYS))<NM.[CENA_MIN]) AND A.symbol=@agencja AND R.[symbol akwizytora]=@agent AND datediff(month,R.[DATA ZAMÓWIENIA],getdate()) <= 3 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 560 | command.Parameters.AddWithValue("@agencja", e.Node.Parent.Text);
|
|---|
| 561 | command.Parameters.AddWithValue("@agent", e.Node.Name);
|
|---|
| 562 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 563 | commandExecuted = true;
|
|---|
| 564 | reklamaDataGridView.Refresh();
|
|---|
| 565 |
|
|---|
| 566 | this.Cursor = Cursors.Default;
|
|---|
| 567 |
|
|---|
| 568 | break;
|
|---|
| 569 | case "ZaDrogi":
|
|---|
| 570 |
|
|---|
| 571 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 572 |
|
|---|
| 573 | analizaCenyModuluColumns();
|
|---|
| 574 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 575 | command.CommandText += "WHERE (R.SZER * R.WYS <> 0) AND (((R.[CENA JEDN] - R.[RABAT WARTOÆ]) " +
|
|---|
| 576 | "/( R.SZER * R.WYS))>NM.[CENA]) AND A.symbol=@agencja AND R.[symbol akwizytora]=@agent AND datediff(month,R.[DATA ZAMÓWIENIA],getdate()) <= 3 ORDER BY R.[DATA ZAMÓWIENIA] DESC";
|
|---|
| 577 | command.Parameters.AddWithValue("@agencja", e.Node.Parent.Text);
|
|---|
| 578 | command.Parameters.AddWithValue("@agent", e.Node.Name);
|
|---|
| 579 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 580 | commandExecuted = true;
|
|---|
| 581 | reklamaDataGridView.Refresh();
|
|---|
| 582 |
|
|---|
| 583 | this.Cursor = Cursors.Default;
|
|---|
| 584 |
|
|---|
| 585 | break;
|
|---|
| 586 |
|
|---|
| 587 | default:
|
|---|
| 588 | break;
|
|---|
| 589 | }
|
|---|
| 590 | break;
|
|---|
| 591 | default:
|
|---|
| 592 | break;
|
|---|
| 593 | }
|
|---|
| 594 | break;
|
|---|
| 595 | default:
|
|---|
| 596 | break;
|
|---|
| 597 | }
|
|---|
| 598 | }
|
|---|
| 599 | }
|
|---|
| 600 |
|
|---|
| 601 | private void toolStripButton6_Click(object sender, EventArgs e)
|
|---|
| 602 | {
|
|---|
| 603 | szukajToolStrip.Visible = szukajToolStrip.Visible ? false : true;
|
|---|
| 604 | }
|
|---|
| 605 |
|
|---|
| 606 | private void szukajToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 607 | {
|
|---|
| 608 | command.CommandText = query;
|
|---|
| 609 |
|
|---|
| 610 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 611 |
|
|---|
| 612 | command.CommandText += " where 1=1 AND (r.SZER * r.WYS)<>0 ";
|
|---|
| 613 |
|
|---|
| 614 | command.Parameters.Clear();
|
|---|
| 615 |
|
|---|
| 616 | if (agencjaToolStripComboBox.Text.Trim() != "")
|
|---|
| 617 | {
|
|---|
| 618 | command.CommandText += " AND A.Symbol=@agencja ";
|
|---|
| 619 | command.Parameters.AddWithValue("@agencja", agencjaToolStripComboBox.Text.Trim());
|
|---|
| 620 | }
|
|---|
| 621 |
|
|---|
| 622 | if (agentToolStripComboBox.Text.Trim() != "")
|
|---|
| 623 | {
|
|---|
| 624 | command.CommandText += "AND ([symbol akwizytora] like '%' + @agent + '%' )";
|
|---|
| 625 | command.Parameters.AddWithValue("@agent", agentToolStripComboBox.Text.Trim());
|
|---|
| 626 |
|
|---|
| 627 | }
|
|---|
| 628 |
|
|---|
| 629 | if (symbolToolStripTextBox.Text.Trim() != "")
|
|---|
| 630 | {
|
|---|
| 631 | command.CommandText += "AND r.[id reklamy] like '%' + @symbol + '%' ";
|
|---|
| 632 | command.Parameters.AddWithValue("@symbol", symbolToolStripTextBox.Text.Trim());
|
|---|
| 633 |
|
|---|
| 634 | }
|
|---|
| 635 |
|
|---|
| 636 | if (rokToolStripTextBox.Text.Trim() != "")
|
|---|
| 637 | {
|
|---|
| 638 | int i;
|
|---|
| 639 | if (!Int32.TryParse(rokToolStripTextBox.Text.Trim(),out i)) {
|
|---|
| 640 | MessageBox.Show("Podaj prawid³owy rok.");
|
|---|
| 641 | this.Cursor = Cursors.Default;
|
|---|
| 642 | return;
|
|---|
| 643 | }
|
|---|
| 644 |
|
|---|
| 645 | command.CommandText += "AND DATEPART(yyyy,NR.DATA_W)=@rok ";
|
|---|
| 646 | command.Parameters.AddWithValue("@rok", rokToolStripTextBox.Text.Trim());
|
|---|
| 647 | }
|
|---|
| 648 |
|
|---|
| 649 | if (msToolStripTextBox.Text.Trim() != "")
|
|---|
| 650 | {
|
|---|
| 651 | int i;
|
|---|
| 652 | if (!Int32.TryParse(msToolStripTextBox.Text.Trim(), out i))
|
|---|
| 653 | {
|
|---|
| 654 | MessageBox.Show("Podaj prawid³owy miesi¹c.");
|
|---|
| 655 | this.Cursor = Cursors.Default;
|
|---|
| 656 | return;
|
|---|
| 657 | }
|
|---|
| 658 |
|
|---|
| 659 | command.CommandText += "AND DATEPART(month,NR.DATA_W)=@ms ";
|
|---|
| 660 | command.Parameters.AddWithValue("@ms", msToolStripTextBox.Text.Trim());
|
|---|
| 661 | }
|
|---|
| 662 |
|
|---|
| 663 |
|
|---|
| 664 | if (tytToolStripComboBox.SelectedIndex != -1)
|
|---|
| 665 | {
|
|---|
| 666 | command.CommandText += "AND R.[tytu³]=@tytul ";
|
|---|
| 667 | command.Parameters.AddWithValue("@tytul",tytToolStripComboBox.Text.Trim());
|
|---|
| 668 | }
|
|---|
| 669 |
|
|---|
| 670 | if (typToolStripComboBox.Text.Trim() != "")
|
|---|
| 671 | {
|
|---|
| 672 | command.CommandText += "AND R.[TYP]=@typ ";
|
|---|
| 673 | command.Parameters.AddWithValue("@typ", typToolStripComboBox.Text.Trim());
|
|---|
| 674 | }
|
|---|
| 675 |
|
|---|
| 676 | if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["DRCheckBox"]).Control).CheckState == CheckState.Checked) {
|
|---|
| 677 | command.CommandText += " AND R.[ZATWIERDZONO DO DRUKU]=1 ";
|
|---|
| 678 | }
|
|---|
| 679 | else if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["DRCheckBox"]).Control).CheckState == CheckState.Unchecked) {
|
|---|
| 680 | command.CommandText += " AND R.[ZATWIERDZONO DO DRUKU]=0 ";
|
|---|
| 681 | }
|
|---|
| 682 |
|
|---|
| 683 | if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["FWCheckBox"]).Control).CheckState == CheckState.Checked)
|
|---|
| 684 | {
|
|---|
| 685 | command.CommandText += "AND R.[FAKTURA WYSTAWIONO]=1 ";
|
|---|
| 686 | }
|
|---|
| 687 | else if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["FWCheckBox"]).Control).CheckState == CheckState.Unchecked)
|
|---|
| 688 | {
|
|---|
| 689 | command.CommandText += "AND R.[FAKTURA WYSTAWIONO]=0 ";
|
|---|
| 690 | }
|
|---|
| 691 |
|
|---|
| 692 | if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["KZCheckBox"]).Control).CheckState == CheckState.Checked)
|
|---|
| 693 | {
|
|---|
| 694 | command.CommandText += " AND R.[kier_zatwierdzil]=1 ";
|
|---|
| 695 | }
|
|---|
| 696 | else if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["KZCheckBox"]).Control).CheckState == CheckState.Unchecked)
|
|---|
| 697 | {
|
|---|
| 698 | command.CommandText += " AND R.[kier_zatwierdzil]=0 ";
|
|---|
| 699 | }
|
|---|
| 700 |
|
|---|
| 701 | if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["PRCheckBox"]).Control).CheckState == CheckState.Checked)
|
|---|
| 702 | {
|
|---|
| 703 | command.CommandText += " AND R.[zablokuj_prowizje]=1 ";
|
|---|
| 704 | }
|
|---|
| 705 | else if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["PRCheckBox"]).Control).CheckState == CheckState.Unchecked)
|
|---|
| 706 | {
|
|---|
| 707 | command.CommandText += " AND R.[zablokuj_prowizje]=0 ";
|
|---|
| 708 | }
|
|---|
| 709 |
|
|---|
| 710 | if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["ZPCheckBox"]).Control).CheckState == CheckState.Checked)
|
|---|
| 711 | {
|
|---|
| 712 | command.CommandText += " AND R.[ZAP£ACONO]=1 ";
|
|---|
| 713 | } if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["ZPCheckBox"]).Control).CheckState == CheckState.Unchecked)
|
|---|
| 714 | {
|
|---|
| 715 | command.CommandText += " AND R.[ZAP£ACONO]=0 ";
|
|---|
| 716 | }
|
|---|
| 717 |
|
|---|
| 718 | if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["WyrCheckBox"]).Control).CheckState == CheckState.Checked)
|
|---|
| 719 | {
|
|---|
| 720 | command.CommandText += " AND R.[wyroznienie]=1 ";
|
|---|
| 721 | } if (((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["WyrCheckBox"]).Control).CheckState == CheckState.Unchecked)
|
|---|
| 722 | {
|
|---|
| 723 | command.CommandText += " AND R.[wyroznienie]=0 ";
|
|---|
| 724 | }
|
|---|
| 725 |
|
|---|
| 726 |
|
|---|
| 727 | command.CommandText += " order by R.[DATA ZAMÓWIENIA] desc";
|
|---|
| 728 |
|
|---|
| 729 | sqlDataAdapter.SelectCommand = command;
|
|---|
| 730 |
|
|---|
| 731 | //MessageBox.Show(sqlDataAdapter.SelectCommand.CommandText);
|
|---|
| 732 |
|
|---|
| 733 | /*
|
|---|
| 734 | this.rEKLAMADataSet.REKLAMA.Clear();
|
|---|
| 735 | try
|
|---|
| 736 | {
|
|---|
| 737 | sqlDataAdapter.Fill(this.rEKLAMADataSet.REKLAMA);
|
|---|
| 738 | }
|
|---|
| 739 | catch (Exception e1)
|
|---|
| 740 | {
|
|---|
| 741 | MessageBox.Show(e1.Message);
|
|---|
| 742 | }
|
|---|
| 743 | */
|
|---|
| 744 |
|
|---|
| 745 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 746 |
|
|---|
| 747 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 748 | commandExecuted = true;
|
|---|
| 749 |
|
|---|
| 750 | reklamaDataGridView.Refresh();
|
|---|
| 751 |
|
|---|
| 752 | treeView1.CollapseAll();
|
|---|
| 753 | treeView1.SelectedNode = null;
|
|---|
| 754 |
|
|---|
| 755 | this.Cursor = Cursors.Default;
|
|---|
| 756 |
|
|---|
| 757 | //MessageBox.Show("Wyszukiwanie zakoñczone");
|
|---|
| 758 |
|
|---|
| 759 | }
|
|---|
| 760 |
|
|---|
| 761 | private void reklamaDataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|---|
| 762 | {
|
|---|
| 763 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 764 | {
|
|---|
| 765 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 766 | int idRek = Int32.Parse(row["reklamaId"].ToString());
|
|---|
| 767 |
|
|---|
| 768 |
|
|---|
| 769 | OrderDetails.getOrderDetails().pokazSzczegolyZamowienia(idRek);
|
|---|
| 770 | DialogResult result = OrderDetails.getOrderDetails().ShowDialog();
|
|---|
| 771 |
|
|---|
| 772 | /*
|
|---|
| 773 | OrderDetails od = new OrderDetails();
|
|---|
| 774 | od.pokazSzczegolyZamowienia(idRek);
|
|---|
| 775 | DialogResult result = od.ShowDialog();*/
|
|---|
| 776 |
|
|---|
| 777 | if (result == DialogResult.OK) {
|
|---|
| 778 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 779 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 780 | }
|
|---|
| 781 | }
|
|---|
| 782 |
|
|---|
| 783 | }
|
|---|
| 784 |
|
|---|
| 785 | private void treeView1_AfterExpand(object sender, TreeViewEventArgs e)
|
|---|
| 786 | {
|
|---|
| 787 | if (e.Node != null)
|
|---|
| 788 | {
|
|---|
| 789 | SqlConnection conn = new SqlConnection(ConnString.getConnString().Value);
|
|---|
| 790 |
|
|---|
| 791 | SqlCommand comand = new SqlCommand();
|
|---|
| 792 | comand.Connection = conn;
|
|---|
| 793 | comand.CommandType = CommandType.Text;
|
|---|
| 794 |
|
|---|
| 795 | TreeNode node;
|
|---|
| 796 | SqlDataReader reader;
|
|---|
| 797 |
|
|---|
| 798 | switch (e.Node.Level)
|
|---|
| 799 | {
|
|---|
| 800 | case 0:
|
|---|
| 801 |
|
|---|
| 802 | switch (e.Node.Name)
|
|---|
| 803 | {
|
|---|
| 804 | case "Tytuly":
|
|---|
| 805 | DBBindings.dodajTytulyDoWezla(e.Node);
|
|---|
| 806 | break;
|
|---|
| 807 | case "MojeZamowienia":
|
|---|
| 808 | DBBindings.dodajTytulyDoWezla(e.Node);
|
|---|
| 809 |
|
|---|
| 810 | node = new TreeNode("Zatwierdzone-niezap³acone");
|
|---|
| 811 | node.Name = "ZatwierdzoneNiezaplacone";
|
|---|
| 812 | treeView1.Nodes["MojeZamowienia"].Nodes.Add(node);
|
|---|
| 813 |
|
|---|
| 814 | break;
|
|---|
| 815 | case "KoniecEmisji":
|
|---|
| 816 | DBBindings.dodajTytulyDoWezla(e.Node);
|
|---|
| 817 | break;
|
|---|
| 818 | case "ZatwierdzoneNiezaplacone":
|
|---|
| 819 |
|
|---|
| 820 | if (User.getUser().St_kierownik | User.getUser().St_produkcja)
|
|---|
| 821 | {
|
|---|
| 822 | DBBindings.dodajAgencjeDoWezla(e.Node);
|
|---|
| 823 | }
|
|---|
| 824 | else if (User.getUser().St_handlowiec| User.getUser().St_sekretarka | User.getUser().St_subhandlowiec)
|
|---|
| 825 | {
|
|---|
| 826 | e.Node.Nodes.Clear();
|
|---|
| 827 | node = new TreeNode(User.getUser().SymbolAgencji);
|
|---|
| 828 | node.Name = User.getUser().IdAgencji.ToString();
|
|---|
| 829 | node.Nodes.Add(new TreeNode());
|
|---|
| 830 | treeView1.Nodes["ZatwierdzoneNiezaplacone"].Nodes.Add(node);
|
|---|
| 831 | }
|
|---|
| 832 | break;
|
|---|
| 833 | case "ZmodyfikowaneDzisiaj":
|
|---|
| 834 | DBBindings.dodajAgencjeDoWezla(e.Node);
|
|---|
| 835 | break;
|
|---|
| 836 | case "DodaneDzisiaj":
|
|---|
| 837 | DBBindings.dodajAgencjeDoWezla(e.Node);
|
|---|
| 838 | break;
|
|---|
| 839 | default:
|
|---|
| 840 | break;
|
|---|
| 841 | }
|
|---|
| 842 |
|
|---|
| 843 | break;
|
|---|
| 844 | case 1:
|
|---|
| 845 | switch (e.Node.Parent.Name)
|
|---|
| 846 | {
|
|---|
| 847 | case "KoniecEmisji":
|
|---|
| 848 | e.Node.Nodes.Clear();
|
|---|
| 849 |
|
|---|
| 850 | comand.CommandText = "select top 20 NRW from dbo.NR where DATA_W > dateadd(day,-70,getDate()) AND tyt = @param";
|
|---|
| 851 | conn.Open();
|
|---|
| 852 | comand.Parameters.Clear();
|
|---|
| 853 | comand.Parameters.AddWithValue("@param", e.Node.Name);
|
|---|
| 854 | reader = comand.ExecuteReader();
|
|---|
| 855 |
|
|---|
| 856 | while (reader.Read())
|
|---|
| 857 | {
|
|---|
| 858 | node = new TreeNode(reader.GetValue(0).ToString());
|
|---|
| 859 | node.Name = reader.GetValue(0).ToString();
|
|---|
| 860 | e.Node.Nodes.Add(node);
|
|---|
| 861 | }
|
|---|
| 862 | conn.Close();
|
|---|
| 863 | break;
|
|---|
| 864 | case "ZatwierdzoneNiezaplacone":
|
|---|
| 865 | DBBindings.dodajAgentowDoWezla(e.Node, e.Node.Name);
|
|---|
| 866 | break;
|
|---|
| 867 | case "ZmodyfikowaneDzisiaj":
|
|---|
| 868 | DBBindings.dodajAgentowDoWezla(e.Node, e.Node.Name);
|
|---|
| 869 | break;
|
|---|
| 870 | case "DodaneDzisiaj":
|
|---|
| 871 | DBBindings.dodajAgentowDoWezla(e.Node, e.Node.Name);
|
|---|
| 872 | break;
|
|---|
| 873 | case "AnalizaCenyModulu":
|
|---|
| 874 | DBBindings.dodajAgencjeDoWezla(e.Node);
|
|---|
| 875 | break;
|
|---|
| 876 | default:
|
|---|
| 877 | e.Node.Nodes.Clear();
|
|---|
| 878 |
|
|---|
| 879 | comand.CommandText = "select distinct datepart(year,DATA_W) as rok from dbo.NR where TYT=@param order by rok desc";
|
|---|
| 880 | conn.Open();
|
|---|
| 881 | comand.Parameters.Clear();
|
|---|
| 882 | comand.Parameters.AddWithValue("@param", e.Node.Name);
|
|---|
| 883 | reader = comand.ExecuteReader();
|
|---|
| 884 |
|
|---|
| 885 | while (reader.Read())
|
|---|
| 886 | {
|
|---|
| 887 | node = new TreeNode(reader.GetValue(0).ToString());
|
|---|
| 888 | node.Name = reader.GetValue(0).ToString();
|
|---|
| 889 |
|
|---|
| 890 | for (int i = 1; i <= 12; i++)
|
|---|
| 891 | {
|
|---|
| 892 | TreeNode node2 = new TreeNode(i.ToString());
|
|---|
| 893 | node2.Name = i.ToString();
|
|---|
| 894 | node.Nodes.Add(node2);
|
|---|
| 895 | }
|
|---|
| 896 |
|
|---|
| 897 | e.Node.Nodes.Add(node);
|
|---|
| 898 | }
|
|---|
| 899 | conn.Close();
|
|---|
| 900 | break;
|
|---|
| 901 | }
|
|---|
| 902 | break;
|
|---|
| 903 | case 2:
|
|---|
| 904 | switch (e.Node.Parent.Parent.Name)
|
|---|
| 905 | {
|
|---|
| 906 | case "AnalizaCenyModulu":
|
|---|
| 907 | DBBindings.dodajAgentowDoWezla(e.Node, e.Node.Name);
|
|---|
| 908 | break;
|
|---|
| 909 | default:
|
|---|
| 910 | break;
|
|---|
| 911 | }
|
|---|
| 912 | break;
|
|---|
| 913 | default:
|
|---|
| 914 | break;
|
|---|
| 915 | }
|
|---|
| 916 | }
|
|---|
| 917 | }
|
|---|
| 918 |
|
|---|
| 919 | private void fakturaButton_Click(object sender, EventArgs e)
|
|---|
| 920 | {
|
|---|
| 921 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 922 | {
|
|---|
| 923 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 924 |
|
|---|
| 925 | if (row["id_faktury"] != DBNull.Value)
|
|---|
| 926 | {
|
|---|
| 927 | int idFaktury = Convert.ToInt32(row["id_faktury"]);
|
|---|
| 928 | FactureViewer fv = new FactureViewer(idFaktury,true);
|
|---|
| 929 | fv.ShowDialog();
|
|---|
| 930 | }
|
|---|
| 931 | }
|
|---|
| 932 | else {
|
|---|
| 933 | MessageBox.Show("Wybierz zamowienie");
|
|---|
| 934 | }
|
|---|
| 935 | }
|
|---|
| 936 |
|
|---|
| 937 | private void reklamaDataGridView_CellLeave(object sender, DataGridViewCellEventArgs e)
|
|---|
| 938 | {
|
|---|
| 939 | reklamyZestawienieBindingSource.CancelEdit();
|
|---|
| 940 | }
|
|---|
| 941 |
|
|---|
| 942 | /// <summary>
|
|---|
| 943 | /// Przechodzi do okna KLIENCI i wywietla dane klienta zwi¹zanego z zamówieniem.
|
|---|
| 944 | /// </summary>
|
|---|
| 945 | private void klientToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 946 | {
|
|---|
| 947 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 948 | {
|
|---|
| 949 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 950 |
|
|---|
| 951 | int custID = Convert.ToInt32(row["CustomerId"]);
|
|---|
| 952 |
|
|---|
| 953 | ClientsForm.getClientsForm((MDIBazaReklam)this.MdiParent).pokazKlienta(custID);
|
|---|
| 954 |
|
|---|
| 955 | this.Hide();
|
|---|
| 956 |
|
|---|
| 957 | ClientsForm.getClientsForm((MDIBazaReklam)this.MdiParent).Show();
|
|---|
| 958 |
|
|---|
| 959 | }
|
|---|
| 960 | }
|
|---|
| 961 |
|
|---|
| 962 | private void fakturaToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 963 | {
|
|---|
| 964 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 965 | {
|
|---|
| 966 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 967 | int idRek = Convert.ToInt32(row["reklamaId"]);
|
|---|
| 968 | Facturer f = new Facturer(idRek);
|
|---|
| 969 | DialogResult result = f.ShowDialog();
|
|---|
| 970 |
|
|---|
| 971 | /*
|
|---|
| 972 | if (result == DialogResult.OK)
|
|---|
| 973 | {
|
|---|
| 974 | //tu sie gdzies wywala
|
|---|
| 975 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 976 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 977 | } */
|
|---|
| 978 | }
|
|---|
| 979 | }
|
|---|
| 980 |
|
|---|
| 981 | private void wplataToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 982 | {
|
|---|
| 983 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 984 | {
|
|---|
| 985 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 986 | int idRek = Int32.Parse(row["reklamaId"].ToString());
|
|---|
| 987 | PaymentForm p = new PaymentForm(idRek);
|
|---|
| 988 | DialogResult result = p.ShowDialog();
|
|---|
| 989 |
|
|---|
| 990 | /*
|
|---|
| 991 | if (result == DialogResult.OK) {
|
|---|
| 992 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 993 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 994 | }
|
|---|
| 995 | */
|
|---|
| 996 | }
|
|---|
| 997 | }
|
|---|
| 998 |
|
|---|
| 999 | private void reklamaDataGridView_Leave(object sender, EventArgs e)
|
|---|
| 1000 | {
|
|---|
| 1001 | reklamaDataGridView.EndEdit();
|
|---|
| 1002 | }
|
|---|
| 1003 |
|
|---|
| 1004 | private void kryteriumWyszukiwania_KeyPress(object sender, KeyPressEventArgs e)
|
|---|
| 1005 | {
|
|---|
| 1006 | if (e.KeyChar == 13)
|
|---|
| 1007 | {
|
|---|
| 1008 | szukajToolStripButton.PerformClick();
|
|---|
| 1009 | }
|
|---|
| 1010 | }
|
|---|
| 1011 |
|
|---|
| 1012 | private void wyczyscPolaToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 1013 | {
|
|---|
| 1014 | rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 1015 |
|
|---|
| 1016 | symbolToolStripTextBox.Clear();
|
|---|
| 1017 | rokToolStripTextBox.Clear();
|
|---|
| 1018 | msToolStripTextBox.Clear();
|
|---|
| 1019 | tytToolStripComboBox.SelectedIndex = -1;
|
|---|
| 1020 | tytToolStripComboBox.Text = "";
|
|---|
| 1021 | agencjaToolStripComboBox.SelectedIndex = -1;
|
|---|
| 1022 | agencjaToolStripComboBox.Text = "";
|
|---|
| 1023 | agentToolStripComboBox.SelectedIndex = -1;
|
|---|
| 1024 | agentToolStripComboBox.Text = "";
|
|---|
| 1025 | typToolStripComboBox.SelectedIndex = -1;
|
|---|
| 1026 | typToolStripComboBox.Text = "";
|
|---|
| 1027 |
|
|---|
| 1028 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["DRCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 1029 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["FWCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 1030 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["KZCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 1031 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["PRCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 1032 | ((CheckBox)((ToolStripControlHost)szukajToolStrip.Items["ZPCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 1033 |
|
|---|
| 1034 | }
|
|---|
| 1035 |
|
|---|
| 1036 | private void zamToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 1037 | {
|
|---|
| 1038 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 1039 | {
|
|---|
| 1040 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 1041 | int idRek = Int32.Parse(row["reklamaId"].ToString());
|
|---|
| 1042 |
|
|---|
| 1043 | OrderDetails.getOrderDetails().pokazSzczegolyZamowienia(idRek);
|
|---|
| 1044 | DialogResult result = OrderDetails.getOrderDetails().ShowDialog();
|
|---|
| 1045 |
|
|---|
| 1046 | /*
|
|---|
| 1047 | OrderDetails od = new OrderDetails();
|
|---|
| 1048 | od.pokazSzczegolyZamowienia(idRek);
|
|---|
| 1049 | DialogResult result = od.ShowDialog();*/
|
|---|
| 1050 | /*
|
|---|
| 1051 | if (result == DialogResult.OK)
|
|---|
| 1052 | {
|
|---|
| 1053 | this.rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 1054 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 1055 | }*/
|
|---|
| 1056 | }
|
|---|
| 1057 | }
|
|---|
| 1058 |
|
|---|
| 1059 | private void pokazZamToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 1060 | {
|
|---|
| 1061 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 1062 | {
|
|---|
| 1063 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 1064 |
|
|---|
| 1065 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 1066 | int idRek = Convert.ToInt32(row["reklamaId"]);
|
|---|
| 1067 | OrderViewer ov = new OrderViewer(idRek);
|
|---|
| 1068 |
|
|---|
| 1069 | this.Cursor = Cursors.Default;
|
|---|
| 1070 |
|
|---|
| 1071 | ov.ShowDialog();
|
|---|
| 1072 | }
|
|---|
| 1073 | }
|
|---|
| 1074 |
|
|---|
| 1075 | private void podgladToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 1076 | {
|
|---|
| 1077 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 1078 | {
|
|---|
| 1079 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 1080 |
|
|---|
| 1081 | if (row["id_faktury"] != DBNull.Value)
|
|---|
| 1082 | {
|
|---|
| 1083 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 1084 |
|
|---|
| 1085 | int idFaktury = Convert.ToInt32(row["id_faktury"]);
|
|---|
| 1086 |
|
|---|
| [91] | 1087 | FactureViewer fv = new FactureViewer(idFaktury, true, 0);
|
|---|
| 1088 | fv.ShowDialog();
|
|---|
| 1089 |
|
|---|
| 1090 | this.Cursor = Cursors.Default;
|
|---|
| [65] | 1091 | }
|
|---|
| 1092 | else {
|
|---|
| 1093 | MessageBox.Show("Nie wystawiono faktury");
|
|---|
| 1094 | }
|
|---|
| 1095 | }
|
|---|
| 1096 | }
|
|---|
| 1097 |
|
|---|
| 1098 | private void generateNodes()
|
|---|
| 1099 | {
|
|---|
| 1100 | TreeNode node;
|
|---|
| 1101 | /*
|
|---|
| 1102 | node = new TreeNode("Tytu³y");
|
|---|
| 1103 | node.Name = "Tytuly";
|
|---|
| 1104 | node.Nodes.Add(new TreeNode());
|
|---|
| 1105 |
|
|---|
| 1106 | treeView1.Nodes.Add(node);
|
|---|
| 1107 | */
|
|---|
| 1108 |
|
|---|
| 1109 | if (User.getUser().St_handlowiec)
|
|---|
| 1110 | {
|
|---|
| 1111 | node = new TreeNode("Moje zamówienia");
|
|---|
| 1112 | node.Name = "MojeZamowienia";
|
|---|
| 1113 | node.Nodes.Add(new TreeNode());
|
|---|
| 1114 |
|
|---|
| 1115 | treeView1.Nodes.Add(node);
|
|---|
| 1116 | }
|
|---|
| 1117 |
|
|---|
| 1118 | node = new TreeNode("Koniec emisji");
|
|---|
| 1119 | node.Name = "KoniecEmisji";
|
|---|
| 1120 | node.Nodes.Add(new TreeNode());
|
|---|
| 1121 |
|
|---|
| 1122 | treeView1.Nodes.Add(node);
|
|---|
| 1123 |
|
|---|
| 1124 | node = new TreeNode("B³êdy");
|
|---|
| 1125 | node.Name = "Bledy";
|
|---|
| 1126 | treeView1.Nodes.Add(node);
|
|---|
| 1127 |
|
|---|
| 1128 | node = new TreeNode("Powtórzenia reklam");
|
|---|
| 1129 | node.Name = "PowtorzeniaReklam";
|
|---|
| 1130 | treeView1.Nodes["Bledy"].Nodes.Add(node);
|
|---|
| 1131 |
|
|---|
| 1132 | node = new TreeNode("B³êdy w reklamach");
|
|---|
| 1133 | node.Name = "BledyWreklamach";
|
|---|
| 1134 | treeView1.Nodes["Bledy"].Nodes.Add(node);
|
|---|
| 1135 |
|
|---|
| 1136 | node = new TreeNode("Modu³y");
|
|---|
| 1137 | node.Name = "Moduly";
|
|---|
| 1138 | treeView1.Nodes["Bledy"].Nodes.Add(node);
|
|---|
| 1139 |
|
|---|
| 1140 |
|
|---|
| 1141 | if (User.getUser().St_kierownik)
|
|---|
| 1142 | {
|
|---|
| 1143 | node = new TreeNode("Analiza ceny modu³u");
|
|---|
| 1144 | node.Name = "AnalizaCenyModulu";
|
|---|
| 1145 | treeView1.Nodes.Add(node);
|
|---|
| 1146 |
|
|---|
| 1147 | node = new TreeNode("Za tani 50%");
|
|---|
| 1148 | node.Name = "ZaTani50";
|
|---|
| 1149 | node.Nodes.Add(new TreeNode());
|
|---|
| 1150 | treeView1.Nodes["AnalizaCenyModulu"].Nodes.Add(node);
|
|---|
| 1151 |
|
|---|
| 1152 | node = new TreeNode("Za tani 30%");
|
|---|
| 1153 | node.Name = "ZaTani30";
|
|---|
| 1154 | node.Nodes.Add(new TreeNode());
|
|---|
| 1155 | treeView1.Nodes["AnalizaCenyModulu"].Nodes.Add(node);
|
|---|
| 1156 |
|
|---|
| 1157 | node = new TreeNode("Za drogi");
|
|---|
| 1158 | node.Name = "ZaDrogi";
|
|---|
| 1159 | node.Nodes.Add(new TreeNode());
|
|---|
| 1160 | treeView1.Nodes["AnalizaCenyModulu"].Nodes.Add(node);
|
|---|
| 1161 | }
|
|---|
| 1162 |
|
|---|
| 1163 | node = new TreeNode("Zatwierdzone-niezap³acone");
|
|---|
| 1164 | node.Name = "ZatwierdzoneNiezaplacone";
|
|---|
| 1165 | node.Nodes.Add(new TreeNode());
|
|---|
| 1166 | treeView1.Nodes.Add(node);
|
|---|
| 1167 |
|
|---|
| 1168 | node = new TreeNode("Zmodyfikowane dzisiaj");
|
|---|
| 1169 | node.Name = "ZmodyfikowaneDzisiaj";
|
|---|
| 1170 | node.Nodes.Add(new TreeNode());
|
|---|
| 1171 | treeView1.Nodes.Add(node);
|
|---|
| 1172 |
|
|---|
| 1173 | node = new TreeNode("Dodane dzisiaj");
|
|---|
| 1174 | node.Name = "DodaneDzisiaj";
|
|---|
| 1175 | node.Nodes.Add(new TreeNode());
|
|---|
| 1176 | treeView1.Nodes.Add(node);
|
|---|
| 1177 |
|
|---|
| 1178 | /*
|
|---|
| 1179 | node = new TreeNode("Zatwierdzone-niezafakturowane");
|
|---|
| 1180 | node.Name = "ZatwierdzoneNiezafakturowane";
|
|---|
| 1181 | node.Nodes.Add(new TreeNode());
|
|---|
| 1182 | */
|
|---|
| 1183 | }
|
|---|
| 1184 |
|
|---|
| 1185 | /// <summary>
|
|---|
| 1186 | /// Widok standardowy kolumn - nieuzywane
|
|---|
| 1187 | /// </summary>
|
|---|
| 1188 | /*
|
|---|
| 1189 | private void defaultColumns()
|
|---|
| 1190 | {
|
|---|
| 1191 | reklamaDataGridView.Columns["CENA_MODULU"].Visible = false;
|
|---|
| 1192 | reklamaDataGridView.Columns["CENA_MIN"].Visible = false;
|
|---|
| 1193 | reklamaDataGridView.Columns["CENA"].Visible = false;
|
|---|
| 1194 | reklamaDataGridView.Columns["PROCENT_PROWIZJI"].Visible = false;
|
|---|
| 1195 |
|
|---|
| 1196 | reklamaDataGridView.Columns["netto"].Visible = false;
|
|---|
| 1197 | reklamaDataGridView.Columns["brutto"].Visible = false;
|
|---|
| 1198 |
|
|---|
| 1199 | reklamaDataGridView.Columns["tYTU£DataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1200 | reklamaDataGridView.Columns["TYP"].Visible = true;
|
|---|
| 1201 | reklamaDataGridView.Columns["oDDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1202 | reklamaDataGridView.Columns["emisjaDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1203 | reklamaDataGridView.Columns["FirstName"].Visible = true;
|
|---|
| 1204 | reklamaDataGridView.Columns["fAKTURANUMERDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1205 | reklamaDataGridView.Columns["dATAOSTATNIEJMODYFIKACJIDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1206 | reklamaDataGridView.Columns["dATAZAP£ATYDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1207 | reklamaDataGridView.Columns["zAP£ACONODataGridViewCheckBoxColumn"].Visible = true;
|
|---|
| 1208 | reklamaDataGridView.Columns["fAKTURAWYSTAWIONODataGridViewCheckBoxColumn"].Visible = true;
|
|---|
| 1209 | reklamaDataGridView.Columns["zATWIERDZONODODRUKUDataGridViewCheckBoxColumn"].Visible = true;
|
|---|
| 1210 | reklamaDataGridView.Columns["wYSDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1211 | reklamaDataGridView.Columns["sZERDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1212 |
|
|---|
| 1213 | reklamaDataGridView.Columns["iDREKLAMYDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1214 | reklamaDataGridView.Columns["mODTYPDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1215 | reklamaDataGridView.Columns["rABATDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1216 | reklamaDataGridView.Columns["kierzatwierdzilDataGridViewCheckBoxColumn"].Visible = true;
|
|---|
| 1217 | reklamaDataGridView.Columns["zablokujprowizjeDataGridViewCheckBoxColumn"].Visible = true;
|
|---|
| 1218 | reklamaDataGridView.Columns["sYMBOLAKWIZYTORADataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1219 | reklamaDataGridView.Columns["agencjaDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1220 |
|
|---|
| 1221 | }
|
|---|
| 1222 | */
|
|---|
| 1223 |
|
|---|
| 1224 | /// <summary>
|
|---|
| 1225 | /// Kolumny z zatwierdzonych - niezap³aconych
|
|---|
| 1226 | /// </summary>
|
|---|
| 1227 | private void zatwierdzoneNiezaplaconeColumns()
|
|---|
| 1228 | {
|
|---|
| 1229 | reklamaDataGridView.Columns["CENA_MODULU"].Visible = false;
|
|---|
| 1230 | reklamaDataGridView.Columns["CENA_MIN"].Visible = false;
|
|---|
| 1231 | reklamaDataGridView.Columns["CENA"].Visible = false;
|
|---|
| 1232 | reklamaDataGridView.Columns["PROCENT_PROWIZJI"].Visible = false;
|
|---|
| 1233 | reklamaDataGridView.Columns["wYSDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1234 | reklamaDataGridView.Columns["sZERDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1235 |
|
|---|
| 1236 | reklamaDataGridView.Columns["tYTU£DataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1237 | reklamaDataGridView.Columns["TYP"].Visible = true;
|
|---|
| 1238 | reklamaDataGridView.Columns["oDDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1239 | reklamaDataGridView.Columns["emisjaDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1240 | reklamaDataGridView.Columns["FirstName"].Visible = true;
|
|---|
| 1241 | reklamaDataGridView.Columns["fAKTURANUMERDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1242 | reklamaDataGridView.Columns["dATAOSTATNIEJMODYFIKACJIDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1243 | reklamaDataGridView.Columns["dATAZAP£ATYDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1244 | reklamaDataGridView.Columns["zAP£ACONODataGridViewCheckBoxColumn"].Visible = true;
|
|---|
| 1245 | reklamaDataGridView.Columns["fAKTURAWYSTAWIONODataGridViewCheckBoxColumn"].Visible = true;
|
|---|
| 1246 | reklamaDataGridView.Columns["zATWIERDZONODODRUKUDataGridViewCheckBoxColumn"].Visible = true;
|
|---|
| 1247 |
|
|---|
| 1248 | reklamaDataGridView.Columns["iDREKLAMYDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1249 | reklamaDataGridView.Columns["mODTYPDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1250 | reklamaDataGridView.Columns["rABATDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1251 | reklamaDataGridView.Columns["kierzatwierdzilDataGridViewCheckBoxColumn"].Visible = true;
|
|---|
| 1252 | reklamaDataGridView.Columns["zablokujprowizjeDataGridViewCheckBoxColumn"].Visible = true;
|
|---|
| 1253 | reklamaDataGridView.Columns["sYMBOLAKWIZYTORADataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1254 | reklamaDataGridView.Columns["agencjaDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1255 |
|
|---|
| 1256 | reklamaDataGridView.Columns["netto"].Visible = true;
|
|---|
| 1257 | reklamaDataGridView.Columns["brutto"].Visible = true;
|
|---|
| 1258 |
|
|---|
| 1259 | }
|
|---|
| 1260 |
|
|---|
| 1261 | /// <summary>
|
|---|
| 1262 | /// Kolumny z analizy ceny modu³u
|
|---|
| 1263 | /// </summary>
|
|---|
| 1264 | private void analizaCenyModuluColumns()
|
|---|
| 1265 | {
|
|---|
| 1266 | reklamaDataGridView.Columns["CENA_MODULU"].Visible = true;
|
|---|
| 1267 | reklamaDataGridView.Columns["CENA_MIN"].Visible = true;
|
|---|
| 1268 | reklamaDataGridView.Columns["CENA"].Visible = true;
|
|---|
| 1269 | reklamaDataGridView.Columns["PROCENT_PROWIZJI"].Visible = true;
|
|---|
| 1270 | reklamaDataGridView.Columns["emisjaDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1271 | reklamaDataGridView.Columns["TYP"].Visible = true;
|
|---|
| 1272 |
|
|---|
| 1273 | reklamaDataGridView.Columns["tYTU£DataGridViewTextBoxColumn"].Visible = false;
|
|---|
| 1274 | reklamaDataGridView.Columns["oDDataGridViewTextBoxColumn"].Visible = false;
|
|---|
| 1275 | reklamaDataGridView.Columns["FirstName"].Visible = false;
|
|---|
| 1276 | reklamaDataGridView.Columns["fAKTURANUMERDataGridViewTextBoxColumn"].Visible = false;
|
|---|
| 1277 | reklamaDataGridView.Columns["dATAOSTATNIEJMODYFIKACJIDataGridViewTextBoxColumn"].Visible = false;
|
|---|
| 1278 | reklamaDataGridView.Columns["dATAZAP£ATYDataGridViewTextBoxColumn"].Visible = false;
|
|---|
| 1279 | reklamaDataGridView.Columns["zAP£ACONODataGridViewCheckBoxColumn"].Visible = false;
|
|---|
| 1280 | reklamaDataGridView.Columns["fAKTURAWYSTAWIONODataGridViewCheckBoxColumn"].Visible = false;
|
|---|
| 1281 | reklamaDataGridView.Columns["zATWIERDZONODODRUKUDataGridViewCheckBoxColumn"].Visible = false;
|
|---|
| 1282 | reklamaDataGridView.Columns["wYSDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1283 | reklamaDataGridView.Columns["sZERDataGridViewTextBoxColumn"].Visible = true;
|
|---|
| 1284 |
|
|---|
| 1285 | reklamaDataGridView.Columns["netto"].Visible = false;
|
|---|
| 1286 | reklamaDataGridView.Columns["brutto"].Visible = false;
|
|---|
| 1287 | }
|
|---|
| 1288 |
|
|---|
| 1289 | private void odswiezToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 1290 | {
|
|---|
| 1291 | if (commandExecuted)
|
|---|
| 1292 | {
|
|---|
| 1293 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 1294 |
|
|---|
| 1295 | rEKLAMADataSet.ReklamyZestawienie.Clear();
|
|---|
| 1296 | sqlDataAdapter.Fill(this.rEKLAMADataSet.ReklamyZestawienie);
|
|---|
| 1297 | reklamaDataGridView.Refresh();
|
|---|
| 1298 |
|
|---|
| 1299 | this.Cursor = Cursors.Default;
|
|---|
| 1300 | }
|
|---|
| 1301 |
|
|---|
| 1302 | }
|
|---|
| 1303 |
|
|---|
| 1304 | private void reklamyZestawienieBindingSource_ListChanged(object sender, ListChangedEventArgs e)
|
|---|
| 1305 | {
|
|---|
| 1306 | podsumuj();
|
|---|
| 1307 | }
|
|---|
| 1308 |
|
|---|
| 1309 |
|
|---|
| 1310 | /// <summary>
|
|---|
| 1311 | /// Podsumowuje brutto i netto z wyswietlonych zamowien
|
|---|
| 1312 | /// </summary>
|
|---|
| 1313 | private void podsumuj()
|
|---|
| 1314 | {
|
|---|
| 1315 |
|
|---|
| 1316 | if (reklamyZestawienieBindingSource.List.Count != 0)
|
|---|
| 1317 | {
|
|---|
| 1318 | decimal brutto = Convert.ToDecimal(rEKLAMADataSet.ReklamyZestawienie.Compute("Sum(BRUTTO)", ""));
|
|---|
| 1319 | decimal netto = Convert.ToDecimal(rEKLAMADataSet.ReklamyZestawienie.Compute("Sum(netto)", ""));
|
|---|
| 1320 |
|
|---|
| 1321 | sumaBruttoTextBox.Text = String.Format("{0:C}", brutto);
|
|---|
| 1322 | sumaNettoTextBox.Text = String.Format("{0:C}", netto);
|
|---|
| 1323 |
|
|---|
| 1324 | }
|
|---|
| 1325 | else
|
|---|
| 1326 | {
|
|---|
| 1327 | sumaBruttoTextBox.Clear();
|
|---|
| 1328 | sumaNettoTextBox.Clear();
|
|---|
| 1329 | }
|
|---|
| 1330 | }
|
|---|
| 1331 |
|
|---|
| 1332 | private void drukujToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 1333 | {
|
|---|
| 1334 | PrintDGV.Print_DataGridView(reklamaDataGridView,50);
|
|---|
| 1335 | }
|
|---|
| 1336 |
|
|---|
| 1337 | private void zamProToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 1338 | {
|
|---|
| 1339 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 1340 | {
|
|---|
| 1341 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 1342 | int idRek = Int32.Parse(row["reklamaId"].ToString());
|
|---|
| 1343 | ProjectForm pf = new ProjectForm(idRek);
|
|---|
| 1344 | pf.ShowDialog();
|
|---|
| 1345 | }
|
|---|
| 1346 | }
|
|---|
| 1347 |
|
|---|
| 1348 | private void OrdersForm_Shown(object sender, EventArgs e)
|
|---|
| 1349 | {
|
|---|
| 1350 | if (User.getUser().St_kierownik)
|
|---|
| 1351 | {
|
|---|
| 1352 | agencjaToolStripComboBox.Text = User.getUser().SymbolAgencji;
|
|---|
| 1353 | }
|
|---|
| 1354 | else if (User.getUser().St_handlowiec | User.getUser().St_subhandlowiec)
|
|---|
| 1355 | {
|
|---|
| 1356 | agentToolStripComboBox.Text = User.getUser().Login;
|
|---|
| 1357 | }
|
|---|
| 1358 |
|
|---|
| 1359 | }
|
|---|
| 1360 |
|
|---|
| 1361 | private void OrdersForm_Leave(object sender, EventArgs e)
|
|---|
| 1362 | {
|
|---|
| 1363 |
|
|---|
| 1364 | }
|
|---|
| 1365 |
|
|---|
| 1366 | private void podgladJPGToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 1367 | {
|
|---|
| 1368 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 1369 | {
|
|---|
| 1370 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 1371 |
|
|---|
| 1372 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 1373 | int reklamaId = Convert.ToInt32(row["reklamaId"]);
|
|---|
| 1374 | string idReklamy = row["id reklamy"].ToString();
|
|---|
| 1375 |
|
|---|
| 1376 | string tytul;
|
|---|
| 1377 | int grzbiet;
|
|---|
| 1378 | string miasto;
|
|---|
| 1379 | byte staryNowyArchiwum;
|
|---|
| 1380 |
|
|---|
| 1381 |
|
|---|
| 1382 | Produkcja.argumentyDoSciezki(reklamaId,idReklamy, out tytul, out grzbiet, out miasto, out staryNowyArchiwum);
|
|---|
| 1383 |
|
|---|
| 1384 | string sciezka = Produkcja.GetReklamaFileName(idReklamy, tytul, grzbiet, miasto, staryNowyArchiwum, "jpg");
|
|---|
| 1385 |
|
|---|
| 1386 | this.Cursor = Cursors.Default;
|
|---|
| 1387 |
|
|---|
| 1388 | if (File.Exists(sciezka))
|
|---|
| 1389 | {
|
|---|
| 1390 | System.Diagnostics.Process.Start(sciezka);
|
|---|
| 1391 | }
|
|---|
| 1392 | else
|
|---|
| 1393 | {
|
|---|
| 1394 | MessageBox.Show("Nie znaleziono pliku:" + sciezka);
|
|---|
| 1395 | }
|
|---|
| 1396 | }
|
|---|
| 1397 | }
|
|---|
| 1398 |
|
|---|
| 1399 | private void toolStripButton1_Click(object sender, EventArgs e)
|
|---|
| 1400 | {
|
|---|
| 1401 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 1402 | {
|
|---|
| 1403 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 1404 |
|
|---|
| 1405 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 1406 | int reklamaId = Convert.ToInt32(row["reklamaId"]);
|
|---|
| 1407 | string idReklamy = row["id reklamy"].ToString();
|
|---|
| 1408 |
|
|---|
| 1409 | string tytul;
|
|---|
| 1410 | int grzbiet;
|
|---|
| 1411 | string miasto;
|
|---|
| 1412 | byte staryNowyArchiwum;
|
|---|
| 1413 |
|
|---|
| 1414 | Produkcja.argumentyDoSciezki(reklamaId,idReklamy, out tytul, out grzbiet, out miasto, out staryNowyArchiwum);
|
|---|
| 1415 |
|
|---|
| 1416 | string sciezka = Produkcja.GetReklamaFileName(idReklamy, tytul, grzbiet, miasto, staryNowyArchiwum, "pdf");
|
|---|
| 1417 |
|
|---|
| 1418 | this.Cursor = Cursors.Default;
|
|---|
| 1419 |
|
|---|
| 1420 | if (File.Exists(sciezka))
|
|---|
| 1421 | {
|
|---|
| 1422 | System.Diagnostics.Process.Start(sciezka);
|
|---|
| 1423 | }
|
|---|
| 1424 | else
|
|---|
| 1425 | {
|
|---|
| 1426 | MessageBox.Show("Nie znaleziono pliku: " + sciezka);
|
|---|
| 1427 | }
|
|---|
| 1428 |
|
|---|
| 1429 | }
|
|---|
| 1430 | }
|
|---|
| 1431 |
|
|---|
| 1432 | private void excelToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 1433 | {
|
|---|
| 1434 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 1435 |
|
|---|
| 1436 | ExcelHandler ex = new ExcelHandler();
|
|---|
| 1437 | ex.exportToExcel(reklamaDataGridView);
|
|---|
| 1438 |
|
|---|
| 1439 | this.Cursor = Cursors.Default;
|
|---|
| 1440 | }
|
|---|
| 1441 |
|
|---|
| 1442 | private void zamowieniaToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 1443 | {
|
|---|
| 1444 | if (reklamyZestawienieBindingSource.Current != null)
|
|---|
| 1445 | {
|
|---|
| 1446 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 1447 |
|
|---|
| 1448 | DataRowView row = (DataRowView)reklamyZestawienieBindingSource.Current;
|
|---|
| 1449 | REKLAMADataSet.ReklamyZestawienieRow rek = (REKLAMADataSet.ReklamyZestawienieRow)
|
|---|
| 1450 | row.Row;
|
|---|
| [84] | 1451 | if (!rek.IsidZamowieniaNull())
|
|---|
| 1452 | {
|
|---|
| 1453 | ZamowieniaForm zam = new ZamowieniaForm(rek.CustomerID, rek.idZamowienia);
|
|---|
| 1454 | zam.ShowDialog();
|
|---|
| 1455 | }
|
|---|
| 1456 | else
|
|---|
| 1457 | {
|
|---|
| 1458 | ZamowieniaForm zam = new ZamowieniaForm(rek.CustomerID);
|
|---|
| 1459 | zam.ShowDialog();
|
|---|
| 1460 | }
|
|---|
| [65] | 1461 |
|
|---|
| 1462 | this.Cursor = Cursors.Default;
|
|---|
| 1463 | }
|
|---|
| 1464 | }
|
|---|
| 1465 | }
|
|---|
| 1466 | } |
|---|