public override int GetHashCode()
        {
            int hash = 17;

            hash ^= 31 + SerialNumber.ToInt();
            hash ^= 31 + DateOfIssue.ToShortDateString().ToInt();
            return(hash ^ 31 + ExpiryDate.ToShortDateString().ToInt());
        }
예제 #2
0
        void FillFrontSideTextByDrawText(Graphics gr)
        {
            var textMargin = GraphicsHelper.DefaultMainTextMargin + 26;

            GraphicsHelper.DrawMainText(gr, "1.", 146);
            GraphicsHelper.DrawText(gr, RegNumber.ToUpper(), textMargin, 146);
            GraphicsHelper.DrawMainText(gr, "2.", 183);
            GraphicsHelper.DrawText(gr, Model.ToUpper(), textMargin, 183);
            GraphicsHelper.DrawMainText(gr, "3.", 220);
            GraphicsHelper.DrawText(gr, Color.ToUpper(), textMargin, 220);
            GraphicsHelper.DrawMainText(gr, "4.", 257);
            GraphicsHelper.DrawText(gr, Owner.ToUpper(), textMargin, 257, GraphicsHelper.DefaultTextBlockWidth, 65);
            GraphicsHelper.DrawMainText(gr, "5.", 330);
            GraphicsHelper.DrawText(gr, Address, textMargin, 330, GraphicsHelper.DefaultTextBlockWidth, 85);
            GraphicsHelper.DrawMainText(gr, "6.", 425);
            var dt = DateOfIssue.ToShortDateString();

            GraphicsHelper.DrawText(gr, dt.ToUpper(), textMargin, 425);
            GraphicsHelper.DrawMainText(gr, "7.", 466);
            GraphicsHelper.DrawText(gr, PlaceOfIssue.ToUpper(), textMargin, 466);
            GraphicsHelper.DrawMainText(gr, "8.", 510);
            GraphicsHelper.DrawText(gr, PersonalNumber.ToUpper(), textMargin, 510);
        }
예제 #3
0
        public void generate()
        {
            string    path = "invoiceTemplate.xml";
            XDocument doc  = XDocument.Load(path);
            XElement  root = doc.Element("Template");

            string header = root.Element("Header").Value;

            header = string.Format(header, Company.Name, Company.FullAddress, Company.NIP, Company.REGON, Company.Phone, Company.Email, Company.Website, Company.BankName, Company.BankAccount);

            string cityOfIssue    = root.Element("DatePlace").Value;
            string dateOfIssue    = DateOfIssue.ToShortDateString();
            string dateOfDelivery = DateOfDelivery.ToShortDateString();

            cityOfIssue = string.Format(cityOfIssue, dateOfIssue, IssuePlace, dateOfDelivery);

            string title = root.Element("Title").Value;

            title = string.Format(title, Number);

            string sellerBuyer = root.Element("SellerBuyer").Value;

            sellerBuyer = string.Format(sellerBuyer, Company.FullName, Company.FullAddress, Company.NIP, Contractor.FullName, Contractor.FullAddress, Contractor.NIP);

            header += cityOfIssue += title += sellerBuyer;

            string invoiceItemsTable   = root.Element("InvoiceItemsTableHeader").Value;
            string invoiceItemsSummary = root.Element("InvoiceItemTableSummary").Value;
            string invoiceItem         = root.Element("InvoiceItem").Value;

            int i = 1;

            foreach (InvoiceItem item in InvoiceItems)
            {
                string newItem = string.Format(invoiceItem, i, item.Item.Name, item.Item.UnitOfMeasure, item.Quantity, item.Item.UnitPrice.ToString("0.00"), item.ValueNetto.ToString("0.00"), item.Item.VatRate.ToString("0.00"), item.VATValue.ToString("0.00"), item.ValueBrutto.ToString("0.00"));
                Console.WriteLine(newItem);
                invoiceItemsTable += newItem;
                i++;
            }
            invoiceItemsSummary = string.Format(invoiceItemsSummary, TotalValueNetto.ToString("0.00"), TotalVATValue.ToString("0.00"), TotalValueBrutto.ToString("0.00"));
            invoiceItemsTable  += invoiceItemsSummary;

            string taxTableHeader  = root.Element("TaxTableHeader").Value;
            string tax             = root.Element("Tax").Value;
            string taxTableSummary = root.Element("TaxTableSummary").Value;
            string taxTable        = taxTableHeader + tax + taxTableSummary;

            string priceSummary = root.Element("PriceSummary").Value;

            priceSummary = string.Format(priceSummary, TotalValueBrutto.ToString("0.00"), "słownie złotych", "groszy");
            string paymentMethod = root.Element("PaymentMethod").Value;

            paymentMethod = string.Format(paymentMethod, PaymentMethod.Name, DateOfIssue.AddDays(PaymentMethod.DueDate).ToShortDateString());
            string issuer = root.Element("Issuer").Value;

            issuer = string.Format(issuer, Company.IssuerName);
            string footer = paymentMethod + issuer;


            string output = header + invoiceItemsTable + taxTable + priceSummary + footer;

            output = output.Replace("~^~^", "{{");
            output = output.Replace("^~^~", "}}");
            output = output.Replace("~^", "{");
            output = output.Replace("^~", "}");
            File.WriteAllText("out.tex", output);

            Process process = new Process();

            process.StartInfo.FileName  = "pdflatex";
            process.StartInfo.Arguments = "out.tex";
            process.Start();
            //process.Dispose();
        }
예제 #4
0
 public override string ToString()
 {
     return(String.Format("Номер замовлення: {0}\tБібліотекар: {1} {2}\tСписок книг: {3}\tЧитач: {4} {5}\tДата видачі: {6}\tДата здачі: {7}\n\n"
                          , NumberOfOrder, Librarian.Person.FirstName, Librarian.Person.LastName, BookList.NumberOfBooks, Reader.Person.FirstName, Reader.Person.LastName, DateOfIssue.ToShortDateString(), DateOfAdmission.ToShortDateString()));
 }
예제 #5
0
        void drawPrescriptionTemplate(Graphics g)
        {
            g.PageUnit = GraphicsUnit.Millimeter;
            float lineSize  = 0.2f;
            Pen   p         = new Pen(Color.Black, lineSize);
            Pen   penDotted = new Pen(Color.Black, lineSize);

            penDotted.DashStyle = System.Drawing.Drawing2D.DashStyle.Dash;

            int       pageWidth    = 99;
            int       pageHeight   = 200;
            Point     rectLocation = new Point(0, 0);
            Size      rectSize     = new Size(pageWidth, pageHeight);
            Rectangle rectangle    = new Rectangle(rectLocation, rectSize);

            g.DrawRectangle(p, rectangle);
            g.FillRectangle(Brushes.White, rectangle);

            Point hLine00 = new Point(0, 35);
            Point hLine01 = new Point(99, 35);
            Point hLine10 = new Point(0, 74);
            Point hLine11 = new Point(99, 74);
            Point hLine20 = new Point(0, 160);
            Point hLine21 = new Point(99, 160);

            g.DrawLine(p, hLine00, hLine01);
            g.DrawLine(p, hLine10, hLine11);
            g.DrawLine(p, hLine20, hLine21);

            Point hLine30 = new Point(69, 48);
            Point hLine31 = new Point(99, 48);

            g.DrawLine(p, hLine30, hLine31);
            Point hLine110 = new Point(69, 61);
            Point hLine111 = new Point(99, 61);

            g.DrawLine(p, hLine110, hLine111);

            Point vLine00 = new Point(69, 35);
            Point vLine01 = new Point(69, 74);

            g.DrawLine(p, vLine00, vLine01);

            Point vLine10 = new Point(69, 74);
            Point vLine11 = new Point(69, 148);

            g.DrawLine(penDotted, vLine10, vLine11);

            Point hLine60 = new Point(0, 79);
            Point hLine61 = new Point(99, 79);

            g.DrawLine(penDotted, hLine60, hLine61);

            Point hLine70 = new Point(0, 93);
            Point hLine71 = new Point(99, 93);

            g.DrawLine(penDotted, hLine70, hLine71);
            Point hLine80 = new Point(0, 107);
            Point hLine81 = new Point(99, 107);

            g.DrawLine(penDotted, hLine80, hLine81);
            Point hLine90 = new Point(0, 121);
            Point hLine91 = new Point(99, 121);

            g.DrawLine(penDotted, hLine90, hLine91);
            Point hLine100 = new Point(0, 135);
            Point hLine101 = new Point(99, 135);

            g.DrawLine(penDotted, hLine100, hLine101);

            Point hLine50 = new Point(0, 148);
            Point hLine51 = new Point(99, 148);

            g.DrawLine(penDotted, hLine50, hLine51);

            Point vLine20 = new Point(35, 160);
            Point vLine21 = new Point(35, 200);

            g.DrawLine(p, vLine20, vLine21);

            Point hLine40 = new Point(0, 180);
            Point hLine41 = new Point(35, 180);

            g.DrawLine(p, hLine40, hLine41);

            int marginLeft = 3;
            int marginTop  = 3;

            Font  fontDefault = new Font("Arial", 10);
            Font  fontSmall   = new Font("Arial", 8);
            Brush brush       = Brushes.Black;

            Point ptPrescriptonStr        = new Point(marginLeft, marginTop);
            Point ptPrescriptionNumberVal = new Point(marginLeft + 30, marginTop);
            Point ptSwiadczeniodawcaVal   = new Point(marginLeft, marginTop + 5);
            Point ptSwiadczeniodawcaStr   = new Point(marginLeft, 30);
            Point ptPacjentStr            = new Point(marginLeft, 35);
            Point ptPacjentFullNameVal    = new Point(marginLeft, 40);
            Point ptPatientFullAddressVal = new Point(marginLeft, 45);
            Point ptWiek                   = new Point(marginLeft, 60);
            Point ptPeselStr               = new Point(marginLeft, 69);
            Point ptPeselVal               = new Point(marginLeft + 20, 69);
            Point ptNfzStr                 = new Point(70, 35);
            Point ptNfzVal                 = new Point(75, 40);
            Point ptUprawnieniaStr         = new Point(70, hLine30.Y);
            Point ptUprawnieniaVal         = new Point(75, hLine30.Y + 5);
            Point ptChorobyPrzewlekle      = new Point(70, hLine110.Y);
            Point ptRpStr                  = new Point(marginLeft, 75);
            Point ptRefundacjaStr          = new Point(70, 75);
            Point ptPosition0              = new Point(marginLeft, hLine70.Y - 12);
            Point ptPosition1              = new Point(marginLeft, hLine80.Y - 12);
            Point ptPosition2              = new Point(marginLeft, hLine90.Y - 12);
            Point ptPosition3              = new Point(marginLeft, hLine100.Y - 12);
            Point ptPosition4              = new Point(marginLeft, hLine50.Y - 12);
            Point ptPrescriptionNumberVal2 = new Point(27, 155);
            Point ptDaneLekarzaStr         = new Point(40, 160);
            Point ptDaneLekarzaVal         = new Point(40, 165);
            Point ptDaneLekarzaNrPrawaVal  = new Point(40, 170);
            Point ptDataWystawieniaStr     = new Point(marginLeft, 160);
            Point ptDataWystawieniaVal     = new Point(marginLeft, 165);
            Point ptDataRealizacjiStr      = new Point(marginLeft, 180);
            Point ptWydrukWlasnyStr        = new Point(70, 195);

            g.DrawString("Recepta", fontDefault, brush, ptPrescriptonStr);
            g.DrawString(PrescriptionNumber.Number, fontDefault, brush, ptPrescriptionNumberVal);
            g.DrawString(Gabinet.Nazwa + "\n" + "REGON " + Gabinet.REGON, fontDefault, brush, ptSwiadczeniodawcaVal);
            g.DrawString("Świadczeniodawca", fontDefault, brush, ptSwiadczeniodawcaStr);
            g.DrawString("Pacjent", fontDefault, brush, ptPacjentStr);
            g.DrawString(Patient.FullName, fontDefault, brush, ptPacjentFullNameVal);
            g.DrawString(Patient.FullAddress, fontDefault, brush, ptPatientFullAddressVal);
            g.DrawString("R.p.", fontDefault, brush, ptRpStr);
            g.DrawString("Refundacja", fontDefault, brush, ptRefundacjaStr);
            g.DrawString("Wiek: " + Patient.Age, fontDefault, brush, ptWiek);
            g.DrawString("PESEL", fontDefault, brush, ptPeselStr);
            g.DrawString(Patient.PESEL, fontDefault, brush, ptPeselVal);
            g.DrawString("Oddział NFZ", fontDefault, brush, ptNfzStr);
            g.DrawString(Patient.Kod, fontDefault, brush, ptNfzVal);
            g.DrawString("Uprawnienia", fontDefault, brush, ptUprawnieniaStr);
            g.DrawString(Patient.Uprawnienie, fontDefault, brush, ptUprawnieniaVal);
            g.DrawString("Ch. przewlekłe", fontDefault, brush, ptChorobyPrzewlekle);
            g.DrawString(PrescriptionNumber.Number, fontDefault, brush, ptPrescriptionNumberVal2);
            g.DrawString("Dane i podpis lekarza", fontDefault, brush, ptDaneLekarzaStr);
            g.DrawString(Doctor.FullName, fontDefault, brush, ptDaneLekarzaVal);
            g.DrawString("Nr prawa: " + Doctor.RightToPracticeNumber, fontDefault, brush, ptDaneLekarzaNrPrawaVal);
            g.DrawString("Data wystawienia", fontSmall, brush, ptDataWystawieniaStr);
            g.DrawString(DateOfIssue.ToShortDateString(), fontDefault, brush, ptDataWystawieniaVal);
            g.DrawString("Data realizacji 'od dnia'", fontSmall, brush, ptDataRealizacjiStr);
            g.DrawString("Wydruk własny", fontSmall, brush, ptWydrukWlasnyStr);

            Point[] items = new Point[5];
            items[0] = ptPosition0;
            items[1] = ptPosition1;
            items[2] = ptPosition2;
            items[3] = ptPosition3;
            items[4] = ptPosition4;

            int i = 0;

            foreach (Lek lek in Leki)
            {
                if (Leki[i] != null)
                {
                    g.DrawString(Leki[i].FullInfo, fontDefault, brush, items[i]);
                }
                i++;
            }

            Point ptBarcodeREGON  = new Point(65, 28);
            Image imgREGONBarcode = drawBarcode(Gabinet.REGON);

            g.DrawImage(imgREGONBarcode, ptBarcodeREGON);
            Point ptBarcodePrescriptionNumber  = new Point(27, 150);
            Image imgPrescriptionNumberBarcode = drawBarcode(PrescriptionNumber.Number);

            g.DrawImage(imgPrescriptionNumberBarcode, ptBarcodePrescriptionNumber);
            Point ptBarcodeRightToPractice  = new Point(45, 175);
            Image imgRightToPracticeBarcode = drawBarcode(Doctor.RightToPracticeNumber);

            g.DrawImage(imgRightToPracticeBarcode, ptBarcodeRightToPractice);
        }
예제 #6
0
 public override string ToString()
 {
     return(string.Join("\n\t", "Passport data:", string.Join(string.Empty, "Passport number: ", PassportNumber), PassportIdentification,
                        string.Join(string.Empty, "Date of issue: ", DateOfIssue.ToShortDateString()), string.Join(string.Empty, "Authority: ", Authority),
                        string.Join(string.Empty, "Date of expiry: ", DateOfExpiry.ToShortDateString())));
 }