示例#1
0
        private void BS_Pedido_PositionChanged(object sender, EventArgs e)
        {
            if (BS_Pedido.Current != null)
            {
                //Buscar Expedição
                (BS_Pedido.Current as TRegistro_Pedido).lExpedicao =
                    new TCD_Expedicao().Select(
                        new TpBusca[]
                {
                    new TpBusca()
                    {
                        vNM_Campo = string.Empty,
                        vOperador = "exists",
                        vVL_Busca = "(select 1 from TB_FAT_ItensExpedicao x " +
                                    "where a.cd_empresa = x.cd_empresa " +
                                    "and a.id_expedicao = x.id_expedicao " +
                                    "and x.nr_pedido = " + (BS_Pedido.Current as TRegistro_Pedido).Nr_pedido + ") "
                    }
                }, 0, string.Empty);

                //Buscar lista de itens
                (BS_Pedido.Current as TRegistro_Pedido).Pedido_Itens =
                    new TCD_LanPedido_Item().Select(new TpBusca[]
                {
                    new TpBusca()
                    {
                        vNM_Campo = "a.nr_pedido",
                        vOperador = "=",
                        vVL_Busca = (BS_Pedido.Current as TRegistro_Pedido).Nr_pedido.ToString()
                    },
                    new TpBusca()
                    {
                        vNM_Campo = "a.quantidade - a.qtd_expedida",
                        vOperador = ">",
                        vVL_Busca = "0"
                    }
                }, 0, string.Empty, string.Empty, string.Empty);
                //Buscar Acessórios
                (BS_Pedido.Current as TRegistro_Pedido).lAcessorios =
                    new TCD_AcessoriosPed().Select(
                        new TpBusca[]
                {
                    new TpBusca()
                    {
                        vNM_Campo = "a.nr_pedido",
                        vOperador = "=",
                        vVL_Busca = (BS_Pedido.Current as TRegistro_Pedido).Nr_pedido.ToString()
                    },
                    new TpBusca()
                    {
                        vNM_Campo = "a.quantidade - a.qtd_expedida",
                        vOperador = ">",
                        vVL_Busca = "0"
                    }
                }, 0, string.Empty);
                BS_Pedido.ResetCurrentItem();
                bsExpedicao_PositionChanged(this, new EventArgs());
                BS_Itens_PositionChanged(this, new EventArgs());
            }
        }
示例#2
0
        private void InserirItem()
        {
            //Verificar se o pedido tem conferencia processada
            object obj = new CamadaDados.Faturamento.Pedido.TCD_EntregaPedido().BuscarEscalar(
                new Utils.TpBusca[]
            {
                new Utils.TpBusca()
                {
                    vNM_Campo = "a.nr_pedido",
                    vOperador = "=",
                    vVL_Busca = (BS_Pedido.Current as TRegistro_Pedido).Nr_pedido.ToString()
                },
                new Utils.TpBusca()
                {
                    vNM_Campo = "isnull(a.st_registro, 'A')",
                    vOperador = "=",
                    vVL_Busca = "'P'"
                }
            }, "1");

            if (obj != null)
            {
                if (obj.ToString().Trim().Equals("1"))
                {
                    MessageBox.Show("Não é permitido adicionar item no pedido com conferência processada.",
                                    "Mensagem", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
            }
            using (TFLan_Itens_Faturamento Lan_Itens = new TFLan_Itens_Faturamento())
            {
                Lan_Itens.st_servico          = (BS_Pedido.Current as TRegistro_Pedido).St_servicobool;
                Lan_Itens.st_valoresfixos     = (BS_Pedido.Current as TRegistro_Pedido).St_valoresfixosbool;
                Lan_Itens.CD_TabelaPreco      = (BS_Pedido.Current as TRegistro_Pedido).Cd_tabelapreco;
                Lan_Itens.CD_Empresa          = CD_Empresa.Text;
                Lan_Itens.st_Commodities      = false;
                Lan_Itens.Cfg_pedido          = (BS_Pedido.Current as TRegistro_Pedido).CFG_Pedido;
                Lan_Itens.Comissionar_pedido  = (BS_Pedido.Current as TRegistro_Pedido).St_comissaovendedorbool;
                Lan_Itens.Comissionar_Produto = TCN_Pedido.Busca_Comissao_Vendedor(BS_Pedido.Current as TRegistro_Pedido).Trim().ToUpper().Equals("P");
                Lan_Itens.Pc_desconto         = (BS_Pedido.Current as TRegistro_Pedido).Pc_descgeral;

                Lan_Itens.pTp_movimento = (BS_Pedido.Current as TRegistro_Pedido).TP_Movimento;
                if (Lan_Itens.ShowDialog() == DialogResult.OK)
                {
                    if (Lan_Itens.rItem != null)
                    {
                        (BS_Pedido.Current as TRegistro_Pedido).Pedido_Itens.Add(Lan_Itens.rItem);
                        BS_Pedido.ResetCurrentItem();
                        this.TotalizarPedido();
                    }
                }
            };
        }
示例#3
0
 private void AjustarDadosFinanceiros()
 {
     if (BS_Pedido.Current != null)
     {
         Habilita_Data_Financeiro();
         if (!(Parcelas_Entrada.Text.Trim() == "S"))
         {
             TCN_Pedido.Calcula_Parcelas(BS_Pedido.Current as TRegistro_Pedido);
             BS_Pedido.ResetCurrentItem();
         }
     }
 }
示例#4
0
        private void VL_Entrada_Leave(object sender, EventArgs e)
        {
            decimal _VL_Entrada = VL_Entrada.Value;

            TCN_Pedido.Calcula_Parcelas(BS_Pedido.Current as TRegistro_Pedido);

            for (int x = 0; x < (BS_Pedido.Current as TRegistro_Pedido).Pedidos_DT_Vencto.Count; x++)
            {
                (BS_Pedido.Current as TRegistro_Pedido).Pedidos_DT_Vencto[x].VL_Entrada = VL_Entrada.Value;
                if (x == 0)
                {
                    (BS_Pedido.Current as TRegistro_Pedido).Pedidos_DT_Vencto[x].VL_Parcela = VL_Entrada.Value;
                }
            }

            TCN_Pedido.Recalcula_Parcelas(BS_Pedido.Current as TRegistro_Pedido, 0);
            BS_Pedido.ResetCurrentItem();
        }
示例#5
0
 private void VL_Parcela_Leave(object sender, EventArgs e)
 {
     (BS_Pedido.Current as TRegistro_Pedido).Pedidos_DT_Vencto[BS_Parcelas.Position].VL_Parcela = VL_Parcela.Value;
     TCN_Pedido.Recalcula_Parcelas(BS_Pedido.Current as TRegistro_Pedido, BS_Parcelas.Position);
     BS_Pedido.ResetCurrentItem();
 }
示例#6
0
 private void dt_vencto_Leave(object sender, EventArgs e)
 {
     TCN_Pedido.Valida_Datas(BS_Pedido.Current as TRegistro_Pedido, BS_Parcelas.Position);
     BS_Pedido.ResetCurrentItem();
 }