Click here to Skip to main content
15,902,032 members

Comments by vidya jobin (Top 2 by date)

vidya jobin 14-Aug-17 6:38am View    
i TRY THIS CODE .BUT I NOT GET PROPER RESULT

NOW MY TABLE DATA LIKE THIS

3 1 1 FS001 2017-07-18 A 1 2017-07-18 1 2017-07-18 1
4 1 1 FS001 2017-07-18 A 1 2017-07-18 1 2017-07-18 1
5 1 1 FS001 2017-07-18 A 1 2017-07-18 1 2017-07-18 0
8 1 1 FS001 2017-08-01 A 1 2017-08-01 1 2017-08-01 1
9 1 1 FS001 2017-08-02 A 1 2017-08-02 1 2017-08-01 1
10 1 1 FS002 2017-08-03 A 1 2017-08-03 1 2017-08-01 1
11 1 1 FS002 2017-08-04 A 1 2017-08-04 1 2017-08-01 1
12 1 1 FS002 2017-08-05 A 1 2017-08-05 1 2017-08-01 1
13 1 1 FS002 2017-08-06 A 1 2017-08-05 1 2017-08-01 1
14 1 1 FS002 2017-08-07 A 1 2017-08-05 1 2017-08-01 1
15 1 1 FS002 2017-08-08 A 1 2017-08-05 1 2017-08-01 1

I GET ANSWER LIKE THIS

FS002 2017-08-03
FS002 2017-08-04

THEN I TRY YOUR QUARRY FIRST LINES

SELECT [RegNo], [Attdate]
FROM Attendence T1
WHERE [Attendance] = 'A'
AND EXISTS
(SELECT [Attdate] from Attendence
WHERE DATEDIFF(d, [Attdate], T1.Attdate) = -1
AND [RegNo] = T1.[RegNo] AND [Attendance] = 'A')

THEN I GET
FS001 2017-08-01
FS002 2017-08-03
FS002 2017-08-04
FS002 2017-08-05
FS002 2017-08-06
FS002 2017-08-07
vidya jobin 26-Dec-11 2:54am View    
I'm trying to print an Image using PrintDocumentin C# but somehow the setting (like Number of Pages and Image Quality ) are ignored while printing and preview.

Is there anything wrong in following code, Am I missing something?

my code below
string mname="";
DialogResult result1 = MessageBox.Show("Are you want to Print the Bill", "", MessageBoxButtons.YesNo);
if (result1 == DialogResult.Yes)
{
Graphics g1 = this.CreateGraphics();
Image MyImage = new Bitmap(this.ClientRectangle.Width, this.ClientRectangle.Height, g1);
Graphics g2 = Graphics.FromImage(MyImage);
IntPtr dc1 = g1.GetHdc();
IntPtr dc2 = g2.GetHdc();
BitBlt(dc2, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height, dc1, 0, 0, 13369376);
g1.ReleaseHdc(dc1);
g2.ReleaseHdc(dc2);
MyImage.Save(@"c:\PrintPage.jpg", ImageFormat.Jpeg);

FileStream fileStream = new FileStream(@"c:\PrintPage.jpg", FileMode.Open , FileAccess.ReadWrite );
StartPrint(fileStream, "Image");
fileStream.Close();

if (System.IO.File.Exists(@"c:\PrintPage.jpg"))
{
System.IO.File.Delete(@"c:\PrintPage.jpg");
}
if (type == "IPD")
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells["medname"].Value != null)
{
mname = mname + row.Cells["medname"].Value.ToString() + ",";
SqlCommand cmd = new SqlCommand("insert into Tmedicine values('" + Tid().ToString() + "','" + label7.Text + "','" + label6.Text + "','" + row.Cells["medname"].Value + "','" + row.Cells["mdate"].Value + "','" + row.Cells["intake"].Value + "','" + row.Cells["unit"].Value + "','" + label4.Text + "','" + row.Cells["unitprice"].Value + "','" + row.Cells["qty"].Value + "','" + row.Cells["total"].Value + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
}
else
{
foreach (DataGridViewRow row in dataGridView1.Rows)
{
if (row.Cells["medname"].Value != null)
{
mname = mname + row.Cells["medname"].Value.ToString() + ",";
SqlCommand cmd = new SqlCommand("insert into OutMedical values('" + oTid().ToString() + "','" + label7.Text + "','" + label6.Text + "','" + row.Cells["medname"].Value + "','" + row.Cells["mdate"].Value + "','" + row.Cells["intake"].Value + "','" + row.Cells["unit"].Value + "','" + label4.Text + "','" + row.Cells["unitprice"].Value + "','" + row.Cells["qty"].Value + "','" + row.Cells["total"].Value + "')", con);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
}
}

SqlCommand com = new SqlCommand("insert into phpayment values('" + label3.Text + "','" + label4.Text + "','"+DateTime.Now.ToShortTimeString()+"','" + label7.Text + "','" + label6.Text + "','" + label10.Text + "','"+mname.ToString()+"','" + textBox1.Text + "')", con);
con.Open();
com.ExecuteNonQuery();
con.Close();
billid();
}