Index: /trunk/BazaReklam/FakturowaniePoznanKatowice.Designer.cs
===================================================================
--- /trunk/BazaReklam/FakturowaniePoznanKatowice.Designer.cs (revision 106)
+++ /trunk/BazaReklam/FakturowaniePoznanKatowice.Designer.cs (revision 144)
@@ -31,5 +31,5 @@
             this.components = new System.ComponentModel.Container();
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FakturowaniePoznanKatowice));
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
             this.fakturaButton = new System.Windows.Forms.Button();
             this.korektaButton = new System.Windows.Forms.Button();
@@ -158,6 +158,6 @@
             this.fAKTURYDataGridView.AllowUserToAddRows = false;
             this.fAKTURYDataGridView.AllowUserToDeleteRows = false;
-            dataGridViewCellStyle1.BackColor = System.Drawing.Color.MintCream;
-            this.fAKTURYDataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
+            dataGridViewCellStyle2.BackColor = System.Drawing.Color.MintCream;
+            this.fAKTURYDataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle2;
             this.fAKTURYDataGridView.AutoGenerateColumns = false;
             this.fAKTURYDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
@@ -278,6 +278,5 @@
             this.agencjaListBox.Items.AddRange(new object[] {
             "POZ",
-            "KAT",
-            "D2D"});
+            "KAT"});
             this.agencjaListBox.Location = new System.Drawing.Point(23, 22);
             this.agencjaListBox.Name = "agencjaListBox";
@@ -314,4 +313,5 @@
             this.Controls.Add(this.groupBox3);
             this.Name = "FakturowaniePoznanKatowice";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
             this.Text = "Fakturowanie - Poznañ - Katowice";
             this.Load += new System.EventHandler(this.FakturowaniePoznanKatowice_Load);
Index: /trunk/BazaReklam/FakturowaniePoznanKatowice.cs
===================================================================
--- /trunk/BazaReklam/FakturowaniePoznanKatowice.cs (revision 106)
+++ /trunk/BazaReklam/FakturowaniePoznanKatowice.cs (revision 144)
@@ -21,4 +21,7 @@
         REKLAMADataSet.KLIENCIRow klientKatowice;
 
+        int idZamowieniaPoznan;
+        int idZamowieniaKatowice;
+
         public FakturowaniePoznanKatowice()
         {
@@ -42,4 +45,17 @@
 
             nrTygodniaUpDown.Value = weekNum;
+
+
+            if (ConnString.getConnString().Value.Contains("TEST"))
+            {
+                idZamowieniaKatowice = 149;
+                idZamowieniaPoznan = 148;
+            }
+            else
+            {
+                //baza produkcyjna
+                idZamowieniaPoznan = 272;
+                idZamowieniaKatowice = 273;
+            }
         }
 
@@ -235,7 +251,14 @@
             naglowekKorekty.DATA_WYSTAWIENIA = DateTime.Today;
 
-            naglowekKorekty.idZamowienia = 148;
+            if (faktura.ID_SPRZEDAWCY == 6)
+            {
+                naglowekKorekty.idZamowienia = idZamowieniaPoznan;
+            }
+            else
+            {
+                naglowekKorekty.idZamowienia = idZamowieniaKatowice;
+            }
+            
             naglowekKorekty.ID_SPRZEDAWCY = faktura.ID_SPRZEDAWCY;
-
             naglowekKorekty.MIEJSCOWOSC_WYSTAWIENIA = faktura.MIEJSCOWOSC_WYSTAWIENIA;
             naglowekKorekty.SPRZEDAWCA_ADRES = faktura.SPRZEDAWCA_ADRES;
@@ -248,5 +271,5 @@
             naglowekKorekty.NABYWCA_ADRES = faktura.NABYWCA_ADRES;
             naglowekKorekty.NABYWCA_NIP = faktura.NABYWCA_NIP;
-            naglowekKorekty.TERMIN_ZAPLATY = DateTime.Today.AddDays(30);
+            naglowekKorekty.TERMIN_ZAPLATY = DateTime.Today.AddDays(14);
             naglowekKorekty.opis = "rezygnacja z emisji reklamy";
 
@@ -281,5 +304,13 @@
             }
 
-            naglowekFaktury.idZamowienia = 148;
+            if (agencja.Id_agencji == 6)
+            {
+                naglowekFaktury.idZamowienia = idZamowieniaPoznan;
+            }
+            else
+            {
+                naglowekFaktury.idZamowienia = idZamowieniaKatowice;
+            }
+
             naglowekFaktury.ID_SPRZEDAWCY = agencja.Id_agencji;
 
@@ -300,5 +331,5 @@
             naglowekFaktury.SPOSOB_ZAPLATY = "Przelew";
            
-            naglowekFaktury.TERMIN_ZAPLATY = naglowekFaktury.DATA_SPRZEDAZY.AddDays(30);
+            naglowekFaktury.TERMIN_ZAPLATY = naglowekFaktury.DATA_SPRZEDAZY.AddDays(14);
             naglowekFaktury.ZAPLACONO = false;
 
@@ -316,9 +347,9 @@
             REKLAMADataSet.FAKTURA_DETAILSDataTable pozycjeFakturDlaKlientow =
                 this.fakturA_DETAILSTableAdapter.GetDataByNrTygodniaWRoku(
-                    dtpZmianaDaty.Value.Year, nrTygodniaUpDown.Value, naglowekFaktury.ID_SPRZEDAWCY);
+                    dtpZmianaDaty.Value.Year, nrTygodniaUpDown.Value, naglowekFaktury.ID_SPRZEDAWCY, dtpZmianaDaty.Value.Month);
                         
             REKLAMADataSet.FAKTURYDataTable naglowkiFakturDlaKlientow =
                 this.fAKTURYTableAdapter.GetDataByNrTygodniaWRoku(
-                    dtpZmianaDaty.Value.Year, nrTygodniaUpDown.Value, naglowekFaktury.ID_SPRZEDAWCY);
+                    dtpZmianaDaty.Value.Year, nrTygodniaUpDown.Value, naglowekFaktury.ID_SPRZEDAWCY,dtpZmianaDaty.Value.Month);
 
             if (pozycjeFakturDlaKlientow.Rows.Count == 0 || naglowkiFakturDlaKlientow.Rows.Count == 0)
@@ -374,10 +405,10 @@
 
             REKLAMADataSet.FAKTURA_DETAILSDataTable pozycjeFakturDlaKlientow =
-                this.fakturA_DETAILSTableAdapter.GetDataByNrTygodniaRokZKorekta(
-                    naglowekFaktury.ID_SPRZEDAWCY,dtpZmianaDaty.Value.Year, nrTygodniaUpDown.Value);
+                this.fakturA_DETAILSTableAdapter.GetDataByNrTygodniaRokZKorekta(dtpZmianaDaty.Value.Month,
+                    dtpZmianaDaty.Value.Year, nrTygodniaUpDown.Value,naglowekFaktury.ID_SPRZEDAWCY);
 
             REKLAMADataSet.FAKTURYDataTable naglowkiFakturDlaKlientow =
-                this.fAKTURYTableAdapter.GetDataByNrTygodniaWRokuZKorekta(
-                    naglowekFaktury.ID_SPRZEDAWCY,dtpZmianaDaty.Value.Year, nrTygodniaUpDown.Value);
+                this.fAKTURYTableAdapter.GetDataByNrTygodniaWRokuZKorekta(dtpZmianaDaty.Value.Month,
+                    dtpZmianaDaty.Value.Year, nrTygodniaUpDown.Value,naglowekFaktury.ID_SPRZEDAWCY);
 
             if (pozycjeFakturDlaKlientow.Rows.Count == 0 || naglowkiFakturDlaKlientow.Rows.Count == 0)
@@ -434,6 +465,13 @@
             REKLAMADataSet.WplatyRow wplata = this.rEKLAMADataSet.Wplaty.NewWplatyRow();
             wplata.idFaktury = naglowekFaktury.ID_FAKTURY;
-            wplata.idZamowienia = 148;
-            this.rEKLAMADataSet.Wplaty.AddWplatyRow(wplata);
+
+            if (naglowekFaktury.ID_SPRZEDAWCY == 6)
+            {
+                wplata.idZamowienia = idZamowieniaPoznan;
+            }
+            else
+            {
+                wplata.idZamowienia = idZamowieniaKatowice;
+            }
         }
 
@@ -475,4 +513,6 @@
                     REKLAMADataSet.FAKTURYRow faktura = (REKLAMADataSet.FAKTURYRow)
                         ((DataRowView)fAKTURYBindingSource.Current).Row;
+
+                    string kod = faktura.NUMER_ROZ;
 
                     if (faktura.KOREKTA)
@@ -493,4 +533,6 @@
                     }
 
+                    this.fAKTURYTableAdapter.FillByKodAgenta(this.rEKLAMADataSet.FAKTURY, kod);
+                    
                     this.Cursor = Cursors.Default;
                 }
