private void txtFORNECEDOR_TextChanged(object sender, EventArgs e) { DataRowView table = new SigaObjects.SXManager(empresa.CODIGO).getTabela("SA2"); StringBuilder sQuery = new StringBuilder(); if (table != null) { sQuery.AppendLine("SELECT A2_COD, A2_LOJA, A2_NOME"); sQuery.AppendLine(" FROM " + table["X2_ARQUIVO"].ToString()); sQuery.AppendLine(" WHERE A2_COD = '" + txtFORNECEDOR.Text.Trim() + "'"); if (table["X2_MODO"].ToString() == "E") { sQuery.AppendLine(" AND A2_FILIAL = '" + empresa.CODIGO_FILIAL + "'"); } } if (sQuery.Length > 0) { DataTable fornece = new SigaObjects.DataMaster().SelectDataTable(sQuery); if (fornece.DefaultView.Count > 0) { txtNOMEFORNECEDOR.Text = fornece.DefaultView[0]["A2_NOME"].ToString().Trim(); txtLOJA.Text = fornece.DefaultView[0]["A2_LOJA"].ToString().Trim(); } else { MessageBox.Show("Fornecedor inexistente. cod:" + txtFORNECEDOR.Text.Trim()); } } }
private void btnBuscaNatureza_Click(object sender, EventArgs e) { DataRowView table = new SigaObjects.SXManager(empresa.CODIGO).getTabela("SED"); StringBuilder sQuery = new StringBuilder(); if (table != null) { sQuery.AppendLine("SELECT ED_CODIGO , ED_DESCRIC, ED_CALCIRF, ED_CALCISS"); sQuery.AppendLine(" , ED_CALCINS, ED_CALCCSL, ED_CALCCOF, ED_CALCPIS"); sQuery.AppendLine(" FROM " + table["X2_ARQUIVO"].ToString()); if (table["X2_MODO"].ToString() == "E") { sQuery.AppendLine(" WHERE ED_FILIAL = '" + empresa.CODIGO_FILIAL + "'"); } sQuery.AppendLine(" ORDER BY ED_DESCRIC"); } if (sQuery.Length > 0) { DataTable fornece = new SigaObjects.DataMaster().SelectDataTable(sQuery); new gridWindow(fornece, txtNATUREZA, "ED_CODIGO").showWindow(this.Form, true, 50); } }
private void initialize(string sQuery) { //this.Dock = DockStyle.Fill; //InitializeComponent(); DataTable dtGrid = new SigaObjects.DataMaster().SelectDataTable(sQuery); //dataGridView1.DataSource = dtGrid.DefaultView; //barra.Text = string.Format(">> {0} Registros", dtGrid.DefaultView.Count); //table = dtGrid; //this.calcTotalRow(); initialize(dtGrid); }
private void btnBuscaFornece_Click(object sender, EventArgs e) { DataRowView table = new SigaObjects.SXManager(empresa.CODIGO).getTabela("SA2"); StringBuilder sQuery = new StringBuilder(); if (table != null) { sQuery.AppendLine("SELECT A2_COD, A2_LOJA, A2_NOME"); sQuery.AppendLine(" FROM " + table["X2_ARQUIVO"].ToString()); if (table["X2_MODO"].ToString() == "E") { sQuery.AppendLine(" WHERE A2_FILIAL = '" + empresa.CODIGO_FILIAL + "'"); } sQuery.AppendLine(" ORDER BY A2_NOME"); } if (sQuery.Length > 0) { DataTable fornece = new SigaObjects.DataMaster().SelectDataTable(sQuery); new gridWindow(fornece, txtFORNECEDOR, "A2_COD").showWindow(this.Form, true, 50); } }