Пример #1
0
        public void PopulaEmit(belinfCte objbelinfCte)
        {
            try
            {
                DataTable dt = BuscaDadosEmit();

                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.emit           = new belemit();
                    objbelinfCte.emit.enderEmit = new belenderEmit();


                    objbelinfCte.emit.CNPJ              = Util.TiraSimbolo(dr["CNPJ"].ToString());
                    objbelinfCte.emit.IE                = Util.TiraSimbolo(dr["IE"].ToString());
                    objbelinfCte.emit.xNome             = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                    objbelinfCte.emit.xFant             = Util.TiraSimbolo(dr["xFant"].ToString(), "");
                    objbelinfCte.emit.enderEmit.xLgr    = Util.TiraSimbolo(dr["xLgr"].ToString(), "");
                    objbelinfCte.emit.enderEmit.nro     = dr["nro"].ToString();
                    objbelinfCte.emit.enderEmit.xCpl    = dr["xCpl"].ToString();
                    objbelinfCte.emit.enderEmit.xBairro = Util.TiraSimbolo(dr["xBairro"].ToString(), "");
                    objbelinfCte.emit.enderEmit.UF      = dr["UF"].ToString();
                    objbelinfCte.emit.enderEmit.xMun    = Util.TiraSimbolo(dr["xMun"].ToString(), "");
                    objbelinfCte.emit.enderEmit.cMun    = dr["cMun"].ToString();
                    objbelinfCte.emit.enderEmit.CEP     = dr["CEP"].ToString() != "" ? Util.TiraSimbolo(dr["CEP"].ToString()) : "";
                    if (dr["fone"].ToString() != "")
                    {
                        objbelinfCte.emit.enderEmit.fone = Util.TiraSimbolo(dr["fone"].ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #2
0
        public void PopulaRem(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosRem(sCte);

                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.rem           = new belrem();
                    objbelinfCte.rem.enderReme = new belenderReme();


                    objbelinfCte.rem.CNPJ  = Util.TiraSimbolo(dr["CNPJ"].ToString());
                    objbelinfCte.rem.CPF   = Util.TiraSimbolo(dr["CPF"].ToString());
                    objbelinfCte.rem.IE    = Util.TiraSimbolo(dr["IE"].ToString());
                    objbelinfCte.rem.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                    objbelinfCte.rem.xFant = Util.TiraSimbolo(dr["xFant"].ToString(), "");
                    objbelinfCte.rem.fone  = Util.TiraSimbolo(dr["fone"].ToString());

                    objbelinfCte.rem.enderReme.xLgr    = Util.TiraSimbolo(dr["xLgr"].ToString(), "");
                    objbelinfCte.rem.enderReme.nro     = dr["nro"].ToString();
                    objbelinfCte.rem.enderReme.xBairro = Util.TiraSimbolo(dr["xBairro"].ToString(), "");
                    objbelinfCte.rem.enderReme.xMun    = Util.TiraSimbolo(dr["xMun"].ToString(), "");
                    objbelinfCte.rem.enderReme.UF      = dr["UF"].ToString();
                    objbelinfCte.rem.enderReme.cMun    = dr["cMun"].ToString();
                    objbelinfCte.rem.enderReme.CEP     = Util.TiraSimbolo(dr["CEP"].ToString());
                    objbelinfCte.rem.enderReme.xPais   = "Brasil";
                    objbelinfCte.rem.enderReme.cPais   = "1058";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #3
0
        public void PopulaRodo(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosRodo(sCte);


                objbelinfCte.infCTeNorm.seg = new belseg();
                objbelinfCte.infCTeNorm.rodo = new belrodo();

                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.infCTeNorm.seg.respSeg = dr["respSeg"].ToString() != "" ? dr["respSeg"].ToString().Substring(0, 1) : "";
                    objbelinfCte.infCTeNorm.seg.nApol = dr["nApol"].ToString() != "" ? Util.TiraSimbolo(dr["nApol"].ToString()) : "";
                    objbelinfCte.infCTeNorm.rodo.RNTRC = dr["RNTRC"].ToString();
                    objbelinfCte.infCTeNorm.rodo.dPrev = dr["dPrev"].ToString();
                    objbelinfCte.infCTeNorm.rodo.lota = dr["lota"].ToString();
                }


            }
            catch (Exception ex)
            {
                throw ex;
            }


        }
Пример #4
0
        public void PopulaDest(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosDest(sCte);
                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.dest           = new beldest();
                    objbelinfCte.dest.enderDest = new belenderDest();


                    objbelinfCte.dest.CNPJ  = Util.TiraSimbolo(dr["CNPJ"].ToString());
                    objbelinfCte.dest.CPF   = Util.TiraSimbolo(dr["CPF"].ToString());
                    objbelinfCte.dest.IE    = Util.TiraSimbolo(dr["IE"].ToString());
                    objbelinfCte.dest.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                    objbelinfCte.dest.fone  = Util.TiraSimbolo(dr["fone"].ToString());
                    objbelinfCte.dest.ISUF  = dr["ISUF"].ToString();

                    objbelinfCte.dest.enderDest.xLgr    = Util.TiraSimbolo(dr["xLgr"].ToString(), "");
                    objbelinfCte.dest.enderDest.nro     = dr["nro"].ToString();
                    objbelinfCte.dest.enderDest.xBairro = Util.TiraSimbolo(dr["xBairro"].ToString(), "");
                    objbelinfCte.dest.enderDest.xMun    = Util.TiraSimbolo(dr["xMun"].ToString(), "");
                    objbelinfCte.dest.enderDest.UF      = dr["UF"].ToString();
                    objbelinfCte.dest.enderDest.cMun    = dr["cMun"].ToString();
                    objbelinfCte.dest.enderDest.CEP     = Util.TiraSimbolo(dr["CEP"].ToString());
                    objbelinfCte.dest.enderDest.xPais   = "Brasil";
                    objbelinfCte.dest.enderDest.cPais   = "1058";
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #5
0
        public void PopulaConhecimentos(belPopulaObjetos objbelObjetos)
        {
            this.objbelObjetos = objbelObjetos;
            try
            {

                if (File.Exists(objbelObjetos.sPath))
                {
                    File.Delete(objbelObjetos.sPath);
                }

                foreach (string sCte in objbelObjetos.objListaNumeroConhecimentos)
                {

                    string sCTe = "CTe" + GeraChave(sCte);
                    belinfCte objbelinfCte = new belinfCte();
                    belDadosIde objIde = new belDadosIde();
                    belDadosEmit objEmit = new belDadosEmit();
                    belDadosRem objRem = new belDadosRem();
                    belDadosDest objDest = new belDadosDest();
                    belDadosNf objNf = new belDadosNf();
                    belDadosExped objExped = new belDadosExped();
                    belDadosReceb objReceb = new belDadosReceb();
                    belDadosVPrest objVPrest = new belDadosVPrest();
                    belDadosImp objImp = new belDadosImp();
                    belDadosinfCarga objInfCarga = new belDadosinfCarga();
                    belDadosinfQ objInfQ = new belDadosinfQ();
                    belDadosrodo objRodo = new belDadosrodo();

                    objbelinfCte.compl = new belcompl(sCte);

                    objIde.PopulaIde(sCte, sCTe[sCTe.Length - 1].ToString(), objbelinfCte, sCTe);
                    objEmit.PopulaEmit(objbelinfCte);
                    objRem.PopulaRem(objbelinfCte, sCte);
                    objDest.PopulaDest(objbelinfCte, sCte);
                    objNf.PopulaNf(objbelinfCte, sCte);
                    objExped.PopulaExped(objbelinfCte, sCte);
                    objReceb.PopulaReceb(objbelinfCte, sCte);
                    objVPrest.PopulaVPrest(objbelinfCte, sCte);
                    objImp.PopulaImp(objbelinfCte, sCte);
                    objInfCarga.PopulainfCarga(objbelinfCte, sCte);
                    objInfQ.PopulainfQ(objbelinfCte, sCte);
                    objRodo.PopulaRodo(objbelinfCte, sCte);
                    objRodo.PopulaVeiculo(objbelinfCte,   sCte);
                    objRodo.PopulaMotorista(objbelinfCte,  sCte);

                    objbelObjetos.objListaConhecimentos.Add(objbelinfCte);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
Пример #6
0
        public void PopulaVeiculo(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                objbelinfCte.infCTeNorm.rodo.veic = new List<belveic>();
                if (objbelinfCte.infCTeNorm.rodo.lota == "1")
                {
                    for (int tot = 0; tot < objbelinfCte.ide.Veiculo.Count; tot++)
                    {
                        DataTable dt = BuscaDadosVeiculo(objbelinfCte.ide.Veiculo[tot]);

                        foreach (DataRow dr in dt.Rows)
                        {
                            belveic veic = new belveic();
                            veic.RENAVAM = dr["RENAVAM"].ToString();
                            veic.placa = dr["placa"].ToString();
                            veic.tara = dr["tara"].ToString().Substring(0, dr["tara"].ToString().IndexOf('.'));
                            veic.capKG = dr["capKG"].ToString().Substring(0, dr["capKG"].ToString().IndexOf('.'));
                            veic.capM3 = dr["capM3"].ToString().Substring(0, dr["capM3"].ToString().IndexOf('.'));
                            veic.tpProp = dr["tpProp"].ToString();
                            veic.tpVeic = dr["tpVeic"].ToString();
                            veic.tpRod = dr["tpRod"].ToString();
                            veic.tpCar = dr["tpCar"].ToString();
                            veic.UF = dr["UF"].ToString();

                            objbelinfCte.infCTeNorm.rodo.veic.Add(veic);
                        }

                        if (objbelinfCte.infCTeNorm.rodo.veic[tot].tpProp == "T")
                        {
                            DataTable dtP = BuscaDadosProprietarioVeiculo(objbelinfCte.ide.Veiculo[tot]);

                            objbelinfCte.infCTeNorm.rodo.veic[tot].prop = new belprop();
                            foreach (DataRow dr in dtP.Rows)
                            {
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.CPFCNPJ = Util.TiraSimbolo(dr["CPF"].ToString());
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.RNTRC = dr["RNTRC"].ToString();
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.IE = Util.TiraSimbolo(dr["IE"].ToString());
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.UF = dr["UF"].ToString();
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.tpProp = dr["tpProp"].ToString();
                            }

                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }


        }
Пример #7
0
        public void PopulaConhecimentos(belPopulaObjetos objbelObjetos)
        {
            this.objbelObjetos = objbelObjetos;
            try
            {
                if (File.Exists(objbelObjetos.sPath))
                {
                    File.Delete(objbelObjetos.sPath);
                }

                foreach (string sCte in objbelObjetos.objListaNumeroConhecimentos)
                {
                    string           sCTe         = "CTe" + GeraChave(sCte);
                    belinfCte        objbelinfCte = new belinfCte();
                    belDadosIde      objIde       = new belDadosIde();
                    belDadosEmit     objEmit      = new belDadosEmit();
                    belDadosRem      objRem       = new belDadosRem();
                    belDadosDest     objDest      = new belDadosDest();
                    belDadosNf       objNf        = new belDadosNf();
                    belDadosExped    objExped     = new belDadosExped();
                    belDadosReceb    objReceb     = new belDadosReceb();
                    belDadosVPrest   objVPrest    = new belDadosVPrest();
                    belDadosImp      objImp       = new belDadosImp();
                    belDadosinfCarga objInfCarga  = new belDadosinfCarga();
                    belDadosinfQ     objInfQ      = new belDadosinfQ();
                    belDadosrodo     objRodo      = new belDadosrodo();

                    objbelinfCte.compl = new belcompl(sCte);

                    objIde.PopulaIde(sCte, sCTe[sCTe.Length - 1].ToString(), objbelinfCte, sCTe);
                    objEmit.PopulaEmit(objbelinfCte);
                    objRem.PopulaRem(objbelinfCte, sCte);
                    objDest.PopulaDest(objbelinfCte, sCte);
                    objNf.PopulaNf(objbelinfCte, sCte);
                    objExped.PopulaExped(objbelinfCte, sCte);
                    objReceb.PopulaReceb(objbelinfCte, sCte);
                    objVPrest.PopulaVPrest(objbelinfCte, sCte);
                    objImp.PopulaImp(objbelinfCte, sCte);
                    objInfCarga.PopulainfCarga(objbelinfCte, sCte);
                    objInfQ.PopulainfQ(objbelinfCte, sCte);
                    objRodo.PopulaRodo(objbelinfCte, sCte);
                    objRodo.PopulaVeiculo(objbelinfCte, sCte);
                    objRodo.PopulaMotorista(objbelinfCte, sCte);

                    objbelObjetos.objListaConhecimentos.Add(objbelinfCte);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #8
0
        public void PopulaVeiculo(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                objbelinfCte.infCTeNorm.rodo.veic = new List <belveic>();
                if (objbelinfCte.infCTeNorm.rodo.lota == "1")
                {
                    for (int tot = 0; tot < objbelinfCte.ide.Veiculo.Count; tot++)
                    {
                        DataTable dt = BuscaDadosVeiculo(objbelinfCte.ide.Veiculo[tot]);

                        foreach (DataRow dr in dt.Rows)
                        {
                            belveic veic = new belveic();
                            veic.RENAVAM = dr["RENAVAM"].ToString();
                            veic.placa   = dr["placa"].ToString();
                            veic.tara    = dr["tara"].ToString().Substring(0, dr["tara"].ToString().IndexOf('.'));
                            veic.capKG   = dr["capKG"].ToString().Substring(0, dr["capKG"].ToString().IndexOf('.'));
                            veic.capM3   = dr["capM3"].ToString().Substring(0, dr["capM3"].ToString().IndexOf('.'));
                            veic.tpProp  = dr["tpProp"].ToString();
                            veic.tpVeic  = dr["tpVeic"].ToString();
                            veic.tpRod   = dr["tpRod"].ToString();
                            veic.tpCar   = dr["tpCar"].ToString();
                            veic.UF      = dr["UF"].ToString();

                            objbelinfCte.infCTeNorm.rodo.veic.Add(veic);
                        }

                        if (objbelinfCte.infCTeNorm.rodo.veic[tot].tpProp == "T")
                        {
                            DataTable dtP = BuscaDadosProprietarioVeiculo(objbelinfCte.ide.Veiculo[tot]);

                            objbelinfCte.infCTeNorm.rodo.veic[tot].prop = new belprop();
                            foreach (DataRow dr in dtP.Rows)
                            {
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.CPFCNPJ = Util.TiraSimbolo(dr["CPF"].ToString());
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.RNTRC   = dr["RNTRC"].ToString();
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.xNome   = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.IE      = Util.TiraSimbolo(dr["IE"].ToString());
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.UF      = dr["UF"].ToString();
                                objbelinfCte.infCTeNorm.rodo.veic[tot].prop.tpProp  = dr["tpProp"].ToString();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #9
0
        public void PopulaReceb(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                string sCodConsig = BuscaDadosReceb(sCte);

                if (sCodConsig != "")
                {
                    DataTable dt = BuscaDadosConsig(sCodConsig);


                    objbelinfCte.receb = new belreceb();
                    objbelinfCte.receb.enderReceb = new belenderReceb();

                    foreach (DataRow dr in dt.Rows)
                    {
                        objbelinfCte.ide.tpServ = 2;

                        objbelinfCte.receb.CNPJ = Util.TiraSimbolo(dr["CNPJ"].ToString());
                        objbelinfCte.receb.CPF = Util.TiraSimbolo(dr["CPF"].ToString());
                        objbelinfCte.receb.IE = Util.TiraSimbolo(dr["IE"].ToString());
                        objbelinfCte.receb.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                        objbelinfCte.receb.fone = Util.TiraSimbolo(dr["fone"].ToString());

                        objbelinfCte.receb.enderReceb.xLgr = Util.TiraSimbolo(dr["xLgr"].ToString(), "");
                        objbelinfCte.receb.enderReceb.nro = dr["nro"].ToString();
                        objbelinfCte.receb.enderReceb.xBairro = Util.TiraSimbolo(dr["xBairro"].ToString(), "");
                        objbelinfCte.receb.enderReceb.xMun = Util.TiraSimbolo(dr["xMun"].ToString(), "");
                        objbelinfCte.receb.enderReceb.CEP = Util.TiraSimbolo(dr["CEP"].ToString());
                        objbelinfCte.receb.enderReceb.UF = dr["UF"].ToString();
                        objbelinfCte.receb.enderReceb.cMun = dr["cMun"].ToString();
                        objbelinfCte.receb.enderReceb.xPais = "Brasil";
                        objbelinfCte.receb.enderReceb.cPais = "1058";
                    }
                }


            }
            catch (Exception ex)
            {
                throw ex;
            }



        }
Пример #10
0
        public void PopulaExped(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                string sCodRedes = BuscaDadosExped(sCte);

                if (sCodRedes != "")
                {
                    DataTable dt = BuscaDadosRedes(sCodRedes);


                    objbelinfCte.exped = new belexped();
                    objbelinfCte.exped.enderExped = new belenderExped();
                    foreach (DataRow dr in dt.Rows)
                    {
                        objbelinfCte.ide.tpServ = 2;

                        objbelinfCte.exped.CNPJ = Util.TiraSimbolo(dr["CNPJ"].ToString());
                        objbelinfCte.exped.CPF = Util.TiraSimbolo(dr["CPF"].ToString());
                        objbelinfCte.exped.IE = Util.TiraSimbolo(dr["IE"].ToString());
                        objbelinfCte.exped.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                        objbelinfCte.exped.fone = Util.TiraSimbolo(dr["fone"].ToString());
                        objbelinfCte.exped.enderExped.xLgr = Util.TiraSimbolo(dr["xLgr"].ToString(), "");
                        objbelinfCte.exped.enderExped.nro = dr["nro"].ToString();
                        objbelinfCte.exped.enderExped.xBairro = Util.TiraSimbolo(dr["xBairro"].ToString(), "");
                        objbelinfCte.exped.enderExped.xMun = Util.TiraSimbolo(dr["xMun"].ToString(), "");
                        objbelinfCte.exped.enderExped.CEP = Util.TiraSimbolo(dr["CEP"].ToString());
                        objbelinfCte.exped.enderExped.UF = dr["UF"].ToString();
                        objbelinfCte.exped.enderExped.cMun = dr["cMun"].ToString();
                        objbelinfCte.exped.enderExped.xPais = "Brasil";
                        objbelinfCte.exped.enderExped.cPais = "1058";
                    }
                }


            }
            catch (Exception ex)
            {
                throw ex;
            }



        }
Пример #11
0
        public void PopulainfQ(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosinfQ(sCte);

                if (objbelinfCte.infCTeNorm == null)
                {
                    objbelinfCte.infCTeNorm = new belinfCTeNorm();
                    objbelinfCte.infCTeNorm.infCarga = new belinfCarga();
                }
                objbelinfCte.infCTeNorm.infCarga.infQ = new List<belinfQ>();

                foreach (DataRow dr in dt.Rows)
                {
                    //belinfQ objinfQ = new belinfQ();
                    //objinfQ.cUnid = dr["cUnid"].ToString();
                    //objinfQ.tpMed = dr["tpMed"].ToString();
                    //objinfQ.qCarga = Convert.ToDecimal(dr["qCarga"].ToString().Replace(".", ","));
                    //objbelinfCte.infCTeNorm.infCarga.infQ.Add(objinfQ);

                    belinfQ objinfQ = new belinfQ();
                    objinfQ.cUnid = "00";
                    objinfQ.tpMed = dr["tpMed"].ToString().ToUpper();
                    objinfQ.qCarga = Convert.ToDecimal(dr["qCarga_Volume"].ToString().Replace(".", ","));
                    objbelinfCte.infCTeNorm.infCarga.infQ.Add(objinfQ);

                    objinfQ = new belinfQ();
                    objinfQ.cUnid = dr["cUnid"].ToString();
                    objinfQ.tpMed = "PESO";
                    objinfQ.qCarga = Convert.ToDecimal(dr["qCarga_Peso"].ToString().Replace(".", ","));
                    objbelinfCte.infCTeNorm.infCarga.infQ.Add(objinfQ);


                }
            }
            catch (Exception ex)
            {
                throw ex;
            }



        }
Пример #12
0
        public void PopulainfCarga(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosinfCarga(sCte);

                //objbelinfCte.infCTeNorm = new belinfCTeNorm();
                objbelinfCte.infCTeNorm.infCarga = new belinfCarga();

                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.infCTeNorm.infCarga.vCarga += Convert.ToDecimal(dr["vMerc"].ToString().Replace(".", ","));
                    objbelinfCte.infCTeNorm.infCarga.proPred = Util.TiraSimbolo(dr["proPred"].ToString(), "");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #13
0
        public void PopulaReceb(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                string sCodConsig = BuscaDadosReceb(sCte);

                if (sCodConsig != "")
                {
                    DataTable dt = BuscaDadosConsig(sCodConsig);


                    objbelinfCte.receb            = new belreceb();
                    objbelinfCte.receb.enderReceb = new belenderReceb();

                    foreach (DataRow dr in dt.Rows)
                    {
                        objbelinfCte.ide.tpServ = 2;

                        objbelinfCte.receb.CNPJ  = Util.TiraSimbolo(dr["CNPJ"].ToString());
                        objbelinfCte.receb.CPF   = Util.TiraSimbolo(dr["CPF"].ToString());
                        objbelinfCte.receb.IE    = Util.TiraSimbolo(dr["IE"].ToString());
                        objbelinfCte.receb.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                        objbelinfCte.receb.fone  = Util.TiraSimbolo(dr["fone"].ToString());

                        objbelinfCte.receb.enderReceb.xLgr    = Util.TiraSimbolo(dr["xLgr"].ToString(), "");
                        objbelinfCte.receb.enderReceb.nro     = dr["nro"].ToString();
                        objbelinfCte.receb.enderReceb.xBairro = Util.TiraSimbolo(dr["xBairro"].ToString(), "");
                        objbelinfCte.receb.enderReceb.xMun    = Util.TiraSimbolo(dr["xMun"].ToString(), "");
                        objbelinfCte.receb.enderReceb.CEP     = Util.TiraSimbolo(dr["CEP"].ToString());
                        objbelinfCte.receb.enderReceb.UF      = dr["UF"].ToString();
                        objbelinfCte.receb.enderReceb.cMun    = dr["cMun"].ToString();
                        objbelinfCte.receb.enderReceb.xPais   = "Brasil";
                        objbelinfCte.receb.enderReceb.cPais   = "1058";
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #14
0
        public void PopulaRem(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosRem(sCte);

                foreach (DataRow dr in dt.Rows)
                {

                    objbelinfCte.rem = new belrem();
                    objbelinfCte.rem.enderReme = new belenderReme();


                    objbelinfCte.rem.CNPJ = Util.TiraSimbolo(dr["CNPJ"].ToString());
                    objbelinfCte.rem.CPF = Util.TiraSimbolo(dr["CPF"].ToString());
                    objbelinfCte.rem.IE = Util.TiraSimbolo(dr["IE"].ToString());
                    objbelinfCte.rem.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                    objbelinfCte.rem.xFant = Util.TiraSimbolo(dr["xFant"].ToString(), "");
                    objbelinfCte.rem.fone = Util.TiraSimbolo(dr["fone"].ToString());

                    objbelinfCte.rem.enderReme.xLgr = Util.TiraSimbolo(dr["xLgr"].ToString(), "");
                    objbelinfCte.rem.enderReme.nro = dr["nro"].ToString();
                    objbelinfCte.rem.enderReme.xBairro = Util.TiraSimbolo(dr["xBairro"].ToString(), "");
                    objbelinfCte.rem.enderReme.xMun = Util.TiraSimbolo(dr["xMun"].ToString(), "");
                    objbelinfCte.rem.enderReme.UF = dr["UF"].ToString();
                    objbelinfCte.rem.enderReme.cMun = dr["cMun"].ToString();
                    objbelinfCte.rem.enderReme.CEP = Util.TiraSimbolo(dr["CEP"].ToString());
                    objbelinfCte.rem.enderReme.xPais = "Brasil";
                    objbelinfCte.rem.enderReme.cPais = "1058";

                }

            }
            catch (Exception ex)
            {
                throw ex;
            }



        }
Пример #15
0
        public void PopulainfCarga(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosinfCarga(sCte);

                //objbelinfCte.infCTeNorm = new belinfCTeNorm();
                objbelinfCte.infCTeNorm.infCarga = new belinfCarga();

                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.infCTeNorm.infCarga.vCarga += Convert.ToDecimal(dr["vMerc"].ToString().Replace(".", ","));
                    objbelinfCte.infCTeNorm.infCarga.proPred = Util.TiraSimbolo(dr["proPred"].ToString(), "");
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #16
0
        public void PopulaEmit(belinfCte objbelinfCte)
        {
            try
            {
                DataTable dt = BuscaDadosEmit();

                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.emit = new belemit();
                    objbelinfCte.emit.enderEmit = new belenderEmit();


                    objbelinfCte.emit.CNPJ = Util.TiraSimbolo(dr["CNPJ"].ToString());
                    objbelinfCte.emit.IE = Util.TiraSimbolo(dr["IE"].ToString());
                    objbelinfCte.emit.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                    objbelinfCte.emit.xFant = Util.TiraSimbolo(dr["xFant"].ToString(), "");
                    objbelinfCte.emit.enderEmit.xLgr = Util.TiraSimbolo(dr["xLgr"].ToString(), "");
                    objbelinfCte.emit.enderEmit.nro = dr["nro"].ToString();
                    objbelinfCte.emit.enderEmit.xCpl = dr["xCpl"].ToString();
                    objbelinfCte.emit.enderEmit.xBairro = Util.TiraSimbolo(dr["xBairro"].ToString(), "");
                    objbelinfCte.emit.enderEmit.UF = dr["UF"].ToString();
                    objbelinfCte.emit.enderEmit.xMun = Util.TiraSimbolo(dr["xMun"].ToString(), "");
                    objbelinfCte.emit.enderEmit.cMun = dr["cMun"].ToString();
                    objbelinfCte.emit.enderEmit.CEP = dr["CEP"].ToString() != "" ? Util.TiraSimbolo(dr["CEP"].ToString()) : "";
                    if (dr["fone"].ToString() != "")
                    {
                        objbelinfCte.emit.enderEmit.fone = Util.TiraSimbolo(dr["fone"].ToString());
                    }
                }


            }
            catch (Exception ex)
            {
                throw ex;
            }



        }
Пример #17
0
        public void PopulaDest(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosDest(sCte);
                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.dest = new beldest();
                    objbelinfCte.dest.enderDest = new belenderDest();


                    objbelinfCte.dest.CNPJ = Util.TiraSimbolo(dr["CNPJ"].ToString());
                    objbelinfCte.dest.CPF = Util.TiraSimbolo(dr["CPF"].ToString());
                    objbelinfCte.dest.IE = Util.TiraSimbolo(dr["IE"].ToString());
                    objbelinfCte.dest.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                    objbelinfCte.dest.fone = Util.TiraSimbolo(dr["fone"].ToString());
                    objbelinfCte.dest.ISUF = dr["ISUF"].ToString();

                    objbelinfCte.dest.enderDest.xLgr = Util.TiraSimbolo(dr["xLgr"].ToString(), "");
                    objbelinfCte.dest.enderDest.nro = dr["nro"].ToString();
                    objbelinfCte.dest.enderDest.xBairro = Util.TiraSimbolo(dr["xBairro"].ToString(), "");
                    objbelinfCte.dest.enderDest.xMun = Util.TiraSimbolo(dr["xMun"].ToString(), "");
                    objbelinfCte.dest.enderDest.UF = dr["UF"].ToString();
                    objbelinfCte.dest.enderDest.cMun = dr["cMun"].ToString();
                    objbelinfCte.dest.enderDest.CEP = Util.TiraSimbolo(dr["CEP"].ToString());
                    objbelinfCte.dest.enderDest.xPais = "Brasil";
                    objbelinfCte.dest.enderDest.cPais = "1058";

                }

            }
            catch (Exception ex)
            {
                throw ex;
            }



        }
Пример #18
0
        public void PopulaExped(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                string sCodRedes = BuscaDadosExped(sCte);

                if (sCodRedes != "")
                {
                    DataTable dt = BuscaDadosRedes(sCodRedes);


                    objbelinfCte.exped            = new belexped();
                    objbelinfCte.exped.enderExped = new belenderExped();
                    foreach (DataRow dr in dt.Rows)
                    {
                        objbelinfCte.ide.tpServ = 2;

                        objbelinfCte.exped.CNPJ               = Util.TiraSimbolo(dr["CNPJ"].ToString());
                        objbelinfCte.exped.CPF                = Util.TiraSimbolo(dr["CPF"].ToString());
                        objbelinfCte.exped.IE                 = Util.TiraSimbolo(dr["IE"].ToString());
                        objbelinfCte.exped.xNome              = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                        objbelinfCte.exped.fone               = Util.TiraSimbolo(dr["fone"].ToString());
                        objbelinfCte.exped.enderExped.xLgr    = Util.TiraSimbolo(dr["xLgr"].ToString(), "");
                        objbelinfCte.exped.enderExped.nro     = dr["nro"].ToString();
                        objbelinfCte.exped.enderExped.xBairro = Util.TiraSimbolo(dr["xBairro"].ToString(), "");
                        objbelinfCte.exped.enderExped.xMun    = Util.TiraSimbolo(dr["xMun"].ToString(), "");
                        objbelinfCte.exped.enderExped.CEP     = Util.TiraSimbolo(dr["CEP"].ToString());
                        objbelinfCte.exped.enderExped.UF      = dr["UF"].ToString();
                        objbelinfCte.exped.enderExped.cMun    = dr["cMun"].ToString();
                        objbelinfCte.exped.enderExped.xPais   = "Brasil";
                        objbelinfCte.exped.enderExped.cPais   = "1058";
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #19
0
        public void PopulainfQ(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosinfQ(sCte);

                if (objbelinfCte.infCTeNorm == null)
                {
                    objbelinfCte.infCTeNorm          = new belinfCTeNorm();
                    objbelinfCte.infCTeNorm.infCarga = new belinfCarga();
                }
                objbelinfCte.infCTeNorm.infCarga.infQ = new List <belinfQ>();

                foreach (DataRow dr in dt.Rows)
                {
                    //belinfQ objinfQ = new belinfQ();
                    //objinfQ.cUnid = dr["cUnid"].ToString();
                    //objinfQ.tpMed = dr["tpMed"].ToString();
                    //objinfQ.qCarga = Convert.ToDecimal(dr["qCarga"].ToString().Replace(".", ","));
                    //objbelinfCte.infCTeNorm.infCarga.infQ.Add(objinfQ);

                    belinfQ objinfQ = new belinfQ();
                    objinfQ.cUnid  = "00";
                    objinfQ.tpMed  = dr["tpMed"].ToString().ToUpper();
                    objinfQ.qCarga = Convert.ToDecimal(dr["qCarga_Volume"].ToString().Replace(".", ","));
                    objbelinfCte.infCTeNorm.infCarga.infQ.Add(objinfQ);

                    objinfQ        = new belinfQ();
                    objinfQ.cUnid  = dr["cUnid"].ToString();
                    objinfQ.tpMed  = "PESO";
                    objinfQ.qCarga = Convert.ToDecimal(dr["qCarga_Peso"].ToString().Replace(".", ","));
                    objbelinfCte.infCTeNorm.infCarga.infQ.Add(objinfQ);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #20
0
 public void PopulaMotorista(belinfCte objbelinfCte, string sCte)
 {
     try
     {
         if (objbelinfCte.infCTeNorm.rodo.veic.Count() > 0)
         {
             DataTable dt = BuscaDadosMotorista(objbelinfCte.ide.Motorista);
             if (objbelinfCte.infCTeNorm.rodo.lota == "1")
             {
                 objbelinfCte.infCTeNorm.rodo.moto = new belmoto();
             }
             foreach (DataRow dr in dt.Rows)
             {
                 objbelinfCte.infCTeNorm.rodo.moto       = new belmoto();
                 objbelinfCte.infCTeNorm.rodo.moto.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                 objbelinfCte.infCTeNorm.rodo.moto.CPF   = Util.TiraSimbolo(dr["CPF"].ToString());
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Пример #21
0
        public void PopulaRodo(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosRodo(sCte);


                objbelinfCte.infCTeNorm.seg  = new belseg();
                objbelinfCte.infCTeNorm.rodo = new belrodo();

                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.infCTeNorm.seg.respSeg = dr["respSeg"].ToString() != "" ? dr["respSeg"].ToString().Substring(0, 1) : "";
                    objbelinfCte.infCTeNorm.seg.nApol   = dr["nApol"].ToString() != "" ? Util.TiraSimbolo(dr["nApol"].ToString()) : "";
                    objbelinfCte.infCTeNorm.rodo.RNTRC  = dr["RNTRC"].ToString();
                    objbelinfCte.infCTeNorm.rodo.dPrev  = dr["dPrev"].ToString();
                    objbelinfCte.infCTeNorm.rodo.lota   = dr["lota"].ToString();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #22
0
        public void PopulaMotorista(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                if (objbelinfCte.infCTeNorm.rodo.veic.Count() > 0)
                {
                    DataTable dt = BuscaDadosMotorista(objbelinfCte.ide.Motorista);
                    if (objbelinfCte.infCTeNorm.rodo.lota == "1")
                    {
                        objbelinfCte.infCTeNorm.rodo.moto = new belmoto();
                    }
                    foreach (DataRow dr in dt.Rows)
                    {
                        objbelinfCte.infCTeNorm.rodo.moto = new belmoto();
                        objbelinfCte.infCTeNorm.rodo.moto.xNome = Util.TiraSimbolo(dr["xNome"].ToString(), "");
                        objbelinfCte.infCTeNorm.rodo.moto.CPF = Util.TiraSimbolo(dr["CPF"].ToString());
                    }
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }




        }
Пример #23
0
        public void PopulaIde(string sCte, string sDigVerif, belinfCte objbelinfCte, string sId)
        {
            try
            {
                DataTable dt = BuscaDadosPopulaIde(sCte);

                foreach (DataRow dr in dt.Rows)
                {


                    objbelinfCte.ide = new belide();
                    bel.belUF objbelUF = new bel.belUF();

                    objbelinfCte.id = sId;
                    objbelinfCte.ide.cUF = objbelUF.RetornaCUF(dr["cUF"].ToString());
                    objbelinfCte.ide.cCT = dr["cCT"].ToString();
                    objbelinfCte.ide.CFOP = dr["CFOP"].ToString();
                    objbelinfCte.ide.natOp = dr["natOp"].ToString().Length > 60 ? dr["natOp"].ToString().Substring(0, 60) : dr["natOp"].ToString();
                    objbelinfCte.ide.forPag = Convert.ToInt32(dr["forPag"]);
                    objbelinfCte.ide.mod = "57";
                    objbelinfCte.ide.serie = Acesso.TP_EMIS == 3 ? "900" : "1";
                    objbelinfCte.ide.nCT = dr["nCT"].ToString();
                    objbelinfCte.ide.tpImp = "1";
                    objbelinfCte.ide.tpEmis = Acesso.TP_EMIS != 1 ? "5" : "1";
                    objbelinfCte.ide.cDV = sDigVerif;
                    objbelinfCte.ide.tpAmb = Convert.ToString(Acesso.TP_AMB);
                    objbelinfCte.ide.tpCTe = 0;
                    objbelinfCte.ide.procEmi = 0;
                    objbelinfCte.ide.verProc = Acesso.versaoCTe;
                    objbelinfCte.ide.xMunEnv = dr["xMunEmi"].ToString();
                    objbelinfCte.ide.UFEnv = dr["UFEmi"].ToString();
                    objbelinfCte.ide.cMunEnv = RetornaCodigoCidade(objbelinfCte.ide.xMunEnv, objbelinfCte.ide.UFEnv);
                    objbelinfCte.ide.modal = "01";
                    objbelinfCte.ide.tpServ = 0;
                    objbelinfCte.ide.xMunIni = dr["xMunIni"].ToString();
                    objbelinfCte.ide.UFIni = dr["UFIni"].ToString();
                    objbelinfCte.ide.cMunIni = dr["cMunIni"].ToString();
                    objbelinfCte.ide.xMunFim = dr["xMunFim"].ToString();
                    objbelinfCte.ide.UFFim = dr["UFFim"].ToString();
                    objbelinfCte.ide.cMunFim = dr["cMunFim"].ToString();
                    objbelinfCte.ide.retira = 0;
                    objbelinfCte.ide.xDetRetira = null;
                    if (dr["Veiculo"].ToString() != "") { objbelinfCte.ide.Veiculo.Add(dr["Veiculo"].ToString()); }
                    if (dr["Veiculo2"].ToString() != "") { objbelinfCte.ide.Veiculo.Add(dr["Veiculo2"].ToString()); }
                    if (dr["Veiculo3"].ToString() != "") { objbelinfCte.ide.Veiculo.Add(dr["Veiculo3"].ToString()); }
                    if (dr["Veiculo4"].ToString() != "") { objbelinfCte.ide.Veiculo.Add(dr["Veiculo4"].ToString()); }

                    objbelinfCte.ide.Motorista = dr["Motorista"].ToString();

                    string sTipoTomador = dr["Tomador"].ToString();
                    switch (sTipoTomador)
                    {
                        case "R": objbelinfCte.ide.toma03 = new beltoma03();
                            objbelinfCte.ide.toma03.toma = "0";
                            break;

                        case "D": objbelinfCte.ide.toma03 = new beltoma03();
                            objbelinfCte.ide.toma03.toma = "3";
                            break;

                        default: objbelinfCte.ide.toma04 = new beltoma04();
                            objbelinfCte.ide.toma04.toma = "4";
                            break;
                    }
                }

            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
Пример #24
0
        public void PopulaIde(string sCte, string sDigVerif, belinfCte objbelinfCte, string sId)
        {
            try
            {
                DataTable dt = BuscaDadosPopulaIde(sCte);

                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.ide = new belide();
                    bel.belUF objbelUF = new bel.belUF();

                    objbelinfCte.id             = sId;
                    objbelinfCte.ide.cUF        = objbelUF.RetornaCUF(dr["cUF"].ToString());
                    objbelinfCte.ide.cCT        = dr["cCT"].ToString();
                    objbelinfCte.ide.CFOP       = dr["CFOP"].ToString();
                    objbelinfCte.ide.natOp      = dr["natOp"].ToString().Length > 60 ? dr["natOp"].ToString().Substring(0, 60) : dr["natOp"].ToString();
                    objbelinfCte.ide.forPag     = Convert.ToInt32(dr["forPag"]);
                    objbelinfCte.ide.mod        = "57";
                    objbelinfCte.ide.serie      = Acesso.TP_EMIS == 3 ? "900" : "1";
                    objbelinfCte.ide.nCT        = dr["nCT"].ToString();
                    objbelinfCte.ide.tpImp      = "1";
                    objbelinfCte.ide.tpEmis     = Acesso.TP_EMIS != 1 ? "5" : "1";
                    objbelinfCte.ide.cDV        = sDigVerif;
                    objbelinfCte.ide.tpAmb      = Convert.ToString(Acesso.TP_AMB);
                    objbelinfCte.ide.tpCTe      = 0;
                    objbelinfCte.ide.procEmi    = 0;
                    objbelinfCte.ide.verProc    = Acesso.versaoCTe;
                    objbelinfCte.ide.xMunEnv    = dr["xMunEmi"].ToString();
                    objbelinfCte.ide.UFEnv      = dr["UFEmi"].ToString();
                    objbelinfCte.ide.cMunEnv    = RetornaCodigoCidade(objbelinfCte.ide.xMunEnv, objbelinfCte.ide.UFEnv);
                    objbelinfCte.ide.modal      = "01";
                    objbelinfCte.ide.tpServ     = 0;
                    objbelinfCte.ide.xMunIni    = dr["xMunIni"].ToString();
                    objbelinfCte.ide.UFIni      = dr["UFIni"].ToString();
                    objbelinfCte.ide.cMunIni    = dr["cMunIni"].ToString();
                    objbelinfCte.ide.xMunFim    = dr["xMunFim"].ToString();
                    objbelinfCte.ide.UFFim      = dr["UFFim"].ToString();
                    objbelinfCte.ide.cMunFim    = dr["cMunFim"].ToString();
                    objbelinfCte.ide.retira     = 0;
                    objbelinfCte.ide.xDetRetira = null;
                    if (dr["Veiculo"].ToString() != "")
                    {
                        objbelinfCte.ide.Veiculo.Add(dr["Veiculo"].ToString());
                    }
                    if (dr["Veiculo2"].ToString() != "")
                    {
                        objbelinfCte.ide.Veiculo.Add(dr["Veiculo2"].ToString());
                    }
                    if (dr["Veiculo3"].ToString() != "")
                    {
                        objbelinfCte.ide.Veiculo.Add(dr["Veiculo3"].ToString());
                    }
                    if (dr["Veiculo4"].ToString() != "")
                    {
                        objbelinfCte.ide.Veiculo.Add(dr["Veiculo4"].ToString());
                    }

                    objbelinfCte.ide.Motorista = dr["Motorista"].ToString();

                    string sTipoTomador = dr["Tomador"].ToString();
                    switch (sTipoTomador)
                    {
                    case "R": objbelinfCte.ide.toma03 = new beltoma03();
                        objbelinfCte.ide.toma03.toma  = "0";
                        break;

                    case "D": objbelinfCte.ide.toma03 = new beltoma03();
                        objbelinfCte.ide.toma03.toma  = "3";
                        break;

                    default: objbelinfCte.ide.toma04 = new beltoma04();
                        objbelinfCte.ide.toma04.toma = "4";
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #25
0
        public void PopulaVPrest(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosVPrest(sCte);

                objbelinfCte.vPrest = new belvPrest();
                objbelinfCte.vPrest.Comp = new List<belComp>();

                foreach (DataRow dr in dt.Rows)
                {

                    objbelinfCte.vPrest.vTPrest = dr["vTPrest"].ToString();
                    objbelinfCte.vPrest.vRec = dr["vTPrest"].ToString();

                    belComp Comp = new belComp();

                    if (dr["vl_gris"].ToString() != "0.00")
                    {
                        if (Convert.ToDecimal(dr["vl_gris"].ToString()) > 0)
                        {
                            Comp = new belComp();
                            Comp.xNome = "GRIS";
                            Comp.vComp = dr["vl_gris"].ToString();
                            objbelinfCte.vPrest.Comp.Add(Comp);
                        }
                    }
                    if (dr["vl_vladic"].ToString() != "0.00")
                    {
                        if (Convert.ToDecimal(dr["vl_vladic"].ToString()) > 0)
                        {
                            Comp = new belComp();
                            Comp.xNome = "VALOR ADICIONAL";
                            Comp.vComp = dr["vl_vladic"].ToString();
                            objbelinfCte.vPrest.Comp.Add(Comp);
                        }
                    }


                    if (dr["FRETEVALOR"].ToString() != "0.00")
                    {
                        Comp = new belComp();
                        Comp.xNome = "FRETE VALOR";
                        Comp.vComp = dr["FRETEVALOR"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["FRETECUBAGEM"].ToString() != "0.00")
                    {
                        Comp = new belComp();
                        Comp.xNome = "FRETE CUBAGEM";
                        Comp.vComp = dr["FRETECUBAGEM"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["FRETEPESO"].ToString() != "0.00")
                    {
                        Comp = new belComp();
                        Comp.xNome = "FRETE PESO";
                        Comp.vComp = dr["FRETEPESO"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["CAT"].ToString() != "0.00")
                    {
                        Comp = new belComp();
                        Comp.xNome = "CAT";
                        Comp.vComp = dr["CAT"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["DESPACHO"].ToString() != "0.00")
                    {
                        Comp = new belComp();
                        Comp.xNome = "DESPACHO";
                        Comp.vComp = dr["DESPACHO"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["PEDAGIO"].ToString() != "0.00")
                    {
                        Comp = new belComp();
                        Comp.xNome = "PEDAGIO";
                        Comp.vComp = dr["PEDAGIO"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["OUTROS"].ToString() != "0.00")
                    {
                        Comp = new belComp();
                        Comp.xNome = "OUTROS";
                        Comp.vComp = dr["OUTROS"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["ADME"].ToString() != "0.00")
                    {
                        Comp = new belComp();
                        Comp.xNome = "ADME";
                        Comp.vComp = dr["ADME"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["ENTREGA"].ToString() != "0.00")
                    {
                        Comp = new belComp();
                        Comp.xNome = "ENTREGA";
                        Comp.vComp = dr["ENTREGA"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

        }
Пример #26
0
        public void PopulaNf(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosNf(sCte);
                //objbelinfCte.infCTeNorm = new belinfCTeNorm();
                foreach (DataRow dr in dt.Rows)
                {
                    switch (dr["Tipo"].ToString())
                    {
                        case "N":
                            belinfNF infNf = new belinfNF();
                            infNf.mod = dr["mod"].ToString();
                            infNf.serie = dr["serie"].ToString();
                            infNf.nDoc = dr["nDoc"].ToString();
                            infNf.dEmi = dr["dEmi"].ToString() != "" ? (Convert.ToDateTime(dr["dEmi"].ToString())).ToString("dd/MM/yyyy") : "";
                            infNf.vBC = dr["vBC"].ToString() != "" ? dr["vBC"].ToString().Replace(",", ".") : "0.00";
                            infNf.vICMS = dr["vICMS"].ToString() != "" ? dr["vICMS"].ToString().Replace(",", ".") : "0.00";
                            infNf.vBCST = dr["vBCST"].ToString() != "" ? dr["vBCST"].ToString().Replace(",", ".") : "0.00";
                            infNf.vST = dr["vST"].ToString() != "" ? dr["vST"].ToString().Replace(",", ".") : "0.00";
                            infNf.vProd = dr["vProd"].ToString() != "" ? dr["vProd"].ToString().Replace(",", ".") : "0.00";
                            infNf.vNF = dr["vProd"].ToString() != "" ? dr["vProd"].ToString().Replace(",", ".") : "0.00";
                            infNf.nCFOP = dr["nCFOP"].ToString() != "" ? Convert.ToInt32(dr["nCFOP"]).ToString() : "0";

                            objbelinfCte.infCTeNorm.infDoc.infNF.Add(infNf);
                            break;

                        case "E":
                            belinfNFe infNfe = new belinfNFe();
                            infNfe.chave = dr["chave"].ToString();
                            infNfe.nDoc = dr["nDoc"].ToString();
                            objbelinfCte.infCTeNorm.infDoc.infNFe.Add(infNfe);
                            break;

                        case "00":
                            belinfOutros infDeclaracao = new belinfOutros();
                            infDeclaracao.tpDoc = "00";
                            infDeclaracao.nDoc = dr["nDoc"].ToString();
                            infDeclaracao.dEmi = dr["dEmi"].ToString() != "" ? (Convert.ToDateTime(dr["dEmi"].ToString())).ToString("dd/MM/yyyy") : "";
                            infDeclaracao.vDocFisc = dr["vProd"].ToString() != "" ? dr["vProd"].ToString().Replace(",", ".") : "0.00";

                            objbelinfCte.infCTeNorm.infDoc.infOutros.Add(infDeclaracao);
                            break;

                        case "10":
                            belinfOutros infDutoviario = new belinfOutros();
                            infDutoviario.tpDoc = "00";
                            infDutoviario.nDoc = dr["nDoc"].ToString();
                            infDutoviario.dEmi = dr["dEmi"].ToString() != "" ? (Convert.ToDateTime(dr["dEmi"].ToString())).ToString("dd/MM/yyyy") : "";
                            infDutoviario.vDocFisc = dr["vProd"].ToString() != "" ? dr["vProd"].ToString().Replace(",", ".") : "0.00";

                            objbelinfCte.infCTeNorm.infDoc.infOutros.Add(infDutoviario);
                            break;

                        case "99":
                            belinfOutros infOutros = new belinfOutros();
                            infOutros.tpDoc = "99";
                            infOutros.descOutros = dr["descOutros"].ToString();
                            infOutros.nDoc = dr["nDoc"].ToString();
                            infOutros.dEmi = dr["dEmi"].ToString() != "" ? (Convert.ToDateTime(dr["dEmi"].ToString())).ToString("dd/MM/yyyy") : "";
                            infOutros.vDocFisc = dr["vProd"].ToString() != "" ? dr["vProd"].ToString().Replace(",", ".") : "0.00";

                            objbelinfCte.infCTeNorm.infDoc.infOutros.Add(infOutros);
                            break;

                        default:
                            throw new Exception("A nota " + dr["nDoc"].ToString() + " do Conhecimento " + objbelinfCte.ide.nCT + " não tem Tipo selecionado(NF, NF-e, Declaração, Dutoviário, Outros)");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #27
0
        public void PopulaImp(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosImp(sCte);
                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.imp      = new belimp();
                    objbelinfCte.imp.ICMS = new belICMS();
                    switch (dr["CST"].ToString())
                    {
                    case "000":
                        objbelinfCte.imp.ICMS.ICMS00       = new belICMS00();
                        objbelinfCte.imp.ICMS.ICMS00.CST   = "00";
                        objbelinfCte.imp.ICMS.ICMS00.vBC   = dr["vBC"].ToString().Replace(",", ".");
                        objbelinfCte.imp.ICMS.ICMS00.pICMS = dr["pICMS"].ToString().Replace(",", ".");
                        objbelinfCte.imp.ICMS.ICMS00.vICMS = dr["vICMS"].ToString().Replace(",", ".");
                        break;

                    case "020":
                        objbelinfCte.imp.ICMS.ICMS20        = new belICMS20();
                        objbelinfCte.imp.ICMS.ICMS20.CST    = "20";
                        objbelinfCte.imp.ICMS.ICMS20.pRedBC = dr["pRedBC"].ToString().Replace(",", ".");
                        objbelinfCte.imp.ICMS.ICMS20.vBC    = dr["vBC"].ToString().Replace(",", ".");
                        objbelinfCte.imp.ICMS.ICMS20.pICMS  = dr["pICMS"].ToString().Replace(",", ".");
                        objbelinfCte.imp.ICMS.ICMS20.vICMS  = dr["vICMS"].ToString().Replace(",", ".");
                        break;

                    case "040":
                        PopulaCst45(objbelinfCte, "40");
                        break;

                    case "041":
                        PopulaCst45(objbelinfCte, "41");
                        break;

                    case "051":
                        PopulaCst45(objbelinfCte, "51");
                        break;

                    case "060":
                        objbelinfCte.imp.ICMS.ICMS60            = new belICMS60();
                        objbelinfCte.imp.ICMS.ICMS60.CST        = "60";
                        objbelinfCte.imp.ICMS.ICMS60.vBCSTRet   = dr["vBC"].ToString().Replace(",", ".");
                        objbelinfCte.imp.ICMS.ICMS60.vICMSSTRet = dr["vICMS"].ToString().Replace(",", ".");
                        objbelinfCte.imp.ICMS.ICMS60.pICMSSTRet = dr["pICMS"].ToString().Replace(",", ".");

                        break;


                    case "090":
                        objbelinfCte.imp.ICMS               = new belICMS();
                        objbelinfCte.imp.ICMS.ICMS90        = new belICMS90();
                        objbelinfCte.imp.ICMS.ICMS90.CST    = "90";
                        objbelinfCte.imp.ICMS.ICMS90.pRedBC = dr["pRedBC"].ToString().Replace(",", ".");
                        objbelinfCte.imp.ICMS.ICMS90.vBC    = dr["vBC"].ToString().Replace(",", ".");
                        objbelinfCte.imp.ICMS.ICMS90.pICMS  = dr["pICMS"].ToString().Replace(",", ".");
                        objbelinfCte.imp.ICMS.ICMS90.vICMS  = dr["vICMS"].ToString().Replace(",", ".");
                        break;


                    default:
                        throw new Exception("O Conhecimento " + objbelinfCte.ide.nCT + " não tem Situação Tributária Válida!");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #28
0
 private void PopulaCst45(belinfCte objbelinfCte, string CST)
 {
     objbelinfCte.imp.ICMS.ICMS45     = new belICMS45();
     objbelinfCte.imp.ICMS.ICMS45.CST = CST;
 }
Пример #29
0
        public void PopulaImp(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosImp(sCte);
                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.imp = new belimp();
                    objbelinfCte.imp.ICMS = new belICMS();
                    switch (dr["CST"].ToString())
                    {
                        case "000":
                            objbelinfCte.imp.ICMS.ICMS00 = new belICMS00();
                            objbelinfCte.imp.ICMS.ICMS00.CST = "00";
                            objbelinfCte.imp.ICMS.ICMS00.vBC = dr["vBC"].ToString().Replace(",", ".");
                            objbelinfCte.imp.ICMS.ICMS00.pICMS = dr["pICMS"].ToString().Replace(",", ".");
                            objbelinfCte.imp.ICMS.ICMS00.vICMS = dr["vICMS"].ToString().Replace(",", ".");
                            break;

                        case "020":
                            objbelinfCte.imp.ICMS.ICMS20 = new belICMS20();
                            objbelinfCte.imp.ICMS.ICMS20.CST = "20";
                            objbelinfCte.imp.ICMS.ICMS20.pRedBC = dr["pRedBC"].ToString().Replace(",", ".");
                            objbelinfCte.imp.ICMS.ICMS20.vBC = dr["vBC"].ToString().Replace(",", ".");
                            objbelinfCte.imp.ICMS.ICMS20.pICMS = dr["pICMS"].ToString().Replace(",", ".");
                            objbelinfCte.imp.ICMS.ICMS20.vICMS = dr["vICMS"].ToString().Replace(",", ".");
                            break;

                        case "040":
                            PopulaCst45(objbelinfCte, "40");
                            break;

                        case "041":
                            PopulaCst45(objbelinfCte, "41");
                            break;

                        case "051":
                            PopulaCst45(objbelinfCte, "51");
                            break;

                        case "060":
                            objbelinfCte.imp.ICMS.ICMS60 = new belICMS60();
                            objbelinfCte.imp.ICMS.ICMS60.CST = "60";
                            objbelinfCte.imp.ICMS.ICMS60.vBCSTRet = dr["vBC"].ToString().Replace(",", ".");
                            objbelinfCte.imp.ICMS.ICMS60.vICMSSTRet = dr["vICMS"].ToString().Replace(",", ".");
                            objbelinfCte.imp.ICMS.ICMS60.pICMSSTRet = dr["pICMS"].ToString().Replace(",", ".");

                            break;


                        case "090":
                            objbelinfCte.imp.ICMS = new belICMS();
                            objbelinfCte.imp.ICMS.ICMS90 = new belICMS90();
                            objbelinfCte.imp.ICMS.ICMS90.CST = "90";
                            objbelinfCte.imp.ICMS.ICMS90.pRedBC = dr["pRedBC"].ToString().Replace(",", ".");
                            objbelinfCte.imp.ICMS.ICMS90.vBC = dr["vBC"].ToString().Replace(",", ".");
                            objbelinfCte.imp.ICMS.ICMS90.pICMS = dr["pICMS"].ToString().Replace(",", ".");
                            objbelinfCte.imp.ICMS.ICMS90.vICMS = dr["vICMS"].ToString().Replace(",", ".");
                            break;


                        default:
                            throw new Exception("O Conhecimento " + objbelinfCte.ide.nCT + " não tem Situação Tributária Válida!");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #30
0
        public void PopulaNf(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosNf(sCte);
                //objbelinfCte.infCTeNorm = new belinfCTeNorm();
                foreach (DataRow dr in dt.Rows)
                {
                    switch (dr["Tipo"].ToString())
                    {
                    case "N":
                        belinfNF infNf = new belinfNF();
                        infNf.mod   = dr["mod"].ToString();
                        infNf.serie = dr["serie"].ToString();
                        infNf.nDoc  = dr["nDoc"].ToString();
                        infNf.dEmi  = dr["dEmi"].ToString() != "" ? (Convert.ToDateTime(dr["dEmi"].ToString())).ToString("dd/MM/yyyy") : "";
                        infNf.vBC   = dr["vBC"].ToString() != "" ? dr["vBC"].ToString().Replace(",", ".") : "0.00";
                        infNf.vICMS = dr["vICMS"].ToString() != "" ? dr["vICMS"].ToString().Replace(",", ".") : "0.00";
                        infNf.vBCST = dr["vBCST"].ToString() != "" ? dr["vBCST"].ToString().Replace(",", ".") : "0.00";
                        infNf.vST   = dr["vST"].ToString() != "" ? dr["vST"].ToString().Replace(",", ".") : "0.00";
                        infNf.vProd = dr["vProd"].ToString() != "" ? dr["vProd"].ToString().Replace(",", ".") : "0.00";
                        infNf.vNF   = dr["vProd"].ToString() != "" ? dr["vProd"].ToString().Replace(",", ".") : "0.00";
                        infNf.nCFOP = dr["nCFOP"].ToString() != "" ? Convert.ToInt32(dr["nCFOP"]).ToString() : "0";

                        objbelinfCte.infCTeNorm.infDoc.infNF.Add(infNf);
                        break;

                    case "E":
                        belinfNFe infNfe = new belinfNFe();
                        infNfe.chave = dr["chave"].ToString();
                        infNfe.nDoc  = dr["nDoc"].ToString();
                        objbelinfCte.infCTeNorm.infDoc.infNFe.Add(infNfe);
                        break;

                    case "00":
                        belinfOutros infDeclaracao = new belinfOutros();
                        infDeclaracao.tpDoc    = "00";
                        infDeclaracao.nDoc     = dr["nDoc"].ToString();
                        infDeclaracao.dEmi     = dr["dEmi"].ToString() != "" ? (Convert.ToDateTime(dr["dEmi"].ToString())).ToString("dd/MM/yyyy") : "";
                        infDeclaracao.vDocFisc = dr["vProd"].ToString() != "" ? dr["vProd"].ToString().Replace(",", ".") : "0.00";

                        objbelinfCte.infCTeNorm.infDoc.infOutros.Add(infDeclaracao);
                        break;

                    case "10":
                        belinfOutros infDutoviario = new belinfOutros();
                        infDutoviario.tpDoc    = "00";
                        infDutoviario.nDoc     = dr["nDoc"].ToString();
                        infDutoviario.dEmi     = dr["dEmi"].ToString() != "" ? (Convert.ToDateTime(dr["dEmi"].ToString())).ToString("dd/MM/yyyy") : "";
                        infDutoviario.vDocFisc = dr["vProd"].ToString() != "" ? dr["vProd"].ToString().Replace(",", ".") : "0.00";

                        objbelinfCte.infCTeNorm.infDoc.infOutros.Add(infDutoviario);
                        break;

                    case "99":
                        belinfOutros infOutros = new belinfOutros();
                        infOutros.tpDoc      = "99";
                        infOutros.descOutros = dr["descOutros"].ToString();
                        infOutros.nDoc       = dr["nDoc"].ToString();
                        infOutros.dEmi       = dr["dEmi"].ToString() != "" ? (Convert.ToDateTime(dr["dEmi"].ToString())).ToString("dd/MM/yyyy") : "";
                        infOutros.vDocFisc   = dr["vProd"].ToString() != "" ? dr["vProd"].ToString().Replace(",", ".") : "0.00";

                        objbelinfCte.infCTeNorm.infDoc.infOutros.Add(infOutros);
                        break;

                    default:
                        throw new Exception("A nota " + dr["nDoc"].ToString() + " do Conhecimento " + objbelinfCte.ide.nCT + " não tem Tipo selecionado(NF, NF-e, Declaração, Dutoviário, Outros)");
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #31
0
        public void PopulaVPrest(belinfCte objbelinfCte, string sCte)
        {
            try
            {
                DataTable dt = BuscaDadosVPrest(sCte);

                objbelinfCte.vPrest      = new belvPrest();
                objbelinfCte.vPrest.Comp = new List <belComp>();

                foreach (DataRow dr in dt.Rows)
                {
                    objbelinfCte.vPrest.vTPrest = dr["vTPrest"].ToString();
                    objbelinfCte.vPrest.vRec    = dr["vTPrest"].ToString();

                    belComp Comp = new belComp();

                    if (dr["vl_gris"].ToString() != "0.00")
                    {
                        if (Convert.ToDecimal(dr["vl_gris"].ToString()) > 0)
                        {
                            Comp       = new belComp();
                            Comp.xNome = "GRIS";
                            Comp.vComp = dr["vl_gris"].ToString();
                            objbelinfCte.vPrest.Comp.Add(Comp);
                        }
                    }
                    if (dr["vl_vladic"].ToString() != "0.00")
                    {
                        if (Convert.ToDecimal(dr["vl_vladic"].ToString()) > 0)
                        {
                            Comp       = new belComp();
                            Comp.xNome = "VALOR ADICIONAL";
                            Comp.vComp = dr["vl_vladic"].ToString();
                            objbelinfCte.vPrest.Comp.Add(Comp);
                        }
                    }


                    if (dr["FRETEVALOR"].ToString() != "0.00")
                    {
                        Comp       = new belComp();
                        Comp.xNome = "FRETE VALOR";
                        Comp.vComp = dr["FRETEVALOR"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["FRETECUBAGEM"].ToString() != "0.00")
                    {
                        Comp       = new belComp();
                        Comp.xNome = "FRETE CUBAGEM";
                        Comp.vComp = dr["FRETECUBAGEM"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["FRETEPESO"].ToString() != "0.00")
                    {
                        Comp       = new belComp();
                        Comp.xNome = "FRETE PESO";
                        Comp.vComp = dr["FRETEPESO"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["CAT"].ToString() != "0.00")
                    {
                        Comp       = new belComp();
                        Comp.xNome = "CAT";
                        Comp.vComp = dr["CAT"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["DESPACHO"].ToString() != "0.00")
                    {
                        Comp       = new belComp();
                        Comp.xNome = "DESPACHO";
                        Comp.vComp = dr["DESPACHO"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["PEDAGIO"].ToString() != "0.00")
                    {
                        Comp       = new belComp();
                        Comp.xNome = "PEDAGIO";
                        Comp.vComp = dr["PEDAGIO"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["OUTROS"].ToString() != "0.00")
                    {
                        Comp       = new belComp();
                        Comp.xNome = "OUTROS";
                        Comp.vComp = dr["OUTROS"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["ADME"].ToString() != "0.00")
                    {
                        Comp       = new belComp();
                        Comp.xNome = "ADME";
                        Comp.vComp = dr["ADME"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                    if (dr["ENTREGA"].ToString() != "0.00")
                    {
                        Comp       = new belComp();
                        Comp.xNome = "ENTREGA";
                        Comp.vComp = dr["ENTREGA"].ToString();
                        objbelinfCte.vPrest.Comp.Add(Comp);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Пример #32
0
 private void PopulaCst45(belinfCte objbelinfCte, string CST)
 {
     objbelinfCte.imp.ICMS.ICMS45 = new belICMS45();
     objbelinfCte.imp.ICMS.ICMS45.CST = CST;
 }
Пример #33
0
        private void CriaObjAlter()
        {
            try
            {
                List<belinfCte> objList = new List<belinfCte>();

                for (int i = 0; i < this.objObjetos.objListaConhecimentos.Count; i++)
                {
                    belinfCte objbelinfCte = new belinfCte();
                    belinfCte obj = this.objObjetos.objListaConhecimentos[i];

                    #region Identificacao
                    objbelinfCte.id = obj.id;
                    objbelinfCte.ide = new belide();

                    objbelinfCte.ide.cUF = obj.ide.cUF;
                    objbelinfCte.ide.cCT = obj.ide.cCT;
                    objbelinfCte.ide.CFOP = obj.ide.CFOP;
                    objbelinfCte.ide.natOp = obj.ide.natOp;
                    objbelinfCte.ide.forPag = obj.ide.forPag;
                    objbelinfCte.ide.mod = obj.ide.mod;
                    objbelinfCte.ide.serie = obj.ide.serie;
                    objbelinfCte.ide.nCT = obj.ide.nCT;
                    objbelinfCte.ide.tpImp = obj.ide.tpImp;
                    objbelinfCte.ide.tpEmis = obj.ide.tpEmis;
                    objbelinfCte.ide.cDV = obj.ide.cDV;
                    objbelinfCte.ide.tpAmb = obj.ide.tpAmb;
                    objbelinfCte.ide.tpCTe = obj.ide.tpCTe;
                    objbelinfCte.ide.procEmi = obj.ide.procEmi;
                    objbelinfCte.ide.verProc = obj.ide.verProc;
                    objbelinfCte.ide.cMunEnv = obj.ide.cMunEnv;
                    objbelinfCte.ide.xMunEnv = obj.ide.xMunEnv;
                    objbelinfCte.ide.UFEnv = obj.ide.UFEnv;
                    objbelinfCte.ide.modal = obj.ide.modal;
                    objbelinfCte.ide.tpServ = obj.ide.tpServ;
                    objbelinfCte.ide.cMunIni = obj.ide.cMunIni;
                    objbelinfCte.ide.xMunIni = obj.ide.xMunIni;
                    objbelinfCte.ide.UFIni = obj.ide.UFIni;
                    objbelinfCte.ide.cMunFim = obj.ide.cMunFim;
                    objbelinfCte.ide.xMunFim = obj.ide.xMunFim;
                    objbelinfCte.ide.UFFim = obj.ide.UFFim;
                    objbelinfCte.ide.retira = obj.ide.retira;
                    objbelinfCte.ide.xDetRetira = obj.ide.xDetRetira;

                    #endregion

                    #region Tomador
                    if (obj.ide.toma03 != null)
                    {
                        objbelinfCte.ide.toma03 = new beltoma03();
                        objbelinfCte.ide.toma03.toma = obj.ide.toma03.toma;
                    }
                    else if (obj.ide.toma04 != null)
                    {
                        objbelinfCte.ide.toma04 = new beltoma04();
                        objbelinfCte.ide.toma04.toma = obj.ide.toma04.toma;
                        objbelinfCte.ide.toma04.CNPJ = obj.ide.toma04.CNPJ;
                        objbelinfCte.ide.toma04.CPF = obj.ide.toma04.CPF;
                        objbelinfCte.ide.toma04.IE = obj.ide.toma04.IE;
                        objbelinfCte.ide.toma04.xNome = obj.ide.toma04.xNome;
                        objbelinfCte.ide.toma04.xFant = obj.ide.toma04.xFant;
                        objbelinfCte.ide.toma04.fone = obj.ide.toma04.fone;

                        objbelinfCte.ide.toma04.enderToma = new belenderToma();
                        objbelinfCte.ide.toma04.enderToma.xLgr = obj.ide.toma04.enderToma.xLgr;
                        objbelinfCte.ide.toma04.enderToma.nro = obj.ide.toma04.enderToma.nro;
                        objbelinfCte.ide.toma04.enderToma.xCpl = obj.ide.toma04.enderToma.xCpl;
                        objbelinfCte.ide.toma04.enderToma.xBairro = obj.ide.toma04.enderToma.xBairro;
                        objbelinfCte.ide.toma04.enderToma.cMun = obj.ide.toma04.enderToma.cMun;
                        objbelinfCte.ide.toma04.enderToma.xMun = obj.ide.toma04.enderToma.xMun;
                        objbelinfCte.ide.toma04.enderToma.CEP = obj.ide.toma04.enderToma.CEP;
                        objbelinfCte.ide.toma04.enderToma.UF = obj.ide.toma04.enderToma.UF;
                        objbelinfCte.ide.toma04.enderToma.cPais = obj.ide.toma04.enderToma.cPais;
                        objbelinfCte.ide.toma04.enderToma.xPais = obj.ide.toma04.enderToma.xPais;

                    }

                    #endregion

                    #region Emitente
                    objbelinfCte.emit = new belemit();

                    objbelinfCte.emit.CNPJ = obj.emit.CNPJ;
                    objbelinfCte.emit.IE = obj.emit.IE;
                    objbelinfCte.emit.xNome = obj.emit.xNome;
                    objbelinfCte.emit.xFant = obj.emit.xFant;

                    objbelinfCte.emit.enderEmit = new belenderEmit();

                    objbelinfCte.emit.enderEmit.xLgr = obj.emit.enderEmit.xLgr;
                    objbelinfCte.emit.enderEmit.nro = obj.emit.enderEmit.nro;
                    objbelinfCte.emit.enderEmit.xCpl = obj.emit.enderEmit.xCpl;
                    objbelinfCte.emit.enderEmit.xBairro = obj.emit.enderEmit.xBairro;
                    objbelinfCte.emit.enderEmit.cMun = obj.emit.enderEmit.cMun;
                    objbelinfCte.emit.enderEmit.xMun = obj.emit.enderEmit.xMun;
                    objbelinfCte.emit.enderEmit.CEP = obj.emit.enderEmit.CEP;
                    objbelinfCte.emit.enderEmit.UF = obj.emit.enderEmit.UF;
                    objbelinfCte.emit.enderEmit.fone = obj.emit.enderEmit.fone;

                    #endregion

                    #region Remetente
                    objbelinfCte.rem = new belrem();

                    objbelinfCte.rem.CNPJ = obj.rem.CNPJ;
                    objbelinfCte.rem.CPF = obj.rem.CPF;
                    objbelinfCte.rem.IE = obj.rem.IE;
                    objbelinfCte.rem.xNome = obj.rem.xNome;
                    objbelinfCte.rem.xFant = obj.rem.xFant;
                    objbelinfCte.rem.fone = obj.rem.fone;

                    objbelinfCte.rem.enderReme = new belenderReme();

                    objbelinfCte.rem.enderReme.xLgr = obj.rem.enderReme.xLgr;
                    objbelinfCte.rem.enderReme.nro = obj.rem.enderReme.nro;
                    objbelinfCte.rem.enderReme.xCpl = obj.rem.enderReme.xCpl;
                    objbelinfCte.rem.enderReme.xBairro = obj.rem.enderReme.xBairro;
                    objbelinfCte.rem.enderReme.cMun = obj.rem.enderReme.cMun;
                    objbelinfCte.rem.enderReme.xMun = obj.rem.enderReme.xMun;
                    try
                    {
                        objbelinfCte.rem.enderReme.CEP = obj.rem.enderReme.CEP;
                    }
                    catch (Exception)
                    {
                    }
                    
                    objbelinfCte.rem.enderReme.UF = obj.rem.enderReme.UF;
                    objbelinfCte.rem.enderReme.xPais = obj.rem.enderReme.xPais;
                    objbelinfCte.rem.enderReme.cPais = obj.rem.enderReme.cPais;

                    #endregion

                    #region Destinatario

                    objbelinfCte.dest = new beldest();

                    objbelinfCte.dest.CNPJ = obj.dest.CNPJ;
                    objbelinfCte.dest.CPF = obj.dest.CPF;
                    objbelinfCte.dest.IE = obj.dest.IE;
                    objbelinfCte.dest.xNome = obj.dest.xNome;
                    objbelinfCte.dest.fone = obj.dest.fone;
                    objbelinfCte.dest.ISUF = obj.dest.ISUF;

                    objbelinfCte.dest.enderDest = new belenderDest();

                    objbelinfCte.dest.enderDest.xLgr = obj.dest.enderDest.xLgr;
                    objbelinfCte.dest.enderDest.nro = obj.dest.enderDest.nro;
                    objbelinfCte.dest.enderDest.xCpl = obj.dest.enderDest.xCpl;
                    objbelinfCte.dest.enderDest.xBairro = obj.dest.enderDest.xBairro;
                    objbelinfCte.dest.enderDest.cMun = obj.dest.enderDest.cMun;
                    objbelinfCte.dest.enderDest.xMun = obj.dest.enderDest.xMun;
                    objbelinfCte.dest.enderDest.CEP = obj.dest.enderDest.CEP;
                    objbelinfCte.dest.enderDest.UF = obj.dest.enderDest.UF;
                    objbelinfCte.dest.enderDest.xPais = obj.dest.enderDest.xPais;
                    objbelinfCte.dest.enderDest.cPais = obj.dest.enderDest.cPais;

                    #endregion

                    #region Expedidor
                    if (obj.exped != null)
                    {
                        objbelinfCte.exped = new belexped();

                        objbelinfCte.exped.CNPJ = obj.exped.CNPJ;
                        objbelinfCte.exped.CPF = obj.exped.CPF;
                        objbelinfCte.exped.IE = obj.exped.IE;
                        objbelinfCte.exped.xNome = obj.exped.xNome;
                        objbelinfCte.exped.fone = obj.exped.fone;

                        objbelinfCte.exped.enderExped = new belenderExped();

                        objbelinfCte.exped.enderExped.xLgr = obj.exped.enderExped.xLgr;
                        objbelinfCte.exped.enderExped.nro = obj.exped.enderExped.nro;
                        objbelinfCte.exped.enderExped.xCpl = obj.exped.enderExped.xCpl;
                        objbelinfCte.exped.enderExped.xBairro = obj.exped.enderExped.xBairro;
                        objbelinfCte.exped.enderExped.cMun = obj.exped.enderExped.cMun;
                        objbelinfCte.exped.enderExped.xMun = obj.exped.enderExped.xMun;
                        objbelinfCte.exped.enderExped.CEP = obj.exped.enderExped.CEP;
                        objbelinfCte.exped.enderExped.UF = obj.exped.enderExped.UF;
                        objbelinfCte.exped.enderExped.xPais = obj.exped.enderExped.xPais;
                        objbelinfCte.exped.enderExped.cPais = obj.exped.enderExped.cPais;


                    }


                    #endregion

                    #region Recebedor
                    if (obj.receb != null)
                    {
                        objbelinfCte.receb = new belreceb();

                        objbelinfCte.receb.CNPJ = obj.receb.CNPJ;
                        objbelinfCte.receb.CPF = obj.receb.CPF;
                        objbelinfCte.receb.IE = obj.receb.IE;
                        objbelinfCte.receb.xNome = obj.receb.xNome;
                        objbelinfCte.receb.fone = obj.receb.fone;

                        objbelinfCte.receb.enderReceb = new belenderReceb();

                        objbelinfCte.receb.enderReceb.xLgr = obj.receb.enderReceb.xLgr;
                        objbelinfCte.receb.enderReceb.nro = obj.receb.enderReceb.nro;
                        objbelinfCte.receb.enderReceb.xCpl = obj.receb.enderReceb.xCpl;
                        objbelinfCte.receb.enderReceb.xBairro = obj.receb.enderReceb.xBairro;
                        objbelinfCte.receb.enderReceb.cMun = obj.receb.enderReceb.cMun;
                        objbelinfCte.receb.enderReceb.xMun = obj.receb.enderReceb.xMun;
                        objbelinfCte.receb.enderReceb.CEP = obj.receb.enderReceb.CEP;
                        objbelinfCte.receb.enderReceb.UF = obj.receb.enderReceb.UF;
                        objbelinfCte.receb.enderReceb.xPais = obj.receb.enderReceb.xPais;
                        objbelinfCte.receb.enderReceb.cPais = obj.receb.enderReceb.cPais;


                    }


                    #endregion

                    #region Informacoes da NF
                    objbelinfCte.infCTeNorm.infDoc.infNF = obj.infCTeNorm.infDoc.infNF;
                    //objbelinfCte.infCTeNorm.infDoc.infNF = new List<belinfNF>();
                    //for (int j = 0; j < obj.infCTeNorm.infDoc.infNF.Count; j++)
                    //{
                    //    belinfNF nf = new belinfNF();
                    //    nf.mod = obj.infCTeNorm.infDoc.infNF[j].mod;
                    //    nf.nDoc = obj.infCTeNorm.infDoc.infNF[j].nDoc;
                    //    nf.serie = obj.infCTeNorm.infDoc.infNF[j].serie;
                    //    nf.dEmi = obj.infCTeNorm.infDoc.infNF[j].dEmi;
                    //    nf.vBC = obj.infCTeNorm.infDoc.infNF[j].vBC;
                    //    nf.vICMS = obj.infCTeNorm.infDoc.infNF[j].vICMS;
                    //    nf.vBCST = obj.infCTeNorm.infDoc.infNF[j].vBCST;
                    //    nf.vST = obj.infCTeNorm.infDoc.infNF[j].vST;
                    //    nf.vProd = obj.infCTeNorm.infDoc.infNF[j].vProd;
                    //    nf.vNF = obj.infCTeNorm.infDoc.infNF[j].vNF;
                    //    nf.nCFOP = Convert.ToInt32(obj.infCTeNorm.infDoc.infNF[j].nCFOP).ToString();

                    //    objbelinfCte.infCTeNorm.infDoc.infNF.Add(nf);
                    //}

                    objbelinfCte.infCTeNorm.infDoc.infNFe = obj.infCTeNorm.infDoc.infNFe;
                    //objbelinfCte.infCTeNorm.infDoc.infNFe = new List<belinfNFe>();
                    //for (int n = 0; n < obj.infCTeNorm.infDoc.infNFe.Count; n++)
                    //{
                    //    belinfNFe nfe = new belinfNFe();
                    //    nfe.chave = obj.infCTeNorm.infDoc.infNFe[n].chave;
                    //    nfe.nDoc = obj.infCTeNorm.infDoc.infNFe[n].nDoc;

                    //    objbelinfCte.infCTeNorm.infDoc.infNFe.Add(nfe);
                    //}

                    #endregion

                    #region Outros Documentos

                    objbelinfCte.infCTeNorm.infDoc.infOutros = obj.infCTeNorm.infDoc.infOutros;
                    //objbelinfCte.infCTeNorm.infDoc.infOutros = new List<belinfOutros>();
                    //for (int j = 0; j < obj.infCTeNorm.infDoc.infOutros.Count; j++)
                    //{
                    //    belinfOutros infOutros = new belinfOutros();
                    //    infOutros.tpDoc = obj.infCTeNorm.infDoc.infOutros[j].tpDoc;
                    //    infOutros.descOutros = obj.infCTeNorm.infDoc.infOutros[j].descOutros;
                    //    infOutros.nDoc = obj.infCTeNorm.infDoc.infOutros[j].nDoc;
                    //    infOutros.dEmi = obj.infCTeNorm.infDoc.infOutros[j].dEmi;
                    //    infOutros.vDocFisc = obj.infCTeNorm.infDoc.infOutros[j].vDocFisc;

                    //    objbelinfCte.infCTeNorm.infDoc.infOutros.Add(infOutros);
                    //}


                    #endregion

                    #region Valores

                    objbelinfCte.vPrest = new belvPrest();
                    objbelinfCte.vPrest.vTPrest = obj.vPrest.vTPrest;
                    objbelinfCte.vPrest.vRec = obj.vPrest.vRec;

                    objbelinfCte.vPrest.Comp = obj.vPrest.Comp;



                    objbelinfCte.imp = new belimp();
                    objbelinfCte.imp.ICMS = new belICMS();

                    if (obj.imp.ICMS.ICMS00 != null)
                    {
                        objbelinfCte.imp.ICMS.ICMS00 = new belICMS00();
                        objbelinfCte.imp.ICMS.ICMS00.CST = obj.imp.ICMS.ICMS00.CST;
                        objbelinfCte.imp.ICMS.ICMS00.vBC = obj.imp.ICMS.ICMS00.vBC;
                        objbelinfCte.imp.ICMS.ICMS00.pICMS = obj.imp.ICMS.ICMS00.pICMS;
                        objbelinfCte.imp.ICMS.ICMS00.vICMS = obj.imp.ICMS.ICMS00.vICMS;
                    }
                    else if (obj.imp.ICMS.ICMS20 != null)
                    {
                        objbelinfCte.imp.ICMS.ICMS20 = new belICMS20();
                        objbelinfCte.imp.ICMS.ICMS20.CST = obj.imp.ICMS.ICMS20.CST;
                        objbelinfCte.imp.ICMS.ICMS20.pRedBC = obj.imp.ICMS.ICMS20.pRedBC;
                        objbelinfCte.imp.ICMS.ICMS20.vBC = obj.imp.ICMS.ICMS20.vBC;
                        objbelinfCte.imp.ICMS.ICMS20.pICMS = obj.imp.ICMS.ICMS20.pICMS;
                        objbelinfCte.imp.ICMS.ICMS20.vICMS = obj.imp.ICMS.ICMS20.vICMS;
                    }
                    else if (obj.imp.ICMS.ICMS45 != null)
                    {
                        objbelinfCte.imp.ICMS.ICMS45 = new belICMS45();
                        objbelinfCte.imp.ICMS.ICMS45.CST = obj.imp.ICMS.ICMS45.CST;
                    }
                    else if (obj.imp.ICMS.ICMS60 != null)
                    {
                        objbelinfCte.imp.ICMS.ICMS60 = new belICMS60();
                        objbelinfCte.imp.ICMS.ICMS60.CST = obj.imp.ICMS.ICMS60.CST;
                        objbelinfCte.imp.ICMS.ICMS60.vBCSTRet = obj.imp.ICMS.ICMS60.vBCSTRet;
                        objbelinfCte.imp.ICMS.ICMS60.vICMSSTRet = obj.imp.ICMS.ICMS60.vICMSSTRet;
                        objbelinfCte.imp.ICMS.ICMS60.pICMSSTRet = obj.imp.ICMS.ICMS60.pICMSSTRet;
                        objbelinfCte.imp.ICMS.ICMS60.vCred = obj.imp.ICMS.ICMS60.vCred;
                    }
                    else if (obj.imp.ICMS.ICMS90 != null)
                    {
                        objbelinfCte.imp.ICMS.ICMS90 = new belICMS90();
                        objbelinfCte.imp.ICMS.ICMS90.CST = obj.imp.ICMS.ICMS90.CST;
                        objbelinfCte.imp.ICMS.ICMS90.pRedBC = obj.imp.ICMS.ICMS90.pRedBC;
                        objbelinfCte.imp.ICMS.ICMS90.vBC = obj.imp.ICMS.ICMS90.vBC;
                        objbelinfCte.imp.ICMS.ICMS90.pICMS = obj.imp.ICMS.ICMS90.pICMS;
                        objbelinfCte.imp.ICMS.ICMS90.vICMS = obj.imp.ICMS.ICMS90.vICMS;
                        objbelinfCte.imp.ICMS.ICMS90.vCred = obj.imp.ICMS.ICMS90.vCred;
                    }
                    else if (obj.imp.ICMS.ICMSOutraUF != null)
                    {
                        objbelinfCte.imp.ICMS.ICMSOutraUF = new belICMSOutraUF();
                        objbelinfCte.imp.ICMS.ICMSOutraUF.CST = obj.imp.ICMS.ICMSOutraUF.CST;
                        objbelinfCte.imp.ICMS.ICMSOutraUF.pRedBCOutraUF = obj.imp.ICMS.ICMSOutraUF.pRedBCOutraUF;
                        objbelinfCte.imp.ICMS.ICMSOutraUF.vBCOutraUF = obj.imp.ICMS.ICMSOutraUF.vBCOutraUF;
                        objbelinfCte.imp.ICMS.ICMSOutraUF.pICMSOutraUF = obj.imp.ICMS.ICMSOutraUF.pICMSOutraUF;
                        objbelinfCte.imp.ICMS.ICMSOutraUF.vICMSOutraUF = obj.imp.ICMS.ICMSOutraUF.vICMSOutraUF;
                    }


                    #endregion

                    #region InformacoesCarga

                    //objbelinfCte.infCTeNorm = new belinfCTeNorm();
                    objbelinfCte.infCTeNorm.infCarga = new belinfCarga();

                    objbelinfCte.infCTeNorm.infCarga.vCarga = obj.infCTeNorm.infCarga.vCarga;
                    objbelinfCte.infCTeNorm.infCarga.proPred = obj.infCTeNorm.infCarga.proPred;
                    objbelinfCte.infCTeNorm.infCarga.xOutCat = obj.infCTeNorm.infCarga.xOutCat;

                    objbelinfCte.infCTeNorm.infCarga.infQ = new List<belinfQ>();
                    for (int j = 0; j < obj.infCTeNorm.infCarga.infQ.Count; j++)
                    {
                        belinfQ objInfQ = new belinfQ();
                        objInfQ.cUnid = obj.infCTeNorm.infCarga.infQ[j].cUnid;
                        objInfQ.tpMed = obj.infCTeNorm.infCarga.infQ[j].tpMed;
                        objInfQ.qCarga = obj.infCTeNorm.infCarga.infQ[j].qCarga;

                        objbelinfCte.infCTeNorm.infCarga.infQ.Add(objInfQ);
                    }

                    #endregion

                    #region Rodoviario

                    objbelinfCte.infCTeNorm.seg = new belseg();
                    objbelinfCte.infCTeNorm.rodo = new belrodo();

                    objbelinfCte.infCTeNorm.seg.respSeg = obj.infCTeNorm.seg.respSeg;
                    objbelinfCte.infCTeNorm.seg.nApol = obj.infCTeNorm.seg.nApol;
                    objbelinfCte.infCTeNorm.rodo.RNTRC = obj.infCTeNorm.rodo.RNTRC;
                    objbelinfCte.infCTeNorm.rodo.dPrev = obj.infCTeNorm.rodo.dPrev;
                    objbelinfCte.infCTeNorm.rodo.lota = obj.infCTeNorm.rodo.lota;

                    #endregion

                    #region Obs
                    objbelinfCte.compl = new belcompl();
                    objbelinfCte.compl.ObsCont.xTexto = obj.compl.ObsCont.xTexto;
                    #endregion

                    #region Veiculo

                    objbelinfCte.infCTeNorm.rodo.veic = new List<belveic>();
                    for (int v = 0; v < obj.infCTeNorm.rodo.veic.Count; v++)
                    {
                        belveic veic = new belveic();

                        veic.RENAVAM = obj.infCTeNorm.rodo.veic[v].RENAVAM;
                        veic.placa = obj.infCTeNorm.rodo.veic[v].placa;
                        veic.tara = obj.infCTeNorm.rodo.veic[v].tara;
                        veic.capKG = obj.infCTeNorm.rodo.veic[v].capKG;
                        veic.capM3 = obj.infCTeNorm.rodo.veic[v].capM3;
                        veic.tpProp = obj.infCTeNorm.rodo.veic[v].tpProp;
                        veic.tpVeic = obj.infCTeNorm.rodo.veic[v].tpVeic;
                        veic.tpRod = obj.infCTeNorm.rodo.veic[v].tpRod;
                        veic.tpCar = obj.infCTeNorm.rodo.veic[v].tpCar;
                        veic.UF = obj.infCTeNorm.rodo.veic[v].UF;

                        if (obj.infCTeNorm.rodo.veic[v].prop != null)
                        {
                            veic.prop = new belprop();

                            veic.prop.CPFCNPJ = obj.infCTeNorm.rodo.veic[v].prop.CPFCNPJ;
                            veic.prop.RNTRC = obj.infCTeNorm.rodo.veic[v].prop.RNTRC;
                            veic.prop.xNome = obj.infCTeNorm.rodo.veic[v].prop.xNome;
                            veic.prop.IE = obj.infCTeNorm.rodo.veic[v].prop.IE;
                            veic.prop.UF = obj.infCTeNorm.rodo.veic[v].prop.UF;
                            veic.prop.tpProp = obj.infCTeNorm.rodo.veic[v].prop.tpProp;
                        }

                        objbelinfCte.infCTeNorm.rodo.veic.Add(veic);
                    }
                    if (obj.infCTeNorm.rodo.moto != null)
                    {
                        objbelinfCte.infCTeNorm.rodo.moto = new belmoto();
                        objbelinfCte.infCTeNorm.rodo.moto.xNome = obj.infCTeNorm.rodo.moto.xNome;
                        objbelinfCte.infCTeNorm.rodo.moto.CPF = obj.infCTeNorm.rodo.moto.CPF;
                    }
                    #endregion

                    objList.Add(objbelinfCte);

                }
                this.objObjetosAlter = new belPopulaObjetos(objObjetos.objListaNumeroConhecimentos);
                this.objObjetosAlter.objListaConhecimentos = objList;
                this.objObjetosAlter.sFormEmiss = objObjetos.sFormEmiss;
                this.objObjetosAlter.sNomeArq = objObjetos.sNomeArq;
                this.objObjetosAlter.sPath = objObjetos.sPath;

                bsNotas.DataSource = this.objObjetosAlter.objListaConhecimentos;
                bsNotas.MoveFirst();
                lblContagemNotas.Text = "1 de " + bsNotas.Count;

            }
            catch (Exception ex)
            {
                new HLPexception(ex);
            }
        }