- Data:
- 2009-06-16 17:51:04 (17 years ago)
- Lokalizacja:
- branches/Abonament/BazaReklam
- Pliki:
-
- 4 dodane
- 12 zmodyfikowane
-
Baza Reklam.csproj (zmodyfikowane) (3 diffs)
-
Classes/Interfaces/IProduct.cs (zmodyfikowane) (3 diffs)
-
Classes/Interfaces/IProductDetail.cs (dodane)
-
Classes/Model/Agent.cs (zmodyfikowane) (2 diffs)
-
Classes/Model/Enums/InvoicingType.cs (dodane)
-
Classes/Model/Enums/ProductType.cs (zmodyfikowane) (1 diff)
-
Classes/Model/Product.cs (zmodyfikowane) (5 diffs)
-
Classes/Model/ProductDetail.cs (dodane)
-
Classes/Repositories/AgentRepository.cs (zmodyfikowane) (2 diffs)
-
Classes/Repositories/CustomerRepository.cs (zmodyfikowane) (2 diffs)
-
Classes/Repositories/ProductRepository.cs (dodane)
-
ClientsForm.cs (zmodyfikowane) (1 diff)
-
FacturesFormNew.cs (zmodyfikowane) (1 diff)
-
ZamowieniaForm.Designer.cs (zmodyfikowane) (12 diffs)
-
ZamowieniaForm.cs (zmodyfikowane) (31 diffs)
-
ZamowieniaForm.resx (zmodyfikowane) (4 diffs)
Legenda:
- Bez zmian
- Dodane
- Usunięte
-
branches/Abonament/BazaReklam/Baza Reklam.csproj
r704 r705 142 142 <Compile Include="Classes\Interfaces\IForm.cs" /> 143 143 <Compile Include="Classes\Interfaces\IProduct.cs" /> 144 <Compile Include="Classes\Interfaces\IProductDetail.cs" /> 145 <Compile Include="Classes\Model\Enums\InvoicingType.cs" /> 144 146 <Compile Include="Classes\Model\Enums\ProductType.cs" /> 145 147 <Compile Include="Classes\Model\Product.cs" /> … … 153 155 <Compile Include="Classes\Global.cs" /> 154 156 <Compile Include="Classes\Logger.cs" /> 157 <Compile Include="Classes\Model\ProductDetail.cs" /> 155 158 <Compile Include="Classes\Model\State.cs" /> 156 159 <Compile Include="Classes\Model\Subscription.cs" /> … … 165 168 <Compile Include="Classes\Repositories\CustomerRepository.cs" /> 166 169 <Compile Include="Classes\Repositories\IRepository.cs" /> 170 <Compile Include="Classes\Repositories\ProductRepository.cs" /> 167 171 <Compile Include="Classes\Repositories\Repository.cs" /> 168 172 <Compile Include="Classes\Repositories\StateRepository.cs" /> -
branches/Abonament/BazaReklam/Classes/Interfaces/IProduct.cs
r704 r705 1 1 using System; 2 using System.Collections.Generic; 2 3 using Baza_Reklam.Classes.Model.Enums; 3 4 … … 10 11 string Type { get; set; } 11 12 string ShortName { get; set; } 12 DateTime StartDate { get; set; }13 DateTime? StartDate { get; set; } 13 14 decimal Price { get; set; } 14 15 decimal TotalPrice { get; set; } … … 18 19 int? OrderId { get; set; } 19 20 bool HasInvoice { get; set; } 21 List<IProductDetail> ProductDetails { get; } 22 void AddProductDetail(IProductDetail productDetail); 20 23 } 21 24 } -
branches/Abonament/BazaReklam/Classes/Model/Agent.cs
r621 r705 6 6 private string _loginName; 7 7 private string _shortName; 8 private string _firstName; 9 private string _lastName; 8 10 9 11 public Agent(string loginName) … … 36 38 set { _invoiceProvider = value; } 37 39 } 40 41 public string FirstName 42 { 43 get { return _firstName; } 44 set { _firstName = value; } 45 } 46 47 public string LastName 48 { 49 get { return _lastName; } 50 set { _lastName = value; } 51 } 52 53 public override string ToString() 54 { 55 return _firstName + " " + _lastName; 56 } 38 57 } 39 58 } -
branches/Abonament/BazaReklam/Classes/Model/Enums/ProductType.cs
r704 r705 3 3 public enum ProductType 4 4 { 5 Advertisment= 1,6 Subscription = 25 Subscription = 1, 6 Advertisment = 2, 7 7 } 8 8 } -
branches/Abonament/BazaReklam/Classes/Model/Product.cs
r704 r705 1 1 using System; 2 using System.Collections.Generic; 2 3 using Baza_Reklam.Classes.Interfaces; 3 4 using Baza_Reklam.Classes.Model.Enums; … … 11 12 private string _type; 12 13 private string _shortName; 13 private DateTime _startDate;14 private DateTime? _startDate; 14 15 private decimal _price; 15 16 private decimal _totalPrice; … … 19 20 private int? _orderId; 20 21 private bool _hasInvoice; 22 private List<IProductDetail> _productDetails = new List<IProductDetail>(); 21 23 22 24 public int Id … … 44 46 } 45 47 46 public DateTime StartDate48 public DateTime? StartDate 47 49 { 48 50 get { return _startDate; } … … 91 93 set { _hasInvoice = value; } 92 94 } 95 96 public List<IProductDetail> ProductDetails 97 { 98 get { return _productDetails; } 99 } 100 101 public void AddProductDetail(IProductDetail productDetail) 102 { 103 productDetail.ProductId = _id; 104 _productDetails.Add(productDetail); 105 } 93 106 } 94 107 } -
branches/Abonament/BazaReklam/Classes/Repositories/AgentRepository.cs
r702 r705 54 54 public Agent FindByShortName(string shortName) 55 55 { 56 const string query = "SELECT Symbol, F_ROZ, InvoiceProviderId FROM dbo.Agenci WHERE F_ROZ=@shortName";56 const string query = "SELECT Symbol, F_ROZ, InvoiceProviderId, [Imiê], Nazwisko FROM dbo.Agenci WHERE F_ROZ=@shortName"; 57 57 SqlConnection conn = null; 58 58 SqlCommand cmd = null; … … 64 64 conn.Open(); 65 65 cmd = new SqlCommand(query, conn); 66 cmd.Parameters.AddWithValue("@shortName", shortName); 66 67 reader = cmd.ExecuteReader(); 67 68 if (reader != null && reader.Read()) 68 return new Agent(reader.GetString(0).Trim().ToLower(), 69 reader.GetString(1).Trim().ToUpper(), 70 reader.GetInt32(2)); 69 { 70 Agent agent = new Agent(reader.GetString(0).Trim().ToLower()); 71 agent.ShortName = reader.GetString(1).Trim().ToUpper(); 72 agent.InvoiceProvider = reader.GetInt32(2); 73 agent.FirstName = reader.GetString(3); 74 agent.LastName = reader.GetString(4); 75 return agent; 76 } 71 77 } 72 78 finally -
branches/Abonament/BazaReklam/Classes/Repositories/CustomerRepository.cs
r704 r705 3 3 using System.Data; 4 4 using System.Data.SqlClient; 5 using System.Diagnostics; 5 6 using Baza_Reklam.Classes.Interfaces; 6 7 using Baza_Reklam.Classes.Model; … … 180 181 product.ProductType = (ProductType)_reader.GetInt32(2); 181 182 product.ShortName = _reader.GetString(3); 182 product.StartDate = _reader.GetDateTime(4); 183 if (_reader[4] != DBNull.Value) 184 product.StartDate = _reader.GetDateTime(4); 185 else 186 Debug.WriteLine(product.ShortName); 183 187 product.Price = _reader.GetDecimal(5); 184 188 product.TotalPrice = _reader.GetDecimal(6); -
branches/Abonament/BazaReklam/ClientsForm.cs
r703 r705 2307 2307 private void toolStripButton1_Click(object sender, EventArgs e) 2308 2308 { 2309 if (kLIENCIBindingSource.Current != null) 2310 { 2309 if (kLIENCIBindingSource.Current == null) return; 2310 2311 try 2312 { 2313 Cursor = Cursors.WaitCursor; 2311 2314 DataRowView row = (DataRowView)kLIENCIBindingSource.Current; 2312 2315 REKLAMADataSet.KLIENCIRow klient = (REKLAMADataSet.KLIENCIRow)row.Row; 2313 2316 2314 2317 ZamowieniaForm zam = new ZamowieniaForm(klient); 2315 zam.ShowDialog(); 2316 } 2318 zam.ShowDialog(); 2319 } 2320 finally 2321 { 2322 Cursor = Cursors.Default; 2323 } 2324 2317 2325 } 2318 2326 -
branches/Abonament/BazaReklam/FacturesFormNew.cs
r676 r705 332 332 private void zamowieniaToolStripButton_Click(object sender, EventArgs e) 333 333 { 334 if (VIEW_ZESTAWIENIE_FAKTUR_NOWEBindingSource.Current != null) 335 { 334 if (VIEW_ZESTAWIENIE_FAKTUR_NOWEBindingSource.Current == null) return; 335 336 337 try 338 { 339 Cursor = Cursors.WaitCursor; 336 340 DataRowView row = (DataRowView)VIEW_ZESTAWIENIE_FAKTUR_NOWEBindingSource.Current; 337 341 REKLAMADataSet.VIEW_ZESTAWIENIE_FAKTUR_NOWERow f = (REKLAMADataSet.VIEW_ZESTAWIENIE_FAKTUR_NOWERow)row.Row; 338 342 339 343 ZamowieniaForm zf = new ZamowieniaForm(f.ID_NABYWCY, f.idZamowienia); 340 zf.ShowDialog(); 341 } 344 zf.ShowDialog(); 345 } 346 finally 347 { 348 Cursor = Cursors.Default; 349 } 350 351 342 352 } 343 353 -
branches/Abonament/BazaReklam/ZamowieniaForm.Designer.cs
r704 r705 30 30 { 31 31 this.components = new System.ComponentModel.Container(); 32 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); 33 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); 34 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); 35 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); 36 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); 32 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle(); 33 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle(); 34 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle(); 35 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle13 = new System.Windows.Forms.DataGridViewCellStyle(); 36 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle14 = new System.Windows.Forms.DataGridViewCellStyle(); 37 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle15 = new System.Windows.Forms.DataGridViewCellStyle(); 38 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle16 = new System.Windows.Forms.DataGridViewCellStyle(); 39 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); 37 40 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ZamowieniaForm)); 38 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle(); 39 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); 40 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle7 = new System.Windows.Forms.DataGridViewCellStyle(); 41 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle8 = new System.Windows.Forms.DataGridViewCellStyle(); 41 System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); 42 42 this.zamowieniaDataGridView = new System.Windows.Forms.DataGridView(); 43 43 this.dataGridViewCheckBoxColumn1 = new System.Windows.Forms.DataGridViewCheckBoxColumn(); … … 49 49 this.rEKLAMADataSet = new Baza_Reklam.REKLAMADataSet(); 50 50 this.rEKLAMADataGridView = new System.Windows.Forms.DataGridView(); 51 this.rEKLAMABindingSource = new System.Windows.Forms.BindingSource(this.components); 51 this.TYP = new System.Windows.Forms.DataGridViewTextBoxColumn(); 52 this.ShortName = new System.Windows.Forms.DataGridViewTextBoxColumn(); 53 this.VAT = new System.Windows.Forms.DataGridViewTextBoxColumn(); 54 this.Brutto_Euro_Miano = new System.Windows.Forms.DataGridViewTextBoxColumn(); 55 this.ZATWIERDZONO_DO_DRUKU = new System.Windows.Forms.DataGridViewCheckBoxColumn(); 52 56 this.rEKLAMADataGridView1 = new System.Windows.Forms.DataGridView(); 53 this.rEKLAMABindingSource1 = new System.Windows.Forms.BindingSource(this.components); 57 this.Data1Emisji = new System.Windows.Forms.DataGridViewTextBoxColumn(); 58 this.ShortName1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); 59 this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn(); 60 this.dataGridViewTextBoxColumn43 = new System.Windows.Forms.DataGridViewTextBoxColumn(); 61 this.dataGridViewTextBoxColumn44 = new System.Windows.Forms.DataGridViewTextBoxColumn(); 62 this.ZATWIERDZONO_DO_DRUKU2 = new System.Windows.Forms.DataGridViewCheckBoxColumn(); 54 63 this.dodajButton = new System.Windows.Forms.Button(); 55 64 this.dodajDoZamButton = new System.Windows.Forms.Button(); … … 89 98 this.toolTip = new System.Windows.Forms.ToolTip(this.components); 90 99 this.KlientLabel = new System.Windows.Forms.Label(); 91 this.TYP = new System.Windows.Forms.DataGridViewTextBoxColumn();92 this.ShortName = new System.Windows.Forms.DataGridViewTextBoxColumn();93 this.VAT = new System.Windows.Forms.DataGridViewTextBoxColumn();94 this.Brutto_Euro_Miano = new System.Windows.Forms.DataGridViewTextBoxColumn();95 this.ZATWIERDZONO_DO_DRUKU = new System.Windows.Forms.DataGridViewCheckBoxColumn();96 this.Data1Emisji = new System.Windows.Forms.DataGridViewTextBoxColumn();97 this.ShortName1 = new System.Windows.Forms.DataGridViewTextBoxColumn();98 this.dataGridViewTextBoxColumn1 = new System.Windows.Forms.DataGridViewTextBoxColumn();99 this.dataGridViewTextBoxColumn43 = new System.Windows.Forms.DataGridViewTextBoxColumn();100 this.dataGridViewTextBoxColumn44 = new System.Windows.Forms.DataGridViewTextBoxColumn();101 this.ZATWIERDZONO_DO_DRUKU2 = new System.Windows.Forms.DataGridViewCheckBoxColumn();102 100 ((System.ComponentModel.ISupportInitialize)(this.zamowieniaDataGridView)).BeginInit(); 103 101 ((System.ComponentModel.ISupportInitialize)(this.zamowieniaBindingSource)).BeginInit(); 104 102 ((System.ComponentModel.ISupportInitialize)(this.rEKLAMADataSet)).BeginInit(); 105 103 ((System.ComponentModel.ISupportInitialize)(this.rEKLAMADataGridView)).BeginInit(); 106 ((System.ComponentModel.ISupportInitialize)(this.rEKLAMABindingSource)).BeginInit();107 104 ((System.ComponentModel.ISupportInitialize)(this.rEKLAMADataGridView1)).BeginInit(); 108 ((System.ComponentModel.ISupportInitialize)(this.rEKLAMABindingSource1)).BeginInit();109 105 ((System.ComponentModel.ISupportInitialize)(this.fAKTURYDataGridView)).BeginInit(); 110 106 ((System.ComponentModel.ISupportInitialize)(this.fAKTURYBindingSource)).BeginInit(); … … 118 114 this.zamowieniaDataGridView.AllowUserToAddRows = false; 119 115 this.zamowieniaDataGridView.AllowUserToDeleteRows = false; 120 dataGridViewCellStyle1 .BackColor = System.Drawing.Color.MintCream;121 this.zamowieniaDataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1 ;116 dataGridViewCellStyle10.BackColor = System.Drawing.Color.MintCream; 117 this.zamowieniaDataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle10; 122 118 this.zamowieniaDataGridView.AutoGenerateColumns = false; 123 119 this.zamowieniaDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; 124 120 this.zamowieniaDataGridView.BackgroundColor = System.Drawing.Color.White; 125 121 this.zamowieniaDataGridView.CausesValidation = false; 126 dataGridViewCellStyle 2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;127 dataGridViewCellStyle 2.BackColor = System.Drawing.SystemColors.Control;128 dataGridViewCellStyle 2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));129 dataGridViewCellStyle 2.ForeColor = System.Drawing.SystemColors.WindowText;130 dataGridViewCellStyle 2.SelectionBackColor = System.Drawing.SystemColors.Highlight;131 dataGridViewCellStyle 2.SelectionForeColor = System.Drawing.SystemColors.HighlightText;132 dataGridViewCellStyle 2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;133 this.zamowieniaDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle 2;122 dataGridViewCellStyle11.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 123 dataGridViewCellStyle11.BackColor = System.Drawing.SystemColors.Control; 124 dataGridViewCellStyle11.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); 125 dataGridViewCellStyle11.ForeColor = System.Drawing.SystemColors.WindowText; 126 dataGridViewCellStyle11.SelectionBackColor = System.Drawing.SystemColors.Highlight; 127 dataGridViewCellStyle11.SelectionForeColor = System.Drawing.SystemColors.HighlightText; 128 dataGridViewCellStyle11.WrapMode = System.Windows.Forms.DataGridViewTriState.True; 129 this.zamowieniaDataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11; 134 130 this.zamowieniaDataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { 135 131 this.dataGridViewCheckBoxColumn1, … … 206 202 this.rEKLAMADataGridView.BackgroundColor = System.Drawing.Color.White; 207 203 this.rEKLAMADataGridView.CausesValidation = false; 208 dataGridViewCellStyle 3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;209 dataGridViewCellStyle 3.BackColor = System.Drawing.SystemColors.Control;210 dataGridViewCellStyle 3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));211 dataGridViewCellStyle 3.ForeColor = System.Drawing.SystemColors.WindowText;212 dataGridViewCellStyle 3.SelectionBackColor = System.Drawing.SystemColors.Highlight;213 dataGridViewCellStyle 3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;214 dataGridViewCellStyle 3.WrapMode = System.Windows.Forms.DataGridViewTriState.True;215 this.rEKLAMADataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle 3;204 dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 205 dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control; 206 dataGridViewCellStyle12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); 207 dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText; 208 dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Highlight; 209 dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.HighlightText; 210 dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True; 211 this.rEKLAMADataGridView.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12; 216 212 this.rEKLAMADataGridView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { 217 213 this.TYP, … … 229 225 this.rEKLAMADataGridView.TabIndex = 1; 230 226 // 231 // rEKLAMABindingSource 232 // 233 this.rEKLAMABindingSource.DataMember = "REKLAMA"; 234 this.rEKLAMABindingSource.DataSource = this.rEKLAMADataSet; 227 // TYP 228 // 229 this.TYP.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; 230 this.TYP.DataPropertyName = "Type"; 231 this.TYP.HeaderText = "Typ"; 232 this.TYP.Name = "TYP"; 233 this.TYP.ReadOnly = true; 234 this.TYP.Width = 50; 235 // 236 // ShortName 237 // 238 this.ShortName.DataPropertyName = "ShortName"; 239 this.ShortName.HeaderText = "Symbol"; 240 this.ShortName.Name = "ShortName"; 241 this.ShortName.ReadOnly = true; 242 // 243 // VAT 244 // 245 this.VAT.DataPropertyName = "Vat"; 246 dataGridViewCellStyle13.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 247 dataGridViewCellStyle13.Format = "P"; 248 this.VAT.DefaultCellStyle = dataGridViewCellStyle13; 249 this.VAT.HeaderText = "Vat"; 250 this.VAT.Name = "VAT"; 251 this.VAT.ReadOnly = true; 252 // 253 // Brutto_Euro_Miano 254 // 255 this.Brutto_Euro_Miano.DataPropertyName = "Currency"; 256 this.Brutto_Euro_Miano.HeaderText = "Waluta"; 257 this.Brutto_Euro_Miano.Name = "Brutto_Euro_Miano"; 258 this.Brutto_Euro_Miano.ReadOnly = true; 259 // 260 // ZATWIERDZONO_DO_DRUKU 261 // 262 this.ZATWIERDZONO_DO_DRUKU.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; 263 this.ZATWIERDZONO_DO_DRUKU.DataPropertyName = "IsActivated"; 264 this.ZATWIERDZONO_DO_DRUKU.HeaderText = "ZD"; 265 this.ZATWIERDZONO_DO_DRUKU.Name = "ZATWIERDZONO_DO_DRUKU"; 266 this.ZATWIERDZONO_DO_DRUKU.ReadOnly = true; 267 this.ZATWIERDZONO_DO_DRUKU.Width = 25; 235 268 // 236 269 // rEKLAMADataGridView1 … … 238 271 this.rEKLAMADataGridView1.AllowUserToAddRows = false; 239 272 this.rEKLAMADataGridView1.AllowUserToDeleteRows = false; 240 dataGridViewCellStyle 5.BackColor = System.Drawing.Color.MintCream;241 this.rEKLAMADataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle 5;273 dataGridViewCellStyle14.BackColor = System.Drawing.Color.MintCream; 274 this.rEKLAMADataGridView1.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle14; 242 275 this.rEKLAMADataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; 243 276 this.rEKLAMADataGridView1.BackgroundColor = System.Drawing.Color.White; 244 277 this.rEKLAMADataGridView1.CausesValidation = false; 245 dataGridViewCellStyle 6.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;246 dataGridViewCellStyle 6.BackColor = System.Drawing.SystemColors.Control;247 dataGridViewCellStyle 6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));248 dataGridViewCellStyle 6.ForeColor = System.Drawing.SystemColors.WindowText;249 dataGridViewCellStyle 6.SelectionBackColor = System.Drawing.SystemColors.Highlight;250 dataGridViewCellStyle 6.SelectionForeColor = System.Drawing.SystemColors.HighlightText;251 dataGridViewCellStyle 6.WrapMode = System.Windows.Forms.DataGridViewTriState.True;252 this.rEKLAMADataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle 6;278 dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 279 dataGridViewCellStyle15.BackColor = System.Drawing.SystemColors.Control; 280 dataGridViewCellStyle15.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238))); 281 dataGridViewCellStyle15.ForeColor = System.Drawing.SystemColors.WindowText; 282 dataGridViewCellStyle15.SelectionBackColor = System.Drawing.SystemColors.Highlight; 283 dataGridViewCellStyle15.SelectionForeColor = System.Drawing.SystemColors.HighlightText; 284 dataGridViewCellStyle15.WrapMode = System.Windows.Forms.DataGridViewTriState.True; 285 this.rEKLAMADataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle15; 253 286 this.rEKLAMADataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { 254 287 this.Data1Emisji, … … 267 300 this.rEKLAMADataGridView1.TabIndex = 2; 268 301 // 269 // rEKLAMABindingSource1 270 // 271 this.rEKLAMABindingSource1.DataMember = "REKLAMA"; 272 this.rEKLAMABindingSource1.DataSource = this.rEKLAMADataSet; 302 // Data1Emisji 303 // 304 this.Data1Emisji.DataPropertyName = "StartDate"; 305 dataGridViewCellStyle16.Format = "d"; 306 dataGridViewCellStyle16.NullValue = null; 307 this.Data1Emisji.DefaultCellStyle = dataGridViewCellStyle16; 308 this.Data1Emisji.HeaderText = "1 Emisja"; 309 this.Data1Emisji.Name = "Data1Emisji"; 310 this.Data1Emisji.ReadOnly = true; 311 // 312 // ShortName1 313 // 314 this.ShortName1.DataPropertyName = "ShortName"; 315 this.ShortName1.HeaderText = "Symbol"; 316 this.ShortName1.Name = "ShortName1"; 317 this.ShortName1.ReadOnly = true; 318 // 319 // dataGridViewTextBoxColumn1 320 // 321 this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; 322 this.dataGridViewTextBoxColumn1.DataPropertyName = "Type"; 323 this.dataGridViewTextBoxColumn1.HeaderText = "Typ"; 324 this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; 325 this.dataGridViewTextBoxColumn1.ReadOnly = true; 326 this.dataGridViewTextBoxColumn1.Width = 50; 327 // 328 // dataGridViewTextBoxColumn43 329 // 330 this.dataGridViewTextBoxColumn43.DataPropertyName = "Vat"; 331 dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 332 dataGridViewCellStyle17.Format = "P"; 333 this.dataGridViewTextBoxColumn43.DefaultCellStyle = dataGridViewCellStyle17; 334 this.dataGridViewTextBoxColumn43.HeaderText = "Vat"; 335 this.dataGridViewTextBoxColumn43.Name = "dataGridViewTextBoxColumn43"; 336 this.dataGridViewTextBoxColumn43.ReadOnly = true; 337 // 338 // dataGridViewTextBoxColumn44 339 // 340 this.dataGridViewTextBoxColumn44.DataPropertyName = "Currency"; 341 this.dataGridViewTextBoxColumn44.HeaderText = "Waluta"; 342 this.dataGridViewTextBoxColumn44.Name = "dataGridViewTextBoxColumn44"; 343 this.dataGridViewTextBoxColumn44.ReadOnly = true; 344 // 345 // ZATWIERDZONO_DO_DRUKU2 346 // 347 this.ZATWIERDZONO_DO_DRUKU2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; 348 this.ZATWIERDZONO_DO_DRUKU2.DataPropertyName = "IsActivated"; 349 this.ZATWIERDZONO_DO_DRUKU2.HeaderText = "ZD"; 350 this.ZATWIERDZONO_DO_DRUKU2.Name = "ZATWIERDZONO_DO_DRUKU2"; 351 this.ZATWIERDZONO_DO_DRUKU2.ReadOnly = true; 352 this.ZATWIERDZONO_DO_DRUKU2.Width = 25; 273 353 // 274 354 // dodajButton … … 335 415 this.fAKTURYDataGridView.AllowUserToAddRows = false; 336 416 this.fAKTURYDataGridView.AllowUserToDeleteRows = false; 337 dataGridViewCellStyle 9.BackColor = System.Drawing.Color.MintCream;338 this.fAKTURYDataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle 9;417 dataGridViewCellStyle18.BackColor = System.Drawing.Color.MintCream; 418 this.fAKTURYDataGridView.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle18; 339 419 this.fAKTURYDataGridView.AutoGenerateColumns = false; 340 420 this.fAKTURYDataGridView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; … … 658 738 this.KlientLabel.Text = "----"; 659 739 // 660 // TYP661 //662 this.TYP.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;663 this.TYP.DataPropertyName = "Type";664 this.TYP.HeaderText = "Typ";665 this.TYP.Name = "TYP";666 this.TYP.ReadOnly = true;667 this.TYP.Width = 50;668 //669 // ShortName670 //671 this.ShortName.DataPropertyName = "ShortName";672 this.ShortName.HeaderText = "Symbol";673 this.ShortName.Name = "ShortName";674 this.ShortName.ReadOnly = true;675 //676 // VAT677 //678 this.VAT.DataPropertyName = "Vat";679 dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;680 dataGridViewCellStyle4.Format = "P";681 this.VAT.DefaultCellStyle = dataGridViewCellStyle4;682 this.VAT.HeaderText = "Vat";683 this.VAT.Name = "VAT";684 this.VAT.ReadOnly = true;685 //686 // Brutto_Euro_Miano687 //688 this.Brutto_Euro_Miano.DataPropertyName = "Currency";689 this.Brutto_Euro_Miano.HeaderText = "Waluta";690 this.Brutto_Euro_Miano.Name = "Brutto_Euro_Miano";691 this.Brutto_Euro_Miano.ReadOnly = true;692 //693 // ZATWIERDZONO_DO_DRUKU694 //695 this.ZATWIERDZONO_DO_DRUKU.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;696 this.ZATWIERDZONO_DO_DRUKU.DataPropertyName = "IsActivated";697 this.ZATWIERDZONO_DO_DRUKU.HeaderText = "ZD";698 this.ZATWIERDZONO_DO_DRUKU.Name = "ZATWIERDZONO_DO_DRUKU";699 this.ZATWIERDZONO_DO_DRUKU.ReadOnly = true;700 this.ZATWIERDZONO_DO_DRUKU.Width = 25;701 //702 // Data1Emisji703 //704 this.Data1Emisji.DataPropertyName = "StartDate";705 dataGridViewCellStyle7.Format = "d";706 dataGridViewCellStyle7.NullValue = null;707 this.Data1Emisji.DefaultCellStyle = dataGridViewCellStyle7;708 this.Data1Emisji.HeaderText = "1 Emisja";709 this.Data1Emisji.Name = "Data1Emisji";710 this.Data1Emisji.ReadOnly = true;711 //712 // ShortName1713 //714 this.ShortName1.DataPropertyName = "ShortName";715 this.ShortName1.HeaderText = "Symbol";716 this.ShortName1.Name = "ShortName1";717 this.ShortName1.ReadOnly = true;718 //719 // dataGridViewTextBoxColumn1720 //721 this.dataGridViewTextBoxColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;722 this.dataGridViewTextBoxColumn1.DataPropertyName = "Type";723 this.dataGridViewTextBoxColumn1.HeaderText = "Typ";724 this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1";725 this.dataGridViewTextBoxColumn1.ReadOnly = true;726 this.dataGridViewTextBoxColumn1.Width = 50;727 //728 // dataGridViewTextBoxColumn43729 //730 this.dataGridViewTextBoxColumn43.DataPropertyName = "Vat";731 dataGridViewCellStyle8.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter;732 dataGridViewCellStyle8.Format = "P";733 this.dataGridViewTextBoxColumn43.DefaultCellStyle = dataGridViewCellStyle8;734 this.dataGridViewTextBoxColumn43.HeaderText = "Vat";735 this.dataGridViewTextBoxColumn43.Name = "dataGridViewTextBoxColumn43";736 this.dataGridViewTextBoxColumn43.ReadOnly = true;737 //738 // dataGridViewTextBoxColumn44739 //740 this.dataGridViewTextBoxColumn44.DataPropertyName = "Currency";741 this.dataGridViewTextBoxColumn44.HeaderText = "Waluta";742 this.dataGridViewTextBoxColumn44.Name = "dataGridViewTextBoxColumn44";743 this.dataGridViewTextBoxColumn44.ReadOnly = true;744 //745 // ZATWIERDZONO_DO_DRUKU2746 //747 this.ZATWIERDZONO_DO_DRUKU2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None;748 this.ZATWIERDZONO_DO_DRUKU2.DataPropertyName = "IsActivated";749 this.ZATWIERDZONO_DO_DRUKU2.HeaderText = "ZD";750 this.ZATWIERDZONO_DO_DRUKU2.Name = "ZATWIERDZONO_DO_DRUKU2";751 this.ZATWIERDZONO_DO_DRUKU2.ReadOnly = true;752 this.ZATWIERDZONO_DO_DRUKU2.Width = 25;753 //754 740 // ZamowieniaForm 755 741 // … … 769 755 ((System.ComponentModel.ISupportInitialize)(this.rEKLAMADataSet)).EndInit(); 770 756 ((System.ComponentModel.ISupportInitialize)(this.rEKLAMADataGridView)).EndInit(); 771 ((System.ComponentModel.ISupportInitialize)(this.rEKLAMABindingSource)).EndInit();772 757 ((System.ComponentModel.ISupportInitialize)(this.rEKLAMADataGridView1)).EndInit(); 773 ((System.ComponentModel.ISupportInitialize)(this.rEKLAMABindingSource1)).EndInit();774 758 ((System.ComponentModel.ISupportInitialize)(this.fAKTURYDataGridView)).EndInit(); 775 759 ((System.ComponentModel.ISupportInitialize)(this.fAKTURYBindingSource)).EndInit(); … … 801 785 private System.Windows.Forms.DataGridView fAKTURYDataGridView; 802 786 private System.Windows.Forms.Button WydrukButton; 803 private System.Windows.Forms.BindingSource rEKLAMABindingSource;804 private System.Windows.Forms.BindingSource rEKLAMABindingSource1;805 787 private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn3; 806 788 private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn4; -
branches/Abonament/BazaReklam/ZamowieniaForm.cs
r704 r705 8 8 using Baza_Reklam.Classes.Helpers; 9 9 using Baza_Reklam.Classes.Interfaces; 10 using Baza_Reklam.Classes.Model; 10 11 using Baza_Reklam.Classes.Model.Enums; 11 12 using Baza_Reklam.Classes.Repositories; … … 18 19 private List<IProduct> productsWithOrder = new List<IProduct>(); 19 20 private List<IProduct> productsWithoutOrder = new List<IProduct>(); 21 private AgentRepository agentRepository; 22 private Agent agent; 20 23 21 24 private REKLAMADataSet.KLIENCIRow klient; 22 23 25 private int idZamowienia; 24 25 private REKLAMADataSet.REKLAMADataTable reklamyBezZamowienia;26 26 27 27 private REKLAMADataSetTableAdapters.KLIENCITableAdapter klienciTableAdapter = … … 49 49 new SLOWNIKDataSetTableAdapters.Kursy_WalutTableAdapter(); 50 50 51 #region properties 52 53 public REKLAMADataSet.REKLAMADataTable ReklamyBezZamowienia 54 { 55 get { return reklamyBezZamowienia; } 56 set { reklamyBezZamowienia = value; } 57 } 58 59 #endregion properties 60 51 61 52 public ZamowieniaForm(REKLAMADataSet.KLIENCIRow klient) 62 53 { … … 82 73 klient = klienciTableAdapter.GetDataByCustomerId(idKlienta)[0]; 83 74 this.idZamowienia = idZamowienia; 84 85 75 } 86 76 … … 88 78 { 89 79 customerRepository = new CustomerRepository(ConnString.getConnString().Value); 80 agentRepository = new AgentRepository(ConnString.getConnString().Value); 90 81 91 82 productsWithOrder = customerRepository.FindProductsWithOrders(customerId); 92 83 productsWithoutOrder = customerRepository.FindProductsWithoutOrders(customerId); 93 84 94 rEKLAMABindingSource1.DataSource = ReklamyBezZamowienia;95 85 zamowieniaTableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; 96 86 rEKLAMATableAdapter.Connection.ConnectionString = ConnString.getConnString().Value; … … 131 121 zamowieniaBindingSource.CurrentChanged += zamowieniaBindingSource_CurrentChanged; 132 122 133 ReklamyBezZamowienia = rEKLAMATableAdapter.GetDataByCustomerIdandIdZamowienia(klient.CustomerID);134 rEKLAMABindingSource1.DataSource = ReklamyBezZamowienia;135 123 zamowieniaTableAdapter.FillByIdKlienta(rEKLAMADataSet.zamowienia, klient.CustomerID); 136 124 … … 140 128 141 129 BindProductsWithOrders(idZamowienia); 142 130 143 131 fAKTURYTableAdapter.FillByIdZamowienia(rEKLAMADataSet.FAKTURY, idZamowienia); 144 132 } 145 133 else 146 {147 134 zamowieniaBindingSource.Position = 0; 148 } 149 150 if (klient != null) 151 { 152 if (klient.IskodKlientaNull()) 153 { 154 KlientLabel.Text = "BRAK KODU KLIENTA"; 155 } 156 else 157 { 158 KlientLabel.Text = "KOD KLIENTA: " + klient.kodKlienta; 159 } 160 } 135 136 if (klient == null) return; 137 138 KlientLabel.Text = klient.IskodKlientaNull() 139 ? "BRAK KODU KLIENTA" 140 : "KOD KLIENTA: " + klient.kodKlienta; 161 141 } 162 142 … … 172 152 if (azf.ShowDialog() == DialogResult.OK) 173 153 { 174 //rEKLAMADataSet.zamowienia.Clear();175 //this.zamowieniaTableAdapter.FillByIdKlienta(this.rEKLAMADataSet.zamowienia, klient.CustomerID);176 154 rEKLAMADataSet.zamowienia.ImportRow(azf.Zamowienia[0]); 177 155 int idZam = azf.Zamowienia[0].idZamowienia; … … 217 195 } 218 196 219 //TODO: move that piece to separate method 220 if (product.ProductType == ProductType.Advertisment) 221 { 222 if (zamowienie.IsidKontaNull()) 223 { 224 // zmiana domylnego konta do faktury dla EUR 225 if (User.Instance().IdAgencji != 4 && product.Currency == "EUR") 226 { 227 if (User.Instance().IdAgencji == 1223940396 || User.Instance().IdAgencji == 1223940398) 228 zamowienie.idKonta = 3; 229 else 230 zamowienie.idKonta = 5; 231 232 zamowieniaTableAdapter.Update(rEKLAMADataSet.zamowienia); 233 } 234 } 235 } 197 UpdateOrderAccount(product, zamowienie); 236 198 237 199 product.OrderId = zamowienie.idZamowienia; … … 243 205 BindProductsWithOrders(zamowienie.idZamowienia); 244 206 BindProductsWithoutOrders(); 207 } 208 209 private void UpdateOrderAccount(IProduct product, REKLAMADataSet.zamowieniaRow order) 210 { 211 if (product.ProductType != ProductType.Advertisment || !order.IsidKontaNull()) return; 212 213 // zmiana domylnego konta do faktury dla EUR 214 if (User.Instance().IdAgencji != 4 && product.Currency == "EUR") 215 { 216 if (User.Instance().IdAgencji == 1223940396 || User.Instance().IdAgencji == 1223940398) 217 order.idKonta = 3; 218 else 219 order.idKonta = 5; 220 221 zamowieniaTableAdapter.Update(rEKLAMADataSet.zamowienia); 222 } 245 223 } 246 224 … … 315 293 REKLAMADataSet.zamowieniaRow zamowienie = (REKLAMADataSet.zamowieniaRow) z.Row; 316 294 317 REKLAMADataSet.KLIENCIRow klientRow =318 (REKLAMADataSet.KLIENCIRow) klienciTableAdapter.GetDataByCustomerId(zamowienie.idKlienta).Rows[0];319 320 295 InitIssueTables(zamowienie); 321 296 322 string errorMessage = CzyMoznaZafakturowac(zamowienie, klient Row);297 string errorMessage = CzyMoznaZafakturowac(zamowienie, klient); 323 298 324 299 if (errorMessage != string.Empty) … … 329 304 } 330 305 331 WystawFakture(zamowienie, klientRow, false); 306 List<IProduct> subscriptionsToInvoice = GetSubscriptionsToInvoice(productsWithOrder); 307 308 WystawFakture(zamowienie, klient, subscriptionsToInvoice, false); 332 309 333 310 RestoreConnections(); … … 343 320 } 344 321 345 private int WystawFakture(REKLAMADataSet.zamowieniaRow zamowienie, REKLAMADataSet.KLIENCIRow klientRow, bool proforma)322 private int WystawFakture(REKLAMADataSet.zamowieniaRow zamowienie, REKLAMADataSet.KLIENCIRow klientRow, List<IProduct> subscriptions, bool proforma) 346 323 { 347 324 int idNaglowka; 348 325 349 326 try 350 327 { 351 REKLAMADataSet.FAKTURYRow naglowekFaktury = UtworzNaglowekFaktury(zamowienie, klientRow, proforma);352 rEKLAMADataSet.FAKTURY.AddFAKTURYRow(naglowekFaktury);353 PobierzOznaczEmisje(zamowienie, naglowekFaktury);354 UtworzPozycjeFaktury(naglowekFaktury, klientRow);355 DodajWplate(naglowekFaktury);356 357 zamowienie.zafakturowano = true;358 zamowienie.EndEdit();359 360 328 SqlConnection conn = new SqlConnection(ConnString.getConnString().Value); 361 329 … … 377 345 wplatyTableAdapter.AttachTransaction(transaction); 378 346 347 348 REKLAMADataSet.FAKTURYRow naglowekFaktury = UtworzNaglowekFaktury(zamowienie, klientRow, proforma); 379 349 try 380 350 { 351 rEKLAMADataSet.FAKTURY.AddFAKTURYRow(naglowekFaktury); 352 PobierzOznaczEmisje(zamowienie, naglowekFaktury); 353 UtworzPozycjeFaktury(naglowekFaktury, klientRow, subscriptions); 354 DodajWplate(naglowekFaktury); 355 356 zamowienie.zafakturowano = true; 357 zamowienie.EndEdit(); 358 381 359 fAKTURYTableAdapter.Update(rEKLAMADataSet.FAKTURY); 382 360 idNaglowka = naglowekFaktury.ID_FAKTURY; … … 385 363 wplatyTableAdapter.Update(rEKLAMADataSet.Wplaty); 386 364 387 int il = (int)emisjeTableAdapter.iloscNiezafakturowanychEmisjiWZamowieniu( 388 zamowienie.idZamowienia); 365 int il = (int) emisjeTableAdapter.iloscNiezafakturowanychEmisjiWZamowieniu(zamowienie.idZamowienia); 389 366 if (il == 0 && !proforma) 390 367 { … … 427 404 fAKTURYDataGridView.Refresh(); 428 405 zamowieniaBindingSource.ResetBindings(false); 429 406 430 407 } 431 408 … … 441 418 } 442 419 443 private void UtworzPozycjeFaktury(REKLAMADataSet.FAKTURYRow naglowekFaktury, REKLAMADataSet.KLIENCIRow klientRow )420 private void UtworzPozycjeFaktury(REKLAMADataSet.FAKTURYRow naglowekFaktury, REKLAMADataSet.KLIENCIRow klientRow, List<IProduct> subscriptionsToInvoice) 444 421 { 445 422 decimal bruttoWaluta = 0; … … 532 509 } 533 510 511 foreach (IProduct subscription in subscriptionsToInvoice) 512 { 513 514 foreach (IProductDetail subscriptionDetail in subscription.ProductDetails) 515 { 516 REKLAMADataSet.FAKTURA_DETAILSRow fakturaDetailsRow = rEKLAMADataSet.FAKTURA_DETAILS.NewFAKTURA_DETAILSRow(); 517 518 fakturaDetailsRow.ROK = subscriptionDetail.Year; 519 fakturaDetailsRow.MIESIAC = (short)subscriptionDetail.Month; 520 //TODO: Add Title to Subscription schema 521 //fakturaDetailsRow.TYTUL = subscriptionDetail; 522 //TODO: Nazwa uslugi dla reklamy i abonamentu 523 fakturaDetailsRow.NAZWA_USLUGI = subscriptionDetail.ProductId + " | " + subscriptionDetail.Id; 524 fakturaDetailsRow.reklamaId = subscription.Id; 525 fakturaDetailsRow.CENA_JEDN = subscription.Price; 526 fakturaDetailsRow.ILOSC = 1; 527 fakturaDetailsRow.JM = "szt."; 528 529 fakturaDetailsRow.NETTO = subscriptionDetail.PricePln; 530 fakturaDetailsRow.BRUTTO = Math.Round(subscriptionDetail.PricePln * (1 + subscription.Vat)); 531 fakturaDetailsRow.S_VAT = (double)subscription.Vat; 532 fakturaDetailsRow.VAT = Math.Round(subscriptionDetail.PricePln * subscription.Vat); 533 534 //TODO: Get discount from parent 535 //fakturaDetailsRow.UPUST_PR = subscription.Discount; 536 //fakturaDetailsRow.UPUST_NETTO = fakturaDetailsRow.UPUST_PR != 0 ? Math.Round(netto / Convert.ToDecimal(reklama.RABAT) - netto, 2) : 0; 537 538 fakturaDetailsRow.TYP = 1; 539 fakturaDetailsRow.PODTYP = 1; 540 fakturaDetailsRow.ID_FAKTURY = naglowekFaktury.ID_FAKTURY; 541 542 rEKLAMADataSet.FAKTURA_DETAILS.AddFAKTURA_DETAILSRow(fakturaDetailsRow); 543 544 if (subscription.Currency != "PLN") 545 bruttoWaluta += subscriptionDetail.Price; 546 } 547 548 549 } 550 551 534 552 if (bruttoWaluta != 0) 535 553 { … … 546 564 rEKLAMADataSet.UKAZE_SIE_W_NR.Clear(); 547 565 rEKLAMADataSet.DatyWydan.Clear(); 566 rEKLAMATableAdapter.FillByIdZamowienia(rEKLAMADataSet.REKLAMA, zamowienie.idZamowienia); 548 567 549 568 REKLAMADataSet.DatyWydanDataTable t = datyWydanTableAdapter.GetDataByPierwszaEmisjaWZamowieniu(zamowienie.idZamowienia); … … 551 570 552 571 DateTime d = t[0].DATA_W; 553 //d = zamowienie.IsdataOstatniejZafakturowanejEmisjiNull() ? d : zamowienie.dataOstatniejZafakturowanejEmisji.AddMonths(1); 554 555 List<string> adIds = new List<string>(); 556 557 foreach (DataRow r in rEKLAMADataSet.REKLAMA.Rows) 558 { 559 REKLAMADataSet.REKLAMARow reklama = (REKLAMADataSet.REKLAMARow)r; 560 adIds.Add(reklama.ID_REKLAMY); 572 573 foreach (REKLAMADataSet.REKLAMARow reklama in rEKLAMADataSet.REKLAMA.Rows) 574 { 561 575 switch (zamowienie.rodzajFakturowania) 562 576 { … … 593 607 private void PobierzOznaczEmisje(REKLAMADataSet.zamowieniaRow zamowienie, REKLAMADataSet.FAKTURYRow naglowekFaktury) 594 608 { 595 //InitIssueTables(zamowienie);596 597 609 if (zamowienie.IsdataOstatniejZafakturowanejEmisjiNull()) 598 610 { … … 600 612 } 601 613 602 foreach (DataRow r in rEKLAMADataSet.REKLAMA.Rows) 603 { 604 REKLAMADataSet.REKLAMARow reklama = (REKLAMADataSet.REKLAMARow)r; 605 614 foreach (REKLAMADataSet.REKLAMARow reklama in rEKLAMADataSet.REKLAMA.Rows) 615 { 606 616 foreach (DataRow em in rEKLAMADataSet.UKAZE_SIE_W_NR) 607 617 { … … 648 658 private REKLAMADataSet.FAKTURYRow UtworzNaglowekFaktury(REKLAMADataSet.zamowieniaRow zamowienie, REKLAMADataSet.KLIENCIRow klientRow, bool proforma) 649 659 { 650 SLOWNIKDataSet.AGENCIRow agent = (SLOWNIKDataSet.AGENCIRow)agenciTableAdapter.GetDataByKodAgenta(zamowienie.kodAgenta).Rows[0];651 IInvoiceProvider invoiceProvider = InvoiceProviderFactory.GetInvoiceProviderById(agent.InvoiceProviderId); 652 660 agent = agentRepository.FindByShortName(zamowienie.kodAgenta); 661 662 IInvoiceProvider invoiceProvider = InvoiceProviderFactory.GetInvoiceProviderById(agent.InvoiceProvider); 653 663 654 664 REKLAMADataSet.FAKTURYRow naglowekFaktury = (REKLAMADataSet.FAKTURYRow)rEKLAMADataSet.FAKTURY.NewRow(); … … 661 671 naglowekFaktury.DATA_WYSTAWIENIA = DateTime.Today; 662 672 663 if (User.Instance().IsKierownik) 664 { 665 if (dtpZmianaDaty.Value != DateTime.Today) 666 { 667 naglowekFaktury.DATA_WYSTAWIENIA = dtpZmianaDaty.Value; 668 } 669 } 673 //TODO: pass issueDate as parameter 674 if (dtpZmianaDaty.Value != DateTime.Today && User.Instance().IsKierownik) 675 naglowekFaktury.DATA_WYSTAWIENIA = dtpZmianaDaty.Value; 670 676 671 677 SLOWNIKDataSet.AGENCJERow agencja = (SLOWNIKDataSet.AGENCJERow)agencjeTableAdapter.GetDataByKodAgenta(zamowienie.kodAgenta).Rows[0]; 672 678 naglowekFaktury.ID_SPRZEDAWCY = agencja.Id_agencji; 673 679 674 if (naglowekFaktury.ID_SPRZEDAWCY == 4 || naglowekFaktury.ID_SPRZEDAWCY == 6 || 675 naglowekFaktury.ID_SPRZEDAWCY == 1223940400) 676 { 680 //Set EKSPORT to true to avoid to export this invoice to SoftLab FK accounting system 681 if (naglowekFaktury.ID_SPRZEDAWCY == 4 || naglowekFaktury.ID_SPRZEDAWCY == 6) 677 682 naglowekFaktury.EKSPORT = true; 678 }679 683 680 684 naglowekFaktury.MIEJSCOWOSC_WYSTAWIENIA = agencja.miasto; 681 naglowekFaktury.SPRZEDAWCA_ADRES = invoiceProvider.GetAddress(); //agencja.Adres_Fk;682 naglowekFaktury.SPRZEDAWCA_NIP = invoiceProvider.TaxNumber; //agencja.NIP;685 naglowekFaktury.SPRZEDAWCA_ADRES = invoiceProvider.GetAddress(); 686 naglowekFaktury.SPRZEDAWCA_NIP = invoiceProvider.TaxNumber; 683 687 naglowekFaktury.SystemKsiegowyId = Convert.ToByte(invoiceProvider.SystemKsiegowyId); 684 685 686 //SLOWNIKDataSet.AGENCIRow agent = (SLOWNIKDataSet.AGENCIRow)agenciTableAdapter.GetDataByKodAgenta(zamowienie.kodAgenta).Rows[0]; 687 naglowekFaktury.PODPIS_WYSTAWIL = agent.Imiê + " " + agent.Nazwisko; 688 689 naglowekFaktury.PODPIS_WYSTAWIL = agent.ToString(); 688 690 naglowekFaktury.DATA_SPRZEDAZY = naglowekFaktury.DATA_WYSTAWIENIA; 689 691 690 naglowekFaktury.ID_NABYWCY = zamowienie.idKlienta;692 naglowekFaktury.ID_NABYWCY = klientRow.CustomerID; 691 693 naglowekFaktury.NABYWCA_ADRES = klientRow.Adres_Fkatura; 692 694 naglowekFaktury.NABYWCA_NIP = klientRow.Nip; 693 695 naglowekFaktury.opis = "Faktura za reklamy zgodnie z zamówieniem: " 694 + klientRow.kodKlienta + 695 "/" + zamowienie.nrZamowienia + 696 "/" + zamowienie.kodAgenta + 697 "/" + zamowienie.rokZamowienia; 698 696 + klientRow.kodKlienta + 697 "/" + zamowienie.nrZamowienia + 698 "/" + zamowienie.kodAgenta + 699 "/" + zamowienie.rokZamowienia; 699 700 700 701 naglowekFaktury.SPOSOB_ZAPLATY = FakturaHelper.GetPaymentType(zamowienie.sposobZaplaty); … … 708 709 naglowekFaktury.waluta_kurs = 1d; 709 710 //WALUTOWE 710 if (!rEKLAMADataSet.REKLAMA[0].IsBrutto_Euro_MianoNull() && 711 rEKLAMADataSet.REKLAMA[0].Brutto_Euro_Miano != string.Empty) 712 { 713 //naglowekFaktury.SPRZEDAWCA_NIP = agencja.vies; 711 if (!rEKLAMADataSet.REKLAMA[0].IsBrutto_Euro_MianoNull() && rEKLAMADataSet.REKLAMA[0].Brutto_Euro_Miano != string.Empty) 712 { 714 713 naglowekFaktury.SPRZEDAWCA_NIP = invoiceProvider.TaxCountryPrefix + " " + invoiceProvider.TaxNumber; //agencja.vies; 715 714 naglowekFaktury.NABYWCA_NIP = klientRow.nipKraj + " " + klientRow.Nip; … … 741 740 return naglowekFaktury; 742 741 } 743 744 745 742 746 743 private string CzyMoznaZafakturowac(REKLAMADataSet.zamowieniaRow zamowienie, REKLAMADataSet.KLIENCIRow klientRow) … … 1172 1169 { 1173 1170 if (zamowieniaBindingSource.Current == null) return; 1174 1175 1176 DataRowView z = (DataRowView)zamowieniaBindingSource.Current; 1177 REKLAMADataSet.zamowieniaRow zamowienie = (REKLAMADataSet.zamowieniaRow)z.Row; 1178 1179 //rEKLAMATableAdapter.FillByIdZamowienia(rEKLAMADataSet.REKLAMA, zamowienie.idZamowienia); 1171 1172 DataRowView z = (DataRowView) zamowieniaBindingSource.Current; 1173 REKLAMADataSet.zamowieniaRow zamowienie = (REKLAMADataSet.zamowieniaRow) z.Row; 1174 1180 1175 BindProductsWithOrders(zamowienie.idZamowienia); 1181 1176 … … 1394 1389 REKLAMADataSet.zamowieniaRow zamowienie = (REKLAMADataSet.zamowieniaRow) z.Row; 1395 1390 1396 REKLAMADataSet.KLIENCIRow _klient =1397 (REKLAMADataSet.KLIENCIRow) klienciTableAdapter.GetDataByCustomerId(zamowienie.idKlienta).Rows[0];1398 1399 1391 InitIssueTables(zamowienie); 1400 1392 1401 string errorMessage = CzyMoznaZafakturowac(zamowienie, _klient);1393 string errorMessage = CzyMoznaZafakturowac(zamowienie, klient); 1402 1394 1403 1395 if (errorMessage != string.Empty) … … 1411 1403 try 1412 1404 { 1413 id = WystawFakture(zamowienie, _klient, true); 1414 FactureViewer fv = new FactureViewer(id, true, _klient.kodKlienta); 1405 List<IProduct> subscriptionsToInvoice = GetSubscriptionsToInvoice(productsWithOrder); 1406 1407 id = WystawFakture(zamowienie, klient, subscriptionsToInvoice, true); 1408 FactureViewer fv = new FactureViewer(id, true, klient.kodKlienta); 1415 1409 fv.ShowDialog(); 1416 1410 } … … 1419 1413 DataRow[] rows = rEKLAMADataSet.FAKTURY.Select("id_faktury=" + id); 1420 1414 if (rows.Length > 0) 1421 usunFakture((REKLAMADataSet.FAKTURYRow) rows[0]);1422 1415 usunFakture((REKLAMADataSet.FAKTURYRow)rows[0]); 1416 1423 1417 RestoreConnections(); 1424 1418 Cursor = Cursors.Default; … … 1435 1429 wplatyTableAdapter.Connection = new SqlConnection(ConnString.getConnString().Value); 1436 1430 } 1431 1432 private List<IProduct> GetSubscriptionsToInvoice(List<IProduct> products) 1433 { 1434 ProductRepository productRepository = new ProductRepository(ConnString.getConnString().Value); 1435 List<IProduct> subscriptions = products.FindAll(delegate(IProduct p) { return p.ProductType == ProductType.Subscription; }); 1436 DateTime date = productRepository.FindFirstDateForInvoice(subscriptions); 1437 List<IProduct> subscriptionsToInvoice = productRepository.FindProductsToInvoice(subscriptions, InvoicingType.ThreeMonths, date); 1438 return subscriptionsToInvoice; 1439 } 1440 1437 1441 } 1438 1442 } -
branches/Abonament/BazaReklam/ZamowieniaForm.resx
r704 r705 136 136 <value>17, 17</value> 137 137 </metadata> 138 <metadata name="rEKLAMADataSet.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> 139 <value>17, 17</value> 140 </metadata> 138 141 <metadata name="TYP.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 139 142 <value>True</value> … … 151 154 <value>True</value> 152 155 </metadata> 153 <metadata name="rEKLAMABindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">154 <value>1087, 17</value>155 </metadata>156 156 <metadata name="Data1Emisji.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 157 157 <value>True</value> … … 171 171 <metadata name="ZATWIERDZONO_DO_DRUKU2.UserAddedColumn" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 172 172 <value>True</value> 173 </metadata>174 <metadata name="rEKLAMABindingSource1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">175 <value>17, 54</value>176 173 </metadata> 177 174 <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> … … 546 543 </data> 547 544 <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> 548 <value> 87</value>545 <value>52</value> 549 546 </metadata> 550 547 </root>
