예제 #1
0
        private void button5_Click(object sender, RoutedEventArgs e)
        {
            if (verificador())
            {
                if (MsgBox.Show.Pergunta("Quer mesmo realizar essa expedição?"))
                {
                    Banco.checklist chk   = new Banco.checklist();
                    CheckListFinal  final = new CheckListFinal();
                    final.ShowDialog();
                    if (final.finalizou)
                    {
                        chk = final.checklist;
                    }
                    else
                    {
                        MsgBox.Show.Error("Não foi possível realizar esta expedição por que o checkList não foi preenchido!");
                        return;
                    }


                    BuscarProximoId();

                    List <string> colunas = new List <string>();
                    colunas.Add("idmotorista");
                    colunas.Add("idtransportadoras");
                    colunas.Add("idcaminhao");
                    colunas.Add("data");
                    colunas.Add("liquido");
                    colunas.Add("bruto");
                    colunas.Add("idcd");
                    colunas.Add("criador");

                    List <dynamic> valores = new List <dynamic>();
                    valores.Add(cbo_motorista.SelectedValue);
                    valores.Add(cbo_transportadora.SelectedValue);
                    valores.Add(cbo_caminhao.SelectedValue);
                    valores.Add(dt_data.DisplayDate);
                    valores.Add(liquido);
                    valores.Add(bruto);
                    valores.Add(cbo_cd.SelectedValue);
                    valores.Add(Sessao.usuario.Nome);

                    if (ExecuteNonSql.Executar("romaneio", TipoDeOperacao.Tipo.Insert, colunas, valores, null) != -1)
                    {
                        colunas.Clear();
                        valores.Clear();

                        colunas.Add("idromaneio");
                        colunas.Add("idprodutos");
                        colunas.Add("nota");
                        colunas.Add("data");
                        colunas.Add("cidade");
                        colunas.Add("estado");
                        colunas.Add("lote");
                        colunas.Add("liquido");
                        colunas.Add("bruto");
                        colunas.Add("cliente");

                        List <string> coluna1 = new List <string>();
                        coluna1.Add("nota");
                        List <dynamic> valores1 = new List <dynamic>();


                        for (int a = 0; a < notas.Count; a++)
                        {
                            valores.Add(idromaneio);
                            valores.Add(notas[a].idproduto);
                            valores.Add(notas[a].notaFiscal);
                            valores.Add(notas[a].emissao);
                            valores.Add(notas[a].cidade);
                            valores.Add(notas[a].uf);
                            valores.Add(notas[a].lote);
                            valores.Add(notas[a].liquido);
                            valores.Add(notas[a].bruto);
                            valores.Add(notas[a].cliente);
                        }

                        if (ExecuteNonSql.Executar("expedicao", TipoDeOperacao.Tipo.InsertMultiplo, colunas, valores, null) != -1)
                        {
                            DataTable nots = Select.SelectSQL("select distinct nota from expedicao where idromaneio=" + idromaneio + "");

                            for (int a = 0; a < nots.Rows.Count; a++)
                            {
                                valores1.Add(nots.Rows[a][0] + "");
                            }

                            if (ExecuteNonSql.Executar("entrega", TipoDeOperacao.Tipo.InsertMultiplo, coluna1, valores1, null) != -1)
                            {
                                chk.Idromaneio = idromaneio;
                                if (chk.Inserir() == -1)
                                {
                                    MsgBox.Show.Error("Erro ao inserir checklist");
                                }

                                MsgBox.Show.Info("Expedido com Sucesso!");
                                Sessao.FecharPrograma(this);
                                Programas.RelatorioHTML novo = new RelatorioHTML(GerarHtmlRomaneio.Gerar(idromaneio + ""), false);
                                Programas.RelatorioHTML nova = new RelatorioHTML(GerarChecklist.Gerar(idromaneio + ""), false);
                                novo.Show();
                                nova.Show();
                            }
                            else
                            {
                                MsgBox.Show.Error("Erro ao ingressar novas notas para entrega!");
                                Programas.RelatorioHTML novo = new RelatorioHTML(GerarHtmlRomaneio.Gerar(idromaneio + ""), false);
                                Programas.RelatorioHTML nova = new RelatorioHTML(GerarChecklist.Gerar(idromaneio + ""), false);
                                novo.Show();
                                nova.Show();
                            }
                        }
                        else
                        {
                            MsgBox.Show.Error("Erro ao Fazer Expedição");
                        }
                    }
                    else
                    {
                        MsgBox.Show.Error("Erro ao Fazer Româneio!");
                    }
                }
            }
        }
예제 #2
0
        static private string SetarAsChecklist(Banco.checklist chk, string Ohtml)
        {
            string html = Ohtml;

            if (chk != null)
            {
                if (chk.M1)
                {
                    html = html.Replace("MS1", "P");
                    html = html.Replace("MN1", "");
                }
                else
                {
                    html = html.Replace("MS1", "");
                    html = html.Replace("MN1", "P");
                }

                if (chk.M2)
                {
                    html = html.Replace("MS2", "P");
                    html = html.Replace("MN2", "");
                }
                else
                {
                    html = html.Replace("MS2", "");
                    html = html.Replace("MN2", "P");
                }

                if (chk.M3)
                {
                    html = html.Replace("MS3", "P");
                    html = html.Replace("MN3", "");
                }
                else
                {
                    html = html.Replace("MS3", "");
                    html = html.Replace("MN3", "P");
                }

                if (chk.M4)
                {
                    html = html.Replace("MS4", "P");
                    html = html.Replace("MN4", "");
                }
                else
                {
                    html = html.Replace("MS4", "");
                    html = html.Replace("MN4", "P");
                }


                if (chk.M5)
                {
                    html = html.Replace("MS5", "P");
                    html = html.Replace("MN5", "");
                }
                else
                {
                    html = html.Replace("MS5", "");
                    html = html.Replace("MN5", "P");
                }

                if (chk.I1)
                {
                    html = html.Replace("IS1", "P");
                    html = html.Replace("IN1", "");
                }
                else
                {
                    html = html.Replace("IS1", "");
                    html = html.Replace("IN1", "P");
                }

                if (chk.I2)
                {
                    html = html.Replace("IS2", "P");
                    html = html.Replace("IN2", "");
                }
                else
                {
                    html = html.Replace("IS2", "");
                    html = html.Replace("IN2", "P");
                }

                if (chk.I3)
                {
                    html = html.Replace("IS3", "P");
                    html = html.Replace("IN3", "");
                }
                else
                {
                    html = html.Replace("IS3", "");
                    html = html.Replace("IN3", "P");
                }

                if (chk.I4)
                {
                    html = html.Replace("IS4", "P");
                    html = html.Replace("IN4", "");
                }
                else
                {
                    html = html.Replace("IS4", "");
                    html = html.Replace("IN4", "P");
                }

                if (chk.I5)
                {
                    html = html.Replace("IS5", "P");
                    html = html.Replace("IN5", "");
                }
                else
                {
                    html = html.Replace("IS5", "");
                    html = html.Replace("IN5", "P");
                }

                if (chk.I6)
                {
                    html = html.Replace("IS6", "P");
                    html = html.Replace("IN6", "");
                }
                else
                {
                    html = html.Replace("IS6", "");
                    html = html.Replace("IN6", "P");
                }


                if (chk.L1)
                {
                    html = html.Replace("LS1", "P");
                    html = html.Replace("LN1", "");
                }
                else
                {
                    html = html.Replace("LS1", "");
                    html = html.Replace("LN1", "P");
                }

                if (chk.L2)
                {
                    html = html.Replace("LS2", "P");
                    html = html.Replace("LN2", "");
                }
                else
                {
                    html = html.Replace("LS2", "");
                    html = html.Replace("LN2", "P");
                }

                if (chk.L3)
                {
                    html = html.Replace("LS3", "P");
                    html = html.Replace("LN3", "");
                }
                else
                {
                    html = html.Replace("LS3", "");
                    html = html.Replace("LN3", "P");
                }

                if (chk.L4)
                {
                    html = html.Replace("LS4", "P");
                    html = html.Replace("LN4", "");
                }
                else
                {
                    html = html.Replace("LS4", "");
                    html = html.Replace("LN4", "P");
                }

                if (chk.L5)
                {
                    html = html.Replace("LS5", "P");
                    html = html.Replace("LN5", "");
                }
                else
                {
                    html = html.Replace("LS5", "");
                    html = html.Replace("LN5", "P");
                }

                if (chk.L6)
                {
                    html = html.Replace("LS6", "P");
                    html = html.Replace("LN6", "");
                }
                else
                {
                    html = html.Replace("LS6", "");
                    html = html.Replace("LN6", "P");
                }

                if (chk.L7)
                {
                    html = html.Replace("LS7", "P");
                    html = html.Replace("LN7", "");
                }
                else
                {
                    html = html.Replace("LS7", "");
                    html = html.Replace("LN7", "P");
                }
            }
            else
            {
                html = html.Replace("MS1", "");
                html = html.Replace("MS2", "");
                html = html.Replace("MS3", "");
                html = html.Replace("MS4", "");
                html = html.Replace("MS5", "");
                html = html.Replace("MN1", "");
                html = html.Replace("MN2", "");
                html = html.Replace("MN3", "");
                html = html.Replace("MN4", "");
                html = html.Replace("MN5", "");
                html = html.Replace("IS1", "");
                html = html.Replace("IS2", "");
                html = html.Replace("IS3", "");
                html = html.Replace("IS4", "");
                html = html.Replace("IS5", "");
                html = html.Replace("IS6", "");
                html = html.Replace("IN1", "");
                html = html.Replace("IN2", "");
                html = html.Replace("IN3", "");
                html = html.Replace("IN4", "");
                html = html.Replace("IN5", "");
                html = html.Replace("IN6", "");
                html = html.Replace("LS1", "");
                html = html.Replace("LS2", "");
                html = html.Replace("LS3", "");
                html = html.Replace("LS4", "");
                html = html.Replace("LS5", "");
                html = html.Replace("LS6", "");
                html = html.Replace("LS7", "");
                html = html.Replace("LN1", "");
                html = html.Replace("LN2", "");
                html = html.Replace("LN3", "");
                html = html.Replace("LN4", "");
                html = html.Replace("LN5", "");
                html = html.Replace("LN6", "");
                html = html.Replace("LN7", "");
            }
            return(html);
        }