Example #1
0
 public RarTurnoverData()
 {
     Subdevision  = new RarSubdevision();
     Manufacturer = new RarCompany();
     Buyer        = new RarCompany();
     License      = new RarLicense();
 }
Example #2
0
        private static void SetupTurnoverData(XElement turnoverdata, RarFormF6 formF6)
        {
            RarSubdevision subdevision = new RarSubdevision();

            subdevision.Name = (string)turnoverdata.Attribute("Наим");
            subdevision.KPP  = (string)turnoverdata.Attribute("КППЮЛ");
            //subdevision.SalePresented = (bool)turnoverdata.Attribute("НаличиеПоставки");
            //subdevision.ReturnPresented = (bool)turnoverdata.Attribute("НаличиеВозврата");
            subdevision.Adress = SetupAdress(turnoverdata.Element("АдрОрг"));
            formF6.OurCompany.SubdevisionList.Add(subdevision);
            foreach (XNode nodeAlcoCode in turnoverdata.Elements("Оборот"))
            {
                XElement elAlcoCode = (XElement)nodeAlcoCode;
                foreach (XNode nodeManufacturer in elAlcoCode.Elements("СведПроизвИмпорт"))
                {
                    XElement   elManufacturer = (XElement)nodeManufacturer;
                    string     manufacturID   = (string)elManufacturer.Attribute("ИдПроизвИмп");
                    RarCompany manufacturer   = formF6.ManufacturersList.Where(p => p.ID == manufacturID).First();
                    foreach (XNode nodeBuyer in elManufacturer.Elements("Получатель"))
                    {
                        XElement   elBuyer = (XElement)nodeBuyer;
                        string     buyerID = (string)elBuyer.Attribute("ИдПолучателя");
                        RarCompany buyer   = formF6.BuyersList.Where(p => p.ID == buyerID).First();
                        buyer.IsUsed = true;
                        string     licenseID = (string)elBuyer.Attribute("ИдЛицензии");
                        RarLicense license   = buyer.LicensesList.Where(s => s.ID == licenseID).FirstOrDefault();

                        foreach (XNode nodeDocument in elBuyer.Elements("Поставка"))
                        {
                            XElement elDocument = (XElement)nodeDocument;

                            RarTurnoverData data = new RarTurnoverData();
                            data.Subdevision  = subdevision;
                            data.AlcoCode     = (string)elAlcoCode.Attribute("П000000000003");
                            data.Manufacturer = manufacturer;
                            data.Buyer        = buyer;
                            data.License      = license;

                            //data.NotificationDate=      DateTime.Parse(el.Element("СведПроизвИмпорт").Element("Получатель").Element("Поставка").Attribute("П000000000015").Value);
                            //data.NotificationNumber =   (string)el.Element("СведПроизвИмпорт").Element("Получатель").Element("Поставка").Attribute("П000000000016");
                            //data.NotificationTurnover = (double)el.Element("СведПроизвИмпорт").Element("Получатель").Element("Поставка").Attribute("П000000000017");
                            data.DocumentDate   = DateTime.Parse(elDocument.Attribute("П000000000018").Value);
                            data.DocumentNumber = (string)elDocument.Attribute("П000000000019");
                            //data.CustomsDeclarationNumber = (string)el.Element("СведПроизвИмпорт").Element("Получатель").Element("Поставка").Attribute("П000000000020");
                            data.Turnover = (double)elDocument.Attribute("П000000000021");
                            formF6.TurnoverDataList.Add(data);
                        }
                    }
                }
            }
        }
Example #3
0
 private static void SetupLisences(RarCompany rc, XElement lisenses)
 {
     foreach (XNode node in lisenses.Elements("Лицензия"))
     {
         RarLicense license = new RarLicense();
         XElement   el      = (XElement)node;
         license.ID           = (string)el.Attribute("ИдЛицензии");
         license.SeriesNumber = (string)el.Attribute("П000000000011");
         license.DateFrom     = DateTime.Parse(el.Attribute("П000000000012").Value);
         license.DateTo       = DateTime.Parse(el.Attribute("П000000000013").Value);
         license.Issuer       = (string)el.Attribute("П000000000014");
         rc.LicensesList.Add(license);
     }
 }
Example #4
0
        private static void SetupManufacturers(XElement references, RarFormF6 formF6)
        {
            foreach (XNode node in references.Elements("ПроизводителиИмпортеры"))
            {
                XElement   el = (XElement)node;
                RarCompany rc = new RarCompany();
                rc.ID   = (string)el.Attribute("ИдПроизвИмп");
                rc.Name = (string)el.Attribute("П000000000004");
                rc.INN  = (string)el.Attribute("П000000000005");
                rc.KPP  = (string)el.Attribute("П000000000006");


                formF6.ManufacturersList.Add(rc);
            }
        }
Example #5
0
        private static void SetupBuyers(XElement references, RarFormF6 formF6)
        {
            foreach (XNode node in references.Elements("Контрагенты"))
            {
                XElement   el = (XElement)node;
                RarCompany rc = new RarCompany();
                rc.Name = el.Attribute("П000000000007").Value;
                rc.ID   = el.Attribute("ИдКонтр").Value;

                XElement resident = el.Element("Резидент");
                if (resident != null)
                {
                    rc.CounryID = "643"; //  ?????????????????????
                    SetupLisences(rc, resident.Element("Лицензии"));
                    XElement adress = resident.Element("П000000000008");
                    rc.Adress = SetupAdress(adress);

                    XElement company = resident.Element("ЮЛ");
                    if (company != null)
                    {
                        rc.INN = (string)company.Attribute("П000000000009");
                        rc.KPP = (string)company.Attribute("П000000000010");
                    }
                    else
                    {
                        XElement individual = resident.Element("ФЛ");
                        if (individual != null)
                        {
                            rc.INN = (string)individual.Attribute("П000000000009");
                        }
                    }
                }
                else
                {
                    XElement foreigner = el.Element("Иностр");
                    if (foreigner != null)
                    {
                        rc.CounryID = (string)foreigner.Attribute("П000000000081");
                        rc.INN      = (string)foreigner.Attribute("Номер");
                        rc.Adress   = new RarAdress((string)foreigner.Attribute("П000000000082"));
                    }
                }

                formF6.BuyersList.Add(rc);
            }
        }
Example #6
0
        private static XElement GetCompanyElement(RarCompany company)
        {
            if ((company.CounryID == null) || (company.CounryID == "643"))
            {
                XElement domestic = new XElement("Резидент",
                                                 GetAdressElement(company.Adress),
                                                 new XElement("ЮЛ",
                                                              new XAttribute("П000000000009", company.INN == null ? "" : company.INN),
                                                              new XAttribute("П000000000010", company.KPP == null ? "" : company.KPP)),
                                                 new XElement("Производитель", new XAttribute("value", "True")),
                                                 new XElement("Перевозчик", new XAttribute("value", "False"))
                                                 );
                return(domestic);
            }

            XElement foreigner = new XElement("Иностр",
                                              new XAttribute("П000000000081", company.CounryID));

            return(foreigner);
        }
Example #7
0
        private static XElement[] GetProductList(List <RarTurnoverData> turnoverList, RarCompany manufacture)
        {
            List <RarTurnoverData> cutTurnoverList = turnoverList.Where(s => s.Manufacturer == manufacture).ToList();

            return(cutTurnoverList.Select(p =>
                                          new XElement("Продукция",
                                                       new XAttribute("П200000000013", p.DocumentDate.ToShortDateString()),
                                                       new XAttribute("П200000000014", p.DocumentNumber),
                                                       p.CustomsDeclarationNumber == null ? null : new XAttribute("П200000000015", p.CustomsDeclarationNumber),
                                                       new XAttribute("П200000000016", p.Turnover)
                                                       )
                                          ).ToArray());
        }