Ejemplo n.º 1
0
        public MakePdf(MainWindow mw, SingleFakturaProperty fakturaProperty)
        {
            var fileName = Path.Combine(Settings.Default.pathDest,
                                        $"{DateTime.Now:yyyyMMddHHmmss}plik.pdf");
            var generujPolaWDokumencie = new GenerujPolaWDokumencie(fileName, fakturaProperty);

            Process.Start(fileName);

            var idFaktura = AddInvoiceValuesDb(mw, Settings.Default.dbConn, fakturaProperty.Work);

            foreach (DataRow row in fakturaProperty.Work.Dt.Rows)
            {
                AddInvoiceExternalValuesDb(mw, Settings.Default.dbConn, idFaktura, row);
            }

            fakturaProperty.Work.MyDtString = fakturaProperty.Work.Dt.Serialize();

            var myId = 1;
            var que  = true;

            while (que)
            {
                myId++;
                que = Property.Instance.Works.Any(f => f.Naglowek.Id == myId);
            }

            fakturaProperty.Work.Naglowek.Id = myId;
            var x = (WorkClass)fakturaProperty.Work.Clone();

            x.Naglowek   = (Naglowek)fakturaProperty.Work.Naglowek.Clone();
            x.Nabywca    = (FirmaData)fakturaProperty.Work.Nabywca.Clone();
            x.Sprzedawca = (FirmaData)fakturaProperty.Work.Sprzedawca.Clone();
            Property.Instance.Works.Add(x);
            Property.Instance.NameList   = Property.Instance.NameList.Distinct().ToList();
            Property.Instance.StawkaList = Property.Instance.StawkaList.Distinct().ToList();
            Property.SerializeXml();

            fakturaProperty      = null;
            fakturaProperty.Work = null;
            mw.FillValuesFaktura(null);
        }
Ejemplo n.º 2
0
 public HelperData(SingleFakturaProperty singleFakturaProperty)
 {
     s_MWorkClass = singleFakturaProperty.Work;
     s_MListDt    = singleFakturaProperty.GetSum();
 }
Ejemplo n.º 3
0
        public GenerujPolaWDokumencie(string FileName, SingleFakturaProperty singleFaktura)
        {
            IHelperData   mHelperData   = new HelperData(singleFaktura);
            IDaneNaglowek mDaneNaglowka = new DaneNaglowek(singleFaktura.Work.Naglowek);

            PdfDocument = new PdfDocument(PaperType.A4, false, UnitOfMeasure.cm, FileName)
            {
                Debug = false
            };

            _arialBold   = PdfFont.CreatePdfFont(PdfDocument, ArialFontName, FontStyle.Bold);
            _arialNormal = PdfFont.CreatePdfFont(PdfDocument, ArialFontName, FontStyle.Regular);

            var Info = PdfInfo.CreatePdfInfo(PdfDocument);

            Info.Title("Faktura");
            Info.Author("TZ");
            Info.Keywords("keyword");
            Info.Subject("Temat");

            _page       = new PdfPage(PdfDocument);
            PdfContents = new PdfContents(_page);

            IdFaktury(singleFaktura.Work.Naglowek.NumerFaktury);

            double lastPosition = 26;

            CreateTable(mDaneNaglowka.GetNaglowekL(), 1.3, 10, 8, lastPosition, lastPosition - 3, false,
                        ContentAlignment.MiddleLeft);

            lastPosition = CreateTable(mDaneNaglowka.GetNaglowekR(), 10.3, 16, 8, lastPosition, lastPosition - 1.5,
                                       false, ContentAlignment.MiddleLeft);

            lastPosition = CreateTable(mHelperData.GetSprzeNaby(), 1.3, 30, 8, lastPosition - 1.4, lastPosition - 6.2,
                                       true, ContentAlignment.MiddleLeft);

            var widthRow =
                _arialNormal.TextWidth(8, mHelperData.NrBankowy()[0].Lewa + mHelperData.NrBankowy()[0].Prawa) + 0.25;

            lastPosition = CreateTable(mHelperData.NrBankowy(), 1.3, 1.3 + widthRow, 8, lastPosition - 1,
                                       lastPosition - 6.2, false, ContentAlignment.MiddleLeft);

            lastPosition = TabelaDaneFaktura(1.3, lastPosition - 1, lastPosition - 11, 19.7, 9,
                                             singleFaktura.GetListDt());

            RazemWTym(12.03, lastPosition - 0.018, lastPosition - 11, 9);

            lastPosition = Summary(12.03, lastPosition - 0.018, lastPosition - 11, 19.7, 9, singleFaktura.GetSum());

            widthRow = _arialNormal.TextWidth(8,
                                              mHelperData.GetZapDoZap()[1].Lewa + mHelperData.GetZapDoZap()[1].Prawa) + 0.25;
            CreateTable(mHelperData.GetZapDoZap(), 1.3, 1.3 + widthRow, 8, lastPosition - 1, lastPosition - 10, false,
                        ContentAlignment.MiddleLeft);

            widthRow     = _arialNormal.TextWidth(12, mHelperData.Razem()[0].Lewa + mHelperData.Razem()[0].Prawa);
            lastPosition = CreateTable(mHelperData.Razem(), 19.7 - widthRow, 19.7, 12, lastPosition - 1,
                                       lastPosition - 10, false, ContentAlignment.MiddleRight);

            widthRow     = _arialNormal.TextWidth(8, mHelperData.RazemSlownie().Lewa + mHelperData.RazemSlownie().Prawa);
            lastPosition = CreateTable(new List <DaneTabela> {
                mHelperData.RazemSlownie()
            }, 19.7 - widthRow, 19.7, 8,
                                       lastPosition, lastPosition - 10, false, ContentAlignment.MiddleRight);

            RamkiEnd(1.3, lastPosition - 1.4, lastPosition - 5, 9, 7, DictionaryMain.LabelPodpisWystawiania);

            RamkiEnd(12, lastPosition - 1.4, lastPosition - 5, 19.7, 7, DictionaryMain.LabelPodpisOdbierania);

            PdfDocument.CreateFile();
        }