Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- StringBuilder Query = new StringBuilder();
- Query.Append(" SELECT ");
- Query.Append(" CAST(0 AS bit) AS SELECIONAR ");
- Query.Append(" ,SC.C2_NUM AS GUIA ");
- Query.Append(" ,SB.B1_DESC AS PRODUTO ");
- Query.Append(" ,SC.C2_XNPAIS [PAÍS ORIGEM] ");
- Query.Append(" ,CONVERT(VARCHAR(10), CAST( SC.C2_XDTFAB AS DATE),103) AS [DT. FABRICAÇÃO] ");
- Query.Append(" ,CONVERT(VARCHAR(10), CAST( SC.C2_XDTVALI AS DATE),103) AS [DT. VALIDADE] ");
- Query.Append(" ,SC.C2_XLOTEF AS [LT. FABRICANTE] ");
- Query.Append(" ,SC.C2_XLOTE AS [LT. INTERNO] ");
- Query.Append(" ,SB.B1_XDCB AS DCB ");
- Query.Append(" ,SB.B1_XCAS AS CAS ");
- Query.Append(" ,CONVERT(VARCHAR(10),CAST(SB.B1_PESO AS NUMERIC(15, 3))) + SB.B1_XSEGUM AS PESO ");
- Query.Append(" ,SC.C2_XNOMFA AS FABRICANTE ");
- Query.Append(" ,CB.CB0_CODETI AS [COD. BARRAS] ");
- Query.Append(" FROM SC2020 AS SC ");
- Query.Append(" INNER JOIN SB1020 AS SB WITH (NOLOCK) ON SB.B1_COD = SC.C2_PRODUTO ");
- Query.Append(" INNER JOIN CB0020 AS CB WITH (NOLOCK) ON CB.CB0_LOTE = SC.C2_XLOTE ");
- Query.Append(" WHERE C2_NUM = @C2_NUM ");
- comando = conex.CreateCommand();
- comando.CommandText = Query.ToString();
- comando.Parameters.Add("@C2_NUM", SqlDbType.VarChar).Value = txtGuiaFrac.Text.Trim();
- try
- {
- SqlDataAdapter dados = new SqlDataAdapter(comando);
- DataTable dtLista = new DataTable();
- dados.Fill(dtLista);
- DGW_EtqFracionamento.DataSource = dtLista;
- DGW_EtqFracionamento.Columns["GUIA"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["PRODUTO"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["PAÍS ORIGEM"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["DT. FABRICAÇÃO"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["DT. VALIDADE"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["LT. FABRICANTE"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["LT. INTERNO"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["DCB"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["CAS"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["PESO"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["FABRICANTE"].ReadOnly = true;
- DGW_EtqFracionamento.Columns["COD. BARRAS"].ReadOnly = true;
- }
- catch
- {
- MessageBox.Show("Não existem dados a serem encontrados");
- }
- }
- var filter = from DataRow row in tableGrid.Rows
- where Convert.ToBoolean(row["SELECIONAR"])
- select row;
- if (filter.Count() > 0)
- {
- tableRelatorio = filter.CopyToDataTable();
- if (caixa_selecao.ShowDialog() == DialogResult.Cancel)
- return;
- else
- EtqFraciona.PrinterSettings = caixa_selecao.PrinterSettings;
- EtqFraciona.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("Etiqueta", 420, 200);
- etqfrac();
- }
- else
- {
- MessageBox.Show("Selecione pelo menos um registro para impressão!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement