Ejemplo n.º 1
0
        public List<belUF> retListaUF()
        {
            List<belUF> objUFs = new List<belUF>();
            belUF objUF = new belUF();

            #region Region_Norte


            objUF._cUF = "11";
            objUF._siglaUF = "RO";
            objUF._xUF = "Rondônia";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "12";
            objUF._siglaUF = "AC";
            objUF._xUF = "Acre";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "13";
            objUF._siglaUF = "AM";
            objUF._xUF = "Amazonas";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "14";
            objUF._siglaUF = "RR";
            objUF._xUF = "Roraima";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "15";
            objUF._siglaUF = "PA";
            objUF._xUF = "Pará";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "16";
            objUF._siglaUF = "AP";
            objUF._xUF = "Amapá";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "17";
            objUF._siglaUF = "TO";
            objUF._xUF = "Tocantins";

            objUFs.Add(objUF);


            #endregion

            #region Regiao_Nordeste

            objUF = new belUF();

            objUF._cUF = "21";
            objUF._siglaUF = "MA";
            objUF._xUF = "Maranhão";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "22";
            objUF._siglaUF = "PI";
            objUF._xUF = "Piauí";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "23";
            objUF._siglaUF = "CE";
            objUF._xUF = "Ceará";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "24";
            objUF._siglaUF = "RN";
            objUF._xUF = "Rio Grande do Norte";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "25";
            objUF._siglaUF = "PB";
            objUF._xUF = "Paraíba";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "26";
            objUF._siglaUF = "PE";
            objUF._xUF = "Pernambuco";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "27";
            objUF._siglaUF = "AL";
            objUF._xUF = "Alagoas";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "28";
            objUF._siglaUF = "SE";
            objUF._xUF = "Sergipe";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "29";
            objUF._siglaUF = "BA";
            objUF._xUF = "Bahía";

            objUFs.Add(objUF);


            #endregion

            #region Regiao_Sudeste

            objUF = new belUF();

            objUF._cUF = "31";
            objUF._siglaUF = "MG";
            objUF._xUF = "Minas Gerais";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "32";
            objUF._siglaUF = "ES";
            objUF._xUF = "Espírito Santo";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "33";
            objUF._siglaUF = "RJ";
            objUF._xUF = "Rio de Janeiro";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "35";
            objUF._siglaUF = "SP";
            objUF._xUF = "São Paulo";

            objUFs.Add(objUF);

            #endregion

            #region Região_Sul

            objUF = new belUF();

            objUF._cUF = "41";
            objUF._siglaUF = "PR";
            objUF._xUF = "Paraná";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "42";
            objUF._siglaUF = "SC";
            objUF._xUF = "Santa Catarina";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "43";
            objUF._siglaUF = "RS";
            objUF._xUF = "Rio Grande do Sul";

            objUFs.Add(objUF);

            #endregion

            #region Região_Centro_Oeste

            objUF = new belUF();

            objUF._cUF = "50";
            objUF._siglaUF = "MS";
            objUF._xUF = "Mato Grosso do Sul";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "51";
            objUF._siglaUF = "MT";
            objUF._xUF = "Mato Grosso";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "52";
            objUF._siglaUF = "GO";
            objUF._xUF = "Goias";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF = "53";
            objUF._siglaUF = "DF";
            objUF._xUF = "Distrito Federal";

            objUFs.Add(objUF);

            #endregion

            return objUFs;

        }
Ejemplo n.º 2
0
        }//Danner - o.s. 24091 - 04/02/2010

        public bool RetornaUF(string sCUF)
        {
            bool bret = true;
            if ((sCUF != null) && (sCUF != ""))
            {

                List<belUF> objUFs = new List<belUF>();
                belUF objUF = new belUF();

                #region Region_Norte


                objUF._cUF = "11";
                objUF._siglaUF = "RO";
                objUF._xUF = "Rondônia";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "12";
                objUF._siglaUF = "AC";
                objUF._xUF = "Acre";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "13";
                objUF._siglaUF = "AM";
                objUF._xUF = "Amazonas";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "14";
                objUF._siglaUF = "RR";
                objUF._xUF = "Roraima";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "15";
                objUF._siglaUF = "PA";
                objUF._xUF = "Pará";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "16";
                objUF._siglaUF = "AP";
                objUF._xUF = "Amapá";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "17";
                objUF._siglaUF = "TO";
                objUF._xUF = "Tocantins";

                objUFs.Add(objUF);


                #endregion

                #region Regiao_Nordeste

                objUF = new belUF();

                objUF._cUF = "21";
                objUF._siglaUF = "MA";
                objUF._xUF = "Maranhão";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "22";
                objUF._siglaUF = "PI";
                objUF._xUF = "Piauí";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "23";
                objUF._siglaUF = "CE";
                objUF._xUF = "Ceará";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "24";
                objUF._siglaUF = "RN";
                objUF._xUF = "Rio Grande do Norte";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "25";
                objUF._siglaUF = "PB";
                objUF._xUF = "Paraíba";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "26";
                objUF._siglaUF = "PE";
                objUF._xUF = "Pernambuco";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "28";
                objUF._siglaUF = "SE";
                objUF._xUF = "Sergipe";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "29";
                objUF._siglaUF = "BA";
                objUF._xUF = "Bahía";

                objUFs.Add(objUF);


                #endregion

                #region Regiao_Sudeste

                objUF = new belUF();

                objUF._cUF = "31";
                objUF._siglaUF = "MG";
                objUF._xUF = "Minas Gerais";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "32";
                objUF._siglaUF = "ES";
                objUF._xUF = "Espírito Santo";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "33";
                objUF._siglaUF = "RJ";
                objUF._xUF = "Rio de Janeiro";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "35";
                objUF._siglaUF = "SP";
                objUF._xUF = "São Paulo";

                objUFs.Add(objUF);

                #endregion

                #region Região_Sul

                objUF = new belUF();

                objUF._cUF = "41";
                objUF._siglaUF = "PR";
                objUF._xUF = "Paraná";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "42";
                objUF._siglaUF = "SC";
                objUF._xUF = "Santa Catarina";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "43";
                objUF._siglaUF = "RS";
                objUF._xUF = "Rio Grande do Sul";

                objUFs.Add(objUF);

                #endregion

                #region Região_Centro_Oeste

                objUF = new belUF();

                objUF._cUF = "50";
                objUF._siglaUF = "MS";
                objUF._xUF = "Mato Grosso do Sul";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "51";
                objUF._siglaUF = "MT";
                objUF._xUF = "Mato Grosso";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "52";
                objUF._siglaUF = "GO";
                objUF._xUF = "Goias";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF = "53";
                objUF._siglaUF = "DF";
                objUF._xUF = "Distrito Federal";

                objUFs.Add(objUF);

                #endregion

                bool ctrl = false;


                foreach (var x in objUFs)
                {
                    if (x._cUF == sCUF)
                        ctrl = true;

                }
                if (ctrl == false)
                    throw new Exception("Código do Estado Inexistente");


            }
            else
            {
                bret = false;
                throw new Exception("Código do Estado está vazio ou nulo");

            }

            return bret;
        }
Ejemplo n.º 3
0
        private void SalvarAlteracao()
        {
            belInfNFe nota = bsNotas.Current as belInfNFe;
            try
            {
                #region IDE


                //nota.ide.Cuf = txtUF.Text;
                //nota.ide.Cnf = txtSeq.Text;
                //nota.ide.Natop = txtNatOp.Text;
                //nota.ide.Indpag = Convert.ToString(cbxIndPag.SelectedIndex).Trim();
                //nota.ide.Mod = txtMod.Text.Trim();
                //nota.ide.Serie = txtSerie.Text.Trim();
                //nota.ide.Nnf = txtNNF.Text.Trim();
                //nota.ide.Demi = Convert.ToDateTime(mtbDEmi.Text);
                //nota.ide.Dsaient = Convert.ToDateTime(mtbDSaiEnt.Text);
                //nota.ide.Tpnf = Convert.ToString(cbxTpNF.SelectedIndex);
                //nota.ide.Cmunfg = txtCMunFG.Text.Trim();
                //nota.ide.Tpimp = Convert.ToString((int)cbxtpImp.SelectedIndex + 1);
                //nota.ide.Tpemis = Convert.ToString((int)cbcxTpEmis.SelectedIndex + 1);
                //nota.ide.Cdv = txtCDV.Text.Trim();
                //nota.ide.Tpamb = Convert.ToString((int)cbxTpAmb.SelectedIndex + 1);
                nota.ide.Finnfe = Convert.ToString((int)cbxFinNFe.SelectedIndex + 1);
                //nota.ide.Procemi = txtProcEmi.Text.Trim();
                //nota.ide.Verproc = txtVerProc.Text.Trim();
                if (bsNFreferenciadas.Count > 0) // 25360
                {
                    List<belNFref> lObjNFref = new List<belNFref>();

                    for (int i = 0; i < bsNFreferenciadas.Count; i++)
                    {
                        lObjNFref.Add((belNFref)bsNFreferenciadas[i]);
                        if (lObjNFref[i].cUF != null)
                        {
                            if (!Util.IsNumeric(lObjNFref[i].cUF))
                            {
                                belUF objuf = new belUF();
                                lObjNFref[i].cUF = objuf.RetornaCUF((lObjNFref[i].cUF));
                                lObjNFref[i].CNPJ = (lObjNFref[i].CNPJ).Replace(",", "").Replace("/", "").Replace("-", "");
                                lObjNFref[i].nNF = (Convert.ToInt32(lObjNFref[i].nNF)).ToString();
                            }
                        }

                    }
                    nota.ide.belNFref = lObjNFref;
                }
                nota.ide.HSaiEnt = dtpHSaiEnt.Value;

                #endregion

                #region Emitente

                if (cbxPessoaEmit.SelectedIndex == 0)
                {
                    nota.emit.Cpf = mtbCpfCnpjEmit.Text;
                }
                else
                {
                    nota.emit.Cnpj = mtbCpfCnpjEmit.Text;
                }
                nota.emit.Xnome = txtXNomeEmit.Text.Trim();
                nota.emit.Xfant = txtXFantEmit.Text.Trim();
                nota.emit.Ie = txtIEEmit.Text.Trim();
                nota.emit.Iest = txtIESTEmit.Text.Trim();
                nota.emit.Im = txtIM.Text.Trim();
                nota.emit.Cnae = txtCNAE.Text;

                //Endereço

                nota.emit.Xlgr = txtEnderEmitXlgr.Text.Trim();
                nota.emit.Nro = txtEnderEmitNum.Text.Trim();
                if (txtEnderEmitCompl.Text != "")
                {
                    nota.emit.Xcpl = txtEnderEmitCompl.Text.Trim();
                }
                nota.emit.Xbairro = txtEnderEmitXbairro.Text.Trim();
                nota.emit.Cmun = txtEnderEmitCmun.Text.Trim();
                nota.emit.Xmun = txtEnderEmitXmun.Text.Trim();
                nota.emit.Uf = txtEnderEmitUF.Text.Trim();
                nota.emit.Cpais = txtEnderEmitCpais.Text.Trim();
                nota.emit.Xpais = txtEnderEmitXpais.Text.Trim();
                nota.emit.Cep = mtbEnderEmitCep.Text.Trim();
                nota.emit.Fone = mtbEnderEmitFone.Text.Trim();

                switch (cmbCRT.SelectedIndex) // NFe_2.0
                {
                    case 0: nota.emit.CRT = 1;
                        break;

                    case 1: nota.emit.CRT = 2;
                        break;

                    case 2: nota.emit.CRT = 3;
                        break;
                }
                #endregion

                #region Destinatário
                if (mtbCpfCnpjDest.Mask.Equals("00.000.000/0000-00") || mtbCpfCnpjDest.Text.ToString().ToUpper().Equals("EXTERIOR"))
                {
                    nota.dest.Cnpj = mtbCpfCnpjDest.Text.Trim();
                }
                else
                {
                    nota.dest.Cpf = mtbCpfCnpjDest.Text.Trim();
                }

                nota.dest.Xnome = (Acesso.TP_AMB == 2 ? "NF-E EMITIDA EM AMBIENTE DE HOMOLOGACAO - SEM VALOR FISCAL"
                    : txtXnomeDest.Text.Trim());

                nota.dest.Ie = txtIEDest.Text.Trim();
                nota.dest.Isuf = txtISUFDest.Text.Trim();

                //Endereço

                nota.dest.Xlgr = txtEnderDestXlgr.Text.Trim();
                nota.dest.Nro = txtEnderDestNro.Text.Trim();
                nota.dest.Xcpl = txtEnderDestCpl.Text.Trim(); //OS_26347
                nota.dest.Xbairro = txtEnderDestXbairro.Text.Trim();
                nota.dest.Cmun = txtEnderDestCmun.Text.Trim();
                nota.dest.Xmun = txtEnderDestXmun.Text.Trim();
                nota.dest.Uf = txtEnderDestUF.Text.Trim();
                nota.dest.Cpais = txtEnderDestCpais.Text.Trim();
                nota.dest.Xpais = txtEnderDestXpais.Text.Trim();
                nota.dest.Cep = mtbEnderDestCEP.Text.Trim();
                nota.dest.Fone = mtbEnderDestFone.Text.Trim();
                nota.dest.email = txtEmaildest.Text.Trim(); // NFe_2.0
                #endregion

                #region Endereço de Entrega
                if (txtEndEntXlgr.Text != "")
                {

                    if (mtbCpfCnpjDest.Mask.Equals("00.000.000/0000-00") || mtbCpfCnpjDest.Text.ToString().ToUpper().Equals("EXTERIOR"))
                    {
                        nota.endent.Cnpj = mtbCpfCnpjDest.Text.Trim();
                    }
                    else
                    {
                        nota.endent.Cpf = mtbCpfCnpjDest.Text.Trim();
                    }
                    nota.endent.Xlgr = txtEndEntXlgr.Text.Trim();
                    nota.endent.Nro = txtEndEntNro.Text.Trim();
                    nota.endent.Cmun = txtEndEntCmun.Text.Trim();
                    nota.endent.Xmun = txtEndEntXmun.Text.Trim();
                    nota.endent.Uf = txtEndEntUF.Text.Trim();
                    nota.endent.Xbairro = txtEndEntXbairro.Text.Trim(); //0S_25185
                    nota.endent.Xcpl = txtEndEntCpl.Text.Trim();//0S_25185
                }
                #endregion

                #region Detatalhes

                #endregion

                #region Totais
                nota.total.belIcmstot.Vbc = nudVBC.Value;
                nota.total.belIcmstot.Vicms = nudVICMS.Value;
                nota.total.belIcmstot.Vbcst = nudVBCICMSST.Value;
                nota.total.belIcmstot.Vst = nudVST.Value;
                nota.total.belIcmstot.Vprod = nudVProd.Value;
                nota.total.belIcmstot.Vfrete = nudVFrete.Value;
                nota.total.belIcmstot.Vseg = nudVSEG.Value;
                nota.total.belIcmstot.Vdesc = nudVDesc.Value;
                nota.total.belIcmstot.Vii = nudVII.Value;
                nota.total.belIcmstot.Vipi = nudVIPI.Value;
                nota.total.belIcmstot.Vpis = nudVPIS.Value;
                nota.total.belIcmstot.Vcofins = nudVCOFINS.Value;
                nota.total.belIcmstot.Voutro = nudVOutro.Value;
                nota.total.belIcmstot.Vnf = nudVNF.Value;
                nota.total.belIcmstot.vTotTrib = nudvTotTrib.Value;
                //Fim - Totais

                //ISSQNtot
                if (flpISSNQ.Enabled != false)
                {
                    nota.total.belIssqntot.Vserv = nudVServ.Value;
                    nota.total.belIssqntot.Vbc = nudVBCISS.Value;
                    nota.total.belIssqntot.Viss = nudVISS.Value;
                    nota.total.belIssqntot.Vpis = nudVPISISS.Value;
                    nota.total.belIssqntot.Vcofins = nudVCOFINSISS.Value;
                }
                //Fin - ISSQNtot;

                //retTrib
                if (flpRetTrib.Enabled != false)
                {
                    belRetTrib objRetTrib = new belRetTrib();

                    objRetTrib.Vretpis = nudVPISRet.Value;
                    objRetTrib.Vretcofins = nudVCOFINSRet.Value;
                    objRetTrib.Vretcsll = nudVCSLLRet.Value;
                    objRetTrib.Vbcretprev = nudVBCIRRFRet.Value;
                    objRetTrib.Virrf = nudVIRRFRet.Value;
                    objRetTrib.Vbcirrf = nudVBCIRRFRet.Value;
                    objRetTrib.Vbcretprev = nudVBCRetPrev.Value;
                    objRetTrib.Vretprev = nudVRetPrev.Value;
                }
                //Fim - retTrib
                #endregion

                #region Transporte
                switch (cbxModFrete.SelectedIndex) //Nfe_2.0
                {
                    case 0: nota.transp.Modfrete = "0";
                        break;

                    case 1: nota.transp.Modfrete = "1";
                        break;

                    case 2: nota.transp.Modfrete = "2";
                        break;

                    case 3: nota.transp.Modfrete = "9";
                        break;
                }
                //Transportadora               
                if (cbxPessoaTranp.SelectedIndex == 1)
                {
                    if (mtbCPJCNPJTransp.Text.Trim() != "")
                    {
                        nota.transp.belTransportadora.Cnpj = mtbCPJCNPJTransp.Text.Trim();
                    }
                }
                else
                {
                    if (mtbCPJCNPJTransp.Text.Trim() != "")
                    {
                        nota.transp.belTransportadora.Cpf = mtbCPJCNPJTransp.Text.Trim();
                    }
                }

                if (txtXnomeTransp.Text.Trim() != "")
                {
                    nota.transp.belTransportadora.Xnome = txtXnomeTransp.Text.Trim();
                }
                if (txtIETransp.Text.Trim() != "")
                {
                    nota.transp.belTransportadora.Ie = txtIETransp.Text.Trim();
                }
                if (txtEnderTransp.Text.Trim() != "")
                {
                    nota.transp.belTransportadora.Xender = txtEnderTransp.Text.Trim();
                }
                if (txtUFTransp.Text.Trim() != "")
                {
                    nota.transp.belTransportadora.Uf = txtUFTransp.Text.Trim();
                }
                if (txtXmunTransp.Text.Trim() != "")
                {
                    nota.transp.belTransportadora.Xmun = txtXmunTransp.Text.Trim();
                }
                //Fim - Transportadora

                //VeicTransp
                if (!mtbPlacaVeicTransp.Text.Trim().Equals(""))
                {
                    nota.transp.belVeicTransp.Placa = mtbPlacaVeicTransp.Text.Trim();
                    nota.transp.belVeicTransp.Uf = txtUFVeicTransp.Text.Trim();
                    if (txtRNTCVeicTransp.Text.Trim() != "")
                    {
                        nota.transp.belVeicTransp.Rntc = txtRNTCVeicTransp.Text.Trim();
                    }
                }
                //Fim -  VeicTransp

                //Reboque
                if (!mtbPlacaReboque.Text.Trim().Equals(""))
                {
                    nota.transp.belReboque.Placa = mtbPlacaReboque.Text.Trim();
                    nota.transp.belReboque.Uf = txtUFReboque.Text.Trim();
                    nota.transp.belReboque.Rntc = txtRNTCReboque.Text.Trim();
                }
                //Fim - Reboque 

                //RetTransp
                if (nudVServTransp.Value > 0)
                {
                    nota.transp.belRetTransp.Vbvret = nudVBCICMSTransp.Value;
                    nota.transp.belRetTransp.Vserv = nudVServTransp.Value;
                    nota.transp.belRetTransp.Picmsret = nudPICMSTRetTransp.Value;
                    nota.transp.belRetTransp.Vicmsret = nudVICMSRet.Value;
                    nota.transp.belRetTransp.Cmunfg = txtCmunFGTransp.Text.Trim();
                    nota.transp.belRetTransp.Cfop = txtCFOPTransp.Text.Trim();
                }
                //Fim - RetTransp

                if (nudQvol.Value > 0)
                {
                    nota.transp.belVol.Esp = txtEsp.Text.Trim();
                    nota.transp.belVol.Marca = txtMarca.Text.Trim();
                    if (txtNVol.Text != "")
                    {
                        nota.transp.belVol.Nvol = txtNVol.Text;
                    }
                    nota.transp.belVol.PesoB = nudPesoB.Value;
                    nota.transp.belVol.PesoL = nudPesoL.Value;
                    nota.transp.belVol.Qvol = nudQvol.Value;
                }
                #endregion

                #region Cobrança

                if (nota.cobr.Fat != null)
                {
                    nota.cobr.Fat.Nfat = txtNFat.Text.Trim();
                    nota.cobr.Fat.Vorig = nudVOrigFat.Value;
                    nota.cobr.Fat.Vdesc = nudVDescFat.Value;
                    nota.cobr.Fat.Vliq = nudVLiqFat.Value;
                    nota.cobr.Fat.belDup = bsDuplicatas.List as List<belDup>;
                }

                //if (bsDuplicatas.Count > 0)
                //{
                //    List<belDup> lObjDup = (List<belDup>)bsDuplicatas.List;

                //    for (int i = 0; i < dgvDup.RowCount; i++)
                //    {
                //        belDup objdup = new belDup();
                //        objdup.Ndup = Convert.ToString(dgvDup[0, i].Value);
                //        objdup.Dvenc = Convert.ToDateTime(dgvDup[1, i].Value);
                //        objdup.Vdup = Convert.ToDecimal(dgvDup[2, i].Value);
                //        lObjDup.Add(objdup);
                //    }
                //    nota.cobr.Fat.belDup = lObjDup;
                //}

                #endregion

                #region Inf Adicionais
                if (txtInfAdic.Text != "")
                {
                    nota.infAdic.Infcpl = null;
                    nota.infAdic.Infcpl = txtInfAdic.Text.Replace(Environment.NewLine, "").Trim().TrimEnd();
                }
                #endregion

                #region exporta
                if (txtUFembarque.Text != "")
                {
                    nota.exporta.Ufembarq = txtUFembarque.Text;
                }
                if (txtLocalEmbarque.Text != "")
                {
                    nota.exporta.Xlocembarq = txtLocalEmbarque.Text;
                }
                #endregion

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

        }
        private string GeraChaveDadosNFe(NFe_HLP objNFe)
        {
            string scUF = "";
            string stpEmis = "";
            string sCNPJ = "";
            string svNF = "";
            string sICMSp = "0";
            string sICMSs = "0";
            string sDD = "";
            string sDV = "";
            belUF objbelUF = new belUF();

            scUF = objbelUF.RetornaCUF(objNFe.enderDest_UF);
            stpEmis = objNFe.tpEmis;
            sCNPJ = objNFe.dest_CPF_CNPJ;
            svNF = objNFe.ICMSTot_vNF.Replace(",", "").PadLeft(14, '0');
            sDD = Convert.ToDateTime(objNFe.ide_dEmi).Day.ToString();


            if (objNFe.ICMSTot_vST != "0,00")
                sICMSs = "1";
            else
                sICMSs = "2";


            if (objNFe.ICMSTot_vICMS != "0,00")
                sICMSs = "1";
            else
                sICMSs = "2";

            string sDadosNfe = scUF + stpEmis + sCNPJ + svNF + sICMSp + sICMSs + sDD;
            string sDig = CalculaDig11(sDadosNfe).ToString();
            return (sDadosNfe + sDig).Trim();
        }
Ejemplo n.º 5
0
        }//Danner - o.s. 24091 - 04/02/2010

        public bool RetornaUF(string sCUF)
        {
            bool bret = true;

            if ((sCUF != null) && (sCUF != ""))
            {
                List <belUF> objUFs = new List <belUF>();
                belUF        objUF  = new belUF();

                #region Region_Norte


                objUF._cUF     = "11";
                objUF._siglaUF = "RO";
                objUF._xUF     = "Rondônia";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "12";
                objUF._siglaUF = "AC";
                objUF._xUF     = "Acre";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "13";
                objUF._siglaUF = "AM";
                objUF._xUF     = "Amazonas";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "14";
                objUF._siglaUF = "RR";
                objUF._xUF     = "Roraima";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "15";
                objUF._siglaUF = "PA";
                objUF._xUF     = "Pará";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "16";
                objUF._siglaUF = "AP";
                objUF._xUF     = "Amapá";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "17";
                objUF._siglaUF = "TO";
                objUF._xUF     = "Tocantins";

                objUFs.Add(objUF);


                #endregion

                #region Regiao_Nordeste

                objUF = new belUF();

                objUF._cUF     = "21";
                objUF._siglaUF = "MA";
                objUF._xUF     = "Maranhão";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "22";
                objUF._siglaUF = "PI";
                objUF._xUF     = "Piauí";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "23";
                objUF._siglaUF = "CE";
                objUF._xUF     = "Ceará";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "24";
                objUF._siglaUF = "RN";
                objUF._xUF     = "Rio Grande do Norte";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "25";
                objUF._siglaUF = "PB";
                objUF._xUF     = "Paraíba";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "26";
                objUF._siglaUF = "PE";
                objUF._xUF     = "Pernambuco";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "28";
                objUF._siglaUF = "SE";
                objUF._xUF     = "Sergipe";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "29";
                objUF._siglaUF = "BA";
                objUF._xUF     = "Bahía";

                objUFs.Add(objUF);


                #endregion

                #region Regiao_Sudeste

                objUF = new belUF();

                objUF._cUF     = "31";
                objUF._siglaUF = "MG";
                objUF._xUF     = "Minas Gerais";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "32";
                objUF._siglaUF = "ES";
                objUF._xUF     = "Espírito Santo";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "33";
                objUF._siglaUF = "RJ";
                objUF._xUF     = "Rio de Janeiro";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "35";
                objUF._siglaUF = "SP";
                objUF._xUF     = "São Paulo";

                objUFs.Add(objUF);

                #endregion

                #region Região_Sul

                objUF = new belUF();

                objUF._cUF     = "41";
                objUF._siglaUF = "PR";
                objUF._xUF     = "Paraná";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "42";
                objUF._siglaUF = "SC";
                objUF._xUF     = "Santa Catarina";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "43";
                objUF._siglaUF = "RS";
                objUF._xUF     = "Rio Grande do Sul";

                objUFs.Add(objUF);

                #endregion

                #region Região_Centro_Oeste

                objUF = new belUF();

                objUF._cUF     = "50";
                objUF._siglaUF = "MS";
                objUF._xUF     = "Mato Grosso do Sul";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "51";
                objUF._siglaUF = "MT";
                objUF._xUF     = "Mato Grosso";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "52";
                objUF._siglaUF = "GO";
                objUF._xUF     = "Goias";

                objUFs.Add(objUF);

                objUF = new belUF();

                objUF._cUF     = "53";
                objUF._siglaUF = "DF";
                objUF._xUF     = "Distrito Federal";

                objUFs.Add(objUF);

                #endregion

                bool ctrl = false;


                foreach (var x in objUFs)
                {
                    if (x._cUF == sCUF)
                    {
                        ctrl = true;
                    }
                }
                if (ctrl == false)
                {
                    throw new Exception("Código do Estado Inexistente");
                }
            }
            else
            {
                bret = false;
                throw new Exception("Código do Estado está vazio ou nulo");
            }

            return(bret);
        }
Ejemplo n.º 6
0
        public List <belUF> retListaUF()
        {
            List <belUF> objUFs = new List <belUF>();
            belUF        objUF  = new belUF();

            #region Region_Norte


            objUF._cUF     = "11";
            objUF._siglaUF = "RO";
            objUF._xUF     = "Rondônia";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "12";
            objUF._siglaUF = "AC";
            objUF._xUF     = "Acre";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "13";
            objUF._siglaUF = "AM";
            objUF._xUF     = "Amazonas";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "14";
            objUF._siglaUF = "RR";
            objUF._xUF     = "Roraima";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "15";
            objUF._siglaUF = "PA";
            objUF._xUF     = "Pará";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "16";
            objUF._siglaUF = "AP";
            objUF._xUF     = "Amapá";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "17";
            objUF._siglaUF = "TO";
            objUF._xUF     = "Tocantins";

            objUFs.Add(objUF);


            #endregion

            #region Regiao_Nordeste

            objUF = new belUF();

            objUF._cUF     = "21";
            objUF._siglaUF = "MA";
            objUF._xUF     = "Maranhão";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "22";
            objUF._siglaUF = "PI";
            objUF._xUF     = "Piauí";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "23";
            objUF._siglaUF = "CE";
            objUF._xUF     = "Ceará";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "24";
            objUF._siglaUF = "RN";
            objUF._xUF     = "Rio Grande do Norte";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "25";
            objUF._siglaUF = "PB";
            objUF._xUF     = "Paraíba";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "26";
            objUF._siglaUF = "PE";
            objUF._xUF     = "Pernambuco";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "27";
            objUF._siglaUF = "AL";
            objUF._xUF     = "Alagoas";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "28";
            objUF._siglaUF = "SE";
            objUF._xUF     = "Sergipe";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "29";
            objUF._siglaUF = "BA";
            objUF._xUF     = "Bahía";

            objUFs.Add(objUF);


            #endregion

            #region Regiao_Sudeste

            objUF = new belUF();

            objUF._cUF     = "31";
            objUF._siglaUF = "MG";
            objUF._xUF     = "Minas Gerais";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "32";
            objUF._siglaUF = "ES";
            objUF._xUF     = "Espírito Santo";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "33";
            objUF._siglaUF = "RJ";
            objUF._xUF     = "Rio de Janeiro";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "35";
            objUF._siglaUF = "SP";
            objUF._xUF     = "São Paulo";

            objUFs.Add(objUF);

            #endregion

            #region Região_Sul

            objUF = new belUF();

            objUF._cUF     = "41";
            objUF._siglaUF = "PR";
            objUF._xUF     = "Paraná";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "42";
            objUF._siglaUF = "SC";
            objUF._xUF     = "Santa Catarina";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "43";
            objUF._siglaUF = "RS";
            objUF._xUF     = "Rio Grande do Sul";

            objUFs.Add(objUF);

            #endregion

            #region Região_Centro_Oeste

            objUF = new belUF();

            objUF._cUF     = "50";
            objUF._siglaUF = "MS";
            objUF._xUF     = "Mato Grosso do Sul";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "51";
            objUF._siglaUF = "MT";
            objUF._xUF     = "Mato Grosso";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "52";
            objUF._siglaUF = "GO";
            objUF._xUF     = "Goias";

            objUFs.Add(objUF);

            objUF = new belUF();

            objUF._cUF     = "53";
            objUF._siglaUF = "DF";
            objUF._xUF     = "Distrito Federal";

            objUFs.Add(objUF);

            #endregion

            return(objUFs);
        }
Ejemplo n.º 7
0
        private void CarregaVariavesSistema()
        {
            //if (Acesso.NM_RAMO != HLP.GeraXml.Comum.Static.Acesso.BancoDados.TRANSPORTE)
            {
                Acesso.NM_EMPRESA = HlpDbFuncoes.qrySeekValue("control", "cd_conteud", "cd_nivel = '0016'");
            }
            //else
            //{
            //    Acesso.NM_EMPRESA = HlpDbFuncoes.qrySeekValue("EMPRESA", "NM_GUERRA", "cd_empresa = '" + Acesso.CD_EMPRESA + "'");
            //}

            DataTable dt = new DataTable();
            if (Acesso.NM_RAMO != HLP.GeraXml.Comum.Static.Acesso.BancoDados.TRANSPORTE)
            {
                dt = HlpDbFuncoes.qrySeekRet(
                                         "EMPRESA left join uf on (uf.cd_uf = empresa.cd_ufnor)",
                                         "empresa.cd_ufnor,empresa.nm_cidnor, nm_empresa, coalesce(empresa.st_ambiente_nfse,'2')tpAmb_Servico, coalesce(empresa.st_ambiente, '2') tpAmb, UF.nr_ufnfe, cd_cgc",
                                         "cd_empresa = '" + Acesso.CD_EMPRESA + "'");
            }
            else
            {
                dt = HlpDbFuncoes.qrySeekRet(
                                         "EMPRESA",
                                         "nm_empresa,empresa.nm_cidnor,cd_cgc,cd_ufnor,coalesce(empresa.st_ambiente, '2') tpAmb ",
                                         "cd_empresa = '" + Acesso.CD_EMPRESA + "'");
            }
            if (Util.VerificaSeEstaNaHLP())
            //if(false)
            {
                Acesso.TP_AMB = 2;
                Acesso.TP_AMB_SERV = 2;
            }
            else
            {
                if (dt.Rows[0]["tpAmb"].ToString().Equals("0"))
                {
                    throw new Exception("Empresa não habilitada para emitir NFe, verifique o cadastro de empresa!");
                }
                Acesso.TP_AMB = Convert.ToInt16(dt.Rows[0]["tpAmb"].ToString());
                try
                {Acesso.TP_AMB_SERV = Convert.ToInt16(dt.Rows[0]["tpAmb_Servico"].ToString());}catch (Exception){}
            }
            Acesso.NM_RAZAOSOCIAL = dt.Rows[0]["nm_empresa"].ToString();
            Acesso.CNPJ_EMPRESA = dt.Rows[0]["cd_cgc"].ToString();
            Acesso.CIDADE_EMPRESA = dt.Rows[0]["nm_cidnor"].ToString().ToUpper();

            if (Acesso.NM_RAMO != HLP.GeraXml.Comum.Static.Acesso.BancoDados.TRANSPORTE)
            {
                Acesso.cUF = Convert.ToInt16(dt.Rows[0]["nr_ufnfe"].ToString());
                Acesso.xUF = dt.Rows[0]["cd_ufnor"].ToString();
                Acesso.TP_AMB_SERV = Convert.ToInt16(dt.Rows[0]["tpAmb_Servico"].ToString());
            }
            else
            {
                belUF objUf = new belUF();
                objUf.SiglaUF = dt.Rows[0]["cd_ufnor"].ToString();
                Acesso.cUF = Convert.ToInt32(objUf.CUF);
                Acesso.xUF = objUf.SiglaUF;
            }
            Acesso.bAGRUPA_ITENS_NFE = daoRegras.VerificaSeAgrupaItensNFe();
            Acesso.bAGRUPA_ITENS_NFSE = daoRegras.VerificaSeAgrupaItensNFeServico();
            daoEmailContador.VerificaEmailContador();
        }