private void emitirNotaFiscal() { DataTable cli = getCliente(txtCodCliente.Text); string tipofrete = "D"; if (!string.IsNullOrEmpty(txtFrete.Text)) { tipofrete = "E"; } double icms = getValorICMS("SP"); // Fixo int nrNotaFiscal = getNumeroNota(); string serie = "0"; string tipo = "S"; string razaoSocial = cli.Rows[0]["RAZAOSOCIAL"].ToString(); DateTime dtEmissao = DateTime.Now; string ie = cli.Rows[0]["IE"].ToString(); string telefone = cli.Rows[0]["TELEFONE"].ToString(); string endereco = cli.Rows[0]["ENDERECO"].ToString(); string bairro = cli.Rows[0]["BAIRRO"].ToString(); string cnpf = cli.Rows[0]["CNPJ"].ToString(); string municipio = cli.Rows[0]["MUNICIPIO"].ToString(); string codVendedor = txtCodVendedor.Text; string codTransportadora = txtCodTransportadora.Text; int nrPedido = Convert.ToInt32(txtbtnPedido.Text); double valorFrete = Convert.ToDouble(txtFrete.Text.Replace("R$", "")); double valorNota = Convert.ToDouble(txtBxVlrPedido.Text.Replace("R$", "")); NOTAFISCALTableAdapter nf = new NOTAFISCALTableAdapter(); nf.Insert(nrNotaFiscal, razaoSocial, serie, dtEmissao, ie, telefone, endereco, bairro, municipio, icms, tipo, cnpf, tipofrete, valorFrete, codVendedor, codTransportadora, nrPedido, valorNota); DataTable itens = getItensPedido(nrPedido); foreach (DataRow s in itens.Rows) { ItemNotaFiscalTableAdapter item = new ItemNotaFiscalTableAdapter(); item.Insert(s["DESCRICAO"].ToString(), Convert.ToInt32(s["QUANTIDADE"]), 0, Convert.ToDouble(s["DESCONTO"]), Convert.ToDouble(s["VALOR"]), Convert.ToDouble(s["IPI"]), Convert.ToInt32(s["CODPRODUTO"]), s["CODUNIDADEMEDIDA"].ToString(), nrNotaFiscal); } }
private void emitirNotaFiscal() { DataTable cli = getCliente(txtCodCliente.Text); string tipofrete = "D"; if (!string.IsNullOrEmpty(txtFrete.Text)) tipofrete = "E"; double icms = getValorICMS("SP"); // Fixo int nrNotaFiscal = getNumeroNota(); string serie = "0"; string tipo = "S"; string razaoSocial = cli.Rows[0]["RAZAOSOCIAL"].ToString(); DateTime dtEmissao = DateTime.Now; string ie = cli.Rows[0]["IE"].ToString(); string telefone = cli.Rows[0]["TELEFONE"].ToString(); string endereco = cli.Rows[0]["ENDERECO"].ToString(); string bairro = cli.Rows[0]["BAIRRO"].ToString(); string cnpf = cli.Rows[0]["CNPJ"].ToString(); string municipio = cli.Rows[0]["MUNICIPIO"].ToString(); string codVendedor = txtCodVendedor.Text; string codTransportadora = txtCodTransportadora.Text; int nrPedido = Convert.ToInt32(txtbtnPedido.Text); double valorFrete = Convert.ToDouble(txtFrete.Text.Replace("R$", "")); double valorNota = Convert.ToDouble(txtBxVlrPedido.Text.Replace("R$", "")); NOTAFISCALTableAdapter nf = new NOTAFISCALTableAdapter(); nf.Insert(nrNotaFiscal, razaoSocial, serie, dtEmissao, ie, telefone, endereco, bairro, municipio, icms, tipo, cnpf, tipofrete, valorFrete, codVendedor, codTransportadora, nrPedido, valorNota); DataTable itens = getItensPedido(nrPedido); foreach (DataRow s in itens.Rows) { ItemNotaFiscalTableAdapter item = new ItemNotaFiscalTableAdapter(); item.Insert(s["DESCRICAO"].ToString(), Convert.ToInt32(s["QUANTIDADE"]), 0, Convert.ToDouble(s["DESCONTO"]), Convert.ToDouble(s["VALOR"]), Convert.ToDouble(s["IPI"]), Convert.ToInt32(s["CODPRODUTO"]), s["CODUNIDADEMEDIDA"].ToString(), nrNotaFiscal); } }