private void PrintDoc_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { ArsSQLQry qryRez = new ArsSQLQry(); qryRez.SQLText = "SELECT TIP_TANIMI, HAR.* FROM [TBLREZERVASYONHAR] HAR, TBLREZERVASYONTIP TIP WHERE /*WS*/TIP.TIP_KODU = HAR.DUGUN_TURU AND HAR.REC_ID = " + OPSIYON_RECID.GetIntData() + "/*WE*/"; qryRez.Open(); if (qryRez.Found()) { ArsSQLQry qryEkstra = new ArsSQLQry(); qryEkstra.SQLText = "SELECT STOK.STOK_ADI, EKSTRA.TUTAR FROM [TBLREZERVASYONEKSTRA] EKSTRA, TBLSTOK STOK WHERE /*WS*/EKSTRA.STOK_KODU = STOK.STOK_KODU AND REZERVASYON_RECID = " + OPSIYON_RECID.GetIntData() + "/*WE*/"; qryEkstra.Open(); string ekstra = ""; if (qryEkstra.Found()) { for (int i = 0; i < qryEkstra.DataCount(); i++) { ekstra += qryEkstra.GetString("STOK_ADI") + "(" + qryEkstra.GetDouble("TUTAR") + " TL) "; if (i % 3 == 0 && i != 0) { ekstra += "\n"; } qryEkstra.Next(); } } e.Graphics.DrawString("Adı Soyadı: " + qryRez.GetString("AD_SOYAD"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 50)); e.Graphics.DrawString("Program Tarihi : " + qryRez.GetDate("TARIH").Split('.')[0] + "/" + qryRez.GetDate("TARIH").Split('.')[1] + "/" + qryRez.GetDate("TARIH").Split('.')[2], new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(490, 50)); e.Graphics.DrawString("T.C. No : " + qryRez.GetString("TC_NO"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 75)); e.Graphics.DrawString("Başlangıç Saati: " + qryRez.GetDate("BASLANGIC_SAATI"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(490, 75)); e.Graphics.DrawString("Tel : " + qryRez.GetString("TC_NO"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 100)); e.Graphics.DrawString("Bitiş Saati : " + qryRez.GetDate("BITIS_SAATI"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(490, 100)); e.Graphics.DrawString("Adres : " + qryRez.GetString("ADRES"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 125)); e.Graphics.DrawString("BİLGİLER", new Font("Arial", 18, FontStyle.Bold), Brushes.Black, new Point(350, 175)); e.Graphics.DrawString("Damat Baba : " + qryRez.GetString("DAMAT_BABA"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 225)); e.Graphics.DrawString("Gelin Baba: " + qryRez.GetDate("GELIN_BABA"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(400, 225)); e.Graphics.DrawString("Damat Adı : " + qryRez.GetString("DAMAT_ADI"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 250)); e.Graphics.DrawString("Gelin Adı : " + qryRez.GetDate("GELIN_ADI"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(400, 250)); e.Graphics.DrawString("Sünnet Çocuğunun Adı: " + qryRez.GetString("SUNNET_COCUGU_ADI"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 275)); e.Graphics.DrawString("Düğün Türü : " + qryRez.GetString("TIP_TANIMI"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 300)); e.Graphics.DrawString("Kişi Sayısı : " + qryRez.GetDouble("KISI_SAYISI"), new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 325)); e.Graphics.DrawString("Paket : ", new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 350)); e.Graphics.DrawString("Ekstra : " + ekstra, new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 375)); e.Graphics.DrawString("Kapora : ", new Font("Courier New", 13, FontStyle.Regular), Brushes.Black, new Point(30, 425)); e.Graphics.DrawString("Toplam :......... ", new Font("Arial", 16, FontStyle.Regular), Brushes.Black, new Point(30, 475)); e.Graphics.DrawString("Tahsil Edilen :......... ", new Font("Arial", 16, FontStyle.Regular), Brushes.Black, new Point(275, 475)); e.Graphics.DrawString("Kalan :......... ", new Font("Arial", 16, FontStyle.Regular), Brushes.Black, new Point(580, 475)); e.Graphics.DrawString("İşletme Yetkilisi İmza", new Font("Arial", 16, FontStyle.Regular), Brushes.Black, new Point(30, 525)); e.Graphics.DrawString("Düğün Sahibi İmza", new Font("Arial", 16, FontStyle.Regular), Brushes.Black, new Point(400, 525)); e.Graphics.DrawString("Düzenleme\nTarihi", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(30, 650)); e.Graphics.DrawString("No", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(30, 700)); e.Graphics.DrawString("Senet Tutarı", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(30, 750)); e.Graphics.DrawString("Ödeme\nTarihi", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(30, 800)); e.Graphics.DrawString("Borçlu", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(30, 850)); e.Graphics.DrawString("Adres", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(30, 900)); e.Graphics.DrawString("Tel", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(30, 950)); e.Graphics.DrawString("Ödeme Günü", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(250, 650)); e.Graphics.FillRectangle(new SolidBrush(Color.Gainsboro), 250, 675, 125, 25); e.Graphics.DrawString("Türk Lirası", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(380, 650)); e.Graphics.FillRectangle(new SolidBrush(Color.Gainsboro), 380, 675, 125, 25); e.Graphics.DrawString("Kr.", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(510, 650)); e.Graphics.FillRectangle(new SolidBrush(Color.Gainsboro), 510, 675, 125, 25); e.Graphics.DrawString("No", new Font("Arial", 13, FontStyle.Regular), Brushes.Black, new Point(640, 650)); e.Graphics.FillRectangle(new SolidBrush(Color.Gainsboro), 640, 675, 125, 25); e.Graphics.DrawString("İşbu emre muharrer senedim .......... mukabilinde ....................... tarihinde\nSayın UMMAN SADEM USTA veya emrühavalesine\nyukarıda yazılı yalnız ..................................................................TL\n.................Kr.ödeyeceğim.Bedeli malen ahzolunmuştur.İş bu bono \nvadesinde ödenmediği taktirde,\nmüteakip bonoların da muacceliyet kesbedeceğine, ihtilaf vukuunda\nT.C.KONYA mahkemelerinin selahiyetini şimdiden kabul ederim.", new Font("Arial", 11, FontStyle.Regular), Brushes.Black, new Point(250, 710)); e.Graphics.DrawString("İsim :.....................", new Font("Courier New", 11, FontStyle.Regular), Brushes.Black, new Point(250, 850)); e.Graphics.DrawString("Adres :.....................\n\n......................................", new Font("Courier New", 11, FontStyle.Regular), Brushes.Black, new Point(250, 875)); e.Graphics.DrawString("T.C Kimlik No :.....................", new Font("Courier New", 11, FontStyle.Regular), Brushes.Black, new Point(250, 935)); e.Graphics.DrawString("KEFİL :.....................", new Font("Courier New", 11, FontStyle.Regular), Brushes.Black, new Point(250, 960)); e.Graphics.DrawString("Vergi D. Hes. No:.....................", new Font("Courier New", 11, FontStyle.Regular), Brushes.Black, new Point(250, 980)); e.Graphics.DrawString("Düz. Tarihi: \n\n ..../..../201..", new Font("Courier New", 11, FontStyle.Regular), Brushes.Black, new Point(650, 850)); e.Graphics.DrawString("İmza", new Font("Courier New", 11, FontStyle.Regular), Brushes.Black, new Point(650, 950)); e.Graphics.DrawString("İmza", new Font("Courier New", 11, FontStyle.Regular), Brushes.Black, new Point(725, 950)); } }
private void TakvimOlustur() { if (acilanTarih.Month != takvimTarih.Month || !firstResize || lastYerIndex != YER_KODU.SelectedIndex || activate) { lastYerIndex = YER_KODU.SelectedIndex; acilanTarih = takvimTarih; activate = false; pnlTakvim.Controls.Clear(); List <string> dayList = new List <string>(); dayList.Add("Pazartesi"); dayList.Add("Salı"); dayList.Add("Çarşamba"); dayList.Add("Perşembe"); dayList.Add("Cuma"); dayList.Add("Cumartesi"); dayList.Add("Pazar"); List <DayOfWeek> dayListEn = new List <DayOfWeek>(); dayListEn.Add(DayOfWeek.Monday); dayListEn.Add(DayOfWeek.Tuesday); dayListEn.Add(DayOfWeek.Wednesday); dayListEn.Add(DayOfWeek.Thursday); dayListEn.Add(DayOfWeek.Friday); dayListEn.Add(DayOfWeek.Saturday); dayListEn.Add(DayOfWeek.Sunday); int weekCount = ArsLibrary.MonthWeekCount(takvimTarih); int pnlWidth = pnlTakvim.Width / 7; int pnlHeight = (pnlTakvim.Height - 30) / weekCount; for (int i = 0; i < 7; i++) { Panel pnlDay = new Panel(); pnlDay.Size = new Size(pnlWidth, 30); pnlDay.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; pnlDay.Location = new Point(i * pnlWidth, 0); Label lblGun = new Label(); lblGun.Text = dayList[i]; lblGun.Font = new Font("Arial", 9, FontStyle.Bold); lblGun.TextAlign = ContentAlignment.MiddleCenter; pnlDay.Controls.Add(lblGun); lblGun.Dock = DockStyle.Fill; pnlTakvim.Controls.Add(pnlDay); } DateTime date = takvimTarih; int month = date.Month; int year = date.Year; int daysThisMonth = DateTime.DaysInMonth(year, month); DateTime beginingOfThisMonth = new DateTime(year, month, 1); int basGun = -1; for (int i = 0; i < 7; i++) { if (beginingOfThisMonth.DayOfWeek == dayListEn[i]) { basGun = i; break; } } beginingOfThisMonth = beginingOfThisMonth.AddDays(-basGun); ArsSQLQry qrySaatAdet = new ArsSQLQry(); qrySaatAdet.SQLText = "SELECT COUNT(*) AS SAAT_ADET FROM [TBLREZERVASYONSAAT] WHERE /*WS*/"; if (YER_KODU.GetString() != "-1") { qrySaatAdet.SQLText += "YER_KODU = '" + YER_KODU.GetString() + "'/*WE*/"; } else { qrySaatAdet.SQLText += "1=1/*WE*/"; } qrySaatAdet.Open(); int saatAdet = qrySaatAdet.GetInt("SAAT_ADET"); ArsSQLQry qryDoluluk = new ArsSQLQry(); qryDoluluk.SQLText = "SELECT COUNT(*) AS DOLULUK, TARIH FROM [TBLREZERVASYONHAR] WHERE /*WS*/1=1 "; if (YER_KODU.GetString() != "-1") { qryDoluluk.SQLText += "AND YER_KODU = '" + YER_KODU.GetString() + "' "; } qryDoluluk.SQLText += "AND TARIH BETWEEN '" + beginingOfThisMonth.AddDays(-1).ToString("MM.dd.yyyy") + "' AND '" + beginingOfThisMonth.AddDays((weekCount * 7) + 1).ToString("MM.dd.yyyy") + "' AND ISNULL(REZ_OPS, 1) = 1/*WE*/ "; qryDoluluk.SQLText += "GROUP BY TARIH"; qryDoluluk.Open(); ArsSQLQry qryOpsiyon = new ArsSQLQry(); qryOpsiyon.SQLText = "SELECT COUNT(*) AS OPSIYON, TARIH FROM [TBLREZERVASYONHAR] WHERE /*WS*/1=1 "; if (YER_KODU.GetString() != "-1") { qryOpsiyon.SQLText += "AND YER_KODU = '" + YER_KODU.GetString() + "' "; } qryOpsiyon.SQLText += "AND TARIH BETWEEN '" + beginingOfThisMonth.AddDays(-1).ToString("MM.dd.yyyy") + "' AND '" + beginingOfThisMonth.AddDays((weekCount * 7) + 1).ToString("MM.dd.yyyy") + "' AND ISNULL(REZ_OPS, 1) = 2 AND OPSIYON_BITIS_TARIHI > '" + DateTime.Now.ToString("MM.dd.yyyy") + "'/*WE*/ "; qryOpsiyon.SQLText += "GROUP BY TARIH"; qryOpsiyon.Open(); for (int i = 0; i < weekCount; i++) { for (int j = 0; j < 7; j++) { int doluluk = 0; int opsiyon = 0; if (qryDoluluk.Found()) { for (int k = 0; k < qryDoluluk.DataCount(); k++) { if (qryDoluluk.GetDate("TARIH") == beginingOfThisMonth.ToString("dd.MM.yyyy")) { doluluk = qryDoluluk.GetInt("DOLULUK"); break; } qryDoluluk.Next(); } } if (qryOpsiyon.Found()) { for (int k = 0; k < qryOpsiyon.DataCount(); k++) { if (qryOpsiyon.GetDate("TARIH") == beginingOfThisMonth.ToString("dd.MM.yyyy")) { opsiyon = qryOpsiyon.GetInt("OPSIYON"); break; } qryOpsiyon.Next(); } } Panel pnlDay = new Panel(); pnlDay.Size = new Size(pnlWidth, pnlHeight); pnlDay.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; pnlDay.Location = new Point(j * pnlWidth, (i * pnlHeight) + 30); if (saatAdet == doluluk) { pnlDay.BackColor = Color.Red; } else if (saatAdet == opsiyon) { pnlDay.BackColor = Color.Orange; } pnlDay.MouseEnter += TakvimMouseEnter; pnlDay.MouseLeave += TakvimMouseLeave; pnlDay.DoubleClick += TakvimClick; pnlTakvim.ContextMenuStrip = msTakvim; ArsLabel lblTarih = new ArsLabel(); lblTarih.Text = beginingOfThisMonth.ToString("dd.MM.yyyy"); lblTarih.Font = new Font("Arial", 9, FontStyle.Bold); lblTarih.TextAlign = ContentAlignment.MiddleCenter; lblTarih.ArTag = 99; lblTarih.Visible = false; pnlDay.Controls.Add(lblTarih); Label lblGun = new Label(); lblGun.Text = beginingOfThisMonth.Day.ToString(); lblGun.Font = new Font("Arial", 18, FontStyle.Bold); lblGun.Size = new Size(pnlWidth, 26); if (beginingOfThisMonth.ToString("dd.MM.yyyy") == DateTime.Now.ToString("dd.MM.yyyy")) { lblGun.ForeColor = Color.FromArgb(50, 160, 220); } else if (beginingOfThisMonth.Month == month) { lblGun.ForeColor = Color.Gray; } else { lblGun.ForeColor = Color.FromArgb(205, 205, 205); } if (saatAdet == doluluk || saatAdet == opsiyon) { lblGun.ForeColor = Color.White; } lblGun.TextAlign = ContentAlignment.TopRight; pnlDay.Controls.Add(lblGun); lblGun.Location = new Point(0, 0); beginingOfThisMonth = beginingOfThisMonth.AddDays(1); pnlTakvim.Controls.Add(pnlDay); } } dtTarihBilgi.Value = takvimTarih; } }