| [9] | 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 |
|
|---|
| 10 | namespace Baza_Reklam
|
|---|
| 11 | {
|
|---|
| 12 | public partial class KorektyForm : Form
|
|---|
| 13 | {
|
|---|
| [10] | 14 | string query = "SELECT top 2000 * from VIEW_KOREKTY ";
|
|---|
| [9] | 15 |
|
|---|
| 16 | private static KorektyForm fakturesForm;
|
|---|
| 17 | private SqlCommand command;
|
|---|
| 18 | private SqlDataAdapter sqlDataAdapter;
|
|---|
| 19 |
|
|---|
| 20 | private bool commandExecuted = false;
|
|---|
| 21 |
|
|---|
| 22 | public static KorektyForm getFacturesForm(MDIBazaReklam parent)
|
|---|
| 23 | {
|
|---|
| 24 | if (fakturesForm == null){
|
|---|
| 25 | fakturesForm = new KorektyForm(parent);
|
|---|
| 26 | }
|
|---|
| 27 | return fakturesForm;
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | private KorektyForm(MDIBazaReklam parent)
|
|---|
| 31 | {
|
|---|
| 32 | InitializeComponent();
|
|---|
| 33 | this.MdiParent = parent;
|
|---|
| 34 |
|
|---|
| 35 | //podmiana connstringa
|
|---|
| [10] | 36 | vIEW_KOREKTYTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;
|
|---|
| [9] | 37 |
|
|---|
| 38 | //obiekty wykorzytywane przy wyszukiwaniu
|
|---|
| 39 | SqlConnection conn = new SqlConnection(ConnString.getConnString().Value);
|
|---|
| 40 | command = new SqlCommand();
|
|---|
| 41 | command.Connection = conn;
|
|---|
| 42 |
|
|---|
| 43 | this.sqlDataAdapter = new SqlDataAdapter();
|
|---|
| 44 |
|
|---|
| 45 | //generuje piersze wêz³y w drzewie
|
|---|
| 46 | generateNodes();
|
|---|
| 47 |
|
|---|
| 48 | //ustawia domyslny rok i miesi¹c w pasku wyszukiwania
|
|---|
| 49 | rokToolStripTextBox.Text = DateTime.Today.Year.ToString();
|
|---|
| 50 | miesiacToolStripTextBox.Text = DateTime.Today.Month.ToString();
|
|---|
| 51 |
|
|---|
| 52 | wyszukajToolStrip.Items.Insert(10, new ToolStripLabel("nieuregulowane:"));
|
|---|
| 53 | wyszukajToolStrip.Items.Insert(11, new ToolStripControlHost(new CheckBox(), "zalegleCheckBox"));
|
|---|
| 54 | ((CheckBox)((ToolStripControlHost)wyszukajToolStrip.Items["zalegleCheckBox"]).Control).ThreeState = true;
|
|---|
| 55 | ((CheckBox)((ToolStripControlHost)wyszukajToolStrip.Items["zalegleCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 56 | }
|
|---|
| 57 |
|
|---|
| 58 | private void FacturesForm_Load(object sender, EventArgs e)
|
|---|
| 59 | {
|
|---|
| 60 | this.WindowState = FormWindowState.Maximized;
|
|---|
| 61 |
|
|---|
| 62 | DBBindings.bindujAgencje(agencjaToolStripComboBox);
|
|---|
| 63 |
|
|---|
| 64 | command.CommandText = this.query;
|
|---|
| 65 | sqlDataAdapter.SelectCommand = command;
|
|---|
| 66 | }
|
|---|
| 67 |
|
|---|
| 68 | private void generateNodes()
|
|---|
| 69 | {
|
|---|
| 70 | TreeNode node;
|
|---|
| 71 |
|
|---|
| 72 | node = new TreeNode("Wp³aty - ksiêgowoæ");
|
|---|
| 73 | node.Name = "WplatyKsiegowosc";
|
|---|
| 74 | treeView1.Nodes.Add(node);
|
|---|
| 75 |
|
|---|
| 76 | node = new TreeNode("Ró¿nice wp³at");
|
|---|
| 77 | node.Nodes.Add(new TreeNode());
|
|---|
| 78 | node.Name = "BrakWKsiegowosci";
|
|---|
| 79 |
|
|---|
| 80 | treeView1.Nodes["WplatyKsiegowosc"].Nodes.Add(node);
|
|---|
| 81 |
|
|---|
| 82 | node = new TreeNode("Brak w reklamie");
|
|---|
| 83 | node.Nodes.Add(new TreeNode());
|
|---|
| 84 | node.Name = "BrakWReklamie";
|
|---|
| 85 |
|
|---|
| 86 | treeView1.Nodes["WplatyKsiegowosc"].Nodes.Add(node);
|
|---|
| 87 |
|
|---|
| 88 | command.Connection.Close();
|
|---|
| 89 | }
|
|---|
| 90 | private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
|
|---|
| 91 | {
|
|---|
| 92 | if (e.Node != null)
|
|---|
| 93 | {
|
|---|
| 94 | command.CommandText = query;
|
|---|
| 95 | command.Parameters.Clear();
|
|---|
| 96 |
|
|---|
| 97 | switch (e.Node.Level)
|
|---|
| 98 | {
|
|---|
| 99 | case 0:
|
|---|
| 100 | break;
|
|---|
| 101 | case 1:
|
|---|
| 102 | switch (e.Node.Parent.Name)
|
|---|
| 103 | {
|
|---|
| 104 | case "WplatyKsiegowosc":
|
|---|
| 105 | break;
|
|---|
| 106 | default:
|
|---|
| 107 | break;
|
|---|
| 108 | }
|
|---|
| 109 | break;
|
|---|
| 110 | case 2:
|
|---|
| [10] | 111 | /*
|
|---|
| [9] | 112 | switch (e.Node.Parent.Parent.Name)
|
|---|
| 113 | {
|
|---|
| [10] | 114 |
|
|---|
| [9] | 115 | case "WplatyKsiegowosc":
|
|---|
| 116 | switch (e.Node.Parent.Name)
|
|---|
| 117 | {
|
|---|
| 118 | case "BrakWKsiegowosci":
|
|---|
| 119 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 120 |
|
|---|
| [10] | 121 | rEKLAMADataSet.VIEW_KOREKTY.Clear();
|
|---|
| [9] | 122 |
|
|---|
| 123 | command.CommandText += " WHERE YEAR(dataWplaty) = @rok AND (suma_zaplat is null OR (CONVERT(int, suma_zaplat * 100) <> CONVERT(int, BRUTTO * 100))) order by dataWplaty";
|
|---|
| 124 |
|
|---|
| 125 | command.Parameters.AddWithValue("@rok", e.Node.Name);
|
|---|
| [10] | 126 | sqlDataAdapter.Fill(this.rEKLAMADataSet.VIEW_KOREKTY);
|
|---|
| [9] | 127 | commandExecuted = true;
|
|---|
| 128 | fakturyDataGridView.Refresh();
|
|---|
| 129 |
|
|---|
| 130 | this.Cursor = Cursors.Default;
|
|---|
| 131 |
|
|---|
| 132 | break;
|
|---|
| 133 |
|
|---|
| 134 | case "BrakWReklamie":
|
|---|
| 135 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 136 |
|
|---|
| [10] | 137 | rEKLAMADataSet.VIEW_KOREKTY.Clear();
|
|---|
| [9] | 138 | command.CommandText += " WHERE YEAR(DATA_SPRZEDAZY) = @rok AND (suma_zaplat is not null AND suma_zaplat<>0) AND (dataWplaty is null) order by DATA_SPRZEDAZY";
|
|---|
| 139 | command.Parameters.AddWithValue("@rok", e.Node.Name);
|
|---|
| [10] | 140 | sqlDataAdapter.Fill(this.rEKLAMADataSet.VIEW_KOREKTY);
|
|---|
| [9] | 141 | commandExecuted = true;
|
|---|
| 142 | fakturyDataGridView.Refresh();
|
|---|
| 143 |
|
|---|
| 144 | this.Cursor = Cursors.Default;
|
|---|
| 145 |
|
|---|
| 146 | break;
|
|---|
| 147 | default:
|
|---|
| 148 | break;
|
|---|
| 149 | }
|
|---|
| 150 | break;
|
|---|
| 151 | default:
|
|---|
| 152 | break;
|
|---|
| [10] | 153 | }*/
|
|---|
| [9] | 154 | break;
|
|---|
| 155 | case 3:
|
|---|
| 156 | switch (e.Node.Parent.Parent.Parent.Name)
|
|---|
| 157 | {
|
|---|
| 158 | case "WplatyKsiegowosc":
|
|---|
| 159 | switch (e.Node.Parent.Parent.Name)
|
|---|
| 160 | {
|
|---|
| 161 | case "BrakWKsiegowosci":
|
|---|
| 162 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 163 |
|
|---|
| [11] | 164 | rEKLAMADataSet.VIEW_ZESTAWIENIE_FAKTUR_NOWE.Clear();
|
|---|
| [9] | 165 | command.CommandText += " WHERE YEAR([dataWplaty]) = @rok AND MONTH(dataWplaty) = @miesiac AND (suma_zaplat is null OR (CONVERT(int, suma_zaplat * 100) <> CONVERT(int, BRUTTO * 100))) order by dataWplaty";
|
|---|
| 166 | command.Parameters.AddWithValue("@rok", e.Node.Parent.Name);
|
|---|
| 167 | command.Parameters.AddWithValue("@miesiac", e.Node.Name);
|
|---|
| [11] | 168 | sqlDataAdapter.Fill(this.rEKLAMADataSet.VIEW_ZESTAWIENIE_FAKTUR_NOWE);
|
|---|
| [9] | 169 | commandExecuted = true;
|
|---|
| 170 | fakturyDataGridView.Refresh();
|
|---|
| 171 |
|
|---|
| 172 | this.Cursor = Cursors.Default;
|
|---|
| 173 | break;
|
|---|
| 174 |
|
|---|
| 175 | case "BrakWReklamie":
|
|---|
| 176 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 177 |
|
|---|
| [10] | 178 | rEKLAMADataSet.VIEW_KOREKTY.Clear();
|
|---|
| [9] | 179 | command.CommandText += " WHERE YEAR(DATA_SPRZEDAZY) = @rok AND MONTH(DATA_SPRZEDAZY) = @miesiac AND (suma_zaplat is not null AND suma_zaplat<>0) AND (dataWplaty is null) order by DATA_SPRZEDAZY";
|
|---|
| 180 | command.Parameters.AddWithValue("@rok", e.Node.Parent.Name);
|
|---|
| 181 | command.Parameters.AddWithValue("@miesiac", e.Node.Name);
|
|---|
| [10] | 182 | sqlDataAdapter.Fill(this.rEKLAMADataSet.VIEW_KOREKTY);
|
|---|
| [9] | 183 | commandExecuted = true;
|
|---|
| 184 | fakturyDataGridView.Refresh();
|
|---|
| 185 |
|
|---|
| 186 | this.Cursor = Cursors.Default;
|
|---|
| 187 | break;
|
|---|
| 188 | }
|
|---|
| 189 | break;
|
|---|
| 190 | default:
|
|---|
| 191 | break;
|
|---|
| 192 | }
|
|---|
| 193 | break;
|
|---|
| 194 | default:
|
|---|
| 195 | break;
|
|---|
| 196 | }
|
|---|
| 197 |
|
|---|
| 198 | }
|
|---|
| 199 | }
|
|---|
| 200 |
|
|---|
| 201 | private void treeView1_AfterExpand(object sender, TreeViewEventArgs e)
|
|---|
| 202 | {
|
|---|
| 203 | TreeNode node;
|
|---|
| 204 | SqlDataReader reader;
|
|---|
| 205 |
|
|---|
| 206 | if (e.Node != null)
|
|---|
| 207 | {
|
|---|
| [10] | 208 | switch (e.Node.Level)
|
|---|
| [9] | 209 | {
|
|---|
| [10] | 210 | case 0:
|
|---|
| [9] | 211 | break;
|
|---|
| 212 | case 1:
|
|---|
| 213 | switch (e.Node.Parent.Name)
|
|---|
| 214 | {
|
|---|
| 215 | case "WplatyKsiegowosc":
|
|---|
| 216 | switch (e.Node.Name)
|
|---|
| 217 | {
|
|---|
| 218 | case "BrakWKsiegowosci":
|
|---|
| 219 | e.Node.Nodes.Clear();
|
|---|
| 220 |
|
|---|
| 221 | command.CommandText = "select distinct datepart(year,DATA_W) as rok from dbo.NR where datepart(year,DATA_W) is not null order by rok desc";
|
|---|
| 222 | command.Connection.Open();
|
|---|
| 223 | reader = command.ExecuteReader();
|
|---|
| 224 |
|
|---|
| 225 | while (reader.Read())
|
|---|
| 226 | {
|
|---|
| 227 | node = new TreeNode(reader.GetValue(0).ToString());
|
|---|
| 228 | node.Name = reader.GetValue(0).ToString();
|
|---|
| 229 |
|
|---|
| 230 | for (int i = 12; i >= 1; i--)
|
|---|
| 231 | {
|
|---|
| 232 | TreeNode node2 = new TreeNode(i.ToString());
|
|---|
| 233 | node2.Name = i.ToString();
|
|---|
| 234 | //node2.Nodes.Add(new TreeNode());
|
|---|
| 235 | node.Nodes.Add(node2);
|
|---|
| 236 | }
|
|---|
| 237 | e.Node.Nodes.Add(node);
|
|---|
| 238 | }
|
|---|
| 239 |
|
|---|
| 240 | command.Connection.Close();
|
|---|
| 241 |
|
|---|
| 242 | break;
|
|---|
| 243 | case "BrakWReklamie":
|
|---|
| 244 | e.Node.Nodes.Clear();
|
|---|
| [10] | 245 | DBBindings.bindujDatyWydan(e.Node);
|
|---|
| [9] | 246 | break;
|
|---|
| 247 | }
|
|---|
| 248 | break;
|
|---|
| 249 | default:
|
|---|
| 250 | e.Node.Nodes.Clear();
|
|---|
| 251 |
|
|---|
| 252 | node = new TreeNode("Biura");
|
|---|
| 253 | node.Name = "Biura";
|
|---|
| 254 | node.Nodes.Add(new TreeNode());
|
|---|
| 255 | e.Node.Nodes.Add(node);
|
|---|
| [10] | 256 | break;
|
|---|
| [9] | 257 | }
|
|---|
| 258 | break;
|
|---|
| 259 | case 2:
|
|---|
| [10] | 260 |
|
|---|
| 261 | switch (e.Node.Name)
|
|---|
| 262 | {
|
|---|
| [9] | 263 | case "Biura":
|
|---|
| 264 | DBBindings.dodajAgencjeDoWezla(e.Node);
|
|---|
| 265 | break;
|
|---|
| 266 | default:
|
|---|
| 267 | break;
|
|---|
| 268 | }
|
|---|
| 269 |
|
|---|
| 270 | break;
|
|---|
| 271 | case 3:
|
|---|
| 272 | switch (e.Node.Parent.Name)
|
|---|
| 273 | {
|
|---|
| 274 | case "Biura":
|
|---|
| 275 | DBBindings.dodajAgentowDoWezla(e.Node, e.Node.Name);
|
|---|
| 276 | break;
|
|---|
| 277 | default:
|
|---|
| 278 | break;
|
|---|
| 279 | }
|
|---|
| 280 | break;
|
|---|
| [10] | 281 | case 4:
|
|---|
| 282 | break;
|
|---|
| [9] | 283 | default:
|
|---|
| 284 | break;
|
|---|
| 285 | }
|
|---|
| 286 | }
|
|---|
| 287 | }
|
|---|
| [10] | 288 |
|
|---|
| [9] | 289 | private void wyszukajToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 290 | {
|
|---|
| 291 | wyszukajToolStrip.Visible = wyszukajToolStrip.Visible ? false : true;
|
|---|
| 292 | }
|
|---|
| 293 |
|
|---|
| 294 | private void szukajToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 295 | {
|
|---|
| 296 | command.CommandText = query;
|
|---|
| [10] | 297 | this.rEKLAMADataSet.VIEW_KOREKTY.Clear();
|
|---|
| [9] | 298 |
|
|---|
| 299 | command.CommandText += " where 1=1 ";
|
|---|
| 300 | command.Parameters.Clear();
|
|---|
| 301 |
|
|---|
| 302 | if (nrFakturyToolStripTextBox.Text.Trim() != "")
|
|---|
| 303 | {
|
|---|
| 304 | int i;
|
|---|
| 305 | if (!Int32.TryParse(nrFakturyToolStripTextBox.Text, out i))
|
|---|
| 306 | {
|
|---|
| 307 | MessageBox.Show("Podaj prawid³owy numer faktury.");
|
|---|
| 308 | return;
|
|---|
| 309 | }
|
|---|
| 310 |
|
|---|
| 311 | command.CommandText += " AND NUMER=@nr";
|
|---|
| 312 | command.Parameters.AddWithValue("@nr", nrFakturyToolStripTextBox.Text.Trim());
|
|---|
| 313 | }
|
|---|
| 314 |
|
|---|
| 315 | if (kodRozliczeniowyToolStripTextBox.Text.Trim() != "")
|
|---|
| 316 | {
|
|---|
| [10] | 317 | command.CommandText += " AND NUMER_ROZ like '%' + @kod + '%'";
|
|---|
| [9] | 318 | command.Parameters.AddWithValue("@kod", kodRozliczeniowyToolStripTextBox.Text.Trim());
|
|---|
| 319 | }
|
|---|
| 320 |
|
|---|
| 321 | if (rokToolStripTextBox.Text.Trim() != "")
|
|---|
| 322 | {
|
|---|
| 323 | int i;
|
|---|
| 324 | if (!Int32.TryParse(rokToolStripTextBox.Text.Trim(), out i))
|
|---|
| 325 | {
|
|---|
| 326 | MessageBox.Show("Podaj prawid³owy rok.");
|
|---|
| 327 | return;
|
|---|
| 328 | }
|
|---|
| 329 |
|
|---|
| [10] | 330 | command.CommandText += " AND YEAR(DATA_WYSTAWIENIA)=@rok";
|
|---|
| [9] | 331 | command.Parameters.AddWithValue("@rok", rokToolStripTextBox.Text.Trim());
|
|---|
| 332 | }
|
|---|
| 333 |
|
|---|
| 334 | if (miesiacToolStripTextBox.Text.Trim() != "")
|
|---|
| 335 | {
|
|---|
| 336 | int i;
|
|---|
| 337 | if (!Int32.TryParse(miesiacToolStripTextBox.Text.Trim(), out i))
|
|---|
| 338 | {
|
|---|
| 339 | MessageBox.Show("Podaj prawid³owy miesi¹c.");
|
|---|
| 340 | return;
|
|---|
| 341 | }
|
|---|
| 342 |
|
|---|
| [10] | 343 | command.CommandText += " AND MONTH(DATA_WYSTAWIENIA)=@miesiac";
|
|---|
| [9] | 344 | command.Parameters.AddWithValue("@miesiac", miesiacToolStripTextBox.Text.Trim());
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | if (agencjaToolStripComboBox.Text.Trim() != "")
|
|---|
| 348 | {
|
|---|
| 349 | command.CommandText += " AND Agencja=@agencja";
|
|---|
| 350 | command.Parameters.AddWithValue("@agencja", agencjaToolStripComboBox.Text.Trim());
|
|---|
| 351 | }
|
|---|
| 352 |
|
|---|
| [10] | 353 | /*
|
|---|
| [9] | 354 | if (((CheckBox)((ToolStripControlHost)wyszukajToolStrip.Items["zalegleCheckBox"]).Control).CheckState == CheckState.Checked)
|
|---|
| 355 | {
|
|---|
| 356 | command.CommandText += " AND (BRUTTO - suma_zaplat) > 0";
|
|---|
| 357 | }
|
|---|
| 358 | else if (((CheckBox)((ToolStripControlHost)wyszukajToolStrip.Items["zalegleCheckBox"]).Control).CheckState == CheckState.Unchecked)
|
|---|
| 359 | {
|
|---|
| 360 | command.CommandText += " AND (BRUTTO - suma_zaplat) <= 0 ";
|
|---|
| [10] | 361 | }*/
|
|---|
| [9] | 362 |
|
|---|
| 363 | //MessageBox.Show(command.CommandText + nrFakturyToolStripTextBox.Text);
|
|---|
| 364 | sqlDataAdapter.SelectCommand = command;
|
|---|
| 365 |
|
|---|
| 366 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 367 |
|
|---|
| 368 | try
|
|---|
| 369 | {
|
|---|
| [10] | 370 | int t = sqlDataAdapter.Fill(this.rEKLAMADataSet.VIEW_KOREKTY);
|
|---|
| [9] | 371 | commandExecuted = true;
|
|---|
| 372 | }
|
|---|
| 373 | catch (Exception e1)
|
|---|
| 374 | {
|
|---|
| 375 | MessageBox.Show(e1.Message);
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 | treeView1.CollapseAll();
|
|---|
| 379 | treeView1.SelectedNode = null;
|
|---|
| 380 |
|
|---|
| 381 | this.Cursor = Cursors.Default;
|
|---|
| 382 | }
|
|---|
| 383 |
|
|---|
| 384 | private void fakturyDataGridView_Leave(object sender, EventArgs e)
|
|---|
| 385 | {
|
|---|
| 386 | fakturyDataGridView.EndEdit();
|
|---|
| 387 | }
|
|---|
| 388 |
|
|---|
| 389 | private void kryteriumWyszukiwania_KeyPress(object sender, KeyPressEventArgs e)
|
|---|
| 390 | {
|
|---|
| 391 | if (e.KeyChar == 13)
|
|---|
| 392 | {
|
|---|
| 393 | wyszukajToolStripButton.PerformClick();
|
|---|
| 394 | }
|
|---|
| 395 | }
|
|---|
| [10] | 396 |
|
|---|
| [9] | 397 | private void toolStripButton1_Click(object sender, EventArgs e)
|
|---|
| 398 | {
|
|---|
| 399 | PrintDGV.Print_DataGridView(fakturyDataGridView,50);
|
|---|
| 400 | }
|
|---|
| 401 |
|
|---|
| 402 | private void wyczyscPolaToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 403 | {
|
|---|
| 404 | rEKLAMADataSet.ZestawienieFaktur.Clear();
|
|---|
| 405 |
|
|---|
| 406 | nrFakturyToolStripTextBox.Clear();
|
|---|
| 407 | kodRozliczeniowyToolStripTextBox.Clear();
|
|---|
| 408 | rokToolStripTextBox.Clear();
|
|---|
| 409 | miesiacToolStripTextBox.Clear();
|
|---|
| 410 | agencjaToolStripComboBox.SelectedIndex = -1;
|
|---|
| 411 | agencjaToolStripComboBox.Text = "";
|
|---|
| 412 | ((CheckBox)((ToolStripControlHost)wyszukajToolStrip.Items["zalegleCheckBox"]).Control).CheckState = CheckState.Indeterminate;
|
|---|
| 413 | }
|
|---|
| 414 |
|
|---|
| 415 | private void podgladToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 416 | {
|
|---|
| [10] | 417 | if (vIEWKOREKTYBindingSource.Current != null)
|
|---|
| [9] | 418 | {
|
|---|
| [10] | 419 | DataRowView row = (DataRowView)vIEWKOREKTYBindingSource.Current;
|
|---|
| 420 | REKLAMADataSet.VIEW_KOREKTYRow faktura = (REKLAMADataSet.VIEW_KOREKTYRow)row.Row;
|
|---|
| [9] | 421 |
|
|---|
| 422 | this.Cursor = Cursors.WaitCursor;
|
|---|
| [10] | 423 | FactureViewer fv = new FactureViewer(faktura.idFakturyKorekta,faktura.ID_FAKTURY);
|
|---|
| [9] | 424 | fv.ShowDialog();
|
|---|
| 425 |
|
|---|
| 426 | this.Cursor = Cursors.Default;
|
|---|
| 427 | }
|
|---|
| 428 | }
|
|---|
| 429 |
|
|---|
| 430 | /// <summary>
|
|---|
| 431 | /// Przechodzi do okna KLIENCI i wywietla dane klienta zwi¹zanego z faktur¹.
|
|---|
| 432 | /// </summary>
|
|---|
| 433 | private void klientToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 434 | {
|
|---|
| [10] | 435 | if (vIEWKOREKTYBindingSource.Current != null)
|
|---|
| [9] | 436 | {
|
|---|
| [10] | 437 | DataRowView row = (DataRowView)vIEWKOREKTYBindingSource.Current;
|
|---|
| 438 | REKLAMADataSet.VIEW_KOREKTYRow korekta = (REKLAMADataSet.VIEW_KOREKTYRow)row.Row;
|
|---|
| 439 |
|
|---|
| 440 | ClientsForm.getClientsForm((MDIBazaReklam)this.MdiParent).pokazKlienta(korekta.CustomerId);
|
|---|
| [9] | 441 | this.Hide();
|
|---|
| 442 |
|
|---|
| 443 | ClientsForm.getClientsForm((MDIBazaReklam)this.MdiParent).Show();
|
|---|
| 444 | }
|
|---|
| 445 | }
|
|---|
| 446 |
|
|---|
| 447 | private void FacturesForm_Shown(object sender, EventArgs e)
|
|---|
| 448 | {
|
|---|
| 449 | if (User.getUser().St_kierownik)
|
|---|
| 450 | {
|
|---|
| 451 | agencjaToolStripComboBox.Text = User.getUser().SymbolAgencji;
|
|---|
| 452 | }
|
|---|
| 453 | else if (User.getUser().St_handlowiec | User.getUser().St_subhandlowiec)
|
|---|
| 454 | {
|
|---|
| 455 | kodRozliczeniowyToolStripTextBox.Text = User.getUser().Kod_agenta;
|
|---|
| 456 | }
|
|---|
| 457 |
|
|---|
| 458 |
|
|---|
| 459 | }
|
|---|
| 460 |
|
|---|
| 461 | private void excelToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 462 | {
|
|---|
| 463 | this.Cursor = Cursors.WaitCursor;
|
|---|
| 464 |
|
|---|
| 465 | ExcelHandler ex = new ExcelHandler();
|
|---|
| 466 | ex.exportToExcel(fakturyDataGridView);
|
|---|
| 467 |
|
|---|
| 468 | this.Cursor = Cursors.Default;
|
|---|
| 469 | }
|
|---|
| 470 |
|
|---|
| 471 | private void fakturyDataGridView_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
|
|---|
| 472 | {
|
|---|
| 473 | if (e.ListChangedType == ListChangedType.Reset)
|
|---|
| 474 | {
|
|---|
| 475 | foreach (DataGridViewRow r in fakturyDataGridView.Rows)
|
|---|
| 476 | {
|
|---|
| 477 | if (r.Cells[8].Value != DBNull.Value && r.Cells[9].Value != DBNull.Value)
|
|---|
| 478 | {
|
|---|
| 479 | if (Convert.ToDecimal(r.Cells[8].Value) != Convert.ToDecimal(r.Cells[9].Value))
|
|---|
| 480 | {
|
|---|
| [10] | 481 | // r.DefaultCellStyle.ForeColor = Color.Red;
|
|---|
| [9] | 482 | }
|
|---|
| 483 | }
|
|---|
| 484 | }
|
|---|
| 485 | }
|
|---|
| 486 | }
|
|---|
| 487 |
|
|---|
| 488 | private void wplata2toolStripButton_Click(object sender, EventArgs e)
|
|---|
| 489 | {
|
|---|
| [10] | 490 | if (vIEWKOREKTYBindingSource.Current != null)
|
|---|
| [9] | 491 | {
|
|---|
| [10] | 492 | /*
|
|---|
| 493 | DataRowView row = (DataRowView)vIEWKOREKTYBindingSource.Current;
|
|---|
| 494 | REKLAMADataSet.KONTAKTYRow f = (REKLAMADataSet.KONTAKTYRow)row.Row;
|
|---|
| [9] | 495 |
|
|---|
| 496 | PaymentForm2 pf2;
|
|---|
| 497 |
|
|---|
| 498 | if (f.IsidWplatyNull())
|
|---|
| 499 | {
|
|---|
| 500 | pf2 = new PaymentForm2(0,f.ID_FAKTURY);
|
|---|
| 501 | }
|
|---|
| 502 | else
|
|---|
| 503 | {
|
|---|
| 504 | pf2 = new PaymentForm2(f.idWplaty, f.ID_FAKTURY);
|
|---|
| 505 | }
|
|---|
| 506 |
|
|---|
| 507 | if (pf2.ShowDialog() == DialogResult.OK)
|
|---|
| 508 | {
|
|---|
| 509 | f.idWplaty = pf2.IdWplaty;
|
|---|
| 510 | f.EndEdit();
|
|---|
| 511 | fakturyDataGridView.Refresh();
|
|---|
| [10] | 512 | }*/
|
|---|
| 513 |
|
|---|
| [9] | 514 | }
|
|---|
| 515 |
|
|---|
| 516 | }
|
|---|
| 517 |
|
|---|
| 518 | private void zamowieniaToolStripButton_Click(object sender, EventArgs e)
|
|---|
| 519 | {
|
|---|
| [10] | 520 | if (vIEWKOREKTYBindingSource.Current != null)
|
|---|
| [9] | 521 | {
|
|---|
| [10] | 522 | DataRowView row = (DataRowView)vIEWKOREKTYBindingSource.Current;
|
|---|
| 523 | REKLAMADataSet.VIEW_KOREKTYRow f = (REKLAMADataSet.VIEW_KOREKTYRow)row.Row;
|
|---|
| [9] | 524 |
|
|---|
| [10] | 525 | ZamowieniaForm zf = new ZamowieniaForm(f.CustomerId,f.idZamowienia);
|
|---|
| [9] | 526 | zf.ShowDialog();
|
|---|
| 527 | }
|
|---|
| 528 | }
|
|---|
| 529 |
|
|---|
| 530 | private void toolStripButton2_Click(object sender, EventArgs e)
|
|---|
| 531 | {
|
|---|
| 532 | }
|
|---|
| 533 | }
|
|---|
| 534 | } |
|---|