Exemplo n.º 1
0
        public void Carrega(string seqNF)
        {
            try
            {
                foreach (DataRow drCob in BuscaCobr(seqNF).Rows)
                {
                    decimal dvDup = Math.Round(Convert.ToDecimal(drCob["vOrig"].ToString()), 2);
                    decimal dDesc = Math.Round(Convert.ToDecimal(drCob["vDesc"].ToString()), 2);
                    if (drCob["nFat"].ToString().Trim() != "")
                    {
                        this.Fat.Nfat = Util.TiraSimbolo(drCob["nFat"].ToString(), "");
                    }
                    this.Fat.Vorig = dvDup;
                    if (drCob["vDesc"].ToString() != "0")
                    {
                        this.Fat.Vdesc = Math.Round(Convert.ToDecimal(dDesc.ToString()), 2);
                    }
                    if (drCob["vLiq"].ToString() != "0")
                    {
                        decimal dLiq = Math.Round(Convert.ToDecimal(drCob["vLiq"].ToString()), 2);
                        this.Fat.Vliq = dLiq;
                    }
                }
                List <belDup> objdups = new List <belDup>();

                foreach (DataRow drFat in BuscaFat(seqNF).Rows)
                {
                    belDup objdup = new belDup();
                    if (drFat["cd_dupli"].ToString() != "")
                    {
                        objdup.Ndup = Util.TiraSimbolo(drFat["cd_dupli"].ToString(), "");
                    }
                    if (!drFat["dt_venci"].Equals(string.Empty))
                    {
                        objdup.Dvenc = System.DateTime.Parse(drFat["dt_venci"].ToString());
                    }
                    decimal dvDup = Math.Round(Convert.ToDecimal(drFat["vl_doc"].ToString()), 2);
                    if (dvDup != 0)
                    {
                        objdup.Vdup = dvDup;
                    }
                    objdups.Add(objdup);
                }
                if (objdups.Count > 0)
                {
                    this.Fat.belDup = objdups.OrderBy(C => C.Dvenc).ToList();
                }
                else
                {
                    this.Fat = null;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 2
0
        public void Carrega(string seqNF)
        {
            try
            {
                foreach (DataRow drCob in BuscaCobr(seqNF).Rows)
                {
                    decimal dvDup = Math.Round(Convert.ToDecimal(drCob["vOrig"].ToString()), 2);
                    decimal dDesc = Math.Round(Convert.ToDecimal(drCob["vDesc"].ToString()), 2);
                    if (drCob["nFat"].ToString().Trim() != "")
                    {
                        this.Fat.Nfat = Util.TiraSimbolo(drCob["nFat"].ToString(), "");
                    }
                    this.Fat.Vorig = dvDup;
                    if (drCob["vDesc"].ToString() != "0")
                    {
                        this.Fat.Vdesc = Math.Round(Convert.ToDecimal(dDesc.ToString()), 2);
                    }
                    if (drCob["vLiq"].ToString() != "0")
                    {
                        decimal dLiq = Math.Round(Convert.ToDecimal(drCob["vLiq"].ToString()), 2);
                        this.Fat.Vliq = dLiq;
                    }
                }
                List<belDup> objdups = new List<belDup>();

                foreach (DataRow drFat in BuscaFat(seqNF).Rows)
                {
                    belDup objdup = new belDup();
                    if (drFat["cd_dupli"].ToString() != "")
                    {
                        objdup.Ndup = Util.TiraSimbolo(drFat["cd_dupli"].ToString(), "");
                    }
                    if (!drFat["dt_venci"].Equals(string.Empty))
                    {
                        objdup.Dvenc = System.DateTime.Parse(drFat["dt_venci"].ToString());
                    }
                    decimal dvDup = Math.Round(Convert.ToDecimal(drFat["vl_doc"].ToString()), 2);
                    if (dvDup != 0)
                    {
                        objdup.Vdup = dvDup;
                    }
                    objdups.Add(objdup);
                }
                if (objdups.Count > 0)
                {
                    this.Fat.belDup = objdups.OrderBy(C => C.Dvenc).ToList();
                }
                else
                {
                    this.Fat = null;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Exemplo n.º 3
0
        public belCobr xmlBuscaCobr()
        {
            belCobr objCobr = new belCobr();
            XmlDocument xCobr = new XmlDocument();
            belFat objFat = new belFat();

            try
            {
                if (xDoc.GetElementsByTagName("cobr").Count > 0)
                {
                    xCobr.LoadXml(xDoc.GetElementsByTagName("cobr")[0].OuterXml);

                    if (xCobr.GetElementsByTagName("fat").Count > 0)
                    {
                        XmlDocument xFat = new XmlDocument();
                        xFat.LoadXml(xCobr.GetElementsByTagName("fat")[0].OuterXml);

                        if (xFat.GetElementsByTagName("nFat").Count > 0)
                        {
                            objFat.Nfat = xFat.GetElementsByTagName("nFat")[0].InnerText;
                        }

                        if (xFat.GetElementsByTagName("vOrig").Count > 0)
                        {
                            objFat.Vorig = Convert.ToDecimal(xFat.GetElementsByTagName("vOrig")[0].InnerText.ToString().Replace(".", ","));
                        }

                        if (xFat.GetElementsByTagName("vDesc").Count > 0)
                        {
                            objFat.Vdesc = Convert.ToDecimal(xFat.GetElementsByTagName("vDesc")[0].InnerText.ToString().Replace(".", ","));
                        }

                        if (xFat.GetElementsByTagName("vLiq").Count > 0)
                        {
                            objFat.Vliq = Convert.ToDecimal(xFat.GetElementsByTagName("vLiq")[0].InnerText.ToString().Replace(".", ","));
                        }
                    }
                    List<belDup> lobjDup = new List<belDup>();

                    for (int i = 0; i < xCobr.GetElementsByTagName("dup").Count; i++)
                    {
                        XmlDocument xDup = new XmlDocument();
                        xDup.LoadXml(xCobr.GetElementsByTagName("dup")[i].OuterXml);

                        belDup objDup = new belDup();

                        if (xDup.GetElementsByTagName("nDup").Count > 0)
                        {
                            objDup.Ndup = xDup.GetElementsByTagName("nDup")[0].InnerText;
                        }

                        if (xDup.GetElementsByTagName("dVenc").Count > 0)
                        {
                            objDup.Dvenc = Convert.ToDateTime(xDup.GetElementsByTagName("dVenc")[0].InnerText);
                        }

                        if (xDup.GetElementsByTagName("vDup").Count > 0)
                        {
                            objDup.Vdup = Convert.ToDecimal(xDup.GetElementsByTagName("vDup")[0].InnerText.ToString().Replace(".", ","));
                        }

                        lobjDup.Add(objDup);

                    }

                    objFat.belDup = lobjDup;
                    objCobr.Fat = objFat;



                }


            }
            catch (Exception ex)
            {

                throw new Exception(string.Format("Problemas lendo a Tag Transp, Cobr.: {0}",
                                                  ex.Message));
            }
            return objCobr;
        }