コード例 #1
0
        private void BB_AlterarCustoOrig_Click(object sender, EventArgs e)
        {
            if (BS_NFEntrada.Current != null)
            {
                TFLan_AlteracaoHeadge FLan_CustoHeadge = new TFLan_AlteracaoHeadge();

                //DEFINE OS TITULOS
                FLan_CustoHeadge.labelNr_Contrato.Text = Convert.ToDecimal((BS_SaldoContrato.Current as TRegistro_CadContratoHeadge).Nr_contrato).ToString();
                FLan_CustoHeadge.labelNr_Pedido.Text   = (BS_NFEntrada.Current as TRegistro_CadNotaFiscalHeadge).Nr_Pedido.ToString();
                FLan_CustoHeadge.labelProduto.Text     = (BS_SaldoContrato.Current as TRegistro_CadContratoHeadge).Cd_produto + " - " + (BS_SaldoContrato.Current as TRegistro_CadContratoHeadge).Ds_produto;

                FLan_CustoHeadge.BS_LanctoNFHeadge.DataSource = TCN_Lan_NFHeadge.Buscar(0, 0, (BS_NFEntrada.Current as TRegistro_CadNotaFiscalHeadge).CD_Empresa,
                                                                                        (BS_NFEntrada.Current as TRegistro_CadNotaFiscalHeadge).Nr_LanctoFiscal,
                                                                                        (BS_NFEntrada.Current as TRegistro_CadNotaFiscalHeadge).ID_NFItem,
                                                                                        (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).Nr_LanctoFiscal,
                                                                                        "SqlCodeBuscaCompra");
                if (FLan_CustoHeadge.ShowDialog() == DialogResult.OK)
                {
                    if (FLan_CustoHeadge.ListaNFHeadge.Count > 0)
                    {
                        TCN_Lan_NFHeadge.AlterarNFHeadge(FLan_CustoHeadge.ListaNFHeadge, null);

                        BS_NFEntrada[BS_NFEntrada.Position] = TCN_LanFechamentoOperacao.BuscarNotaFiscal(Convert.ToDecimal((BS_SaldoContrato.Current as TRegistro_CadContratoHeadge).Nr_contrato),
                                                                                                         Convert.ToDecimal((BS_NFEntrada.Current as TRegistro_CadNotaFiscalHeadge).Nr_LanctoFiscal))[0];
                    }
                }

                FLan_CustoHeadge.Dispose();
            }
        }
コード例 #2
0
        private void buscaHeadge()
        {
            if (BS_Originacao_x_Faturamento.Current != null)
            {
                (BS_Originacao_x_Faturamento.Current as TRegistro_Lan_Originacao_x_Faturamento).lNFHeadge.Clear();
                BS_Headge.DataSource = TCN_Lan_NFHeadge.Buscar(Convert.ToDecimal((BS_Originacao_x_Faturamento.Current as TRegistro_Lan_Originacao_x_Faturamento).Nr_LanctoFiscal), Convert.ToDecimal((BS_Originacao_x_Faturamento.Current as TRegistro_Lan_Originacao_x_Faturamento).ID_NFItem), "SqlCodeBuscaLanctoHeadge", (BS_Originacao_x_Faturamento.Current as TRegistro_Lan_Originacao_x_Faturamento).QTD_Origem, (BS_Originacao_x_Faturamento.Current as TRegistro_Lan_Originacao_x_Faturamento).VL_Origem, 0);

                (BS_Originacao_x_Faturamento.Current as TRegistro_Lan_Originacao_x_Faturamento).lNFHeadge = BS_Headge.DataSource as TList_Lan_NFHeadge;
                BS_Headge.ResetBindings(true);
                BS_Headge.ResetCurrentItem();
            }
        }
コード例 #3
0
        private void grid_NFSaida_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            if (grid_NFSaida.Columns[e.ColumnIndex].Name == "PS_Chegada_Grid")
            {
                //GRAVA O PS CHEGADA
                TRegistro_Lan_Originacao reg_originacao = new TRegistro_Lan_Originacao();
                reg_originacao.PS_Chegada    = (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).Ps_Chegada;
                reg_originacao.ID_Originacao = (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).ID_Originacao;

                //GRAVA
                TCN_Lan_Originacao.GravarPSOriginacao(reg_originacao, (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge), Convert.ToDecimal((BS_SaldoContrato.Current as TRegistro_CadContratoHeadge).Nr_contrato), null);

                //BUSCA OS CUSTos
                TList_Lan_NFHeadge ListaHeadge = TCN_Lan_NFHeadge.Buscar((BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).Nr_LanctoFiscal, (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).ID_NFItem, "SqlCodeBuscaLanctoHeadgeVenda", reg_originacao.PS_Chegada, (reg_originacao.PS_Chegada * ((BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).VL_Subtotal / (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).Quantidade)), reg_originacao.ID_Originacao);

                if (ListaHeadge.Count > 0)
                {
                    TCN_Lan_NFHeadge.GravarNFHeadge(ListaHeadge, null);
                }

                BS_NFSaida[BS_NFSaida.Position] = TCN_LanFechamentoOperacao.BuscarNotaFiscal(Convert.ToDecimal((BS_SaldoContrato.Current as TRegistro_CadContratoHeadge).Nr_contrato),
                                                                                             Convert.ToDecimal((BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).Nr_LanctoFiscal))[0];
            }
        }
コード例 #4
0
        public override int buscarRegistros()
        {
            if (TC_SaldoSintetico.SelectedTab == tabSaldoContrato)
            {
                //BUSCA OS CONTRATOS
                TList_CadContratoHeadge lista = TCN_LanFechamentoOperacao.BuscarContrato(nr_contrato_venda.Text.Equals("") ? 0 : Convert.ToDecimal(nr_contrato_venda.Text),
                                                                                         cd_empresa.Text,
                                                                                         AnoSafra.Text,
                                                                                         nr_pedido.Text.Equals("") ? 0 : Convert.ToDecimal(nr_pedido.Text),
                                                                                         CD_Produto.Text,
                                                                                         cd_clifor.Text);

                if (lista != null)
                {
                    if (lista.Count > 0)
                    {
                        BS_SaldoContrato.DataSource = lista;
                    }
                    else
                    {
                        BS_SaldoContrato.Clear();
                    }
                    return(lista.Count);
                }
            }
            else if (TC_NFS.SelectedTab == tabNFS && TC_SaldoSintetico.SelectedTab == tabNotaFiscal && TC_NF.SelectedTab == tabNFVenda)
            {
                //BUSCA AS NOTAS FISCAL DE SAIDA
                if (BS_SaldoContrato.Current != null)
                {
                    TList_CadNotaFiscalHeadge lista = TCN_LanFechamentoOperacao.BuscarNotaFiscal(Convert.ToDecimal((BS_SaldoContrato.Current as TRegistro_CadContratoHeadge).Nr_contrato), 0);

                    if (lista != null)
                    {
                        if (lista.Count > 0)
                        {
                            BS_NFSaida.DataSource = lista;
                        }
                        else
                        {
                            BS_NFSaida.Clear();
                        }
                        return(lista.Count);
                    }
                }
            }
            else if (TC_NFS.SelectedTab == tabDetalheNFS && TC_SaldoSintetico.SelectedTab == tabNotaFiscal && TC_NF.SelectedTab == tabNFVenda)
            {
                //BUSCA OS DETALHES DE NOTA FISCAL SAIDA
                if (BS_NFSaida.Current != null && BS_SaldoContrato.Current != null)
                {
                    TList_Lan_NFHeadge lista = TCN_Lan_NFHeadge.Buscar(0, 0, (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).CD_Empresa,
                                                                       (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).Nr_LanctoFiscal, (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).ID_NFItem, 0, "");

                    if (lista != null)
                    {
                        if (lista.Count > 0)
                        {
                            BS_CustoVenda.DataSource = lista;
                        }
                        else
                        {
                            BS_CustoVenda.Clear();
                        }
                    }

                    TList_Lan_NFHeadge listaTotais = TCN_Lan_NFHeadge.Buscar((BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).Nr_LanctoFiscal);

                    if (listaTotais != null)
                    {
                        if (listaTotais.Count > 0)
                        {
                            BS_TotaisHeadgeCompra.DataSource = listaTotais;
                        }
                        else
                        {
                            BS_TotaisHeadgeCompra.Clear();
                        }
                    }
                }
            }
            else if ((TC_Originacao.SelectedTab == tabNFEntrada) && TC_SaldoSintetico.SelectedTab == tabNotaFiscal && TC_NF.SelectedTab == tabOriginacao)
            {
                //BUSCA AS NOTAS FISCAL DE ENTRADA
                if (BS_NFSaida.Current != null)
                {
                    TList_CadNotaFiscalHeadge lista = TCN_LanFechamentoOperacao.BuscarNotaFiscalEntrada((BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).CD_Empresa,
                                                                                                        (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).Nr_LanctoFiscal,
                                                                                                        (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).ID_NFItem);

                    if (lista != null)
                    {
                        if (lista.Count > 0)
                        {
                            BS_NFEntrada.DataSource = lista;
                        }
                        else
                        {
                            BS_NFEntrada.Clear();
                        }
                        return(lista.Count);
                    }
                }
            }
            else if ((TC_Originacao.SelectedTab == tabDetalheNFE) && TC_SaldoSintetico.SelectedTab == tabNotaFiscal && TC_NF.SelectedTab == tabOriginacao)
            {
                //BUSCA OS DETALHES DA NOTA FISCAL DE ENTRADA
                if (BS_NFEntrada.Current != null && BS_SaldoContrato.Current != null)
                {
                    TList_Lan_NFHeadge lista = TCN_Lan_NFHeadge.Buscar(0, 0,
                                                                       (BS_NFEntrada.Current as TRegistro_CadNotaFiscalHeadge).CD_Empresa,
                                                                       (BS_NFEntrada.Current as TRegistro_CadNotaFiscalHeadge).Nr_LanctoFiscal,
                                                                       (BS_NFEntrada.Current as TRegistro_CadNotaFiscalHeadge).ID_NFItem,
                                                                       (BS_NFSaida.Current as TRegistro_CadNotaFiscalHeadge).Nr_LanctoFiscal,
                                                                       "SqlCodeBuscaCompra");

                    if (lista != null)
                    {
                        if (lista.Count > 0)
                        {
                            BS_CustoCompra.DataSource = lista;
                        }
                        else
                        {
                            BS_CustoCompra.Clear();
                        }
                        return(lista.Count);
                    }
                }
            }

            return(0);
        }