- Data:
- 2009-01-20 11:27:45 (17 years ago)
- Lokalizacja:
- trunk/BazaReklam
- Pliki:
-
- 2 zmodyfikowane
-
OrderDetails.cs (zmodyfikowane) (37 diffs)
-
ZestawienieZamowienForm.cs (zmodyfikowane) (16 diffs)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
trunk/BazaReklam/OrderDetails.cs
r192 r205 59 59 InitializeComponent(); 60 60 61 this.rEKLAMADataSet.UKAZE_SIE_W_NR.Constraints.Remove("FAKTURY_UKAZE_SIE_W_NR");61 rEKLAMADataSet.UKAZE_SIE_W_NR.Constraints.Remove("FAKTURY_UKAZE_SIE_W_NR"); 62 62 63 63 errProvider = new ErrorProvider(); … … 90 90 zmianyEmisjiTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; 91 91 92 this.nAZWY_MODULOWTableAdapter.Fill(this.sLOWNIKDataSet.NAZWY_MODULOW);93 this.gRZBIETYTableAdapter.Fill(this.sLOWNIKDataSet.GRZBIETY);94 this.pROMOCJETableAdapter.Fill(this.sLOWNIKDataSet.PROMOCJE);92 nAZWY_MODULOWTableAdapter.Fill(sLOWNIKDataSet.NAZWY_MODULOW); 93 gRZBIETYTableAdapter.Fill(sLOWNIKDataSet.GRZBIETY); 94 pROMOCJETableAdapter.Fill(sLOWNIKDataSet.PROMOCJE); 95 95 96 96 if (User.getUser().St_kierownik || User.getUser().St_produkcja) 97 97 { 98 this.lISTA_TYPOW_REKLAMYTableAdapter.Fill(this.sLOWNIKDataSet.LISTA_TYPOW_REKLAMY);98 lISTA_TYPOW_REKLAMYTableAdapter.Fill(sLOWNIKDataSet.LISTA_TYPOW_REKLAMY); 99 99 } 100 100 else 101 101 { 102 this.lISTA_TYPOW_REKLAMYTableAdapter.FillByBezBezplatnych(this.sLOWNIKDataSet.LISTA_TYPOW_REKLAMY);103 } 104 this.lISTA_TYTULOWTableAdapter.Fill(this.sLOWNIKDataSet.LISTA_TYTULOW);105 this.aGENCITableAdapter.FillByAktywny(this.sLOWNIKDataSet.AGENCI);106 this.ogl_dzialyTableAdapter.Fill(this.sLOWNIKDataSet.ogl_dzialy);107 this.ogl_rozdzialyTableAdapter.Fill(this.sLOWNIKDataSet.ogl_rozdzialy);102 lISTA_TYPOW_REKLAMYTableAdapter.FillByBezBezplatnych(sLOWNIKDataSet.LISTA_TYPOW_REKLAMY); 103 } 104 lISTA_TYTULOWTableAdapter.Fill(sLOWNIKDataSet.LISTA_TYTULOW); 105 aGENCITableAdapter.FillByAktywny(sLOWNIKDataSet.AGENCI); 106 ogl_dzialyTableAdapter.Fill(sLOWNIKDataSet.ogl_dzialy); 107 ogl_rozdzialyTableAdapter.Fill(sLOWNIKDataSet.ogl_rozdzialy); 108 108 109 109 usunToolStripMenuItem.Click += usunEmisje; … … 128 128 if (tYTULComboBox.SelectedValue != null) 129 129 { 130 this.nAZWYMODULOWBindingSource.Filter = "tytul='" + tYTULComboBox.SelectedValue.ToString() + "'";131 this.iD_REKLAMYTextBox.Text = (nowyRekord) ? this.numeryReklam[tYTULComboBox.SelectedValue.ToString()] : this.iD_REKLAMYTextBox.Text;132 this.gRZBIETYBindingSource.Filter = "Nazwa like '%" + tYTULComboBox.SelectedValue.ToString() + "%'";130 nAZWYMODULOWBindingSource.Filter = "tytul='" + tYTULComboBox.SelectedValue.ToString() + "'"; 131 iD_REKLAMYTextBox.Text = (nowyRekord) ? numeryReklam[tYTULComboBox.SelectedValue.ToString()] : iD_REKLAMYTextBox.Text; 132 gRZBIETYBindingSource.Filter = "Nazwa like '%" + tYTULComboBox.SelectedValue.ToString() + "%'"; 133 133 int i = lISTATYTULOWBindingSource.Find("SYMB", tYTULComboBox.SelectedValue); 134 this.maksymalnyRabat = Convert.ToDouble(((DataRowView)lISTATYTULOWBindingSource.List[i])["max_rabat"]);134 maksymalnyRabat = Convert.ToDouble(((DataRowView)lISTATYTULOWBindingSource.List[i])["max_rabat"]); 135 135 136 136 DataRowView row = (DataRowView)lISTATYTULOWBindingSource.Current; 137 this.ogl_dzialyBindingSource.Filter = "TYTUL=" + row["id"].ToString();137 ogl_dzialyBindingSource.Filter = "TYTUL=" + row["id"].ToString(); 138 138 139 139 switch (tYTULComboBox.SelectedValue.ToString()) 140 140 { 141 141 case "AMT": 142 this.ogl_dzialyBindingSource.Filter = "TYTUL='2'";142 ogl_dzialyBindingSource.Filter = "TYTUL='2'"; 143 143 break; 144 144 case "GS": 145 this.ogl_dzialyBindingSource.Filter = "TYTUL='1'";145 ogl_dzialyBindingSource.Filter = "TYTUL='1'"; 146 146 break; 147 147 case "AGRO": 148 this.ogl_dzialyBindingSource.Filter = "TYTUL='7'";148 ogl_dzialyBindingSource.Filter = "TYTUL='7'"; 149 149 break; 150 150 case "adMot": 151 this.ogl_dzialyBindingSource.Filter = "TYTUL='6'";151 ogl_dzialyBindingSource.Filter = "TYTUL='6'"; 152 152 break; 153 153 default: 154 this.ogl_dzialyBindingSource.Filter = "";154 ogl_dzialyBindingSource.Filter = ""; 155 155 break; 156 156 } … … 165 165 if ((int)grzbietComboBox.SelectedValue == 9) 166 166 { 167 this.iD_REKLAMYTextBox.Text = (nowyRekord) ? this.numeryReklam["slaski"] : this.iD_REKLAMYTextBox.Text;167 iD_REKLAMYTextBox.Text = (nowyRekord) ? numeryReklam["slaski"] : iD_REKLAMYTextBox.Text; 168 168 } 169 169 else 170 170 { 171 this.iD_REKLAMYTextBox.Text = (nowyRekord) ? this.numeryReklam[tYTULComboBox.SelectedValue.ToString()] : this.iD_REKLAMYTextBox.Text;171 iD_REKLAMYTextBox.Text = (nowyRekord) ? numeryReklam[tYTULComboBox.SelectedValue.ToString()] : iD_REKLAMYTextBox.Text; 172 172 } 173 173 } … … 183 183 rEKLAMABindingSource.RemoveCurrent(); 184 184 rEKLAMABindingSource.EndEdit(); 185 rEKLAMATableAdapter.Update( this.rEKLAMADataSet.REKLAMA);185 rEKLAMATableAdapter.Update(rEKLAMADataSet.REKLAMA); 186 186 } 187 187 } … … 193 193 } 194 194 195 this.obslugaZdarzen = false;195 obslugaZdarzen = false; 196 196 liczbaEmisjiLabel.Text = "-"; 197 197 198 this.DialogResult = bylyZmiany ? DialogResult.OK : DialogResult.Cancel;198 DialogResult = bylyZmiany ? DialogResult.OK : DialogResult.Cancel; 199 199 } 200 200 … … 204 204 private void dodajButton_Click(object sender, EventArgs e) 205 205 { 206 this.Cursor = Cursors.WaitCursor;207 208 this.Validate();206 Cursor = Cursors.WaitCursor; 207 208 Validate(); 209 209 rEKLAMABindingSource.EndEdit(); 210 210 … … 222 222 { 223 223 MessageBox.Show("Zosta³a zmieniona opcja wyró¿nienia. Zamówienie nale¿y ponownie przeliczyæ"); 224 this.Cursor = Cursors.Default;224 Cursor = Cursors.Default; 225 225 return; 226 226 } … … 233 233 //MessageBox.Show(rEKLAMAUKAZESIEWNRBindingSource.List.Count.ToString() + " " + rEKLAMADataSet.UKAZE_SIE_W_NR.Count.ToString()); 234 234 235 this.rEKLAMATableAdapter.Update(this.rEKLAMADataSet.REKLAMA);236 this.uKAZE_SIE_W_NRTableAdapter.Update(this.rEKLAMADataSet.UKAZE_SIE_W_NR);237 this.reklama_Info_DodTableAdapter.Update(this.rEKLAMADataSet.Reklama_Info_Dod);238 this.zmianyEmisjiTableAdapter.Update(this.rEKLAMADataSet.zmianyEmisji);235 rEKLAMATableAdapter.Update(rEKLAMADataSet.REKLAMA); 236 uKAZE_SIE_W_NRTableAdapter.Update(rEKLAMADataSet.UKAZE_SIE_W_NR); 237 reklama_Info_DodTableAdapter.Update(rEKLAMADataSet.Reklama_Info_Dod); 238 zmianyEmisjiTableAdapter.Update(rEKLAMADataSet.zmianyEmisji); 239 239 MessageBox.Show("Zmiany zapisane"); 240 240 … … 245 245 //this.obslugaZdarzen = false; 246 246 247 this.Cursor = Cursors.Default;247 Cursor = Cursors.Default; 248 248 } 249 249 … … 308 308 if (!User.getUser().St_kierownik) 309 309 { 310 if (Convert.ToDouble(row["rabat"]) > this.maksymalnyRabat)310 if (Convert.ToDouble(row["rabat"]) > maksymalnyRabat) 311 311 { 312 MessageBox.Show("Rabat wy¿szy ni¿ " + this.maksymalnyRabat.ToString("P") + ". Zamówienie musi byæ zatwierdzone do druku przez kierownika");312 MessageBox.Show("Rabat wy¿szy ni¿ " + maksymalnyRabat.ToString("P") + ". Zamówienie musi byæ zatwierdzone do druku przez kierownika"); 313 313 zATWIERDZONO_DO_DRUKUCheckBox.CheckState = CheckState.Unchecked; 314 314 } … … 425 425 r.ReadOnly = true; 426 426 r.DefaultCellStyle.BackColor = Color.MintCream; 427 this.juzSieUkazaloWgazecie = true;427 juzSieUkazaloWgazecie = true; 428 428 break; 429 429 } … … 809 809 public void dodajNoweZamowienie(int custId, string kodKlienta) 810 810 { 811 this.nowyRekord = true;812 this.bylyZmiany = false;813 this.juzSieUkazaloWgazecie = false;814 815 this.numeryReklam.Clear();811 nowyRekord = true; 812 bylyZmiany = false; 813 juzSieUkazaloWgazecie = false; 814 815 numeryReklam.Clear(); 816 816 817 817 string nr; … … 819 819 { 820 820 nr = nrRek(User.getUser().Symbol_agenta, r["SYMB2"].ToString().Trim() + User.getUser().Kod_agenta); 821 this.numeryReklam.Add((string)r["SYMB"], nr);821 numeryReklam.Add((string)r["SYMB"], nr); 822 822 } 823 823 //autosalon l¹ski 824 824 nr = nrRek(User.getUser().Symbol_agenta, "G" + User.getUser().Kod_agenta); 825 this.numeryReklam.Add("slaski", nr);826 827 this.rEKLAMADataSet.REKLAMA.Clear();828 this.rEKLAMADataSet.UKAZE_SIE_W_NR.Clear();829 this.rEKLAMADataSet.Reklama_Info_Dod.Clear();830 831 this.customerId = custId;832 833 DataView datatable = (DataView) this.rEKLAMABindingSource.List;825 numeryReklam.Add("slaski", nr); 826 827 rEKLAMADataSet.REKLAMA.Clear(); 828 rEKLAMADataSet.UKAZE_SIE_W_NR.Clear(); 829 rEKLAMADataSet.Reklama_Info_Dod.Clear(); 830 831 customerId = custId; 832 833 DataView datatable = (DataView)rEKLAMABindingSource.List; 834 834 DataRowView row = datatable.AddNew(); 835 835 836 row["CustomerId"] = this.customerId;836 row["CustomerId"] = customerId; 837 837 row["DATA ZAMÓWIENIA"] = DateTime.Now; 838 838 row["nick name"] = kodKlienta; 839 if (Utils.czyKlientMaNrVIES( this.customerId))839 if (Utils.czyKlientMaNrVIES(customerId)) 840 840 { 841 841 row["VAT"] = 0; … … 845 845 { 846 846 row["symbol akwizytora"] = User.getUser().Symbol_agenta; 847 row["ID Reklamy"] = this.numeryReklam["AMT"];847 row["ID Reklamy"] = numeryReklam["AMT"]; 848 848 849 849 //Katowice … … 871 871 public void pokazSzczegolyZamowienia(int rekId) 872 872 { 873 this.nowyRekord = false;874 this.bylyZmiany = false;875 this.reklamaId = rekId;876 877 this.rEKLAMATableAdapter.ClearBeforeFill = true;878 this.rEKLAMATableAdapter.FillByReklamaId(this.rEKLAMADataSet.REKLAMA, reklamaId);879 this.reklama_Info_DodTableAdapter.FillByReklamaId(this.rEKLAMADataSet.Reklama_Info_Dod, reklamaId);880 this.rEKLAMA_STRONATableAdapter.FillByReklamaId(this.rEKLAMADataSet.REKLAMA_STRONA, this.reklamaId);881 this.uKAZE_SIE_W_NRTableAdapter.FillByReklamaId(this.rEKLAMADataSet.UKAZE_SIE_W_NR, this.reklamaId);873 nowyRekord = false; 874 bylyZmiany = false; 875 reklamaId = rekId; 876 877 rEKLAMATableAdapter.ClearBeforeFill = true; 878 rEKLAMATableAdapter.FillByReklamaId(rEKLAMADataSet.REKLAMA, reklamaId); 879 reklama_Info_DodTableAdapter.FillByReklamaId(rEKLAMADataSet.Reklama_Info_Dod, reklamaId); 880 rEKLAMA_STRONATableAdapter.FillByReklamaId(rEKLAMADataSet.REKLAMA_STRONA, reklamaId); 881 uKAZE_SIE_W_NRTableAdapter.FillByReklamaId(rEKLAMADataSet.UKAZE_SIE_W_NR, reklamaId); 882 882 } 883 883 884 884 public void wznowZamowienie(int rekId) 885 885 { 886 this.nowyRekord = true;887 this.bylyZmiany = false;888 this.juzSieUkazaloWgazecie = false;889 890 REKLAMADataSet.REKLAMADataTable old = this.rEKLAMATableAdapter.GetDataByReklamaId(rekId);886 nowyRekord = true; 887 bylyZmiany = false; 888 juzSieUkazaloWgazecie = false; 889 890 REKLAMADataSet.REKLAMADataTable old = rEKLAMATableAdapter.GetDataByReklamaId(rekId); 891 891 DataRow oldRow = old.Rows[0]; 892 892 893 this.rEKLAMADataSet.REKLAMA.Clear();894 this.rEKLAMADataSet.UKAZE_SIE_W_NR.Clear();895 this.rEKLAMADataSet.Reklama_Info_Dod.Clear();896 897 DataView datatable = (DataView) this.rEKLAMABindingSource.List;893 rEKLAMADataSet.REKLAMA.Clear(); 894 rEKLAMADataSet.UKAZE_SIE_W_NR.Clear(); 895 rEKLAMADataSet.Reklama_Info_Dod.Clear(); 896 897 DataView datatable = (DataView)rEKLAMABindingSource.List; 898 898 DataRowView newRow = datatable.AddNew(); 899 899 900 this.customerId = Convert.ToInt32(oldRow["CustomerID"]);900 customerId = Convert.ToInt32(oldRow["CustomerID"]); 901 901 902 902 newRow["CustomerID"] = oldRow["CustomerID"]; … … 947 947 } 948 948 949 this.numeryReklam.Clear();949 numeryReklam.Clear(); 950 950 string nr; 951 951 foreach (DataRowView r in lISTATYTULOWBindingSource.List) 952 952 { 953 953 nr = nrRek(User.getUser().Symbol_agenta, r["SYMB2"].ToString().Trim() + User.getUser().Kod_agenta); 954 this.numeryReklam.Add((string)r["SYMB"], nr);954 numeryReklam.Add((string)r["SYMB"], nr); 955 955 } 956 956 //autosalon l¹ski 957 957 nr = nrRek(User.getUser().Symbol_agenta, "G" + User.getUser().Kod_agenta); 958 this.numeryReklam.Add("slaski", nr);958 numeryReklam.Add("slaski", nr); 959 959 960 960 Validate(); … … 986 986 private void dataGridView1_Leave(object sender, EventArgs e) 987 987 { 988 this.dataGridView1.EndEdit();988 dataGridView1.EndEdit(); 989 989 990 990 Validate(); 991 991 992 this.rEKLAMAReklamaInfoDodBindingSource.EndEdit();992 rEKLAMAReklamaInfoDodBindingSource.EndEdit(); 993 993 } 994 994 … … 1001 1001 rEKLAMABindingSource.RemoveCurrent(); 1002 1002 rEKLAMABindingSource.EndEdit(); 1003 rEKLAMATableAdapter.Update( this.rEKLAMADataSet.REKLAMA);1003 rEKLAMATableAdapter.Update(rEKLAMADataSet.REKLAMA); 1004 1004 } 1005 1005 … … 1012 1012 } 1013 1013 1014 this.obslugaZdarzen = false;1014 obslugaZdarzen = false; 1015 1015 liczbaEmisjiLabel.Text = "-"; 1016 this.nettoBezBOTextBox.Clear();1017 this.kurs = null;1018 this.DialogResult = bylyZmiany ? DialogResult.OK : DialogResult.Cancel;1016 nettoBezBOTextBox.Clear(); 1017 kurs = null; 1018 DialogResult = bylyZmiany ? DialogResult.OK : DialogResult.Cancel; 1019 1019 } 1020 1020 … … 1024 1024 private void zmiany() 1025 1025 { 1026 if ( this.rEKLAMABindingSource.Current != null)1027 { 1028 DataRowView reklamRow = (DataRowView) this.rEKLAMABindingSource.Current;1026 if (rEKLAMABindingSource.Current != null) 1027 { 1028 DataRowView reklamRow = (DataRowView)rEKLAMABindingSource.Current; 1029 1029 1030 1030 bool zablokujProwizje = Convert.ToBoolean(reklamRow["zablokuj_prowizje"]); 1031 1031 bool zatwiedzonoDoDruku = reklamRow["ZATWIERDZONO DO DRUKU"] == DBNull.Value ? false : Convert.ToBoolean(reklamRow["ZATWIERDZONO DO DRUKU"]); 1032 1032 bool kierownikZatwierdzil = reklamRow["kier_zatwierdzil"] == DBNull.Value ? false : Convert.ToBoolean(reklamRow["kier_zatwierdzil"]); 1033 bool rabatPonad30 = (bool)(Convert.ToDouble(reklamRow["rabat"]) > this.maksymalnyRabat);1033 bool rabatPonad30 = (bool)(Convert.ToDouble(reklamRow["rabat"]) > maksymalnyRabat); 1034 1034 bool wystawionoFakture = reklamRow["FAKTURA WYSTAWIONO"] == DBNull.Value ? false : Convert.ToBoolean(reklamRow["FAKTURA WYSTAWIONO"]); 1035 1035 … … 1069 1069 if (e.Control && e.KeyCode == Keys.C) 1070 1070 { 1071 if ( this.ukazeSieDataGridView.GetCellCount(DataGridViewElementStates.Selected) > 0)1071 if (ukazeSieDataGridView.GetCellCount(DataGridViewElementStates.Selected) > 0) 1072 1072 { 1073 1073 try … … 1075 1075 // Add the selection to the clipboard. 1076 1076 Clipboard.SetDataObject( 1077 this.ukazeSieDataGridView.GetClipboardContent());1077 ukazeSieDataGridView.GetClipboardContent()); 1078 1078 } 1079 1079 catch (System.Runtime.InteropServices.ExternalException) … … 1115 1115 try 1116 1116 { 1117 DataView datatable = (DataView) this.rEKLAMAUKAZESIEWNRBindingSource.List;1117 DataView datatable = (DataView)rEKLAMAUKAZESIEWNRBindingSource.List; 1118 1118 DataRowView row = datatable.AddNew(); 1119 1119 row["Nr Wydania"] = nrWydania; … … 1205 1205 tresc.AppendLine(" w/w tytu³u i udokumentowane faktur¹ VAT przes³an¹ na wskazany adres."); 1206 1206 1207 MailForm mf = new MailForm(Utils.customerId( this.reklamaId), "Potwierdzenie z³o¿enia zamówienia " + iD_REKLAMYTextBox.Text, "", tresc.ToString());1207 MailForm mf = new MailForm(Utils.customerId(reklamaId), "Potwierdzenie z³o¿enia zamówienia " + iD_REKLAMYTextBox.Text, "", tresc.ToString()); 1208 1208 1209 1209 mf.ShowDialog(); … … 1223 1223 REKLAMADataSet.UKAZE_SIE_W_NRDataTable table = 1224 1224 (REKLAMADataSet.UKAZE_SIE_W_NRDataTable) 1225 this.rEKLAMADataSet.UKAZE_SIE_W_NR.Copy();1225 rEKLAMADataSet.UKAZE_SIE_W_NR.Copy(); 1226 1226 1227 1227 REKLAMADataSet.REKLAMARow reklama = (REKLAMADataSet.REKLAMARow) 1228 ((DataRowView)( this.rEKLAMABindingSource.Current)).Row;1228 ((DataRowView)(rEKLAMABindingSource.Current)).Row; 1229 1229 1230 1230 KalendarzEmisji kalendarz = … … 1240 1240 Convert.ToDecimal(rows[i]["id"])) == null) 1241 1241 { 1242 this.rEKLAMADataSet.UKAZE_SIE_W_NR.ImportRow(1242 rEKLAMADataSet.UKAZE_SIE_W_NR.ImportRow( 1243 1243 (REKLAMADataSet.UKAZE_SIE_W_NRRow)rows[i]); 1244 1244 } … … 1252 1252 // int il = this.rEKLAMADataSet.UKAZE_SIE_W_NR.Count; 1253 1253 int il = ukazeSieDataGridView.Rows.Count; 1254 this.kROTNOSCTextBox.Text = il.ToString();1255 this.liczbaEmisjiLabel.Text = il.ToString();1254 kROTNOSCTextBox.Text = il.ToString(); 1255 liczbaEmisjiLabel.Text = il.ToString(); 1256 1256 rEKLAMABindingSource.EndEdit(); 1257 1257 … … 1350 1350 // int il = this.rEKLAMADataSet.UKAZE_SIE_W_NR.Count; 1351 1351 int il = ukazeSieDataGridView.Rows.Count; 1352 this.kROTNOSCTextBox.Text = il.ToString();1353 this.liczbaEmisjiLabel.Text = il.ToString();1352 kROTNOSCTextBox.Text = il.ToString(); 1353 liczbaEmisjiLabel.Text = il.ToString(); 1354 1354 rEKLAMABindingSource.EndEdit(); 1355 1355 … … 1377 1377 REKLAMADataSet.UKAZE_SIE_W_NRDataTable table = 1378 1378 (REKLAMADataSet.UKAZE_SIE_W_NRDataTable) 1379 this.rEKLAMADataSet.UKAZE_SIE_W_NR.Copy();1379 rEKLAMADataSet.UKAZE_SIE_W_NR.Copy(); 1380 1380 1381 1381 REKLAMADataSet.REKLAMARow reklama = (REKLAMADataSet.REKLAMARow) 1382 ((DataRowView)( this.rEKLAMABindingSource.Current)).Row;1382 ((DataRowView)(rEKLAMABindingSource.Current)).Row; 1383 1383 1384 1384 KalendarzEmisji kalendarz = new KalendarzEmisji( … … 1404 1404 1405 1405 row.EndEdit(); 1406 this.rEKLAMADataSet.UKAZE_SIE_W_NR.EndInit();1407 this.rEKLAMAUKAZESIEWNRBindingSource.ResetBindings(false);1406 rEKLAMADataSet.UKAZE_SIE_W_NR.EndInit(); 1407 rEKLAMAUKAZESIEWNRBindingSource.ResetBindings(false); 1408 1408 } 1409 1409 } … … 1534 1534 private void wyroznienieCheckBox_Click(object sender, EventArgs e) 1535 1535 { 1536 this.rEKLAMABindingSource.EndEdit();1536 rEKLAMABindingSource.EndEdit(); 1537 1537 PrzeliczCaleZamowienie(); 1538 1538 … … 1569 1569 if (rEKLAMABindingSource.Current != null) 1570 1570 { 1571 DataRowView row = (DataRowView) rEKLAMABindingSource.Current;1572 REKLAMADataSet.REKLAMARow reklama = (REKLAMADataSet.REKLAMARow) row.Row;1571 DataRowView row = (DataRowView) rEKLAMABindingSource.Current; 1572 REKLAMADataSet.REKLAMARow reklama = (REKLAMADataSet.REKLAMARow) row.Row; 1573 1573 //wyliczona cena modulu 1574 1574 double szer = reklama.SZER; … … 1579 1579 double prowizjaProcent = reklama.PROCENT_PROWIZJI; 1580 1580 double rabatProcent = reklama.RABAT; 1581 double rabatWartosc = rabatProcent *cenaJednostkowa;1582 double netto = (cenaJednostkowa - rabatWartosc) *krotnosc;1581 double rabatWartosc = rabatProcent*cenaJednostkowa; 1582 double netto = (cenaJednostkowa - rabatWartosc)*krotnosc; 1583 1583 double cenaModulu; 1584 if ((szer * wys *krotnosc) != 0)1585 { 1586 cenaModulu = netto / (szer * wys *krotnosc);1584 if ((szer*wys*krotnosc) != 0) 1585 { 1586 cenaModulu = netto/(szer*wys*krotnosc); 1587 1587 cenaModuluLabel.Text = String.Format("{0:C}", cenaModulu); 1588 1588 } … … 1592 1592 } 1593 1593 1594 liczbaEmisjiLabel.Text = this.rEKLAMADataSet.UKAZE_SIE_W_NR.Rows.Count.ToString();1595 1596 this.obslugaZdarzen = false;1594 liczbaEmisjiLabel.Text = rEKLAMADataSet.UKAZE_SIE_W_NR.Rows.Count.ToString(); 1595 1596 obslugaZdarzen = false; 1597 1597 if (!reklama.IsBrutto_Euro_MianoNull()) 1598 1598 { … … 1603 1603 walutyComboBox.SelectedIndex = 0; //PLN 1604 1604 } 1605 this.obslugaZdarzen = true; 1606 1607 if ((reklama.TYP == "BEZP£ATNA" || reklama.TYP == "INNE") && reklama.DATA_ZAMÓWIENIA.Year == 2008) 1605 obslugaZdarzen = true; 1606 1607 if ((reklama.TYP == "BEZP£ATNA" || reklama.TYP == "INNE") && 1608 (DateTime.Now.Year > 2008 && DateTime.Now.Month < 2)) 1608 1609 { 1609 1610 cenaEmisjiButton.Enabled = true; … … 1618 1619 private void cenaEmisjiButton_Click(object sender, EventArgs e) 1619 1620 { 1620 if (this.rEKLAMADataSet.UKAZE_SIE_W_NR.Rows.Count > 0) 1621 { 1622 REKLAMADataSet.UKAZE_SIE_W_NRRow em = this.rEKLAMADataSet.UKAZE_SIE_W_NR[0]; 1623 1621 if (rEKLAMADataSet.UKAZE_SIE_W_NR.Rows.Count > 0) 1622 { 1624 1623 CenaEmisji cenaEmisjiForm = new CenaEmisji(); 1625 1624 if (cenaEmisjiForm.ShowDialog() == DialogResult.OK) 1626 1625 { 1627 foreach (REKLAMADataSet.UKAZE_SIE_W_NRRow emisja in this.rEKLAMADataSet.UKAZE_SIE_W_NR)1626 foreach (REKLAMADataSet.UKAZE_SIE_W_NRRow emisja in rEKLAMADataSet.UKAZE_SIE_W_NR) 1628 1627 { 1629 1628 emisja.netto = cenaEmisjiForm.WartoscEmisji; -
trunk/BazaReklam/ZestawienieZamowienForm.cs
r142 r205 1 1 using System; 2 using System.Collections.Generic;3 2 using System.ComponentModel; 4 3 using System.Data; 5 4 using System.Data.SqlClient; 6 using System.Drawing;7 using System.Text;8 5 using System.Windows.Forms; 9 6 … … 12 9 public partial class ZestawienieZamowienForm : Form 13 10 { 14 string query = "SELECT top 2000 * from VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE ";11 private const string query = "SELECT top 2000 * from VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE "; 15 12 16 13 private static ZestawienieZamowienForm form; … … 18 15 private SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(); 19 16 20 private bool commandExecuted = false;17 private bool commandExecuted; 21 18 22 19 public static ZestawienieZamowienForm getZestawienieZamowienForm(MDIBazaReklam parent) … … 32 29 InitializeComponent(); 33 30 34 this.MdiParent = parent;31 MdiParent = parent; 35 32 36 33 //podmiana connstringa 37 this.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWETableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;38 this.reklamyZestawienieTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value;34 VIEW_ZESTAWIENIE_ZAMOWIEN_NOWETableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; 35 reklamyZestawienieTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; 39 36 40 37 //obiekty wykorzytywane przy wyszukiwaniu … … 49 46 private void FacturesForm_Load(object sender, EventArgs e) 50 47 { 51 this.WindowState = FormWindowState.Maximized;52 command.CommandText = this.query;48 WindowState = FormWindowState.Maximized; 49 command.CommandText = query; 53 50 sqlDataAdapter.SelectCommand = command; 54 51 … … 58 55 private void generateNodes() 59 56 { 60 TreeNode node; 61 62 node = new TreeNode("Biura"); 57 TreeNode node = new TreeNode("Biura"); 63 58 node.Nodes.Add(new TreeNode()); 64 59 node.Name = "Biura"; … … 88 83 case "Biura": 89 84 90 this.Cursor = Cursors.WaitCursor;85 Cursor = Cursors.WaitCursor; 91 86 92 87 rEKLAMADataSet.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE.Clear(); 93 88 command.CommandText += " where agent=@agent"; 94 89 command.Parameters.AddWithValue("@agent", e.Node.Name); 95 sqlDataAdapter.Fill( this.rEKLAMADataSet.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE);90 sqlDataAdapter.Fill(rEKLAMADataSet.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE); 96 91 commandExecuted = true; 97 92 fakturyDataGridView.Refresh(); 98 93 99 this.Cursor = Cursors.Default;94 Cursor = Cursors.Default; 100 95 101 96 break; … … 115 110 { 116 111 TreeNode node; 117 SqlDataReader reader;118 112 119 113 if (e.Node != null) … … 153 147 } 154 148 155 156 private void fakturyDataGridView_Leave(object sender, EventArgs e) 157 { 158 fakturyDataGridView.EndEdit(); 159 } 160 149 161 150 private void toolStripButton1_Click(object sender, EventArgs e) 162 151 { … … 185 174 int custID = Convert.ToInt32(row["idKlienta"]); 186 175 187 ClientsForm.getClientsForm((MDIBazaReklam) this.MdiParent).pokazKlienta(custID);188 189 this.Hide();190 191 ClientsForm.getClientsForm((MDIBazaReklam) this.MdiParent).Show();176 ClientsForm.getClientsForm((MDIBazaReklam)MdiParent).pokazKlienta(custID); 177 178 Hide(); 179 180 ClientsForm.getClientsForm((MDIBazaReklam)MdiParent).Show(); 192 181 193 182 } … … 210 199 private void excelToolStripButton_Click(object sender, EventArgs e) 211 200 { 212 this.Cursor = Cursors.WaitCursor;201 Cursor = Cursors.WaitCursor; 213 202 214 203 ExcelHandler ex = new ExcelHandler(); 215 204 ex.exportToExcel(fakturyDataGridView); 216 205 217 this.Cursor = Cursors.Default;206 Cursor = Cursors.Default; 218 207 } 219 208 … … 224 213 (REKLAMADataSet.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWERow)row.Row; 225 214 226 this.reklamyZestawienieTableAdapter.FillByIdZamowienia(227 this.rEKLAMADataSet.ReklamyZestawienie,zam.idZamowienia);215 reklamyZestawienieTableAdapter.FillByIdZamowienia( 216 rEKLAMADataSet.ReklamyZestawienie,zam.idZamowienia); 228 217 229 218 } … … 247 236 if (commandExecuted) 248 237 { 249 this.Cursor = Cursors.WaitCursor;238 Cursor = Cursors.WaitCursor; 250 239 251 240 rEKLAMADataSet.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE.Clear(); 252 sqlDataAdapter.Fill( this.rEKLAMADataSet.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE);241 sqlDataAdapter.Fill(rEKLAMADataSet.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE); 253 242 fakturyDataGridView.Refresh(); 254 243 255 this.Cursor = Cursors.Default;244 Cursor = Cursors.Default; 256 245 } 257 246 } … … 279 268 command.CommandText = query; 280 269 281 this.rEKLAMADataSet.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE.Clear();282 this.rEKLAMADataSet.ReklamyZestawienie.Clear();270 rEKLAMADataSet.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE.Clear(); 271 rEKLAMADataSet.ReklamyZestawienie.Clear(); 283 272 284 273 command.CommandText += " where 1=1 "; … … 332 321 sqlDataAdapter.SelectCommand = command; 333 322 334 this.Cursor = Cursors.WaitCursor;323 Cursor = Cursors.WaitCursor; 335 324 336 325 try 337 326 { 338 int t = sqlDataAdapter.Fill(this.rEKLAMADataSet.VIEW_ZESTAWIENIE_ZAMOWIEN_NOWE);339 327 commandExecuted = true; 340 328 } … … 347 335 treeView1.SelectedNode = null; 348 336 349 this.Cursor = Cursors.Default;337 Cursor = Cursors.Default; 350 338 } 351 339
