| 1 | using System;
|
|---|
| 2 | using System.Collections.Generic;
|
|---|
| 3 | using System.Data;
|
|---|
| 4 | using System.Data.SqlClient;
|
|---|
| 5 | using System.Text;
|
|---|
| 6 | using System.Text.RegularExpressions;
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 | namespace ExportFaktur
|
|---|
| 10 | {
|
|---|
| 11 | class ExpoToCDNExport
|
|---|
| 12 | {
|
|---|
| 13 |
|
|---|
| 14 | #region Fields (3)
|
|---|
| 15 |
|
|---|
| 16 | public CDNDataSet CDNDataset;
|
|---|
| 17 | SqlConnection CDN_conn = new SqlConnection(ConnString.getConnString().CdnExpoConnStr);
|
|---|
| 18 | SqlConnection truck_expo_conn = new SqlConnection(ConnString.getConnString().TruckExpoConnStr);
|
|---|
| 19 |
|
|---|
| 20 | #endregion Fields
|
|---|
| 21 |
|
|---|
| 22 | #region Methods (10)
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | // Public Methods (10)
|
|---|
| 26 |
|
|---|
| 27 | public void DodajElementyFaktury(EXPODataSet.FAKTURA_DETAILSDataTable table, CDNDataSet.TraNagRow naglowekFaktury)
|
|---|
| 28 | {
|
|---|
| 29 | int lp = 1;
|
|---|
| 30 |
|
|---|
| 31 | CDNDataSet.TraNagRow naglowek = naglowekFaktury;
|
|---|
| 32 |
|
|---|
| 33 | foreach (EXPODataSet.FAKTURA_DETAILSRow row in table.Rows)
|
|---|
| 34 | {
|
|---|
| 35 | CDNDataSet.TraElemRow pozycjaFaktury = (CDNDataSet.TraElemRow)CDNDataset.TraElem.NewRow();
|
|---|
| 36 |
|
|---|
| 37 | pozycjaFaktury.TrE_TrNId = naglowek.TrN_TrNID;
|
|---|
| 38 | // pozycjaFaktury.tre_tran
|
|---|
| 39 | if (istniejeKorekta())
|
|---|
| 40 | {
|
|---|
| 41 | pozycjaFaktury.TrE_ZwrId = 0;
|
|---|
| 42 | }
|
|---|
| 43 | pozycjaFaktury.TrE_Lp = lp;
|
|---|
| 44 | pozycjaFaktury.TrE_TypDokumentu = 302;
|
|---|
| 45 | pozycjaFaktury.TrE_Aktywny = 1;
|
|---|
| 46 | pozycjaFaktury.TrE_DataDok = naglowek.TrN_DataDok;
|
|---|
| 47 | pozycjaFaktury.TrE_DataOpe = naglowek.TrN_DataOpe;
|
|---|
| 48 | pozycjaFaktury.TrE_PodmiotTyp = 1;
|
|---|
| 49 | pozycjaFaktury.TrE_PodID = naglowek.TrN_PodID;
|
|---|
| 50 |
|
|---|
| 51 | if ((row.ROK > naglowekFaktury.TrN_DataDok.Year) ||
|
|---|
| 52 | ((row.ROK == naglowekFaktury.TrN_DataDok.Year) && (row.MIESIAC > naglowekFaktury.TrN_DataDok.Month)))
|
|---|
| 53 | {
|
|---|
| 54 | pozycjaFaktury.TrE_KatID = podajIDKategorii(row.ROK, row.MIESIAC);
|
|---|
| 55 | }
|
|---|
| 56 | else
|
|---|
| 57 | {
|
|---|
| 58 | pozycjaFaktury.TrE_KatID = naglowek.TrN_KatID;
|
|---|
| 59 | }
|
|---|
| 60 |
|
|---|
| 61 | pozycjaFaktury.TrE_TwrId = 1;
|
|---|
| 62 | pozycjaFaktury.TrE_TwrNazwa = row.NAZWA_USLUGI + " " + row.MIESIAC + "/" + row.ROK;
|
|---|
| 63 |
|
|---|
| 64 |
|
|---|
| 65 | pozycjaFaktury.TrE_TwrOpis = "";
|
|---|
| 66 | pozycjaFaktury.TrE_TwrSWW = "";
|
|---|
| 67 | pozycjaFaktury.TrE_Stawka = (decimal)row.S_VAT * 100; //svat' @P14 numeric(5,2) 22.00
|
|---|
| 68 | pozycjaFaktury.TrE_Flaga = 2;
|
|---|
| 69 | pozycjaFaktury.TrE_Zrodlowa = 0.00M;
|
|---|
| 70 | pozycjaFaktury.TrE_TwCNumer = 2;
|
|---|
| 71 | pozycjaFaktury.TrE_TypNB = 1;
|
|---|
| 72 |
|
|---|
| 73 |
|
|---|
| 74 | pozycjaFaktury.TrE_CenaT = row.NETTO; //Math.Abs(rsdet("netto"));
|
|---|
| 75 | // pozycjaFaktury.TrE_CenaT = row.CENA_JEDN; //Math.Abs(rsdet("netto"));
|
|---|
| 76 |
|
|---|
| 77 |
|
|---|
| 78 | pozycjaFaktury.TrE_Cena0 = row.NETTO; //Math.Abs(netto);
|
|---|
| 79 | //pozycjaFaktury.TrE_Cena0 = row.CENA_JEDN; //Math.Abs(netto);
|
|---|
| 80 | pozycjaFaktury.TrE_Rabat = (decimal)row.UPUST_PR*100;
|
|---|
| 81 | // pozycjaFaktury.TrE_Rabat = 0;
|
|---|
| 82 | pozycjaFaktury.TrE_CenaW = row.NETTO; //Math.Abs(netto);
|
|---|
| 83 |
|
|---|
| 84 |
|
|---|
| 85 | /*
|
|---|
| 86 | * if rsdet("netto")<0 then
|
|---|
| 87 | pozycjaFaktury.TrE_Ilosc")=-1.0000' @P27 numeric(15,4) 1.0000
|
|---|
| 88 | else
|
|---|
| 89 | pozycjaFaktury.TrE_Ilosc=1.0000' @P27 numeric(15,4) 1.0000
|
|---|
| 90 | end if */
|
|---|
| 91 | pozycjaFaktury.TrE_Ilosc = 1M;
|
|---|
| 92 |
|
|---|
| 93 |
|
|---|
| 94 | pozycjaFaktury.TrE_Jm = "szt.";
|
|---|
| 95 | pozycjaFaktury.TrE_JmCalkowite = 0;
|
|---|
| 96 | pozycjaFaktury.TrE_JMPrzelicznikL = 1.00M;
|
|---|
| 97 | pozycjaFaktury.TrE_JMPrzelicznikM = 1;
|
|---|
| 98 | pozycjaFaktury.TrE_IloscJM = pozycjaFaktury.TrE_Ilosc;
|
|---|
| 99 | pozycjaFaktury.TrE_WartoscNetto = row.NETTO; //rsdet("netto")' @P33 numeric(15,2) 1000.00
|
|---|
| 100 | pozycjaFaktury.TrE_WartoscBrutto = row.BRUTTO; //rsdet("brutto")' @P34 numeric(15,2) 1220.00
|
|---|
| 101 | pozycjaFaktury.TrE_TwrEAN = "";
|
|---|
| 102 | pozycjaFaktury.TrE_TwrNumerKat = "";
|
|---|
| 103 | pozycjaFaktury.TrE_TwrKod = "REKLAMA PRASOWA"; //towarkod' @P37 varchar(3) '125'
|
|---|
| 104 | pozycjaFaktury.TrE_JmZ = "";
|
|---|
| 105 | pozycjaFaktury.TrE_LpPow = lp;
|
|---|
| 106 | pozycjaFaktury.TrE_Cena0WD = row.CENA_JEDN; //abs(rsdet("netto"))' @P40 numeric(15,2) 1000.00
|
|---|
| 107 | pozycjaFaktury.TrE_CenaWWD = row.NETTO;//abs(rsdet("netto"))' @P41 numeric(15,2) 1000.00
|
|---|
| 108 | pozycjaFaktury.TrE_WartoscNettoWal = row.NETTO; //rsdet("netto")' @P42 numeric(15,2) 1000.00
|
|---|
| 109 | pozycjaFaktury.TrE_WartoscBruttoWal = row.BRUTTO; //rsdet("brutto")' @P43 numeric(15,2) 1220.00
|
|---|
| 110 | pozycjaFaktury.TrE_Prog = 0.00M;
|
|---|
| 111 | pozycjaFaktury.TrE_UpustTyp = 0;
|
|---|
| 112 | pozycjaFaktury.TrE_Upust = 0.00M;
|
|---|
| 113 | pozycjaFaktury.TrE_UpustKnt = 0.00M;
|
|---|
| 114 | pozycjaFaktury.TrE_UpustKntTyp = 0;
|
|---|
| 115 | pozycjaFaktury.TrE_KosztUslugi = 0.00M;
|
|---|
| 116 | pozycjaFaktury.TrE_RabatPromocyjny = 0.0000M;
|
|---|
| 117 | pozycjaFaktury.TrE_RabatKorekta = 0.0000M;
|
|---|
| 118 | pozycjaFaktury.TrE_Kaucja = 0;
|
|---|
| 119 | pozycjaFaktury.TrE_IloscKW = 0.0000M;
|
|---|
| 120 | pozycjaFaktury.TrE_IloscJMKW = 0.0000M;
|
|---|
| 121 | pozycjaFaktury.TrE_MagId = 1;
|
|---|
| 122 |
|
|---|
| 123 | // ?????????????????????????????
|
|---|
| 124 | // pozycjaFaktury.TrE_Atr1_DeAId = DBNull.Value;
|
|---|
| 125 | pozycjaFaktury.TrE_Atr1_Kod = "";
|
|---|
| 126 | pozycjaFaktury.TrE_Atr1_Wartosc = "";
|
|---|
| 127 | // pozycjaFaktury.TrE_Atr2_DeAId = DBNull.Value;
|
|---|
| 128 | pozycjaFaktury.TrE_Atr2_Kod = "";
|
|---|
| 129 | pozycjaFaktury.TrE_Atr2_Wartosc = "";
|
|---|
| 130 | // pozycjaFaktury.TrE_Atr3_DeAId = DBNull.Value;
|
|---|
| 131 | pozycjaFaktury.TrE_Atr3_Kod = "";
|
|---|
| 132 | pozycjaFaktury.TrE_Atr3_Wartosc = "";
|
|---|
| 133 | // pozycjaFaktury.TrE_Atr4_DeAId = DBNull.Value;
|
|---|
| 134 | pozycjaFaktury.TrE_Atr4_Kod = "";
|
|---|
| 135 | pozycjaFaktury.TrE_Atr4_Wartosc = "";
|
|---|
| 136 | // pozycjaFaktury.TrE_Atr5_DeAId = DBNull.Value;
|
|---|
| 137 | pozycjaFaktury.TrE_Atr5_Kod = "";
|
|---|
| 138 | pozycjaFaktury.TrE_Atr5_Wartosc = "";
|
|---|
| 139 |
|
|---|
| 140 |
|
|---|
| 141 | pozycjaFaktury.TrE_WartoscZakupuWylicz = 0;
|
|---|
| 142 | //'pozycjaFaktury.TrE_WartoscZakupu=0
|
|---|
| 143 |
|
|---|
| 144 | pozycjaFaktury.TrE_Waluta = "PLN";
|
|---|
| 145 | pozycjaFaktury.TrE_KursNumer = 2;
|
|---|
| 146 | pozycjaFaktury.TrE_KursL = 1.000M;
|
|---|
| 147 | pozycjaFaktury.TrE_KursM = 1;
|
|---|
| 148 |
|
|---|
| 149 | if (naglowek.TrN_Export == 7)
|
|---|
| 150 | {
|
|---|
| 151 | pozycjaFaktury.TrE_Flaga = 4;
|
|---|
| 152 | pozycjaFaktury.TrE_Cena0WD = row.CENA_JEDN / naglowek.TrN_KursL;
|
|---|
| 153 | pozycjaFaktury.TrE_CenaWWD = row.NETTO / naglowek.TrN_KursL;
|
|---|
| 154 | pozycjaFaktury.TrE_WartoscBruttoWal = row.BRUTTO / naglowek.TrN_KursL;
|
|---|
| 155 | pozycjaFaktury.TrE_WartoscNettoWal = row.NETTO / naglowek.TrN_KursL;
|
|---|
| 156 | }
|
|---|
| 157 |
|
|---|
| 158 | CDNDataset.TraElem.AddTraElemRow(pozycjaFaktury);
|
|---|
| 159 |
|
|---|
| 160 | lp++;
|
|---|
| 161 | }
|
|---|
| 162 |
|
|---|
| 163 |
|
|---|
| 164 | }
|
|---|
| 165 |
|
|---|
| 166 | public void DodajKlienta(EXPODataSet.KLIENCIRow klient)
|
|---|
| 167 | {
|
|---|
| 168 | CDNDataSetTableAdapters.KontrahenciTableAdapter adapter = new ExportFaktur.CDNDataSetTableAdapters.KontrahenciTableAdapter();
|
|---|
| 169 | adapter.Connection = CDN_conn;
|
|---|
| 170 |
|
|---|
| 171 | adapter.FillByKnt_Kod(this.CDNDataset.Kontrahenci, klient.CustomerID.ToString());
|
|---|
| 172 |
|
|---|
| 173 | bool klientIstnieje;
|
|---|
| 174 | CDNDataSet.KontrahenciRow kontrahent;
|
|---|
| 175 |
|
|---|
| 176 | if (this.CDNDataset.Kontrahenci.Count == 0)
|
|---|
| 177 | {
|
|---|
| 178 | klientIstnieje = false;
|
|---|
| 179 | kontrahent = (CDNDataSet.KontrahenciRow)this.CDNDataset.Kontrahenci.NewRow();
|
|---|
| 180 | }
|
|---|
| 181 | else
|
|---|
| 182 | {
|
|---|
| 183 | klientIstnieje = true;
|
|---|
| 184 | kontrahent = this.CDNDataset.Kontrahenci[0];
|
|---|
| 185 | }
|
|---|
| 186 |
|
|---|
| 187 | kontrahent.Knt_ZgodaNaEFaktury = 0;
|
|---|
| 188 | kontrahent.Knt_PodmiotTyp = 1;
|
|---|
| 189 | kontrahent.Knt_Kod = klient.CustomerID.ToString();
|
|---|
| 190 | kontrahent.Knt_GLN = "";
|
|---|
| 191 | kontrahent.Knt_EAN = "";
|
|---|
| 192 | kontrahent.Knt_Grupa = "ODBIORCA";
|
|---|
| 193 | kontrahent.Knt_Nazwa1 = klient.IsFirstNameNull() ? "" : klient.FirstName;
|
|---|
| 194 | kontrahent.Knt_Nazwa2 = klient.IsLastNameNull() ? "" : klient.LastName;
|
|---|
| 195 | kontrahent.Knt_Nazwa3 = klient.IsOrganizationNameNull() ? "" : klient.OrganizationName;
|
|---|
| 196 |
|
|---|
| 197 | string kraj = "";
|
|---|
| 198 | if (!klient.IsCountryNull())
|
|---|
| 199 | {
|
|---|
| 200 | kraj = (klient.Country.Length > 40) ? klient.Country.Substring(0, 40) : klient.Country;
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| 203 | kontrahent.Knt_Kraj = kraj;
|
|---|
| 204 |
|
|---|
| 205 | string wojewodztwo = "";
|
|---|
| 206 | if (!klient.IsStateNull())
|
|---|
| 207 | {
|
|---|
| 208 | wojewodztwo = (klient.State.Length > 40) ? klient.State.Substring(0, 40) : klient.State;
|
|---|
| 209 | }
|
|---|
| 210 |
|
|---|
| 211 | kontrahent.Knt_Wojewodztwo = wojewodztwo;
|
|---|
| 212 |
|
|---|
| 213 | kontrahent.Knt_Powiat = "";
|
|---|
| 214 | kontrahent.Knt_Gmina = "";
|
|---|
| 215 |
|
|---|
| 216 | string adres = "";
|
|---|
| 217 | if (!klient.IsAddressNull())
|
|---|
| 218 | {
|
|---|
| 219 | adres = (klient.Address.Length > 40) ? klient.Address.Substring(0, 40) : klient.Address;
|
|---|
| 220 | }
|
|---|
| 221 | kontrahent.Knt_Ulica = adres;
|
|---|
| 222 |
|
|---|
| 223 | kontrahent.Knt_NrDomu = "";
|
|---|
| 224 | kontrahent.Knt_NrLokalu = "";
|
|---|
| 225 |
|
|---|
| 226 | string miasto = "";
|
|---|
| 227 | if (!klient.IsCityNull())
|
|---|
| 228 | {
|
|---|
| 229 | miasto = (klient.City.Length > 40) ? klient.City.Substring(0, 40) : klient.City;
|
|---|
| 230 | }
|
|---|
| 231 | kontrahent.Knt_Miasto = miasto;
|
|---|
| 232 | kontrahent.Knt_Poczta = miasto;
|
|---|
| 233 |
|
|---|
| 234 | string kodPocztowy = "";
|
|---|
| 235 | if (!klient.IsPostalCodeNull())
|
|---|
| 236 | {
|
|---|
| 237 | kodPocztowy = (klient.PostalCode.Length > 10) ? klient.PostalCode.Substring(0, 10) : klient.PostalCode;
|
|---|
| 238 | }
|
|---|
| 239 | kontrahent.Knt_KodPocztowy = kodPocztowy;
|
|---|
| 240 |
|
|---|
| 241 | kontrahent.Knt_Adres2 = "";
|
|---|
| 242 |
|
|---|
| 243 | if (!klient.IsNipNull())
|
|---|
| 244 | {
|
|---|
| 245 | // kontrahent.Knt_NipKraj = PodajKrajNIP(klient.Nip);
|
|---|
| 246 | // kontrahent.Knt_NipE = PodajNumerNIP(klient.Nip);
|
|---|
| 247 | // kontrahent.Knt_Nip = PodajNumerNIP(klient.Nip);
|
|---|
| 248 | if (klient.nipKraj == "" && klient.Country.Trim() == "Polska")
|
|---|
| 249 | {
|
|---|
| 250 | kontrahent.Knt_NipKraj = "PL";
|
|---|
| 251 | kontrahent.Knt_KrajISO = "PL";
|
|---|
| 252 | }
|
|---|
| 253 | else
|
|---|
| 254 | {
|
|---|
| 255 | kontrahent.Knt_NipKraj = klient.nipKraj.Length > 2 ? klient.nipKraj.Substring(0, 2) : klient.nipKraj;
|
|---|
| 256 | kontrahent.Knt_KrajISO = klient.nipKraj.Length > 2 ? klient.nipKraj.Substring(0, 2) : klient.nipKraj;
|
|---|
| 257 | }
|
|---|
| 258 |
|
|---|
| 259 | kontrahent.Knt_NipE = klient.Nip.Length > 13 ? klient.Nip.Substring(0, 13) : klient.Nip;
|
|---|
| 260 | kontrahent.Knt_Nip = klient.Nip.Length > 13 ? klient.Nip.Substring(0,13) : klient.Nip;
|
|---|
| 261 |
|
|---|
| 262 | }
|
|---|
| 263 | else
|
|---|
| 264 | {
|
|---|
| 265 | kontrahent.Knt_NipKraj = "";
|
|---|
| 266 | kontrahent.Knt_NipE = "";
|
|---|
| 267 | kontrahent.Knt_Nip = "";
|
|---|
| 268 | kontrahent.Knt_KrajISO = "";
|
|---|
| 269 | }
|
|---|
| 270 |
|
|---|
| 271 | kontrahent.Knt_Regon = "";
|
|---|
| 272 | kontrahent.Knt_Pesel = "";
|
|---|
| 273 | kontrahent.Knt_Telefon1 = "";
|
|---|
| 274 | kontrahent.Knt_Telefon2 = "";
|
|---|
| 275 | kontrahent.Knt_Fax = "";
|
|---|
| 276 |
|
|---|
| 277 | string email = "";
|
|---|
| 278 | if (!klient.IsEmailNull())
|
|---|
| 279 | {
|
|---|
| 280 | email = (klient.Email.Length > 40) ? klient.Email.Substring(0, 40) : klient.Email;
|
|---|
| 281 | }
|
|---|
| 282 | kontrahent.Knt_Email = email;
|
|---|
| 283 |
|
|---|
| 284 | kontrahent.Knt_URL = "";
|
|---|
| 285 |
|
|---|
| 286 |
|
|---|
| 287 | if (!klientIstnieje)
|
|---|
| 288 | {
|
|---|
| 289 | kontrahent.Knt_Zezwolenie = "";
|
|---|
| 290 | kontrahent.Knt_KodTransakcji = "";
|
|---|
| 291 | //kontrahent.Knt_BNaID=""
|
|---|
| 292 | kontrahent.Knt_RachunekNr = "";
|
|---|
| 293 | kontrahent.Knt_IBAN = 0;
|
|---|
| 294 | //kontrahent.Knt_RachunekNr0=""
|
|---|
| 295 | kontrahent.Knt_OsTytul = "";
|
|---|
| 296 | kontrahent.Knt_OsPlec = 1;
|
|---|
| 297 | kontrahent.Knt_OsNazwisko = "";
|
|---|
| 298 | kontrahent.Knt_OsKraj = kontrahent.Knt_Kraj;
|
|---|
| 299 | kontrahent.Knt_OsWojewodztwo = kontrahent.Knt_Wojewodztwo;
|
|---|
| 300 | kontrahent.Knt_OsPowiat = "";
|
|---|
| 301 | kontrahent.Knt_OsGmina = "";
|
|---|
| 302 | kontrahent.Knt_OsUlica = "";
|
|---|
| 303 | kontrahent.Knt_OsNrDomu = "";
|
|---|
| 304 | kontrahent.Knt_OsNrLokalu = "";
|
|---|
| 305 | kontrahent.Knt_OsMiasto = "";
|
|---|
| 306 | kontrahent.Knt_OsKodPocztowy = "";
|
|---|
| 307 | kontrahent.Knt_OsPoczta = "";
|
|---|
| 308 | kontrahent.Knt_OsAdres2 = "";
|
|---|
| 309 | kontrahent.Knt_OsTelefon = "";
|
|---|
| 310 | kontrahent.Knt_OsGSM = "";
|
|---|
| 311 | kontrahent.Knt_OsEmail = "";
|
|---|
| 312 | kontrahent.Knt_Informacje = 0;
|
|---|
| 313 | kontrahent.Knt_Upust = 0;
|
|---|
| 314 | kontrahent.Knt_LimitFlag = 0;
|
|---|
| 315 | kontrahent.Knt_LimitKredytu = 0;
|
|---|
| 316 | kontrahent.Knt_LimitPrzeterKredytFlag = 0;
|
|---|
| 317 | kontrahent.Knt_LimitPrzeterKredytWartosc = 0;
|
|---|
| 318 | kontrahent.Knt_Ceny = 0;
|
|---|
| 319 | kontrahent.Knt_FplID = 1;
|
|---|
| 320 | kontrahent.Knt_MaxZwloka = 7;
|
|---|
| 321 | kontrahent.Knt_TerminPlat = 1;
|
|---|
| 322 | kontrahent.Knt_Termin = 7;
|
|---|
| 323 | kontrahent.Knt_KontoOdb = "";
|
|---|
| 324 | kontrahent.Knt_KontoDost = "";
|
|---|
| 325 | //kontrahent.Knt_KatID=
|
|---|
| 326 | kontrahent.Knt_BlokadaDok = 0;
|
|---|
| 327 | kontrahent.Knt_LimitKredytuWal = "";
|
|---|
| 328 | kontrahent.Knt_LimitKredytuWykorzystany = 0;
|
|---|
| 329 | kontrahent.Knt_NieRozliczac = 0;
|
|---|
| 330 | kontrahent.Knt_PodatekVat = 1;
|
|---|
| 331 | kontrahent.Knt_Finalny = 0;
|
|---|
| 332 | kontrahent.Knt_Export = 0;
|
|---|
| 333 |
|
|---|
| 334 | if (kontrahent.Knt_NipKraj != "PL")
|
|---|
| 335 | {
|
|---|
| 336 | kontrahent.Knt_Export = 7;
|
|---|
| 337 | }
|
|---|
| 338 |
|
|---|
| 339 | kontrahent.Knt_Rodzaj = 0;
|
|---|
| 340 | kontrahent.Knt_Rodzaj_Dostawca = 0;
|
|---|
| 341 | kontrahent.Knt_Rodzaj_Odbiorca = 1;
|
|---|
| 342 | kontrahent.Knt_Rodzaj_Konkurencja = 0;
|
|---|
| 343 | kontrahent.Knt_Rodzaj_Partner = 0;
|
|---|
| 344 | kontrahent.Knt_Rodzaj_Potencjalny = 0;
|
|---|
| 345 | kontrahent.Knt_Medialny = 0;
|
|---|
| 346 | kontrahent.Knt_MalyPod = 0;
|
|---|
| 347 | kontrahent.Knt_Rolnik = 0;
|
|---|
| 348 | kontrahent.Knt_Nieaktywny = 0;
|
|---|
| 349 | kontrahent.Knt_Chroniony = 0;
|
|---|
| 350 | kontrahent.Knt_Opis = "";
|
|---|
| 351 | //kontrahent.Knt_OdbiorcaId=
|
|---|
| 352 | //kontrahent.Knt_OpiekunTyp=
|
|---|
| 353 | //kontrahent.Knt_OpiekunId=
|
|---|
| 354 | kontrahent.Knt_TerminZwrotuKaucji = 60;
|
|---|
| 355 | kontrahent.Knt_NaliczajPlatnosc = 0;
|
|---|
| 356 | kontrahent.Knt_ZakazDokumentowHaMag = 0;
|
|---|
| 357 | //'kontrahent.Knt_TS_Export=
|
|---|
| 358 | //'kontrahent.Knt_ImportAppId=
|
|---|
| 359 | //'kontrahent.Knt_ImportRowId=
|
|---|
| 360 | kontrahent.Knt_OpeZalID = 11;
|
|---|
| 361 | kontrahent.Knt_StaZalId = 6;
|
|---|
| 362 | kontrahent.Knt_TS_Zal = DateTime.Now;
|
|---|
| 363 | }
|
|---|
| 364 |
|
|---|
| 365 | kontrahent.Knt_OpeModID = 11;
|
|---|
| 366 | kontrahent.Knt_StaModId = 6;
|
|---|
| 367 | kontrahent.Knt_TS_Mod = DateTime.Now;
|
|---|
| 368 | //kontrahent.Knt_GIDTyp=
|
|---|
| 369 | //kontrahent.Knt_GIDFirma=
|
|---|
| 370 | //kontrahent.Knt_GIDNumer=
|
|---|
| 371 | //kontrahent.Knt_GIDLp=
|
|---|
| 372 |
|
|---|
| 373 | if (!klientIstnieje)
|
|---|
| 374 | {
|
|---|
| 375 | this.CDNDataset.Kontrahenci.AddKontrahenciRow(kontrahent);
|
|---|
| 376 | }
|
|---|
| 377 |
|
|---|
| 378 | }
|
|---|
| 379 |
|
|---|
| 380 | public void DodajNaglowekFaktury(EXPODataSet.FAKTURYRow EXPOfaktura, CDNDataSet.KontrahenciRow kontrahent, decimal sumaNETTO, decimal VAT, decimal rabatProcent)
|
|---|
| 381 | {
|
|---|
| 382 |
|
|---|
| 383 | CDNDataSet.TraNagRow nowaFaktura = (CDNDataSet.TraNagRow)this.CDNDataset.TraNag.NewRow();
|
|---|
| 384 |
|
|---|
| 385 | //!!!!!!!!!!!!!!!
|
|---|
| 386 | //nowaFaktura.TrN_DDfId = 1;
|
|---|
| 387 |
|
|---|
| 388 | CDNDataSetTableAdapters.DokDefinicjeTableAdapter adapter = new ExportFaktur.CDNDataSetTableAdapters.DokDefinicjeTableAdapter();
|
|---|
| 389 | adapter.Connection = CDN_conn;
|
|---|
| 390 |
|
|---|
| 391 | CDNDataSet.DokDefinicjeRow dokDef = adapter.GetDataByNumerRozHandlowca(EXPOfaktura.NUMER_ROZ)[0];
|
|---|
| 392 |
|
|---|
| 393 | nowaFaktura.TrN_DDfId = dokDef.DDf_DDfID;
|
|---|
| 394 | nowaFaktura.TrN_TypDokumentu = 302;
|
|---|
| 395 |
|
|---|
| 396 | nowaFaktura.TrN_NumerNr = Int32.Parse(EXPOfaktura.NUMER);
|
|---|
| 397 | nowaFaktura.TrN_NumerString = "@numerS" + "/" + EXPOfaktura.NUMER_ROZ + "/" + EXPOfaktura.NUMER_ROK; //numerstring' @P4 varchar(13) '@numer/O/2007'
|
|---|
| 398 |
|
|---|
| 399 | // 'rsnag("TrN_NumerPelny=numerpelny
|
|---|
| 400 | nowaFaktura.TrN_Bufor = 1;
|
|---|
| 401 | nowaFaktura.TrN_DataDok = EXPOfaktura.DATA_WYSTAWIENIA;
|
|---|
| 402 | nowaFaktura.TrN_DataWys = EXPOfaktura.DATA_WYSTAWIENIA;
|
|---|
| 403 | nowaFaktura.TrN_DataOpe = EXPOfaktura.DATA_SPRZEDAZY;
|
|---|
| 404 | nowaFaktura.TrN_NumerObcy = "";
|
|---|
| 405 | nowaFaktura.TrN_DataKur = DateTime.Now;
|
|---|
| 406 | if (istniejeKorekta())
|
|---|
| 407 | {
|
|---|
| 408 | nowaFaktura.TrN_Korekta = 1;
|
|---|
| 409 | nowaFaktura.TrN_Rodzaj = 302001;
|
|---|
| 410 | int idkorekty = 0;
|
|---|
| 411 | nowaFaktura.TrN_ZwrId = idkorekty;
|
|---|
| 412 | }
|
|---|
| 413 | else
|
|---|
| 414 | {
|
|---|
| 415 | nowaFaktura.TrN_Korekta = 0;
|
|---|
| 416 | nowaFaktura.TrN_Rodzaj = 302000;
|
|---|
| 417 | }
|
|---|
| 418 | nowaFaktura.TrN_Fiskalna = 0;
|
|---|
| 419 | nowaFaktura.TrN_Detal = 0;
|
|---|
| 420 | nowaFaktura.TrN_PodmiotTyp = 1;
|
|---|
| 421 | nowaFaktura.TrN_PodID = kontrahent.Knt_KntId;
|
|---|
| 422 |
|
|---|
| 423 | nowaFaktura.TrN_PodNazwa1 = kontrahent.Knt_Nazwa1;
|
|---|
| 424 | nowaFaktura.TrN_PodNazwa2 = kontrahent.Knt_Nazwa2;
|
|---|
| 425 | nowaFaktura.TrN_PodNazwa3 = kontrahent.Knt_Nazwa3;
|
|---|
| 426 |
|
|---|
| 427 | /*
|
|---|
| 428 | if (kontrahent.Knt_Kraj){
|
|---|
| 429 | nowaFaktura.TrN_PodKraj="Polska";
|
|---|
| 430 | }
|
|---|
| 431 | else {
|
|---|
| 432 | nowaFaktura.TrN_PodKraj=kontrahent.Knt_Kraj;
|
|---|
| 433 | }*/
|
|---|
| 434 |
|
|---|
| 435 | nowaFaktura.TrN_PodKraj = kontrahent.Knt_Kraj;
|
|---|
| 436 |
|
|---|
| 437 | nowaFaktura.TrN_PodWojewodztwo = kontrahent.Knt_Wojewodztwo;
|
|---|
| 438 | nowaFaktura.TrN_PodPowiat = "";
|
|---|
| 439 | nowaFaktura.TrN_PodGmina = "";
|
|---|
| 440 | nowaFaktura.TrN_PodUlica = kontrahent.Knt_Ulica;
|
|---|
| 441 | nowaFaktura.TrN_PodNrDomu = kontrahent.Knt_NrDomu;
|
|---|
| 442 | nowaFaktura.TrN_PodNrLokalu = kontrahent.Knt_NrLokalu;
|
|---|
| 443 | nowaFaktura.TrN_PodMiasto = kontrahent.Knt_Miasto;
|
|---|
| 444 | nowaFaktura.TrN_PodKodPocztowy = kontrahent.Knt_KodPocztowy;
|
|---|
| 445 | nowaFaktura.TrN_PodPoczta = kontrahent.Knt_Poczta;
|
|---|
| 446 | nowaFaktura.TrN_PodAdres2 = "";
|
|---|
| 447 | nowaFaktura.TrN_PodNipKraj = kontrahent.Knt_NipKraj;
|
|---|
| 448 | nowaFaktura.TrN_PodNipE = kontrahent.Knt_NipE;
|
|---|
| 449 | nowaFaktura.TrN_Finalny = 0;
|
|---|
| 450 | nowaFaktura.TrN_Export = 0;
|
|---|
| 451 | nowaFaktura.TrN_OdbiorcaTyp = 1;
|
|---|
| 452 |
|
|---|
| 453 | //ustawione w dataset
|
|---|
| 454 | nowaFaktura.TrN_OdbID = kontrahent.Knt_KntId;
|
|---|
| 455 | nowaFaktura.TrN_OdbNazwa1 = kontrahent.Knt_Nazwa1;
|
|---|
| 456 | nowaFaktura.TrN_OdbNazwa2 = kontrahent.Knt_Nazwa2;
|
|---|
| 457 | nowaFaktura.TrN_OdbNazwa3 = kontrahent.Knt_Nazwa3;
|
|---|
| 458 |
|
|---|
| 459 | nowaFaktura.TrN_OdbKraj = kontrahent.Knt_Kraj;
|
|---|
| 460 |
|
|---|
| 461 | nowaFaktura.TrN_OdbWojewodztwo = kontrahent.Knt_Wojewodztwo;
|
|---|
| 462 | nowaFaktura.TrN_OdbPowiat = "";
|
|---|
| 463 | nowaFaktura.TrN_OdbGmina = "";
|
|---|
| 464 | nowaFaktura.TrN_OdbUlica = kontrahent.Knt_Ulica;
|
|---|
| 465 | nowaFaktura.TrN_OdbNrDomu = kontrahent.Knt_NrDomu;
|
|---|
| 466 | nowaFaktura.TrN_OdbNrLokalu = kontrahent.Knt_NrLokalu;
|
|---|
| 467 | nowaFaktura.TrN_OdbMiasto = kontrahent.Knt_Miasto;
|
|---|
| 468 | nowaFaktura.TrN_OdbKodPocztowy = kontrahent.Knt_KodPocztowy;
|
|---|
| 469 | nowaFaktura.TrN_OdbPoczta = kontrahent.Knt_Poczta;
|
|---|
| 470 | nowaFaktura.TrN_OdbAdres2 = "";
|
|---|
| 471 | nowaFaktura.TrN_OdbNipKraj = kontrahent.Knt_NipKraj;
|
|---|
| 472 | nowaFaktura.TrN_OdbNipE = kontrahent.Knt_NipE;
|
|---|
| 473 |
|
|---|
| 474 |
|
|---|
| 475 | //w zaleznosci od handlowca
|
|---|
| 476 | /*
|
|---|
| 477 | nowaFaktura.TrN_KatID = 42;
|
|---|
| 478 | nowaFaktura.TrN_Kategoria = "Dorota";
|
|---|
| 479 | */
|
|---|
| 480 | nowaFaktura.TrN_KatID = 1;
|
|---|
| 481 | nowaFaktura.TrN_Kategoria = "SPRZEDA¯";
|
|---|
| 482 |
|
|---|
| 483 | nowaFaktura.TrN_FPlId = 3;
|
|---|
| 484 | nowaFaktura.TrN_Termin = EXPOfaktura.TERMIN_ZAPLATY;
|
|---|
| 485 |
|
|---|
| 486 | //NETT, VAT itp.
|
|---|
| 487 | nowaFaktura.TrN_RazemNetto = sumaNETTO;
|
|---|
| 488 | nowaFaktura.TrN_RazemVAT = VAT * sumaNETTO;
|
|---|
| 489 | nowaFaktura.TrN_RazemBrutto = (decimal)((1 + VAT) * nowaFaktura.TrN_RazemNetto);
|
|---|
| 490 | nowaFaktura.TrN_BlokadaPlatnosci = 0;
|
|---|
| 491 | nowaFaktura.TrN_MagZrdId = 1;
|
|---|
| 492 | nowaFaktura.TrN_TypNB = 1;
|
|---|
| 493 | nowaFaktura.TrN_Rabat = rabatProcent * 100;
|
|---|
| 494 | //nowaFaktura.TrN_Rabat = 0;
|
|---|
| 495 |
|
|---|
| 496 |
|
|---|
| 497 | if (EXPOfaktura.IsPODPIS_ODEBRALNull())
|
|---|
| 498 | {
|
|---|
| 499 | nowaFaktura.TrN_Odebral = "zgodnie z owiadczeniem nabywcy";
|
|---|
| 500 | }
|
|---|
| 501 | else
|
|---|
| 502 | {
|
|---|
| 503 | nowaFaktura.TrN_Odebral = EXPOfaktura.PODPIS_ODEBRAL;
|
|---|
| 504 | }
|
|---|
| 505 |
|
|---|
| 506 | nowaFaktura.TrN_Opis = EXPOfaktura.opis;
|
|---|
| 507 | nowaFaktura.TrN_OpeZalID = 9;
|
|---|
| 508 | nowaFaktura.TrN_TS_Zal = EXPOfaktura.TERMIN_ZAPLATY;
|
|---|
| 509 | nowaFaktura.TrN_OpeModID = 9;
|
|---|
| 510 | nowaFaktura.TrN_TS_Mod = EXPOfaktura.TERMIN_ZAPLATY;
|
|---|
| 511 | nowaFaktura.TrN_NotaKorPrzed = "";
|
|---|
| 512 | nowaFaktura.TrN_NotaKorPo = "";
|
|---|
| 513 | nowaFaktura.TrN_TrSTyp = 3;
|
|---|
| 514 | nowaFaktura.TrN_RazemNettoWal = sumaNETTO;
|
|---|
| 515 | nowaFaktura.TrN_Waluta = "";
|
|---|
| 516 | nowaFaktura.TrN_KursNumer = 2;
|
|---|
| 517 | nowaFaktura.TrN_KursL = (decimal)1.00;
|
|---|
| 518 | nowaFaktura.TrN_KursM = 1;
|
|---|
| 519 | nowaFaktura.TrN_PodNazwa3 = "";
|
|---|
| 520 | nowaFaktura.TrN_OdbNazwa3 = "";
|
|---|
| 521 | nowaFaktura.TrN_Centrala = 0;
|
|---|
| 522 | nowaFaktura.TrN_PodmiotGLN = "";
|
|---|
| 523 | nowaFaktura.TrN_OdbiorcaGLN = "";
|
|---|
| 524 | nowaFaktura.TrN_NumerPelnyPrw = "";
|
|---|
| 525 | nowaFaktura.TrN_PlatElemWalSys = 0;
|
|---|
| 526 |
|
|---|
| 527 | nowaFaktura.TrN_RazemVATWal = VAT*100;
|
|---|
| 528 | nowaFaktura.TrN_RazemBruttoWal = (decimal)((1 + VAT) * nowaFaktura.TrN_RazemNetto);
|
|---|
| 529 | nowaFaktura.TrN_StaZalId = 1;
|
|---|
| 530 | nowaFaktura.TrN_StaModId = 1;
|
|---|
| 531 | // 'rsnag("TrN_PodNipKraj=""' @P84 varchar(1) ''
|
|---|
| 532 | // 'rsnag("TrN_OdbNipKraj="" ' @P85 varchar(1) ''
|
|---|
| 533 | nowaFaktura.TrN_KodTransakcji = "";
|
|---|
| 534 |
|
|---|
| 535 | //???
|
|---|
| 536 | DateTime datadok = DateTime.Now;
|
|---|
| 537 | nowaFaktura.TrN_DataTransportu = datadok;
|
|---|
| 538 | nowaFaktura.TrN_KodKraju = "";
|
|---|
| 539 | nowaFaktura.TrN_Anulowany = 0;
|
|---|
| 540 | nowaFaktura.TrN_TerminZwrotuKaucji = datadok.AddDays(30);
|
|---|
| 541 | nowaFaktura.TrN_PlatKaucje = 0;
|
|---|
| 542 | nowaFaktura.TrN_TaxFreePotwierdzony = 0;
|
|---|
| 543 | nowaFaktura.TrN_VatDlaDokWal = 0;
|
|---|
| 544 |
|
|---|
| 545 | if (!EXPOfaktura.Iswaluta_bruttoNull() && EXPOfaktura.waluta_brutto > 0)
|
|---|
| 546 | {
|
|---|
| 547 | nowaFaktura.TrN_Export = 7;
|
|---|
| 548 | nowaFaktura.TrN_WartoscZakupu = 0;
|
|---|
| 549 | nowaFaktura.TrN_RazemVATWal = VAT * 100;
|
|---|
| 550 | nowaFaktura.TrN_RazemBruttoWal = (decimal)EXPOfaktura.waluta_brutto;
|
|---|
| 551 | nowaFaktura.TrN_RazemNettoWal = ((decimal)EXPOfaktura.waluta_brutto / (1 + VAT));
|
|---|
| 552 | nowaFaktura.TrN_Waluta = EXPOfaktura.Iswaluta_mianoNull() ? "" : EXPOfaktura.waluta_miano;
|
|---|
| 553 | nowaFaktura.TrN_KursL = EXPOfaktura.Iswaluta_kursNull()? 1M : (decimal)EXPOfaktura.waluta_kurs;
|
|---|
| 554 | nowaFaktura.TrN_KursM = 1;
|
|---|
| 555 | nowaFaktura.TrN_KursNumer = 1;
|
|---|
| 556 | }
|
|---|
| 557 |
|
|---|
| 558 | this.CDNDataset.TraNag.AddTraNagRow(nowaFaktura);
|
|---|
| 559 |
|
|---|
| 560 | }
|
|---|
| 561 |
|
|---|
| 562 | public void DodajVAT(CDNDataSet.TraNagRow naglowekFaktury, decimal sumaNetto, decimal stawkaVAT)
|
|---|
| 563 | {
|
|---|
| 564 | CDNDataSet.TraVatRow nowyVat = (CDNDataSet.TraVatRow)this.CDNDataset.TraVat.NewRow();
|
|---|
| 565 |
|
|---|
| 566 | nowyVat.TrV_TrNID = naglowekFaktury.TrN_TrNID;
|
|---|
| 567 | nowyVat.TrV_Stawka = stawkaVAT * 100;
|
|---|
| 568 | nowyVat.TrV_Flaga = 2;
|
|---|
| 569 | nowyVat.TrV_Zrodlowa = 0.00M;
|
|---|
| 570 | nowyVat.TrV_Netto = sumaNetto;
|
|---|
| 571 | nowyVat.TrV_VAT = stawkaVAT * sumaNetto;
|
|---|
| 572 | nowyVat.TrV_NettoWal = sumaNetto;
|
|---|
| 573 | nowyVat.TrV_VATWal = stawkaVAT * sumaNetto;
|
|---|
| 574 | nowyVat.TrV_Typ = 0;
|
|---|
| 575 |
|
|---|
| 576 | if (naglowekFaktury.TrN_Export == 7)
|
|---|
| 577 | {
|
|---|
| 578 | nowyVat.TrV_Flaga = 4;
|
|---|
| 579 | nowyVat.TrV_VATWal = naglowekFaktury.TrN_RazemBruttoWal - naglowekFaktury.TrN_RazemNettoWal;
|
|---|
| 580 | nowyVat.TrV_NettoWal = naglowekFaktury.TrN_RazemNettoWal;
|
|---|
| 581 | }
|
|---|
| 582 |
|
|---|
| 583 | this.CDNDataset.TraVat.AddTraVatRow(nowyVat);
|
|---|
| 584 | }
|
|---|
| 585 |
|
|---|
| 586 | public bool isNumeric(string a)
|
|---|
| 587 | {
|
|---|
| 588 | Regex reNum = new Regex(@"^\d+$");
|
|---|
| 589 | return reNum.Match(a).Success;
|
|---|
| 590 | }
|
|---|
| 591 |
|
|---|
| 592 | public bool istniejeKorekta()
|
|---|
| 593 | {
|
|---|
| 594 | return false;
|
|---|
| 595 | }
|
|---|
| 596 |
|
|---|
| 597 | //przyszle okresy
|
|---|
| 598 | public int podajIDKategorii(int rok, int ms)
|
|---|
| 599 | {
|
|---|
| 600 | switch (rok)
|
|---|
| 601 | {
|
|---|
| 602 | case 2008:
|
|---|
| 603 | switch (ms)
|
|---|
| 604 | {
|
|---|
| 605 | case 6:
|
|---|
| 606 | return 107;
|
|---|
| 607 | case 7:
|
|---|
| 608 | return 108;
|
|---|
| 609 | case 8:
|
|---|
| 610 | return 109;
|
|---|
| 611 | case 9:
|
|---|
| 612 | return 110;
|
|---|
| 613 | case 10:
|
|---|
| 614 | return 111;
|
|---|
| 615 | case 11:
|
|---|
| 616 | return 112;
|
|---|
| 617 | case 12:
|
|---|
| 618 | return 113;
|
|---|
| 619 | }
|
|---|
| 620 | break;
|
|---|
| 621 | case 2009:
|
|---|
| 622 | switch (ms)
|
|---|
| 623 | {
|
|---|
| 624 | case 1:
|
|---|
| 625 | return 121;
|
|---|
| 626 | case 2:
|
|---|
| 627 | return 122;
|
|---|
| 628 | case 3:
|
|---|
| 629 | return 123;
|
|---|
| 630 | case 4:
|
|---|
| 631 | return 124;
|
|---|
| 632 | case 5:
|
|---|
| 633 | return 125;
|
|---|
| 634 | }
|
|---|
| 635 | break;
|
|---|
| 636 | }
|
|---|
| 637 |
|
|---|
| 638 | return 1;
|
|---|
| 639 | }
|
|---|
| 640 |
|
|---|
| 641 | public string PodajKrajNIP(string NIP)
|
|---|
| 642 | {
|
|---|
| 643 | string nip = NIP.Replace(" ", "").Replace("-", "").Trim();
|
|---|
| 644 |
|
|---|
| 645 | if (polskiNIP(nip))
|
|---|
| 646 | {
|
|---|
| 647 | return "PL";
|
|---|
| 648 | }
|
|---|
| 649 | else
|
|---|
| 650 | {
|
|---|
| 651 | if ((nip.Length >= 2) && (!isNumeric(nip.Substring(0, 2))))
|
|---|
| 652 | {
|
|---|
| 653 | return nip.Substring(0, 2);
|
|---|
| 654 | }
|
|---|
| 655 | else
|
|---|
| 656 | {
|
|---|
| 657 | return "";
|
|---|
| 658 | }
|
|---|
| 659 |
|
|---|
| 660 | }
|
|---|
| 661 | }
|
|---|
| 662 |
|
|---|
| 663 | public string PodajNumerNIP(string NIP)
|
|---|
| 664 | {
|
|---|
| 665 | string nip = NIP.Replace(" ", "").Replace("-", "").Trim();
|
|---|
| 666 |
|
|---|
| 667 | if (polskiNIP(nip))
|
|---|
| 668 | {
|
|---|
| 669 | return nip.Length > 13 ? nip.Substring(0, 13) : nip;
|
|---|
| 670 | }
|
|---|
| 671 | else
|
|---|
| 672 | {
|
|---|
| 673 | if ((nip.Length >= 2) && (!isNumeric(nip.Substring(0, 2))))
|
|---|
| 674 | {
|
|---|
| 675 | return nip.Length > 15 ? nip.Substring(2, 13) : nip.Substring(2, nip.Length - 2);
|
|---|
| 676 | }
|
|---|
| 677 | else
|
|---|
| 678 | {
|
|---|
| 679 | return nip.Length > 13 ? nip.Substring(0, 13) : nip;
|
|---|
| 680 | }
|
|---|
| 681 |
|
|---|
| 682 | }
|
|---|
| 683 | }
|
|---|
| 684 |
|
|---|
| 685 | public bool polskiNIP(string nip)
|
|---|
| 686 | {
|
|---|
| 687 | int[] wagi = new int[] {6,5,7,2,3,4,5,6,7};
|
|---|
| 688 |
|
|---|
| 689 | string shortNIP;
|
|---|
| 690 | int suma, iloczyn, kontrolny;
|
|---|
| 691 | suma=0;
|
|---|
| 692 | kontrolny=0;
|
|---|
| 693 | shortNIP = nip.Replace(" ", "").Replace("-", "").Trim();
|
|---|
| 694 |
|
|---|
| 695 | if ((shortNIP.Length == 10) && isNumeric(shortNIP))
|
|---|
| 696 | {
|
|---|
| 697 |
|
|---|
| 698 | for (int i = 0; i <= 8; i++)
|
|---|
| 699 | {
|
|---|
| 700 | iloczyn = Convert.ToInt32(shortNIP.Substring(i, 1)) * wagi[i];
|
|---|
| 701 | suma = suma + iloczyn;
|
|---|
| 702 | }
|
|---|
| 703 | kontrolny = suma % 11;
|
|---|
| 704 |
|
|---|
| 705 | if (kontrolny == Convert.ToInt32(shortNIP.Substring(shortNIP.Length - 1, 1)))
|
|---|
| 706 | {
|
|---|
| 707 | return true;
|
|---|
| 708 | }
|
|---|
| 709 | }
|
|---|
| 710 | return false;
|
|---|
| 711 | }
|
|---|
| 712 |
|
|---|
| 713 |
|
|---|
| 714 | #endregion Methods
|
|---|
| 715 |
|
|---|
| 716 | }
|
|---|
| 717 | }
|
|---|