private static bool Generuj_DrukZUS(SPWeb web, SPListItem item, bool result, string okres, int klientId, double kwota, string konto, string fileName) { konto = Clean_NumerRachunku(konto); if (konto.Length == 26 && kwota > 0 && !string.IsNullOrEmpty(fileName)) { string typWplaty = "S"; string numerDeklaracji = "01"; string okresMiesiac = okres.Substring(5, 2); string okresRok = okres.Substring(0, 4); string numerDecyzji = "."; BLL.Models.Klient iok = new BLL.Models.Klient(web, klientId); string nadawca = iok.Get_NazwaNadawcyPrzelewu(); string regon = iok.Regon; string typIdentyfikatora = "R"; if (string.IsNullOrEmpty(regon)) //jeżeli nie ma regonu podaj pesel { regon = iok.Pesel; typIdentyfikatora = "P"; } if (string.IsNullOrEmpty(regon)) //jeżeli nie ma pesela nie podawaj drugiego identyfikatora { typIdentyfikatora = string.Empty; } string nip = iok.NIP; string identyfikatorDeklaracji = String.Format("{0} {1} {2}{3} {4}", typWplaty.Substring(0, 1), numerDeklaracji.Substring(0, 2), okresMiesiac.Substring(0, 2), okresRok.Substring(0, 4), numerDecyzji = numerDecyzji.Length > 15 ? numerDecyzji.Substring(0, 15) : numerDecyzji); result = GeneratorDrukow.DrukWplaty.Attach_DrukWplatyZUS(web, item, fileName, konto, kwota, nadawca, nip, typIdentyfikatora.Substring(0, 1), regon, identyfikatorDeklaracji); } return result; }
private bool ObslugaGBW_RozliczeniePodatkuVAT(SPWeb web, SPListItem item, bool result, string targetFileNameLeading, string klient, string okres, int klientId) { bool wymaganyDrukWplaty = item["colDrukWplaty"] != null ? (bool)item["colDrukWplaty"] : false; string decyzja = item["colVAT_Decyzja"] != null ? item["colVAT_Decyzja"].ToString() : string.Empty; double kwota = item["colVAT_WartoscDoZaplaty"] != null ? Double.Parse(item["colVAT_WartoscDoZaplaty"].ToString()) : 0; string konto = Clean_NumerRachunku(item, "colVAT_Konto"); if (wymaganyDrukWplaty && konto.Length == 26 && kwota > 0 && decyzja == "Do zapłaty") { //string fileName = String.Format(@"{0}Podatek VAT_{1}.pdf", // targetFileNameLeading, // okres); string fileName = String.Format(@"{0}Podatek VAT.pdf", targetFileNameLeading); int urzadId = item["selUrzadSkarbowy"] != null ? new SPFieldLookupValue(item["selUrzadSkarbowy"].ToString()).LookupId : 0; BLL.Models.UrzadSkarbowy us = new BLL.Models.UrzadSkarbowy(web, urzadId); string odbiorca = us.Get_NazwaOdbiorcyPrzelewu(); string numerDeklaracji = string.Empty; string rozliczenie = item["enumRozliczenieVAT"] != null ? item["enumRozliczenieVAT"].ToString() : string.Empty; if (rozliczenie == "Kwartalnie") { numerDeklaracji = okres.Substring(2, 2) + "K"; string m = okres.Substring(5, 2); //oznaczenie miesiąca switch (m) { case "01": case "02": case "03": numerDeklaracji = numerDeklaracji + "01"; break; case "04": case "05": case "06": numerDeklaracji = numerDeklaracji + "02"; break; case "07": case "08": case "09": numerDeklaracji = numerDeklaracji + "03"; break; case "10": case "11": case "12": numerDeklaracji = numerDeklaracji + "04"; break; default: break; } } else { numerDeklaracji = okres.Substring(2, 2) + "M" + okres.Substring(5, 2); } BLL.Models.Klient iok = new BLL.Models.Klient(web, klientId); string nadawca = iok.Get_NazwaNadawcyPrzelewu(); //nip z kartoteki string nip = iok.NIP; string typIdentyfikatora = "N"; string symbolFormularza = iok.FormaOpodatkowaniaVAT.Replace("-", "").Trim(); string opis = "Podatek VAT"; result = GeneratorDrukow.DrukWplaty.Attach_DrukWplatyPD(web, item, fileName, odbiorca, konto, kwota, nadawca, nip, typIdentyfikatora, numerDeklaracji, symbolFormularza, opis); } return result; }
private bool Update_GBW(SPWeb web, SPListItem item, string ct) { bool result = false; string targetFileNameLeading = "DRUK WPŁATY__"; UsunPodobneZalaczniki(item, targetFileNameLeading); if (item["colDrukWplaty"] != null && (bool)item["colDrukWplaty"]) { string klient = item["selKlient"] != null ? new SPFieldLookupValue(item["selKlient"].ToString()).LookupValue : string.Empty; int klientId = item["selKlient"] != null ? new SPFieldLookupValue(item["selKlient"].ToString()).LookupId : 0; BLL.Models.Klient iok = new BLL.Models.Klient(web, klientId); string nadawca = iok.Get_NazwaNadawcyPrzelewu(); string okres = item["selOkres"] != null ? new SPFieldLookupValue(item["selOkres"].ToString()).LookupValue : string.Empty; switch (ct) { case "Rozliczenie z biurem rachunkowym": result = ObslugaGBW_RozliczenieZBiuremRachunkowym(web, item, result, targetFileNameLeading, klient, okres, nadawca); break; case "Rozliczenie podatku VAT": result = ObslugaGBW_RozliczeniePodatkuVAT(web, item, result, targetFileNameLeading, klient, okres, klientId); break; case "Rozliczenie podatku dochodowego": case "Rozliczenie podatku dochodowego spółki": result = ObslugaGBW_RozliczeniePodatkuDochodowego(web, item, result, targetFileNameLeading, klient, okres, klientId); break; case "Rozliczenie ZUS": result = ObslugaGBW_RozliczenieZUS(web, item, result, targetFileNameLeading, klient, okres, klientId); break; default: break; } } return result; }