private void Ensure(ref BLL.Models.Klient iok) { if (iok == null) { iok = new BLL.Models.Klient(item.Web, BLL.Tools.Get_LookupId(item, "selKlient")); } }
public static void Create(Microsoft.SharePoint.SPListItem item) { BLL.Logger.LogEvent_Procedure("GFR_K_Request.Create", item, "start"); int okresId = BLL.Tools.Get_LookupId(item, "selOkres"); int klientId = BLL.Tools.Get_LookupId(item, "selKlient"); string mask = BLL.Tools.Get_Text(item, "colMaskaSerwisu"); if (okresId > 0 && klientId > 0) { BLL.Models.Klient iok = new BLL.Models.Klient(item.Web, klientId); SPListItem klientItem = BLL.tabKlienci.Get_KlientById(item.Web, klientId); int formId = BLL.tabKartyKontrolne.Ensure_KartaKontrolna(item.Web, klientId, okresId, iok); switch (iok.TypKlienta) { case "KPiR": if (mask.StartsWith("ZUS-") || string.IsNullOrEmpty(mask)) ZUS_Forms.Manage_ZUS_Form(item.Web, okresId, klientItem, iok); if (mask.StartsWith("PD-") || string.IsNullOrEmpty(mask)) PD_Forms.Create_PD_Form(item.Web, okresId, klientItem, iok); if (mask.StartsWith("VAT-") || string.IsNullOrEmpty(mask)) VAT_Forms.Create_VAT_Form(item.Web, okresId, klientItem, iok); if (mask.Equals("RBR") || string.IsNullOrEmpty(mask)) RBR_Forms.Create_RBR_Form(item.Web, okresId, klientItem, iok); if (mask.Equals("RB") || string.IsNullOrEmpty(mask)) RB_Forms.Create_RB_Form(item.Web, okresId, klientItem, iok); break; case "KSH": if (mask.StartsWith("ZUS-") || string.IsNullOrEmpty(mask)) ZUS_Forms.Manage_ZUS_Form(item.Web, okresId, klientItem, iok); if (mask.StartsWith("PDS-") || string.IsNullOrEmpty(mask)) PDS_Forms.Create_PDS_Form(item.Web, okresId, klientItem, iok); if (mask.StartsWith("VAT-") || string.IsNullOrEmpty(mask)) VAT_Forms.Create_VAT_Form(item.Web, okresId, klientItem, iok); if (mask.Equals("RBR") || string.IsNullOrEmpty(mask)) RBR_Forms.Create_RBR_Form(item.Web, okresId, klientItem, iok); break; case "Firma": if (mask.StartsWith("PD-") || string.IsNullOrEmpty(mask)) PD_Forms.Create_PD_Form(item.Web, okresId, klientItem, iok); if (mask.StartsWith("VAT-") || string.IsNullOrEmpty(mask)) VAT_Forms.Create_VAT_Form(item.Web, okresId, klientItem, iok); break; case "Osoba fizyczna": if (mask.StartsWith("ZUS-") || string.IsNullOrEmpty(mask)) ZUS_Forms.Manage_ZUS_Form(item.Web, okresId, klientItem, iok); if (mask.StartsWith("PD-") || string.IsNullOrEmpty(mask)) PD_Forms.Create_PD_Form(item.Web, okresId, klientItem, iok); break; default: break; } } BLL.Logger.LogEvent_Procedure("GFR_K_Request.Create", item, "end"); }
private static void Copy_DaneZKartoteki(SPWeb web, int klientId, int okresId, ref SPListItem formatka) { // upewnij się że docelowa formatka została zainicjowana Ensure_CurrentPDS(web, klientId, okresId, ref formatka); // dane uzupełniające BLL.Models.Klient iok = new BLL.Models.Klient(web, klientId); formatka["_IsSpolkaZoo"] = iok.IsSpolkaKapitalowa; }
private static void Set_KartaKontrolna_InitValues(SPListItem newItem, BLL.Models.Klient k) { newItem["enumRozliczeniePD"] = k.RozliczeniePD; newItem["enumRozliczenieVAT"] = k.RozliczenieVAT; newItem["colFormaOpodatkowaniaPD"] = k.FormaOpodatkowaniaPD; newItem["colFormaOpodatkowaniaVAT"] = k.FormaOpodatkowaniaVAT; newItem["colFormaOpodakowania_ZUS"] = k.FormaOpodatkowaniaZUS; newItem["colVAT_TerminZwrotuPodatku"] = string.Empty; newItem["colZatrudniaPracownikow"] = k.ZatrudniaPracownikow; }
private void Ensure(ref BLL.Models.Klient iok) { if (iok == null) iok = new BLL.Models.Klient(item.Web, BLL.Tools.Get_LookupId(item, "selKlient")); }
private void Create_Message_ExecuteCode(object sender, EventArgs e) { logRecord_HistoryOutcome = string.Empty; if (fakturyKlineta == null || fakturyKlineta.Count == 0) { return; } // przygotuj wiadomość string temat = string.Empty; string tresc = string.Empty; string trescHTML = string.Empty; //string nadawca = BLL.Tools.Get_CurrentUser(item); - wymusza przypisanie stopki operatora na podstawie aktualnego adresu nadawcy string nadawca = string.Empty; //wymusza aby testo czy trzeba dodać stopkę został wykonany w procedurze Get_TemplateByKod // przygotuj wiersze tabeli BLL.dicSzablonyKomunikacji.Get_TemplateByKod(item, "INVOICE_LIST_TR_TEMPLATE", out temat, out trescHTML, nadawca); string rowTemplate = trescHTML; StringBuilder sb = new StringBuilder(); foreach (SPListItem faktura in fakturyKlineta) { StringBuilder sbRow = new StringBuilder(rowTemplate); sbRow.Replace("[[BR_NumerFaktury]]", BLL.Tools.Get_Text(faktura, "colBR_NumerFaktury")); sbRow.Replace("[[colBR_DataWystawienia]]", BLL.Tools.Format_Date(BLL.Tools.Get_Date(faktura, "colBR_DataWystawieniaFaktury"))); sbRow.Replace("[[colBR_WartoscDoZaplaty]]", BLL.Tools.Format_Currency(BLL.Tools.Get_Value(faktura, "colBR_WartoscDoZaplaty"))); sbRow.Replace("[[colBR_Konto]]", BLL.Tools.Format_Konto(numerKontaBankowego)); sbRow.Replace("[[colBR_TerminPlatnosci]]", BLL.Tools.Format_Date(BLL.Tools.Get_Date(faktura, "colBR_TerminPlatnosci"))); sb.Append(sbRow.ToString()); } //sprawdz czy nie nadpisać szablonu BLL.dicSzablonyKomunikacji.Get_TemplateByKod(item, "INVOICE_LIST_TEMPLATE.Include", out temat, out trescHTML, nadawca); BLL.Models.Klient iok = new BLL.Models.Klient(item.Web, currentKlientId); temat = temat + " : " + iok.NazwaPrezentowana; StringBuilder sbBody = new StringBuilder(trescHTML); sbBody.Replace("[[TABLE_ROW]]", sb.ToString()); sbBody.Replace("___FOOTER___", string.Empty); trescHTML = sbBody.ToString(); string odbiorca = BLL.tabKlienci.Get_EmailById(item.Web, currentKlientId); string kopiaDla = BLL.Tools.Append_EmailCC(item.Web, currentKlientId, string.Empty); bool KopiaDoNadawcy = false; bool KopiaDoBiura = false; DateTime planowanyTerminNadania = DateTime.Now.AddHours(1); if (BLL.Tools.IsValidEmail(odbiorca)) { SPListItem newItem = CreateMessageItem(item.Web, ref nadawca, odbiorca, kopiaDla, KopiaDoNadawcy, KopiaDoBiura, temat, tresc, trescHTML, planowanyTerminNadania, 0, currentKlientId, 0); // dołącz załączniki w formie plików faktur skojarzonych z listą. foreach (SPListItem faktura in fakturyKlineta) { int dokumentId = (int)BLL.Tools.Get_Value(faktura, "_DokumentId"); SPListItem doc = Get_DocumentById(dokumentId); if (doc != null) { string url = doc.Url; SPFile file = item.ParentList.ParentWeb.GetFile(url); if (file.Exists) { Copy_Attachement(newItem, file); } } } newItem.SystemUpdate(); numerWiadomosci = newItem.ID; logRecord_HistoryOutcome = numerWiadomosci.ToString(); } }
public static void Create(Microsoft.SharePoint.SPListItem item) { BLL.Logger.LogEvent_Procedure("GFR_K_Request.Create", item, "start"); int okresId = BLL.Tools.Get_LookupId(item, "selOkres"); int klientId = BLL.Tools.Get_LookupId(item, "selKlient"); string mask = BLL.Tools.Get_Text(item, "colMaskaSerwisu"); if (okresId > 0 && klientId > 0) { BLL.Models.Klient iok = new BLL.Models.Klient(item.Web, klientId); SPListItem klientItem = BLL.tabKlienci.Get_KlientById(item.Web, klientId); int formId = BLL.tabKartyKontrolne.Ensure_KartaKontrolna(item.Web, klientId, okresId, iok); switch (iok.TypKlienta) { case "KPiR": if (mask.StartsWith("ZUS-") || string.IsNullOrEmpty(mask)) { ZUS_Forms.Manage_ZUS_Form(item.Web, okresId, klientItem, iok); } if (mask.StartsWith("PD-") || string.IsNullOrEmpty(mask)) { PD_Forms.Create_PD_Form(item.Web, okresId, klientItem, iok); } if (mask.StartsWith("VAT-") || string.IsNullOrEmpty(mask)) { VAT_Forms.Create_VAT_Form(item.Web, okresId, klientItem, iok); } if (mask.Equals("RBR") || string.IsNullOrEmpty(mask)) { RBR_Forms.Create_RBR_Form(item.Web, okresId, klientItem, iok); } if (mask.Equals("RB") || string.IsNullOrEmpty(mask)) { RB_Forms.Create_RB_Form(item.Web, okresId, klientItem, iok); } break; case "KSH": if (mask.StartsWith("ZUS-") || string.IsNullOrEmpty(mask)) { ZUS_Forms.Manage_ZUS_Form(item.Web, okresId, klientItem, iok); } if (mask.StartsWith("PDS-") || string.IsNullOrEmpty(mask)) { PDS_Forms.Create_PDS_Form(item.Web, okresId, klientItem, iok); } if (mask.StartsWith("VAT-") || string.IsNullOrEmpty(mask)) { VAT_Forms.Create_VAT_Form(item.Web, okresId, klientItem, iok); } if (mask.Equals("RBR") || string.IsNullOrEmpty(mask)) { RBR_Forms.Create_RBR_Form(item.Web, okresId, klientItem, iok); } break; case "Firma": if (mask.StartsWith("PD-") || string.IsNullOrEmpty(mask)) { PD_Forms.Create_PD_Form(item.Web, okresId, klientItem, iok); } if (mask.StartsWith("VAT-") || string.IsNullOrEmpty(mask)) { VAT_Forms.Create_VAT_Form(item.Web, okresId, klientItem, iok); } break; case "Osoba fizyczna": if (mask.StartsWith("ZUS-") || string.IsNullOrEmpty(mask)) { ZUS_Forms.Manage_ZUS_Form(item.Web, okresId, klientItem, iok); } if (mask.StartsWith("PD-") || string.IsNullOrEmpty(mask)) { PD_Forms.Create_PD_Form(item.Web, okresId, klientItem, iok); } break; default: break; } } BLL.Logger.LogEvent_Procedure("GFR_K_Request.Create", item, "end"); }
internal static void Create_RBR_Form(SPWeb web, int okresId, SPListItem klientItem, BLL.Models.Klient iok) { if (BLL.Tools.Has_SerwisAssigned(klientItem, "selSewisy", "RBR")) { string key = BLL.tabZadania.Define_KEY(ctRBR, klientItem.ID, okresId); if (BLL.tabZadania.Check_KEY_IsAllowed(key, web, 0)) { BLL.tabZadania.Create_ctRBR_Form(web, ctRBR, klientItem.ID, okresId, key, klientItem, iok); } } }
private static int Create_KartaKontrolna(SPWeb web, int klientId, int okresId, BLL.Models.Klient iok, string KEY) { Debug.WriteLine("BLL.tabKartyKontrolne.Create_KartaKontrolna"); SPListItem newItem = web.Lists.TryGetList(targetList).Items.Add(); newItem["KEY"] = KEY; newItem["selKlient"] = klientId; newItem["selOkres"] = okresId; Set_KartaKontrolna_InitValues(newItem, iok); //ustaw CT newItem["ContentType"] = "Karta kontrolna"; newItem.SystemUpdate(); return(newItem.ID); }
public static int Ensure_KartaKontrolna(SPWeb web, int klientId, int okresId, BLL.Models.Klient iok) { Debug.WriteLine("BLL.tabKartyKontrolne.Ensure_KartaKontrolna"); string KEY = Create_KEY(klientId, okresId); int formId = Get_KartaKontrolnaId(web, klientId, okresId, KEY, iok); if (formId > 0) { return(formId); } else { return(Create_KartaKontrolna(web, klientId, okresId, iok, KEY)); } }
internal static void Create_RB_Form(Microsoft.SharePoint.SPWeb web, int okresId, Microsoft.SharePoint.SPListItem klientItem, BLL.Models.Klient iok) { if (BLL.Tools.Has_SerwisAssigned(klientItem, "selSewisy", "RB")) //ograniczony dostęp do tablicy rozliczeń gotówkowych { SPSecurity.RunWithElevatedPrivileges(delegate() { using (SPSite eSite = new SPSite(web.Site.ID)) { using (SPWeb eWeb = eSite.OpenWeb()) { string key = BLL.tabRozliczeniaGotowkowe.Define_KEY(klientItem.ID, okresId); if (BLL.tabRozliczeniaGotowkowe.Check_KEY_IsAllowed(key, web, 0)) { BLL.tabRozliczeniaGotowkowe.Create_ctRB_Form(web, klientItem.ID, okresId, key, klientItem, iok); } } } }); } }
private static void Copy_DaneZKartoteki(SPWeb web, int klientId, int okresId, ref SPListItem formatka) { // upewnij się że docelowa formatka została zainicjowana Ensure_CurrentPDS(web, klientId, okresId, ref formatka); // dane uzupełniające BLL.Models.Klient iok = new BLL.Models.Klient(web, klientId); formatka["_IsSpolkaZoo"] = iok.IsSpolkaKapitalowa; }