Zbiór zmian 262

Pokaż
Ignoruj:
Data:
2009-01-28 17:28:37 (17 years ago)
Autor:
marek
Opis:

fixes #67 - wywalono zaokraglanie na poziomie tworzenia wierszy w tabeli Faktura_Details

Lokalizacja:
trunk
Pliki:
4 zmodyfikowane

Legenda:

Bez zmian
Dodane
Usunięte
  • trunk/BazaReklam/FacturesForm.Designer.cs

    r261 r262  
    4949            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle17 = new System.Windows.Forms.DataGridViewCellStyle(); 
    5050            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle18 = new System.Windows.Forms.DataGridViewCellStyle(); 
     51            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle19 = new System.Windows.Forms.DataGridViewCellStyle(); 
    5152            this.bindingNavigator1 = new System.Windows.Forms.BindingNavigator(this.components); 
    5253            this.zestawienieFakturBindingSource = new System.Windows.Forms.BindingSource(this.components); 
     
    111112            this.vATDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
    112113            this.bRUTTODataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
     114            this.dataGridViewTextBoxColumn2 = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
    113115            this.sumazaplatDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
    114116            this.dataWplaty = new System.Windows.Forms.DataGridViewTextBoxColumn(); 
     
    567569            this.vATDataGridViewTextBoxColumn, 
    568570            this.bRUTTODataGridViewTextBoxColumn, 
     571            this.dataGridViewTextBoxColumn2, 
    569572            this.sumazaplatDataGridViewTextBoxColumn, 
    570573            this.dataWplaty, 
     
    722725            this.bRUTTODataGridViewTextBoxColumn.Width = 60; 
    723726            //  
     727            // dataGridViewTextBoxColumn2 
     728            //  
     729            this.dataGridViewTextBoxColumn2.DataPropertyName = "waluta_brutto"; 
     730            dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; 
     731            dataGridViewCellStyle14.Format = "N2"; 
     732            dataGridViewCellStyle14.NullValue = null; 
     733            this.dataGridViewTextBoxColumn2.DefaultCellStyle = dataGridViewCellStyle14; 
     734            this.dataGridViewTextBoxColumn2.HeaderText = "Waluta brutto"; 
     735            this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; 
     736            this.dataGridViewTextBoxColumn2.Width = 88; 
     737            //  
    724738            // sumazaplatDataGridViewTextBoxColumn 
    725739            //  
    726740            this.sumazaplatDataGridViewTextBoxColumn.DataPropertyName = "suma_zaplat"; 
    727             dataGridViewCellStyle14.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; 
    728             dataGridViewCellStyle14.Format = "C2"; 
    729             this.sumazaplatDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle14; 
     741            dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; 
     742            dataGridViewCellStyle15.Format = "C2"; 
     743            this.sumazaplatDataGridViewTextBoxColumn.DefaultCellStyle = dataGridViewCellStyle15; 
    730744            this.sumazaplatDataGridViewTextBoxColumn.HeaderText = "Zap³ata"; 
    731745            this.sumazaplatDataGridViewTextBoxColumn.Name = "sumazaplatDataGridViewTextBoxColumn"; 
     
    736750            this.dataWplaty.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; 
    737751            this.dataWplaty.DataPropertyName = "dataWplaty"; 
    738             dataGridViewCellStyle15.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 
    739             dataGridViewCellStyle15.Format = "d"; 
    740             dataGridViewCellStyle15.NullValue = null; 
    741             this.dataWplaty.DefaultCellStyle = dataGridViewCellStyle15; 
     752            dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 
     753            dataGridViewCellStyle16.Format = "d"; 
     754            dataGridViewCellStyle16.NullValue = null; 
     755            this.dataWplaty.DefaultCellStyle = dataGridViewCellStyle16; 
    742756            this.dataWplaty.HeaderText = "Data wp³aty"; 
    743757            this.dataWplaty.Name = "dataWplaty"; 
     
    747761            this.wplata_brutto.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; 
    748762            this.wplata_brutto.DataPropertyName = "wplata_brutto"; 
    749             dataGridViewCellStyle16.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; 
    750             dataGridViewCellStyle16.Format = "C"; 
    751             this.wplata_brutto.DefaultCellStyle = dataGridViewCellStyle16; 
     763            dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; 
     764            dataGridViewCellStyle17.Format = "C"; 
     765            this.wplata_brutto.DefaultCellStyle = dataGridViewCellStyle17; 
    752766            this.wplata_brutto.HeaderText = "Wp³ata"; 
    753767            this.wplata_brutto.Name = "wplata_brutto"; 
     
    757771            this.waluta_brutto.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; 
    758772            this.waluta_brutto.DataPropertyName = "wplata_waluta_brutto"; 
    759             dataGridViewCellStyle17.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; 
    760             dataGridViewCellStyle17.Format = "N2"; 
    761             dataGridViewCellStyle17.NullValue = null; 
    762             this.waluta_brutto.DefaultCellStyle = dataGridViewCellStyle17; 
     773            dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleRight; 
     774            dataGridViewCellStyle18.Format = "N2"; 
     775            dataGridViewCellStyle18.NullValue = null; 
     776            this.waluta_brutto.DefaultCellStyle = dataGridViewCellStyle18; 
    763777            this.waluta_brutto.HeaderText = "Wp³ata w walucie"; 
    764778            this.waluta_brutto.Name = "waluta_brutto"; 
     
    768782            this.wplata_waluta_miano.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; 
    769783            this.wplata_waluta_miano.DataPropertyName = "wplata_waluta_miano"; 
    770             dataGridViewCellStyle18.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 
    771             this.wplata_waluta_miano.DefaultCellStyle = dataGridViewCellStyle18; 
     784            dataGridViewCellStyle19.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; 
     785            this.wplata_waluta_miano.DefaultCellStyle = dataGridViewCellStyle19; 
    772786            this.wplata_waluta_miano.HeaderText = "Waluta"; 
    773787            this.wplata_waluta_miano.Name = "wplata_waluta_miano"; 
     
    868882        private System.Windows.Forms.DataGridViewTextBoxColumn vATDataGridViewTextBoxColumn; 
    869883        private System.Windows.Forms.DataGridViewTextBoxColumn bRUTTODataGridViewTextBoxColumn; 
     884        private System.Windows.Forms.DataGridViewTextBoxColumn dataGridViewTextBoxColumn2; 
    870885        private System.Windows.Forms.DataGridViewTextBoxColumn sumazaplatDataGridViewTextBoxColumn; 
    871886        private System.Windows.Forms.DataGridViewTextBoxColumn dataWplaty; 
  • trunk/BazaReklam/FacturesFormNEW.cs

    r218 r262  
    1010    public partial class FacturesFormNEW : Form 
    1111    { 
    12         string query = "SELECT top 2000 * from VIEW_ZESTAWIENIE_FAKTUR_NOWE "; 
     12        private const string query = "SELECT top 2000 * from VIEW_ZESTAWIENIE_FAKTUR_NOWE "; 
    1313 
    1414        private static FacturesFormNEW fakturesForm; 
    15         private SqlCommand command; 
    16         private SqlDataAdapter sqlDataAdapter; 
     15        private readonly SqlCommand command; 
     16        private readonly SqlDataAdapter sqlDataAdapter; 
    1717 
    1818        private bool commandExecuted; 
     
    2626        } 
    2727 
    28         private FacturesFormNEW(MDIBazaReklam parent) 
     28        private FacturesFormNEW(Form parent) 
    2929        { 
    3030            InitializeComponent(); 
     
    7272        private void generateNodes() 
    7373        { 
    74             TreeNode node; 
    75  
    76             node = new TreeNode("Wp³aty - ksiêgowoœæ"); 
     74            TreeNode node = new TreeNode("Wp³aty - ksiêgowoœæ"); 
    7775            node.Name = "WplatyKsiegowosc"; 
    7876            treeView1.Nodes.Add(node); 
     
    555553                DataRowView row = (DataRowView)VIEW_ZESTAWIENIE_FAKTUR_NOWEBindingSource.Current; 
    556554                REKLAMADataSet.VIEW_ZESTAWIENIE_FAKTUR_NOWERow f = (REKLAMADataSet.VIEW_ZESTAWIENIE_FAKTUR_NOWERow)row.Row; 
    557                  
    558                 PaymentForm2 pf2; 
    559  
    560                 if (f.IsidWplatyNull()) 
    561                 { 
    562                     pf2 = new PaymentForm2(0,f.ID_FAKTURY); 
    563                 } 
    564                 else 
    565                 { 
    566                     pf2 = new PaymentForm2(f.idWplaty, f.ID_FAKTURY); 
    567                 } 
     555 
     556                PaymentForm2 pf2 = f.IsidWplatyNull() ? new PaymentForm2(0,f.ID_FAKTURY) : new PaymentForm2(f.idWplaty, f.ID_FAKTURY); 
    568557 
    569558                if (pf2.ShowDialog() == DialogResult.OK) 
  • trunk/BazaReklam/ZamowieniaForm.cs

    r227 r262  
    453453                if (naglowekFaktury.Iswaluta_mianoNull() && klient.Country.ToUpper() == "POLSKA") 
    454454                { 
    455                     fakturaDetailsRow.UPUST_NETTO = 
    456                         Math.Round(Convert.ToDecimal(reklama.RABAT)*fakturaDetailsRow.CENA_JEDN, 2); 
     455                    fakturaDetailsRow.UPUST_NETTO = Convert.ToDecimal(reklama.RABAT) * fakturaDetailsRow.CENA_JEDN; 
    457456                    fakturaDetailsRow.UPUST_PR = reklama.RABAT; 
    458                     decimal netto = (1 - Convert.ToDecimal(reklama.RABAT))*fakturaDetailsRow.CENA_JEDN; 
     457                    decimal netto = (1 - Convert.ToDecimal(reklama.RABAT)) * fakturaDetailsRow.CENA_JEDN; 
    459458 
    460459                    if (reklama.wyroznienie) 
    461                     { 
    462                         netto = Math.Round(Convert.ToDecimal(1 + reklama.wyroznienie_procent)*netto, 2); 
    463                     } 
    464  
    465                     fakturaDetailsRow.NETTO = Math.Round(netto, 2); 
     460                        netto = Convert.ToDecimal(1 + reklama.wyroznienie_procent) * netto; 
     461 
     462                    fakturaDetailsRow.NETTO = netto; 
    466463                    fakturaDetailsRow.S_VAT = reklama.VAT; 
    467464                    decimal VAT = Convert.ToDecimal(reklama.VAT); 
    468                     fakturaDetailsRow.VAT = Convert.ToDecimal(Math.Round(VAT*netto, 2)); 
    469                     fakturaDetailsRow.BRUTTO = Convert.ToDecimal(Math.Round((1 + VAT) * netto, 2)); 
     465                    fakturaDetailsRow.VAT = Convert.ToDecimal(VAT * netto); 
     466                    fakturaDetailsRow.BRUTTO = Convert.ToDecimal((1 + VAT) * netto); 
    470467                } 
    471468                else if(naglowekFaktury.Iswaluta_mianoNull() && klient.Country.ToUpper() != "POLSKA") 
     
    474471                    decimal netto = (1 - Convert.ToDecimal(reklama.RABAT)) * fakturaDetailsRow.CENA_JEDN; 
    475472                    if (reklama.wyroznienie) 
    476                     { 
    477                         netto = Math.Round(Convert.ToDecimal(1 + reklama.wyroznienie_procent) * netto, 2); 
    478                     } 
    479                     fakturaDetailsRow.NETTO = Math.Round(netto, 2); 
     473                        netto = Convert.ToDecimal(1 + reklama.wyroznienie_procent) * netto; 
     474                    fakturaDetailsRow.NETTO = netto; 
    480475                    fakturaDetailsRow.S_VAT = reklama.VAT; 
    481                     fakturaDetailsRow.BRUTTO = Convert.ToDecimal(Math.Round((1 + VAT) * netto, 2)); 
     476                    fakturaDetailsRow.BRUTTO = Convert.ToDecimal((1 + VAT) * netto); 
    482477                     
    483478                    decimal brutto = fakturaDetailsRow.BRUTTO; 
    484479 
    485                     fakturaDetailsRow.VAT = Convert.ToDecimal(Math.Round(VAT * brutto / (1 + VAT), 2)); 
    486  
    487                     fakturaDetailsRow.UPUST_PR = Math.Round(reklama.RABAT, 2); 
     480                    fakturaDetailsRow.VAT = Convert.ToDecimal(VAT * brutto / (1 + VAT)); 
     481 
     482                    fakturaDetailsRow.UPUST_PR = reklama.RABAT; 
    488483                    if (fakturaDetailsRow.UPUST_PR != 0) 
    489                     { 
    490                         fakturaDetailsRow.UPUST_NETTO = Math.Round(netto / Convert.ToDecimal(reklama.RABAT) - netto, 2); 
    491                     } 
     484                        fakturaDetailsRow.UPUST_NETTO = netto/(Convert.ToDecimal(reklama.RABAT) - netto); 
    492485                    else 
    493                     { 
    494486                        fakturaDetailsRow.UPUST_NETTO = 0; 
    495                     } 
    496487 
    497488                    fakturaDetailsRow.CENA_JEDN = Convert.ToDecimal(netto + fakturaDetailsRow.UPUST_NETTO); 
     
    504495                    decimal VAT = Convert.ToDecimal(reklama.VAT); 
    505496                    decimal brutto = fakturaDetailsRow.BRUTTO; 
    506                     fakturaDetailsRow.VAT = Convert.ToDecimal(Math.Round(VAT * brutto / (1 + VAT), 2)); 
     497                    fakturaDetailsRow.VAT = Convert.ToDecimal(VAT * brutto / (1 + VAT)); 
    507498                    decimal netto = brutto - fakturaDetailsRow.VAT; 
    508                     fakturaDetailsRow.NETTO = Math.Round(netto, 2); 
    509  
    510                     fakturaDetailsRow.UPUST_PR = Math.Round(reklama.RABAT, 2); 
     499                    fakturaDetailsRow.NETTO = netto; 
     500 
     501                    fakturaDetailsRow.UPUST_PR = reklama.RABAT; 
    511502                    if (fakturaDetailsRow.UPUST_PR != 0) 
    512503                    { 
    513                         fakturaDetailsRow.UPUST_NETTO = Math.Round(netto / Convert.ToDecimal(reklama.RABAT) - netto, 2); 
     504                        fakturaDetailsRow.UPUST_NETTO = netto / Convert.ToDecimal(reklama.RABAT) - netto; 
    514505                    } 
    515506                    else 
  • trunk/SQL/Views/VIEW_ZESTAWIENIE_FAKTUR_NOWE.txt

    r246 r262  
    2020-- jesli zostala wystawiona faktura korekta, wyswietl wartosc brutto po korekcie 
    2121BRUTTO = CASE  
    22                         WHEN (T.KorektaBrutto IS NULL) THEN T.BRUTTO 
    23                         ELSE T.KorektaBrutto 
     22                        WHEN (T.KorektaBrutto IS NULL) THEN T.NETTO * (1 + T.S_VAT) 
     23                        ELSE T.KorektaNetto * (1 + T.KorektaVat) 
    2424                 END, 
    2525T.suma_zaplat,  
     
    6060                                              dbo.FAKTURY.ID_FK_KOR, Wplaty.brutto as wplata_brutto, Wplaty.waluta_brutto as wplata_waluta_brutto, 
    6161                                                                                          dbo.FAKTURY.SPOSOB_ZAPLATY AS SposobZaplaty, 
     62                                                                                          COALESCE(Korekta.S_VAT, NULL) AS KorektaVat,  
    6263                                                                                          COALESCE(Korekta.Netto, NULL) AS KorektaNetto, 
    6364                                                                                          COALESCE(Korekta.Brutto, NULL) AS KorektaBrutto, 
     
    8081                                              dbo.FAKTURY.ID_FK_KOR, Wplaty.brutto, Wplaty.waluta_brutto, 
    8182                                                                                          dbo.FAKTURY.SPOSOB_ZAPLATY, 
    82                                                                                           Korekta.Netto, Korekta.Brutto, Korekta.waluta_brutto 
     83                                                                                          Korekta.S_VAT, Korekta.Netto, Korekta.Brutto, Korekta.waluta_brutto 
    8384                       ) AS T LEFT OUTER JOIN 
    8485                          (SELECT     idFaktury, round(SUM(netto),2) AS sumaNettoZEmisji, count(id) as ilEmisji