Пример #1
0
        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;
        }
Пример #2
0
        private bool ObslugaGBW_RozliczenieZUS(SPWeb web, SPListItem item, bool result, string targetFileNameLeading, string klient, string okres, int klientId)
        {
            bool wymaganyDrukWplaty = item["colDrukWplaty"] != null ? (bool)item["colDrukWplaty"] : false;
            string opcja = item["colZUS_Opcja"] != null ? item["colZUS_Opcja"].ToString() : string.Empty;

            if (wymaganyDrukWplaty)
            {
                double kwota;
                string konto;
                string fileName;

                BLL.Models.Klient iok = new BLL.Models.Klient(web, klientId);

                if (Get_FlagValue(item, "colZatrudniaPracownikow"))
                {

                    //PIT 8AR  
                    if (Get_FlagValue(item, "colZUS_PIT-8AR_Zalaczony"))
                    {
                        kwota = item["colZUS_PIT-8AR"] != null ? Double.Parse(item["colZUS_PIT-8AR"].ToString()) : 0;
                        if (kwota > 0)
                        {

                            konto = iok.NumerRachunkuPIT_PD;
                            int urzadId = iok.UrzadSkarbowyId;

                            BLL.Models.UrzadSkarbowy us = new BLL.Models.UrzadSkarbowy(web, urzadId);
                            string odbiorca = us.Get_NazwaOdbiorcyPrzelewu();
                            fileName = String.Format(@"{0}PIT-8AR_{1}.pdf",
                                       targetFileNameLeading,
                                       okres);

                            string numerDeklaracji = okres.Substring(2, 2) + "M" + okres.Substring(5, 2); //TODO: obsługa kwartalnych deklaracji

                            result = Generuj_DrukPD_FromZUS(web, item, klientId, okres, kwota, konto, fileName, odbiorca, numerDeklaracji, "PIT8AR", "ZRYCZ.POD.DOCH.UM.Z", iok);
                        }
                    }
                    //PIT 4R
                    if (Get_FlagValue(item, "colZUS_PIT-4R_Zalaczony"))
                    {
                        kwota = item["colZUS_PIT-4R"] != null ? Double.Parse(item["colZUS_PIT-4R"].ToString()) : 0;
                        if (kwota > 0)
                        {

                            konto = iok.NumerRachunkuPIT_PD;
                            int urzadId = iok.UrzadSkarbowyId;

                            BLL.Models.UrzadSkarbowy us = new BLL.Models.UrzadSkarbowy(web, urzadId);
                            string odbiorca = us.Get_NazwaOdbiorcyPrzelewu();
                            fileName = String.Format(@"{0}PIT-4R_{1}.pdf",
                               targetFileNameLeading,
                               okres);

                            string numerDeklaracji = okres.Substring(2, 2) + "M" + okres.Substring(5, 2); //TODO: obsługa kwartalnych deklaracji

                            result = Generuj_DrukPD_FromZUS(web, item, klientId, okres, kwota, konto, fileName, odbiorca, numerDeklaracji, "PIT4R", "POD.DOCH.ZA PRAC.", iok);
                        }
                    }
                }


                switch (opcja)
                {
                    case "Tylko zdrowotna":
                        //skladka zdrowotna
                        kwota = item["colZUS_ZD_Skladka"] != null ? Double.Parse(item["colZUS_ZD_Skladka"].ToString()) : 0;
                        if (kwota > 0)
                        {
                            konto = Clean_NumerRachunku(item, "colZUS_ZD_Konto");
                            fileName = String.Format(@"{0}Składka zdrowotna_{1}.pdf",
                                               targetFileNameLeading,
                                               okres);


                            result = Generuj_DrukZUS(web, item, result, okres, klientId, kwota, konto, fileName);
                        }



                        //skladka spoleczna
                        kwota = item["colZUS_SP_Skladka"] != null ? Double.Parse(item["colZUS_SP_Skladka"].ToString()) : 0;
                        if (kwota > 0) //przypadek gdzie zatrudnia pracowników
                        {
                            konto = Clean_NumerRachunku(item, "colZUS_SP_Konto");
                            fileName = String.Format(@"{0}ZUS 51_{1}.pdf",
                                               targetFileNameLeading,
                                               okres);

                            result = Generuj_DrukZUS(web, item, result, okres, klientId, kwota, konto, fileName);
                        }

                        //fundusz pracy
                        kwota = item["colZUS_FP_Skladka"] != null ? Double.Parse(item["colZUS_FP_Skladka"].ToString()) : 0;
                        if (kwota > 0) //przypadek gdy zatrudnia pracowników
                        {
                            konto = Clean_NumerRachunku(item, "colZUS_FP_Konto");
                            fileName = String.Format(@"{0}ZUS 53_{1}.pdf",
                                               targetFileNameLeading,
                                               okres);

                            result = Generuj_DrukZUS(web, item, result, okres, klientId, kwota, konto, fileName);
                        }

                        break;
                    default:


                        //fundusz pracy
                        kwota = item["colZUS_FP_Skladka"] != null ? Double.Parse(item["colZUS_FP_Skladka"].ToString()) : 0;
                        if (kwota > 0)
                        {
                            konto = Clean_NumerRachunku(item, "colZUS_FP_Konto");
                            fileName = String.Format(@"{0}ZUS 53_{1}.pdf",
                                               targetFileNameLeading,
                                               okres);

                            result = Generuj_DrukZUS(web, item, result, okres, klientId, kwota, konto, fileName);
                        }


                        //skladka zdrowotna
                        kwota = item["colZUS_ZD_Skladka"] != null ? Double.Parse(item["colZUS_ZD_Skladka"].ToString()) : 0;
                        if (kwota > 0)
                        {
                            konto = Clean_NumerRachunku(item, "colZUS_ZD_Konto");
                            fileName = String.Format(@"{0}ZUS 52_{1}.pdf",
                                                targetFileNameLeading,
                                                okres);

                            result = Generuj_DrukZUS(web, item, result, okres, klientId, kwota, konto, fileName);
                        }

                        //skladka spoleczna
                        kwota = item["colZUS_SP_Skladka"] != null ? Double.Parse(item["colZUS_SP_Skladka"].ToString()) : 0;
                        if (kwota > 0)
                        {
                            konto = Clean_NumerRachunku(item, "colZUS_SP_Konto");
                            fileName = String.Format(@"{0}ZUS 51_{1}.pdf",
                                               targetFileNameLeading,
                                               okres);

                            result = Generuj_DrukZUS(web, item, result, okres, klientId, kwota, konto, fileName);
                        }

                        break;
                }


            }

            return result;
        }