private void PrintDoc_Elements(System.Drawing.Printing.PrintPageEventArgs e) { GC.Collect(); //ΕΚΤΥΠΩΣΗ ΣΤΟΙΧΕΙΩΝ ΤΙΜΟΛΟΓΙΟΥ e.Graphics.DrawString(DocName, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 130 + (SelectNameCmb.SelectedIndex == 4 ? 30 : (SelectNameCmb.SelectedIndex == 2 ? 10 : (SelectNameCmb.SelectedIndex == 1 ? 63 : (SelectNameCmb.SelectedIndex == 5 ? 63 :0)))), 250); e.Graphics.DrawString(DocSeries, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 588, 250); e.Graphics.DrawString(DocIdId, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 690, 250); e.Graphics.DrawString(Convert.ToDateTime(DocDate).Day.ToString() + '/' + Convert.ToDateTime(DocDate).Month.ToString() + '/' + Convert.ToDateTime(DocDate).Year.ToString(), new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 821, 250); //ΕΚΤΥΠΩΣΗ ΣΤΟΙΧΕΙΩΝ ΠΕΛΑΤΗ e.Graphics.DrawString(CustomerId, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170 + (SelectNameCmb.SelectedIndex == 4 ? 50 : 0), 329); e.Graphics.DrawString(CustomerName, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 356); e.Graphics.DrawString(CustomerAddress, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 383); e.Graphics.DrawString(CustomerRegion, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 410); e.Graphics.DrawString(CustomerOccupation, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 438); e.Graphics.DrawString(CustomerAfm, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 466); e.Graphics.DrawString(CustomerEmail, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 493); e.Graphics.DrawString(CustomerPhone.Substring(0, 10), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 329); e.Graphics.DrawString(CustomerPhone2.Substring(0, 10), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 356); e.Graphics.DrawString(CustomerTk, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 411); e.Graphics.DrawString(CustomerTax_office, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 466); if (SelectNameCmb.SelectedIndex == 0 || SelectNameCmb.SelectedIndex == 1 || SelectNameCmb.SelectedIndex == 2 || SelectNameCmb.SelectedIndex == 5) { //ΕΚΤΥΠΩΣΗ ΛΟΙΠΩΝ ΣΤΟΙΧΕΙΩΝ ΤΙΜΟΛΟΓΙΟΥ e.Graphics.DrawString(DocDisNotes, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 307); //SXET PARASTATIKA e.Graphics.DrawString(DocFrom, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 336); e.Graphics.DrawString(DocTo, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 365); e.Graphics.DrawString(DocReason, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 394); e.Graphics.DrawString(DocPayment, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 423); e.Graphics.DrawString((DocDisc == "" ?"" : chk.GrNumber(DocDisc) + " %"), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 452); //e.Graphics.DrawString(CustomerTax_office, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 487); METAFORIKO MESO //ΕΚΤΥΠΩΣΗ ΠΡΟΙΟΝΤΩΝ int rest = proditems; int cnt = DocProds.Rows.Count - proditems; bool hasmorepages = false; decimal vat = chk.Return_Vat(CustomerId); for (int i = 1; i <= rest; i++) { if (i == 19) { hasmorepages = true; break; } string qnt = DocProds.Rows[i - 1 + cnt][2].ToString(); string val = DocProds.Rows[i - 1 + cnt][3].ToString(); string disc = DocProds.Rows[i - 1 + cnt][4].ToString(); if (val != "") { decimal totval = Convert.ToDecimal(Math.Round(Convert.ToDouble(qnt) * Convert.ToDouble(val), 2)); decimal totdisc = Convert.ToDecimal(Math.Round(totval * Convert.ToDecimal(((disc == "") ? "0" : disc)) / 100, 2)); totdisc += Convert.ToDecimal(Math.Round((totval - totdisc) * Convert.ToDecimal(DocDisc) / 100, 2)); decimal totdiscval = totval - totdisc; decimal totvat = Convert.ToDecimal(Math.Round(totdiscval * vat / 100, 2)); e.Graphics.DrawString(chk.GrNumber(val), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(632, 558 + i * 25, 58, 25), format); e.Graphics.DrawString(chk.GrNumber((totval).ToString()), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(696, 558 + i * 25, 72, 25), format); e.Graphics.DrawString(((disc == "0") ? "" : chk.GrNumber(disc.ToString())), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(780, 558 + i * 25, 60, 25), format); e.Graphics.DrawString(((totdisc == 0) ? "" : chk.GrNumber(totdisc.ToString())), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(847, 558 + i * 25, 55, 25), format); e.Graphics.DrawString(chk.GrNumber((totdiscval).ToString()), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(908, 558 + i * 25, 63, 25), format); e.Graphics.DrawString((vat).ToString(), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(976, 558 + i * 25, 24, 25), format); e.Graphics.DrawString(chk.GrNumber((totvat).ToString()), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(1006, 558 + i * 25, 52, 25), format); sumval += Convert.ToDecimal(totval); sumdisc += Convert.ToDecimal(totdisc); sumvat += Convert.ToDecimal(totvat); } string descr = DocProds.Rows[i - 1 + cnt][1].ToString(); string Unit = DocProds.Rows[i - 1 + cnt][5].ToString(); if (descr.Length > 60) { descr = descr.Substring(0, 60); } if (Unit.Length > 4) { Unit = Unit.Substring(0, 4); } e.Graphics.DrawString(DocProds.Rows[i - 1 + cnt][0].ToString(), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 33, 558 + i * 25); e.Graphics.DrawString(descr, new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 120, 558 + i * 25); e.Graphics.DrawString(Unit, new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 520, 558 + i * 25); e.Graphics.DrawString(chk.GrQuant(qnt), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(561, 558 + i * 25, 65, 25), format); proditems--; sumquant += Convert.ToDouble(qnt); } //e.Graphics.DrawString(PrevCreditCustomerTxt.Text, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 145, 1052); //ΕΚΤΥΠΩΣΗ ΑΡΙΘΜΙΣΗΣ ΣΕΛΙΔΩΝ ΤΙΜΟΛΟΓΙΟΥ e.Graphics.DrawString("Σελίδα " + pagecount + " από " + (DocProds.Rows.Count / 18 + 1), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 45, 1505); pagecount++; //ΕΚΤΥΠΩΣΗ ΣΥΝΟΛΩΝ ΤΙΜΟΛΟΓΙΟΥ if (hasmorepages == false) { e.Graphics.DrawString(chk.GrQuant(sumquant.ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 645, 1052); e.Graphics.DrawString(chk.GrNumber(sumval.ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(924, 1059, 120, 25), format); e.Graphics.DrawString(chk.GrNumber(sumdisc.ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(924, 1105, 120, 25), format); e.Graphics.DrawString(chk.GrNumber((sumval - sumdisc).ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(924, 1151, 120, 25), format); e.Graphics.DrawString(chk.GrNumber(sumvat.ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(924, 1197, 120, 25), format); e.Graphics.DrawString(chk.GrNumber((sumval - sumdisc + sumvat).ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Bold), Brushes.Black, new Rectangle(924, 1273, 120, 25), format); //e.Graphics.DrawString((Convert.ToDecimal(PrevCreditCustomerTxt.Text) + (PayInvoiceCmb.GetItemText(PayInvoiceCmb.SelectedItem) == "Πίστωση" ? sumval - sumdisc + sumvat : 0)).ToString(), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 391, 1052); proditems = DocProds.Rows.Count; sumquant = 0; sumval = 0; sumdisc = 0; sumvat = 0; pagecount = 1; GC.Collect(); } e.HasMorePages = hasmorepages; } else if (SelectNameCmb.SelectedIndex == 3 || SelectNameCmb.SelectedIndex == 4) { //ΕΚΤΥΠΩΣΗ ΣΤΟΙΧΕΙΩΝ ΑΠΟΔΕΙΞΗΣ for (int i = 1; i <= proditems; i++) { e.Graphics.DrawString(DocProds.Rows[i - 1][0].ToString(), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 110, 560 + i * 25); e.Graphics.DrawString(Convert.ToDateTime(DocProds.Rows[i - 1][1].ToString()).Day.ToString() + '/' + Convert.ToDateTime(DocProds.Rows[i - 1][1].ToString()).Month.ToString() + '/' + Convert.ToDateTime(DocProds.Rows[i - 1][1].ToString()).Year.ToString(), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 375, 560 + i * 25); e.Graphics.DrawString(chk.GrNumber(DocProds.Rows[i - 1][2].ToString()), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(585, 560 + i * 25, 100, 25), format); e.Graphics.DrawString(DocProds.Rows[i - 1][3].ToString(), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 725, 560 + i * 25); } e.Graphics.DrawString(chk.GrNumber(ReceiptCash), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(828, 1105, 100, 25), format); e.Graphics.DrawString(chk.GrNumber(DocPrice), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(828, 1178, 100, 25), format); string fullname1 = ""; string fullname2 = ""; if (DocPrice != "") { try { int decim = 0; decimal price = decimal.Parse(DocPrice); if (price != Math.Truncate(price)) { decim = (int)((price - Math.Truncate(price)) * 100); } fullname1 = chk.Number_fullname(Convert.ToInt32(Math.Truncate(price))) + " ευρώ"; fullname2 = (decim == 0 ? "" : " και " + chk.Number_fullname(decim) + " λεπτά"); } catch (Exception) { } } e.Graphics.DrawString(fullname1, new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 43, 1080); e.Graphics.DrawString(fullname2, new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 43, 1108); } }
private void PrintDoc_Elements(System.Drawing.Printing.PrintPageEventArgs e) { //ΕΚΤΥΠΩΣΗ ΣΤΟΙΧΕΙΩΝ ΤΙΜΟΛΟΓΙΟΥ e.Graphics.DrawString("Δελτίο Αποστολής", new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 193, 250); e.Graphics.DrawString(SeriesInvoiceTxt.Text, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 588, 250); e.Graphics.DrawString(IdInvoiceTxt.Text, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 690, 250); e.Graphics.DrawString(DateTimeInvoicePicker.Value.Day.ToString() + '/' + DateTimeInvoicePicker.Value.Month.ToString() + '/' + DateTimeInvoicePicker.Value.Year.ToString(), new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 821, 250); //ΕΚΤΥΠΩΣΗ ΣΤΟΙΧΕΙΩΝ ΠΕΛΑΤΗ e.Graphics.DrawString(IdSupplierTxt.Text, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 329); e.Graphics.DrawString(NameSupplierTxt.Text, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 356); e.Graphics.DrawString(SupplierAddress, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 383); e.Graphics.DrawString(SupplierRegion, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 410); e.Graphics.DrawString(SupplierOccupation, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 438); e.Graphics.DrawString(AfmSupplierTxt.Text, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 466); e.Graphics.DrawString(SupplierEmail, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 493); e.Graphics.DrawString(SupplierPhone.Substring(0, 10), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 329); e.Graphics.DrawString(SupplierPhone2.Substring(0, 10), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 356); e.Graphics.DrawString(SupplierTk, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 411); e.Graphics.DrawString(SupplierTax_office, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 466); //ΕΚΤΥΠΩΣΗ ΛΟΙΠΩΝ ΣΤΟΙΧΕΙΩΝ ΤΙΜΟΛΟΓΙΟΥ e.Graphics.DrawString(InvoiceDocsTxt.Text, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 307); //SXET PARASTATIKA e.Graphics.DrawString("Έδρα μας", new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 336); e.Graphics.DrawString("Έδρα προμηθευτή", new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 365); e.Graphics.DrawString("Επιστροφή", new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 394); e.Graphics.DrawString(VehicleTxt.Text, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 487); //ΕΚΤΥΠΩΣΗ ΠΡΟΙΟΝΤΩΝ int rest = proditems; int cnt = Convert.ToInt16(ProdItemsTxt.Text) - proditems; bool hasmorepages = false; decimal vat = chk.Return_Vat("999999"); string Unit; for (int i = 1; i <= rest; i++) { if (i == 19) { hasmorepages = true; break; } string qnt = ProductsPanel.Controls.Find("QuantProdTxt" + (i + cnt), true).First().Text; e.Graphics.DrawString(ProductsPanel.Controls.Find("IdProdTxt" + (i + cnt), true).First().Text, new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 33, 558 + i * 25); string descr = ProductsPanel.Controls.Find("DescrProdTxt" + (i + cnt), true).First().Text; if (descr.Length > 60) { descr = descr.Substring(0, 60); } e.Graphics.DrawString(descr, new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 120, 558 + i * 25); e.Graphics.DrawString(chk.GrQuant(qnt), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(561, 558 + i * 25, 65, 25), format); //ΕΥΡΕΣΗ ΜΟΝΑΔΑΣ ΜΕΤΡΗΣΗΣ unt.TryGetValue(ProductsPanel.Controls.Find("IdProdTxt" + (i + cnt), true).First().Text, out Unit); // if (Unit.Length > 4) { Unit = Unit.Substring(0, 4); } e.Graphics.DrawString(Unit, new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 520, 558 + i * 25); proditems--; sumquant += Convert.ToDouble(qnt); } //ΕΚΤΥΠΩΣΗ ΑΡΙΘΜΙΣΗΣ ΣΕΛΙΔΩΝ ΤΙΜΟΛΟΓΙΟΥ e.Graphics.DrawString("Σελίδα " + pagecount + " από " + (Convert.ToInt16(ProdItemsTxt.Text) / 18 + 1), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 45, 1505); pagecount++; //ΕΚΤΥΠΩΣΗ ΣΥΝΟΛΩΝ ΤΙΜΟΛΟΓΙΟΥ if (hasmorepages == false) { if (NotesTxt.Text != "") { string Note1 = NotesTxt.Text; string Note2 = ""; if (Note1.Length > 70) { Note2 = Note1.Substring(70); Note1 = Note1.Substring(0, 70); if (Note2.Length > 70) { Note2 = Note2.Substring(0, 70); } } e.Graphics.DrawString(Note1, new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 39, 1180); e.Graphics.DrawString(Note2, new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 39, 1205); } if (CommentsTxt.Text != "") { string Com1 = CommentsTxt.Text; string Com2 = ""; if (Com1.Length > 70) { Com2 = Com1.Substring(70); Com1 = Com1.Substring(0, 70); if (Com2.Length > 70) { Com2 = Com2.Substring(0, 70); } } e.Graphics.DrawString(Com1, new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 39, 1271); e.Graphics.DrawString(Com2, new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 39, 1296); } e.Graphics.DrawString(chk.GrQuant(sumquant.ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 645, 1052); proditems = Convert.ToInt16(ProdItemsTxt.Text); sumquant = 0; pagecount = 1; GC.Collect(); } e.HasMorePages = hasmorepages; }
private void PrintDoc_Elements(System.Drawing.Printing.PrintPageEventArgs e) { //ΕΚΤΥΠΩΣΗ ΣΤΟΙΧΕΙΩΝ ΤΙΜΟΛΟΓΙΟΥ e.Graphics.DrawString("Πιστωτικό Τιμολόγιο", new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 140, 250); e.Graphics.DrawString(SeriesInvoiceTxt.Text, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 588, 250); e.Graphics.DrawString(IdInvoiceTxt.Text, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 690, 250); e.Graphics.DrawString(DateTimeInvoicePicker.Value.Day.ToString() + '/' + DateTimeInvoicePicker.Value.Month.ToString() + '/' + DateTimeInvoicePicker.Value.Year.ToString(), new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 821, 250); //ΕΚΤΥΠΩΣΗ ΣΤΟΙΧΕΙΩΝ ΠΕΛΑΤΗ e.Graphics.DrawString(IdCustomerTxt.Text, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 329); e.Graphics.DrawString(NameCustomerTxt.Text, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 356); e.Graphics.DrawString(CustomerAddress, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 383); e.Graphics.DrawString(CustomerRegion, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 410); e.Graphics.DrawString(CustomerOccupation, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 438); e.Graphics.DrawString(AfmCustomerTxt.Text, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 466); e.Graphics.DrawString(CustomerEmail, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 170, 493); e.Graphics.DrawString(CustomerPhone.Substring(0, 10), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 329); e.Graphics.DrawString(CustomerPhone2.Substring(0, 10), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 356); e.Graphics.DrawString(CustomerTk, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 411); e.Graphics.DrawString(CustomerTax_office, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 460, 466); //ΕΚΤΥΠΩΣΗ ΛΟΙΠΩΝ ΣΤΟΙΧΕΙΩΝ ΤΙΜΟΛΟΓΙΟΥ e.Graphics.DrawString(InvIds, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 307); //SXET PARASTATIKA e.Graphics.DrawString("Έδρα πελάτη", new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 336); e.Graphics.DrawString("Έδρα μας", new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 365); e.Graphics.DrawString("Επιστροφή", new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 394); e.Graphics.DrawString(PayInvoiceCmb.GetItemText(PayInvoiceCmb.SelectedItem), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 423); e.Graphics.DrawString(chk.GrNumber(DiscInvoiceTxt.Text) + " %", new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 452); //e.Graphics.DrawString(CustomerTax_office, new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 804, 487); METAFORIKO MESO //ΕΚΤΥΠΩΣΗ ΠΡΟΙΟΝΤΩΝ int rest = proditems; int cnt = Convert.ToInt16(ProdItemsTxt.Text) - proditems; bool hasmorepages = false; decimal vat = chk.Return_Vat(IdCustomerTxt.Text); string Unit; for (int i = 1; i <= rest; i++) { if (Chkd.Contains((i + cnt).ToString())) { if (i == 19) { hasmorepages = true; break; } string qnt = ProductsPanel.Controls.Find("QuantProdTxt" + (i + cnt), true).First().Text; string val = ProductsPanel.Controls.Find("ValueProdTxt" + (i + cnt), true).First().Text; string disc = ProductsPanel.Controls.Find("DiscProdTxt" + (i + cnt), true).First().Text; decimal totval = Convert.ToDecimal(Math.Round(Convert.ToDouble(qnt) * Convert.ToDouble(val), 2)); decimal totdisc = Convert.ToDecimal(Math.Round(totval * Convert.ToDecimal(((disc == "") ? "0" : disc)) / 100, 2)); totdisc += Convert.ToDecimal(Math.Round((totval - totdisc) * Convert.ToDecimal(DiscInvoiceTxt.Text) / 100, 2)); decimal totdiscval = totval - totdisc; decimal totvat = Convert.ToDecimal(Math.Round(totdiscval * vat / 100, 2)); //ΕΥΡΕΣΗ ΜΟΝΑΔΑΣ ΜΕΤΡΗΣΗΣ unt.TryGetValue((i + cnt).ToString(), out Unit); // e.Graphics.DrawString(ProductsPanel.Controls.Find("IdProdTxt" + (i + cnt), true).First().Text, new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 33, 558 + i * 25); string descr = ProductsPanel.Controls.Find("DescrProdTxt" + (i + cnt), true).First().Text; if (descr.Length > 60) { descr = descr.Substring(0, 60); } if (Unit.Length > 4) { Unit = Unit.Substring(0, 4); } e.Graphics.DrawString(descr, new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 120, 558 + i * 25); e.Graphics.DrawString(Unit, new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 520, 558 + i * 25); e.Graphics.DrawString(chk.GrQuant(qnt), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(561, 558 + i * 25, 65, 25), format); e.Graphics.DrawString(chk.GrNumber(val), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(632, 558 + i * 25, 58, 25), format); e.Graphics.DrawString(chk.GrNumber((totval).ToString()), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(696, 558 + i * 25, 72, 25), format); e.Graphics.DrawString(((disc == "0") ? "" : chk.GrNumber(disc.ToString())), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(780, 558 + i * 25, 60, 25), format); e.Graphics.DrawString(((totdisc == 0) ? "" : chk.GrNumber(totdisc.ToString())), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(847, 558 + i * 25, 55, 25), format); e.Graphics.DrawString(chk.GrNumber((totdiscval).ToString()), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(908, 558 + i * 25, 63, 25), format); e.Graphics.DrawString((vat).ToString(), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(976, 558 + i * 25, 24, 25), format); e.Graphics.DrawString(chk.GrNumber((totvat).ToString()), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(1006, 558 + i * 25, 52, 25), format); proditems--; sumquant += Convert.ToDouble(qnt); sumval += Convert.ToDecimal(totval); sumdisc += Convert.ToDecimal(totdisc); sumvat += Convert.ToDecimal(totvat); } } e.Graphics.DrawString(chk.GrNumber(PrevCreditCustomerTxt.Text), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 145, 1052); //ΕΚΤΥΠΩΣΗ ΑΡΙΘΜΙΣΗΣ ΣΕΛΙΔΩΝ ΤΙΜΟΛΟΓΙΟΥ e.Graphics.DrawString("Σελίδα " + pagecount + " από " + (Convert.ToInt16(Chkd.Count()) / 18 + 1), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 45, 1505); pagecount++; //ΕΚΤΥΠΩΣΗ ΣΥΝΟΛΩΝ ΤΙΜΟΛΟΓΙΟΥ if (hasmorepages == false) { if (NotesTxt.Text != "") { string Note1 = NotesTxt.Text; string Note2 = ""; if (Note1.Length > 70) { Note2 = Note1.Substring(70); Note1 = Note1.Substring(0, 70); if (Note2.Length > 70) { Note2 = Note2.Substring(0, 70); } } e.Graphics.DrawString(Note1, new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 39, 1180); e.Graphics.DrawString(Note2, new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 39, 1205); } if (CommentsTxt.Text != "") { string Com1 = CommentsTxt.Text; string Com2 = ""; if (Com1.Length > 70) { Com2 = Com1.Substring(70); Com1 = Com1.Substring(0, 70); if (Com2.Length > 70) { Com2 = Com2.Substring(0, 70); } } e.Graphics.DrawString(Com1, new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 39, 1271); e.Graphics.DrawString(Com2, new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 39, 1296); } e.Graphics.DrawString(chk.GrQuant(sumquant.ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 645, 1052); e.Graphics.DrawString(chk.GrNumber(sumval.ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(924, 1059, 120, 25), format); e.Graphics.DrawString(chk.GrNumber(sumdisc.ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(924, 1105, 120, 25), format); e.Graphics.DrawString(chk.GrNumber((sumval - sumdisc).ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(924, 1151, 120, 25), format); e.Graphics.DrawString(chk.GrNumber(sumvat.ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(924, 1197, 120, 25), format); e.Graphics.DrawString(chk.GrNumber((sumval - sumdisc + sumvat).ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Bold), Brushes.Black, new Rectangle(924, 1273, 120, 25), format); e.Graphics.DrawString(chk.GrNumber((Convert.ToDecimal(PrevCreditCustomerTxt.Text) + (PayInvoiceCmb.GetItemText(PayInvoiceCmb.SelectedItem) == "Πίστωση" ? -sumval + sumdisc - sumvat : 0)).ToString()), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, 391, 1052); proditems = Convert.ToInt16(ProdItemsTxt.Text); sumquant = 0; sumval = 0; sumdisc = 0; sumvat = 0; pagecount = 1; GC.Collect(); } e.HasMorePages = hasmorepages; }