Esempio n. 1
0
        public void Append(Statement s)
        {
            if (s != null)
            {
                if (Header == null)
                {
                    Header = new StatementHeader();
                    Header.LoadInfoFrom(s.Header);
                }

                if (s.Header.Month != Header.Month || s.Header.Year != Header.Year)
                {
                    throw new ArgumentException("Statement date differs from base statement date.");
                }

                foreach (KeyValuePair <String, StatementEntry> e in s.Entries)
                {
                    StatementEntry entry;
                    if (Entries.TryGetValue(e.Key, out entry))
                    {
                        entry.InvoiceCount += e.Value.InvoiceCount;
                        entry.BaseValue    += e.Value.BaseValue;
                        entry.VATValue     += e.Value.VATValue;
                    }
                    else
                    {
                        Entries.Add(e.Key, e.Value);
                    }
                }
            }
        }
        public StatementHeader ReadHeaderInto()
        {
            StatementHeader header = new StatementHeader();
            XmlNode d394 = doc.SelectSingleNode("//ds:declaratie394", nsmgr);
            header.Month = d394.Attributes["luna"].Value;
            header.Year = d394.Attributes["an"].Value;
            header.Type = d394.Attributes["tip_D394"].Value[0];

            Issuer issuer = new Issuer();
            issuer.Name = d394.Attributes["nume_declar"].Value;
            issuer.Surname = d394.Attributes["prenume_declar"].Value;
            issuer.Position = d394.Attributes["functie_declar"].Value;

            header.Issuer = issuer;

            XmlNode comp = doc.SelectSingleNode("//ds:identificare", nsmgr);
            Company company = new Company();
            company.CUI = comp.Attributes["cui"].Value;
            company.Name = comp.Attributes["den"].Value;
            company.Adress = comp.Attributes["adresa"].Value;
            company.Phone = comp.Attributes["telefon"].Value;
            company.Fax = comp.Attributes["fax"].Value;
            company.Email = comp.Attributes["mail"].Value;
            header.Company = company;
            return header;
        }
        private static void AppendSummary(StatementHeader header, XmlDocument xml)
        {
            XmlElement summary = xml.CreateElement("rezumat");

            xml.DocumentElement.AppendChild(summary);
            summary.SetAttribute("nrCui", header.Summary.UniquePartenerCount.ToString());

            summary.SetAttribute("bazaL", header.Summary.LType.Base.ToString());
            summary.SetAttribute("tvaL", header.Summary.LType.VAT.ToString());

            summary.SetAttribute("bazaA", header.Summary.AType.Base.ToString());
            summary.SetAttribute("tvaA", header.Summary.AType.VAT.ToString());

            summary.SetAttribute("bazaV", header.Summary.VType.Base.ToString());
            summary.SetAttribute("tvaV", header.Summary.VType.VAT.ToString());

            summary.SetAttribute("bazaVc", header.Summary.VcType.Base.ToString());
            summary.SetAttribute("tvaVc", header.Summary.VcType.VAT.ToString());

            summary.SetAttribute("bazaC", header.Summary.CType.Base.ToString());
            summary.SetAttribute("tvaC", header.Summary.CType.VAT.ToString());

            summary.SetAttribute("bazaCc", header.Summary.CcType.Base.ToString());
            summary.SetAttribute("tvaCc", header.Summary.CcType.VAT.ToString());

            summary.SetAttribute("nrFactL", header.Summary.LTypeCount.ToString());
            summary.SetAttribute("nrFactA", header.Summary.ATypeCount.ToString());
            summary.SetAttribute("nrFactV", header.Summary.VTypeCount.ToString());
            summary.SetAttribute("nrFactC", header.Summary.CTypeCount.ToString());
        }
        public StatementHeader ReadHeaderInto()
        {
            StatementHeader header = new StatementHeader();
            XmlNode         d394   = doc.SelectSingleNode("//ds:declaratie394", nsmgr);

            header.Month = d394.Attributes["luna"].Value;
            header.Year  = d394.Attributes["an"].Value;
            header.Type  = d394.Attributes["tip_D394"].Value[0];

            Issuer issuer = new Issuer();

            issuer.Name     = d394.Attributes["nume_declar"].Value;
            issuer.Surname  = d394.Attributes["prenume_declar"].Value;
            issuer.Position = d394.Attributes["functie_declar"].Value;

            header.Issuer = issuer;

            XmlNode comp    = doc.SelectSingleNode("//ds:identificare", nsmgr);
            Company company = new Company();

            company.CUI    = comp.Attributes["cui"].Value;
            company.Name   = comp.Attributes["den"].Value;
            company.Adress = comp.Attributes["adresa"].Value;
            company.Phone  = comp.Attributes["telefon"].Value;
            company.Fax    = comp.Attributes["fax"].Value;
            company.Email  = comp.Attributes["mail"].Value;
            header.Company = company;
            return(header);
        }
        private static void AppendGeneralData(StatementHeader header, XmlDocument xml)
        {
            XmlElement root = xml.DocumentElement;

            root.SetAttribute("luna", header.Month);
            root.SetAttribute("an", header.Year);
            root.SetAttribute("tip_D394", header.Type.ToString());
            root.SetAttribute("nume_declar", header.Issuer.Name);
            root.SetAttribute("prenume_declar", header.Issuer.Surname);
            root.SetAttribute("functie_declar", header.Issuer.Position);
        }
        private static void AppendCompanyData(StatementHeader header, XmlDocument xml)
        {
            XmlElement ident = xml.CreateElement("identificare");

            xml.DocumentElement.AppendChild(ident);
            ident.SetAttribute("cui", header.Company.CUI);
            ident.SetAttribute("den", header.Company.Name);
            ident.SetAttribute("adresa", header.Company.Adress);
            ident.SetAttribute("telefon", header.Company.Phone);
            ident.SetAttribute("fax", header.Company.Fax);
            ident.SetAttribute("totalPlata_A", header.Summary.GetCRCSum().ToString());
        }
 internal void LoadInfoFrom(StatementHeader header)
 {
     if (header != null)
     {
         this.Month = header.Month;
         this.Year = header.Year;
         this.Type = header.Type;
         this.Issuer = header.Issuer.Clone();
         this.Company = header.Company.Clone();
         this.Summary = new StatementSummary();
     }
 }
Esempio n. 8
0
 internal void LoadInfoFrom(StatementHeader header)
 {
     if (header != null)
     {
         this.Month   = header.Month;
         this.Year    = header.Year;
         this.Type    = header.Type;
         this.Issuer  = header.Issuer.Clone();
         this.Company = header.Company.Clone();
         this.Summary = new StatementSummary();
     }
 }
Esempio n. 9
0
        public void Append(Statement s)
        {
            if (s != null)
            {
                if (Header == null)
                {
                    Header = new StatementHeader();
                    Header.LoadInfoFrom(s.Header);
                }

                if (s.Header.Month != Header.Month || s.Header.Year != Header.Year)
                {
                    throw new ArgumentException("Statement date differs from base statement date.");
                }

                foreach (KeyValuePair<String, StatementEntry> e in s.Entries)
                {
                    StatementEntry entry;
                    if (Entries.TryGetValue(e.Key, out entry))
                    {
                        entry.InvoiceCount += e.Value.InvoiceCount;
                        entry.BaseValue += e.Value.BaseValue;
                        entry.VATValue += e.Value.VATValue;
                    }
                    else
                    {
                        Entries.Add(e.Key, e.Value);
                    }
                }
            }
        }
Esempio n. 10
0
 private void LoadHeaderInfo(DataAccess dataAccess)
 {
     StatementHeader header = dataAccess.ReadHeaderInto();
     Header = header;
 }
Esempio n. 11
0
        private void LoadHeaderInfo(DataAccess dataAccess)
        {
            StatementHeader header = dataAccess.ReadHeaderInto();

            Header = header;
        }
Esempio n. 12
0
 private static void AppendCompanyData(StatementHeader header, XmlDocument xml)
 {
     XmlElement ident = xml.CreateElement("identificare");
     xml.DocumentElement.AppendChild(ident);
     ident.SetAttribute("cui", header.Company.CUI);
     ident.SetAttribute("den", header.Company.Name);
     ident.SetAttribute("adresa", header.Company.Adress);
     ident.SetAttribute("telefon", header.Company.Phone);
     ident.SetAttribute("fax", header.Company.Fax);
     ident.SetAttribute("totalPlata_A", header.Summary.GetCRCSum().ToString());
 }
Esempio n. 13
0
        private static void AppendSummary(StatementHeader header, XmlDocument xml)
        {
            XmlElement summary = xml.CreateElement("rezumat");
            xml.DocumentElement.AppendChild(summary);
            summary.SetAttribute("nrCui", header.Summary.UniquePartenerCount.ToString());

            summary.SetAttribute("bazaL", header.Summary.LType.Base.ToString());
            summary.SetAttribute("tvaL", header.Summary.LType.VAT.ToString());

            summary.SetAttribute("bazaA", header.Summary.AType.Base.ToString());
            summary.SetAttribute("tvaA", header.Summary.AType.VAT.ToString());

            summary.SetAttribute("bazaV", header.Summary.VType.Base.ToString());
            summary.SetAttribute("tvaV", header.Summary.VType.VAT.ToString());

            summary.SetAttribute("bazaVc", header.Summary.VcType.Base.ToString());
            summary.SetAttribute("tvaVc", header.Summary.VcType.VAT.ToString());

            summary.SetAttribute("bazaC", header.Summary.CType.Base.ToString());
            summary.SetAttribute("tvaC", header.Summary.CType.VAT.ToString());

            summary.SetAttribute("bazaCc", header.Summary.CcType.Base.ToString());
            summary.SetAttribute("tvaCc", header.Summary.CcType.VAT.ToString());

            summary.SetAttribute("nrFactL", header.Summary.LTypeCount.ToString());
            summary.SetAttribute("nrFactA", header.Summary.ATypeCount.ToString());
            summary.SetAttribute("nrFactV", header.Summary.VTypeCount.ToString());
            summary.SetAttribute("nrFactC", header.Summary.CTypeCount.ToString());
        }
Esempio n. 14
0
 private static void AppendGeneralData(StatementHeader header, XmlDocument xml)
 {
     XmlElement root = xml.DocumentElement;
     root.SetAttribute("luna", header.Month);
     root.SetAttribute("an", header.Year);
     root.SetAttribute("tip_D394", header.Type.ToString());
     root.SetAttribute("nume_declar", header.Issuer.Name);
     root.SetAttribute("prenume_declar", header.Issuer.Surname);
     root.SetAttribute("functie_declar", header.Issuer.Position);
 }
Esempio n. 15
0
 private void AppendHeader(StatementHeader header, XmlDocument xml)
 {
     AppendGeneralData(header, xml);
     AppendCompanyData(header, xml);
     AppendSummary(header, xml);
 }
Esempio n. 16
0
 private void AppendHeader(StatementHeader header, XmlDocument xml)
 {
     AppendGeneralData(header, xml);
     AppendCompanyData(header, xml);
     AppendSummary(header, xml);
 }