Exemple #1
0
 public RarTurnoverData()
 {
     Subdevision  = new RarSubdevision();
     Manufacturer = new RarCompany();
     Buyer        = new RarCompany();
     License      = new RarLicense();
 }
Exemple #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);
                        }
                    }
                }
            }
        }