private void buttonPrint_Click(object sender, EventArgs e) { Globlevariable.PrintDocNo = textBoxSearch.Text; if (textBoxSearch.Text == "") { MessageBox.Show("Please Enter Invoice Number for Print"); } else { PrintForm PF = new PrintForm(); PF.Show(); } }
public void LoadPrintInvoiceCode() { ProjectConnection Newconnection = new ProjectConnection(); Newconnection.Connection_Today(); SqlCommand comm = new SqlCommand(); comm.Connection = ProjectConnection.conn; comm.CommandType = CommandType.Text; comm.CommandText = " SELECT TOP 1 [Doc_No] FROM [Sales].[Invoice_Header] WHERE Status = 0 ORDER BY [System_Date_Time] DESC "; SqlDataReader dr; dr = comm.ExecuteReader(); if (dr.HasRows == true) { dr.Read(); labelInvoiceDocNo.Text = dr["Doc_No"].ToString(); dr.Close(); } Globlevariable.PrintDocNo = labelInvoiceDocNo.Text; PrintForm PF = new PrintForm(); PF.Show(); }