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.DrawRectangle(Pens.Black, new Rectangle(25, 25, 1044, 50)); e.Graphics.DrawString("Καρτέλα Κινήσεων Προμηθευτών", new Font("Arial", 16, System.Drawing.FontStyle.Bold), Brushes.Black, 400, 35); e.Graphics.DrawRectangle(Pens.Black, new Rectangle(25, 75, 120, 50)); e.Graphics.DrawRectangle(Pens.Black, new Rectangle(145, 75, 924, 50)); e.Graphics.DrawString("Κωδικός", new Font("Arial", 14, System.Drawing.FontStyle.Bold), Brushes.Black, 35, 85); e.Graphics.DrawString("Επωνυμία Προμηθευτή", new Font("Arial", 14, System.Drawing.FontStyle.Bold), Brushes.Black, 155, 85); e.Graphics.DrawRectangle(Pens.Black, new Rectangle(25, 125, 120, 50)); e.Graphics.DrawRectangle(Pens.Black, new Rectangle(145, 125, 924, 50)); e.Graphics.DrawString(IdTxt.Text, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 35, 135); e.Graphics.DrawString(NameTxt.Text, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 155, 135); e.Graphics.DrawRectangle(Pens.Black, new Rectangle(25, 175, 50, 50)); //Α/Α e.Graphics.DrawRectangle(Pens.Black, new Rectangle(75, 175, 110, 50)); //ΗΜΕΡ e.Graphics.DrawRectangle(Pens.Black, new Rectangle(185, 175, 150, 50)); //ΠΑΡΑΣΤ e.Graphics.DrawRectangle(Pens.Black, new Rectangle(335, 175, 404, 50)); //ΑΙΤΙΟΛ e.Graphics.DrawRectangle(Pens.Black, new Rectangle(739, 175, 110, 50)); //ΧΡΕΩΣΗ e.Graphics.DrawRectangle(Pens.Black, new Rectangle(849, 175, 110, 50)); //ΠΙΣΤΩΣΗ e.Graphics.DrawRectangle(Pens.Black, new Rectangle(959, 175, 110, 50)); //ΥΠΟΛ e.Graphics.DrawString("Α/Α", new Font("Arial", 13, System.Drawing.FontStyle.Regular), Brushes.Black, 35, 185); e.Graphics.DrawString("ΗΜΕΡ/ΝΙΑ", new Font("Arial", 13, System.Drawing.FontStyle.Regular), Brushes.Black, 85, 185); e.Graphics.DrawString("ΠΑΡΑΣΤΑΤΙΚΟ", new Font("Arial", 13, System.Drawing.FontStyle.Regular), Brushes.Black, 195, 185); e.Graphics.DrawString("ΑΙΤΙΟΛΟΓΙΑ", new Font("Arial", 13, System.Drawing.FontStyle.Regular), Brushes.Black, 480, 185); e.Graphics.DrawString("ΧΡΕΩΣΗ", new Font("Arial", 13, System.Drawing.FontStyle.Regular), Brushes.Black, 745, 185); e.Graphics.DrawString("ΠΙΣΤΩΣΗ", new Font("Arial", 13, System.Drawing.FontStyle.Regular), Brushes.Black, 855, 185); e.Graphics.DrawString("ΠΙΣΤ.ΥΠΟΛ.", new Font("Arial", 13, System.Drawing.FontStyle.Regular), Brushes.Black, 963, 185); e.Graphics.DrawRectangle(Pens.Black, new Rectangle(25, 225, 50, 1250)); //Α/Α e.Graphics.DrawRectangle(Pens.Black, new Rectangle(75, 225, 110, 1250)); //ΗΜΕΡ e.Graphics.DrawRectangle(Pens.Black, new Rectangle(185, 225, 150, 1250)); //ΠΑΡΑΣΤ e.Graphics.DrawRectangle(Pens.Black, new Rectangle(335, 225, 404, 1250)); //ΑΙΤΙΟΛ e.Graphics.DrawRectangle(Pens.Black, new Rectangle(739, 225, 110, 1250)); //ΧΡΕΩΣΗ e.Graphics.DrawRectangle(Pens.Black, new Rectangle(849, 225, 110, 1250)); //ΠΙΣΤΩΣΗ e.Graphics.DrawRectangle(Pens.Black, new Rectangle(959, 225, 110, 1250)); //ΥΠΟΛ bool hasmorepages = false; int rest = lsview.Count + (1 - pagecount) * 36; int cnt = (pagecount - 1) * 36; for (int i = 0; i < rest; i++) { var item = lsview[i + cnt]; if (i == 36) { hasmorepages = true; break; } if (item[0] == "" && item[2].Substring(0, 1) == "*") { e.Graphics.DrawString(item[2], new Font("Arial", 11, System.Drawing.FontStyle.Italic), Brushes.Black, 345, 235 + i * 30); e.Graphics.DrawString(chk.GrNumber(item[5]), new Font("Arial", 11, System.Drawing.FontStyle.Bold), Brushes.Black, new Rectangle(965, 235 + i * 30, 90, 24), format); } else if (item[2].Substring(0, 3) == "Ημ.") { e.Graphics.DrawString(item[2], new Font("Arial", 11, System.Drawing.FontStyle.Underline), Brushes.Black, 345, 235 + i * 30); } else if (item[0] == "") { e.Graphics.DrawString(" " + item[2], new Font("Arial", 11, System.Drawing.FontStyle.Regular), Brushes.Black, 345, 235 + i * 30); } else { e.Graphics.DrawString(AA.ToString(), new Font("Arial", 11, System.Drawing.FontStyle.Regular), Brushes.Black, 35, 235 + i * 30); e.Graphics.DrawString(item[0], new Font("Arial", 11, System.Drawing.FontStyle.Regular), Brushes.Black, 85, 235 + i * 30); e.Graphics.DrawString(item[1], new Font("Arial", 11, System.Drawing.FontStyle.Regular), Brushes.Black, 195, 235 + i * 30); e.Graphics.DrawString(item[2], new Font("Arial", 11, System.Drawing.FontStyle.Regular), Brushes.Black, 345, 235 + i * 30); e.Graphics.DrawString(chk.GrNumber(item[3]), new Font("Arial", 11, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(745, 235 + i * 30, 90, 24), format); e.Graphics.DrawString(chk.GrNumber(item[4]), new Font("Arial", 11, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(855, 235 + i * 30, 90, 24), format); e.Graphics.DrawString(chk.GrNumber(item[5]), new Font("Arial", 11, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(965, 235 + i * 30, 90, 24), format); AA++; } } //ΕΚΤΥΠΩΣΗ ΑΡΙΘΜΙΣΗΣ ΣΕΛΙΔΩΝ e.Graphics.DrawString("Σελίδα " + pagecount + " από " + (lsview.Count / 36 + 1), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 900, 1490); pagecount++; e.Graphics.DrawString(DateTime.Now.Day.ToString() + "/" + DateTime.Now.Month.ToString() + "/" + DateTime.Now.Year.ToString() + " " + DateTime.Now.ToShortTimeString(), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 55, 1490); if (hasmorepages == false) { pagecount = 1; AA = 1; GC.Collect(); } e.HasMorePages = hasmorepages; }
private void PreviewDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { GC.Collect(); e.Graphics.DrawImage(RecDrawImg, 0, 0, 1094, 1546); //ΕΚΤΥΠΩΣΗ ΣΤΟΙΧΕΙΩΝ ΑΠΟΔΕΙΞΗΣ e.Graphics.DrawString("Απόδειξη Είσπραξης Μετρητών", new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 130, 250); e.Graphics.DrawString(SeriesReceiptTxt.Text, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 588, 250); e.Graphics.DrawString(IdReceiptTxt.Text, new Font("Arial", 14, System.Drawing.FontStyle.Regular), Brushes.Black, 690, 250); e.Graphics.DrawString(DateTimeReceiptPicker.Value.Day.ToString() + '/' + DateTimeReceiptPicker.Value.Month.ToString() + '/' + DateTimeReceiptPicker.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); //ΕΚΤΥΠΩΣΗ ΣΤΟΙΧΕΙΩΝ ΑΠΟΔΕΙΞΗΣ DateTime dt; for (int i = 1; i <= Convert.ToInt16(ValueDocItemsTxt.Text); i++) { if (ProductsPanel.Controls.Find("ValueDocIdTxt" + i, true).First().Text != "" && ProductsPanel.Controls.Find("ValueDocIssuerTxt" + i, true).First().Text != "") { if (ProductsPanel.Controls.Find("ValueDocPriceTxt" + i, true).First().Text != "" && ProductsPanel.Controls.Find("ValueDocPriceTxt" + i, true).First().Text != "0") { dt = ((DateTimePicker)ProductsPanel.Controls.Find("ValueDocDatePkr" + i, true).First()).Value; e.Graphics.DrawString(ProductsPanel.Controls.Find("ValueDocIdTxt" + i, true).First().Text, new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 110, 560 + i * 25); e.Graphics.DrawString(dt.Day.ToString() + '/' + dt.Month.ToString() + '/' + dt.Year.ToString(), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 375, 560 + i * 25); e.Graphics.DrawString(chk.GrNumber(ProductsPanel.Controls.Find("ValueDocPriceTxt" + i, true).First().Text), new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(585, 560 + i * 25, 100, 25), format); e.Graphics.DrawString(ProductsPanel.Controls.Find("ValueDocIssuerTxt" + i, true).First().Text, new Font("Arial", 10, System.Drawing.FontStyle.Regular), Brushes.Black, 725, 560 + i * 25); } } } //ΕΚΤΥΠΩΣΗ ΣΥΝΟΛΩΝ ΑΠΟΔΕΙΞΗΣ e.Graphics.DrawString(chk.GrNumber(CashTxt.Text), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(828, 1105, 100, 25), format); e.Graphics.DrawString(chk.GrNumber(PriceReceiptTxt.Text), new Font("Arial", 12, System.Drawing.FontStyle.Regular), Brushes.Black, new Rectangle(828, 1178, 100, 25), format); string fullname1 = ""; string fullname2 = ""; if (PriceReceiptTxt.Text != "") { try { int decim = 0; decimal price = decimal.Parse(PriceReceiptTxt.Text); 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) { } } 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); } 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, 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; }