public void Parse()
        {
            Assert.IsTrue(FarmSKDParser.CheckFileFormat(Dbf.Load(@"..\..\Data\Waybills\30529180.DBF")));
            var document = WaybillParser.Parse("30529180.DBF");

            Assert.That(document.ProviderDocumentId, Is.EqualTo("29180"));
            Assert.That(document.DocumentDate.Value.ToShortDateString(), Is.EqualTo("05.03.2012"));

            var line = document.Lines[0];

            Assert.That(line.Code, Is.EqualTo("2012-0011610"));
            Assert.That(line.Product, Is.EqualTo("Аллохол табл.п.о. N 50 (48)"));
            Assert.That(line.Country, Is.EqualTo("БЕЛАРУСЬ"));
            Assert.That(line.ProducerCostWithoutNDS, Is.EqualTo(36.27));
            Assert.That(line.ProducerCost, Is.EqualTo(39.9));
            Assert.That(line.SupplierCostWithoutNDS, Is.EqualTo(42.93));
            Assert.That(line.SupplierCost, Is.EqualTo(47.22));
            Assert.That(line.RegistryCost, Is.EqualTo(0));
            Assert.That(line.Nds, Is.EqualTo(10));
            Assert.That(line.Quantity, Is.EqualTo(10));
            Assert.That(line.Amount, Is.EqualTo(472.23));
            Assert.That(line.NdsAmount, Is.EqualTo(42.93));
            Assert.That(line.Producer, Is.EqualTo("Белмедпрепараты"));
            Assert.That(line.Period, Is.EqualTo("01.02.2016"));
            Assert.That(line.SerialNumber, Is.EqualTo("030112"));
            Assert.That(line.Unit, Is.EqualTo("уп."));
            Assert.That(line.Certificates, Is.EqualTo("РОСС BY.ФМ05.Д97735"));
            Assert.That(line.CertificatesDate, Is.EqualTo("06.02.2012"));
            Assert.That(line.EAN13, Is.EqualTo(4810133003801));
            Assert.IsNull(line.BillOfEntryNumber);
        }
        public void Parse()
        {
            Assert.IsTrue(UralBioFarmKurskParser.CheckFileFormat(Dbf.Load(@"..\..\Data\Waybills\152307.DBF")));
            var document = WaybillParser.Parse("152307.DBF");

            Assert.That(document.Lines.Count, Is.EqualTo(3));
            Assert.That(document.ProviderDocumentId, Is.EqualTo("152307"));
            Assert.That(document.DocumentDate.Value.ToShortDateString(), Is.EqualTo("25.11.2011"));

            var invoice = document.Invoice;

            Assert.That(invoice, Is.Not.Null);
            Assert.That(invoice.InvoiceNumber, Is.EqualTo("152307"));
            Assert.That(invoice.InvoiceDate.Value.ToShortDateString(), Is.EqualTo("25.11.2011"));
            Assert.That(invoice.BuyerName, Is.EqualTo("ИП Нескородова Л.А."));
            Assert.That(invoice.BuyerAddress, Is.EqualTo("305025, г.Курск  Магистральный пр. 16 б"));

            var line = document.Lines[0];

            Assert.That(line.Code, Is.EqualTo("2029"));
            Assert.That(line.Product, Is.EqualTo("Асептолин р-р д/наруж. прим. 90% 100мл"));
            Assert.That(line.ProducerCostWithoutNDS, Is.EqualTo(15.32));
            Assert.That(line.ProducerCost, Is.EqualTo(16.85));
            Assert.That(line.SupplierCostWithoutNDS, Is.EqualTo(15.47));
            Assert.That(line.SupplierCost, Is.EqualTo(17.02));
            Assert.That(line.Nds, Is.EqualTo(10));
            Assert.That(line.Quantity, Is.EqualTo(210));
            Assert.That(line.Amount, Is.EqualTo(3573.57));
            Assert.That(line.NdsAmount, Is.EqualTo(324.87));
            Assert.That(line.Producer, Is.EqualTo("Фармацевтический комбинат (Россия)"));
            Assert.That(line.Period, Is.EqualTo("01.10.2013"));
            Assert.That(line.SerialNumber, Is.EqualTo("071011"));
            Assert.That(line.Certificates, Is.EqualTo("POCCRU.ФМ01.Д38608, 01.11.11, ФГБУ\"ЦЭККМП\"Росздравнадзора, 01.10.13"));
            Assert.IsNull(line.BillOfEntryNumber);
        }
        public void Parse_waybills_Convert_Dbf_format()
        {
            var filePath = @"..\..\Data\Waybills\890579.dbf";

            CopyFile(waybillDir, filePath);

            supplier.WaybillSource.ReaderClassName = "ProtekOmsk_3777_Reader";
            MaitainAddressIntersection(client.Addresses[0].Id);

            SetConvertDocumentSettings();

            Process();

            CheckClientDirectory(2, DocType.Waybill);

            var logs = session.Query <TestDocumentLog>().Where(l =>
                                                               l.Client.Id == client.Id &&
                                                               l.Supplier.Id == supplier.Id &&
                                                               l.Address == client.Addresses[0]);

            Assert.That(logs.Count(), Is.EqualTo(2));
            Assert.That(logs.Count(l => l.IsFake), Is.EqualTo(1));
            Assert.That(logs.Count(l => !l.IsFake), Is.EqualTo(1));

            var log      = logs.SingleOrDefault(l => !l.IsFake);
            var file_dbf = GetFileForAddress(DocType.Waybill).Single(f => f.IndexOf(log.Id.ToString()) > -1);

            var data = Dbf.Load(file_dbf, Encoding.GetEncoding(866));

            Assert.IsTrue(data.Columns.Contains("postid_af"));
            Assert.IsTrue(data.Columns.Contains("ttn"));
            Assert.IsTrue(data.Columns.Contains("przv_post"));
        }
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file, Encoding);

            new DbfParser()
            .DocumentHeader(h => h.ProviderDocumentId, "NOMER")
            .DocumentHeader(h => h.DocumentDate, "DATA")
            .Invoice(i => i.BuyerName, "KLI")
            .Invoice(i => i.BuyerId, "REESTR")
            .Line(l => l.Code, "KOD")
            .Line(l => l.Product, "NM")
            .Line(l => l.Producer, "PROIZV")
            .Line(l => l.Country, "COUNTRY")
            .Line(l => l.SupplierCostWithoutNDS, "PRICMNDS")
            .Line(l => l.SupplierCost, "PRICWNDS")
            .Line(l => l.Nds, "NDS")
            .Line(l => l.Amount, "SUMMA")
            .Line(l => l.Quantity, "KOLVO")
            .Line(l => l.Period, "SROKGODN")
            .Line(l => l.Certificates, "SERTIF")
            .Line(l => l.CertificatesDate, "SERTDATA")
            .Line(l => l.CertificatesEndDate, "SROKSERT")
            .Line(l => l.CertificateAuthority, "SERTKEM")
            .Line(l => l.SerialNumber, "SERIA")
            .Line(l => l.BillOfEntryNumber, "GTD")
            .Line(l => l.ProducerCost, "PRICE_PR")
            .Line(l => l.NdsAmount, "REG_NOM")
            .Line(l => l.RegistryCost, "NAC")
            .ToDocument(document, data);

            return(document);
        }
Example #5
0
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file, Encoding);

            new DbfParser()
            .DocumentHeader(h => h.ProviderDocumentId, "NSF")
            .DocumentHeader(h => h.DocumentDate, "DOTG")
            .Invoice(i => i.InvoiceNumber, "NSF")
            .Invoice(i => i.InvoiceDate, "DOTG")
            .Invoice(i => i.BuyerName, "NMPOST")
            .Invoice(i => i.BuyerAddress, "ADRPOST")
            .Line(l => l.Code, "NFS")
            .Line(l => l.Product, "NMFS")
            .Line(l => l.Producer, "ZIZG")
            .Line(l => l.ProducerCostWithoutNDS, "ZNIZG")
            .Line(l => l.ProducerCost, "ZNIZG_S_N")
            .Line(l => l.SupplierCostWithoutNDS, "ZNPROD")
            .Line(l => l.SupplierCost, "ZNPROD_S_N")
            .Line(l => l.RegistryCost, "GR_CENA")
            .Line(l => l.Amount, "SUMNDS")
            .Line(l => l.NdsAmount, "NDSSUM")
            .Line(l => l.Quantity, "KOLF")
            .Line(l => l.Period, "SROK")
            .Line(l => l.Certificates, "SERTIF")
            .Line(l => l.SerialNumber, "SER")
            .Line(l => l.BillOfEntryNumber, "OKDP")
            .Line(l => l.Nds, "NDS")
            .Line(l => l.VitallyImportant, "PV")
            .Line(l => l.OrderId, "NUMZAK")
            .ToDocument(document, data);

            return(document);
        }
        public void Parse_and_Convert_to_Dbf_if_sert_date()
        {
            settings.IsConvertFormat    = true;
            settings.AssortimentPriceId = price.Id;
            settings.SaveAndFlush();

            var ids = ParseFile("20101119_8055_250829.xml");

            var logs = DocumentReceiveLog.Queryable.Where(l => l.Supplier.Id == supplier.Id && l.ClientCode == client.Id);

            Assert.That(logs.Count(), Is.EqualTo(2));
            Assert.That(logs.Where(l => l.IsFake).Count(), Is.EqualTo(1));
            Assert.That(logs.Where(l => !l.IsFake).Count(), Is.EqualTo(1));

            // Проверяем наличие записей в documentheaders для исходных документов.
            foreach (var documentLog in logs)
            {
                var count = documentLog.IsFake
                                        ? Document.Queryable.Where(doc => doc.Log.Id == documentLog.Id && doc.Log.IsFake).Count()
                                        : Document.Queryable.Where(doc => doc.Log.Id == documentLog.Id && doc.Log.IsFake).Count();
                Assert.That(count, documentLog.IsFake ? Is.EqualTo(1) : Is.EqualTo(0));
            }
            var files_dbf = Directory.GetFiles(Path.Combine(docRoot, "Waybills"), "*.dbf");

            Assert.That(files_dbf.Count(), Is.EqualTo(1));
            var file_dbf = files_dbf.Select(f => f).First();
            var data     = Dbf.Load(file_dbf, Encoding.GetEncoding(866));

            Assert.IsTrue(data.Columns.Contains("sert_date"));
            Assert.That(data.Rows[0]["sert_date"], Is.EqualTo("10.08.2009"));
        }
        public void Parse()
        {
            Assert.IsTrue(SiaAstrahanParser.CheckFileFormat(Dbf.Load(@"..\..\Data\Waybills\Р-786953.DBF")));
            var document = WaybillParser.Parse("Р-786953.DBF");

            Assert.That(document.Lines.Count, Is.EqualTo(36));
            Assert.That(document.ProviderDocumentId, Is.EqualTo("Р-786953"));
            Assert.That(document.DocumentDate.Value.ToShortDateString(), Is.EqualTo("12.03.2012"));

            var line = document.Lines[0];

            Assert.That(line.Code, Is.EqualTo("24378"));
            Assert.That(line.Product, Is.EqualTo("Аква Марис капли назальные д/детей 10мл Фл-капельница Б"));
            Assert.That(line.Producer, Is.EqualTo("Ядран Галенский Лабораторий АО"));
            Assert.That(line.Country, Is.EqualTo("ХОРВАТИЯ"));
            Assert.That(line.RegistryCost, Is.EqualTo(0));
            Assert.IsNull(line.ProducerCost);
            Assert.IsNull(line.ProducerCostWithoutNDS);
            Assert.That(line.SupplierCostWithoutNDS, Is.EqualTo(73.22));
            Assert.That(line.SupplierCost, Is.EqualTo(80.54));
            Assert.That(line.Nds, Is.EqualTo(10));
            Assert.That(line.Quantity, Is.EqualTo(2));
            Assert.That(line.Amount, Is.EqualTo(161.08));
            Assert.That(line.NdsAmount, Is.EqualTo(14.64));
            Assert.That(line.Period, Is.EqualTo("01.08.2013"));
            Assert.That(line.SerialNumber, Is.EqualTo("2041"));
            Assert.That(line.Certificates, Is.EqualTo("РОСС HR.ФМ01.Д23988"));
            Assert.That(line.CertificatesDate, Is.EqualTo("25.10.2011"));
            Assert.That(line.VitallyImportant, Is.EqualTo(false));
            Assert.That(line.EAN13, Is.EqualTo(3858881054738));
            Assert.That(line.BillOfEntryNumber, Is.EqualTo("10130030/251011/0004515/1"));
        }
Example #8
0
        public void WriteGB2312()
        {
            var dbf = new Dbf(encoding);

            fields.ForEach(x => dbf.Fields.Add(x));

            DbfRecord record = dbf.CreateRecord();

            foreach (var field in fields)
            {
                object item = null;
                try
                {
                    item = data[field.Name];
                }
                catch (Exception)
                {
                    // ignored
                }

                record.Data[fields.IndexOf(field)] = item;
            }

            // Act.
            dbf.Write("test.dbf", DbfVersion.FoxBaseDBase3NoMemo);

            // Assert.
            var dbfTest = new Dbf(encoding);

            dbfTest.Read("test.dbf");
            var rowStd = dbfTest.Records[0];

            Assert.AreEqual(rowStd["中文字段"], "股票代码");
            Assert.AreEqual(rowStd["中文字段2"], "股票代码股");      //should be truncated to 10 bytes
        }
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file, null, true, false);

            new DbfParser()
            .DocumentHeader(d => d.ProviderDocumentId, "NUMNAK")
            .DocumentHeader(d => d.DocumentDate, "DATAGOT")
            .Line(l => l.Code, "KODNLKLEK")
            .Line(l => l.Product, "NAMLEK")
            .Line(l => l.Producer, "NAMZAVOD")
            .Line(l => l.Country, "NAMSTRANA")
            .Line(l => l.Period, "SROKGOD")
            .Line(l => l.SerialNumber, "SERIJ")
            .Line(l => l.Quantity, "COUNT")
            .Line(l => l.SupplierCost, "CENAPROD")
            .Line(l => l.ProducerCostWithoutNDS, "CENARAS")
            .Line(l => l.Nds, "PRCNDS")
            .Line(l => l.VitallyImportant, "OBAS")
            .Line(l => l.RegistryCost, "CENAREE")
            .Line(l => l.Certificates, "NUMBER")
            .Line(l => l.SupplierCostWithoutNDS, "CENAPRBNDS")
            .Line(l => l.EAN13, "ZSHK")
            .Line(l => l.CertificateAuthority, "NAMEPRINT")
            .Line(l => l.CertificatesEndDate, "SROK")
            .Line(l => l.BillOfEntryNumber, "NUMDECLARE")
            .Line(l => l.Amount, "SUMPROD")
            .Line(l => l.Unit, "VID")
            .Invoice(i => i.SellerName, "SENDER")
            .ToDocument(document, data);
            return(document);
        }
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file, Encoding.GetEncoding(1251), false, false);

            new DbfParser()
            .DocumentHeader(h => h.ProviderDocumentId, "DOCNUM")
            .DocumentHeader(h => h.DocumentDate, "DOCDATE")
            .Line(l => l.Code, "ID")
            .Line(l => l.Product, "NAME")
            .Line(l => l.Quantity, "KOL")
            .Line(l => l.SupplierCostWithoutNDS, "PRICENONDS")
            .Line(l => l.Nds, "NDSPROC")
            .Line(l => l.NdsAmount, "NDSSUM")
            .Line(l => l.Amount, "SUMWNDS")
            .Line(l => l.SerialNumber, "SER")
            .Line(l => l.Period, "SROK")
            .Line(l => l.Certificates, "SERT")
            .Line(l => l.Producer, "PRO")
            .Line(l => l.ProducerCostWithoutNDS, "PRONONDS")
            .Line(l => l.Country, "COUNTRY")
            .Line(l => l.BillOfEntryNumber, "GTD")
            .Line(l => l.EAN13, "BARCODE")
            .Invoice(i => i.ShipperInfo, "VENDOR")
            .ToDocument(document, data);
            return(document);
        }
Example #11
0
        public Document Parse(string file, Document document)
        {
            var data     = Dbf.Load(file);
            var fileName = Path.GetFileNameWithoutExtension(file);

            document.ProviderDocumentId = fileName;
            new DbfParser()
            .DocumentHeader(d => d.DocumentDate, "DATEDOC")
            .Line(l => l.Code, "CODE")
            .Line(l => l.Product, "GOODE")
            .Line(l => l.SerialNumber, "SERIAL")
            .Line(l => l.Period, "DATEB")
            .Line(l => l.SupplierCost, "PRICE")
            .Line(l => l.Quantity, "QUANT")
            .Line(l => l.SupplierPriceMarkup, "MARGIN")
            .Line(l => l.Nds, "NDS")
            .Line(l => l.RegistryCost, "REESTR")
            .Line(l => l.Country, "COUNTRY")
            .Line(l => l.Producer, "PRODUSER")
            .Line(l => l.ProducerCostWithoutNDS, "PPRICEWT")
            .Line(l => l.VitallyImportant, "GV")
            .Line(l => l.NdsAmount, "NDSSUM")
            .Line(l => l.Amount, "SUM")
            .Line(l => l.Certificates, "SERT")
            .Line(l => l.CertificatesEndDate, "DATES")
            .Line(l => l.CertificateAuthority, "SERTWHO")
            .Line(l => l.CertificatesDate, "SERT_DATE")
            .Line(l => l.EAN13, "BARCODE")

            .Invoice(i => i.Amount, "InvoiceSum")
            .ToDocument(document, data);
            return(document);
        }
        public void Parse()
        {
            var log = new DocumentReceiveLog {
                Id       = 100,
                Supplier = new Supplier {
                    Id   = 201,
                    Name = "Тестовый поставщик"
                },
                DocumentType = DocType.Waybill,
                LogTime      = DateTime.Now,
                ClientCode   = 1001,
                Address      = new Address {
                    Id  = 501,
                    Org = new Inforoom.PriceProcessor.Waybills.Models.Org {
                        FullName = "Тестовое юр.лицо"
                    }
                }
            };
            var doc = WaybillParser.Parse(@"..\..\Data\Waybills\ПР-Д-КЗ043809.xml");

            doc.Log     = log;
            doc.Address = new Address {
                Name = "Тестовый Адрес",
                Id   = 2321321
            };
            DbfExporter.SaveUniversalV2(doc, "ПР-Д-КЗ043809.dbf");
            var data = Dbf.Load("ПР-Д-КЗ043809.dbf");

            Assert.That(data.Rows[0]["sgodn"], Is.EqualTo(DBNull.Value));
            Assert.That(data.Rows[0]["przv_post"], Is.EqualTo("ООО \"Медполимерторг\""));
        }
        /// <summary>
        /// Парсер для формата файла DBF
        /// </summary>
        protected void ParseDBF(RejectHeader reject, string filename)
        {
            DataTable data;

            try
            {
                data = Dbf.Load(filename);
            }
            catch (Exception e)
            {
                var err = string.Format("Не удалось получить файл с отказами '{0}' для лога документа {1}", filename, reject.Log.Id);
                Logger.Warn(err, e);
                return;
            }
            for (var i = 0; i < data.Rows.Count; i++)
            {
                var rejectLine = new RejectLine();
                reject.Lines.Add(rejectLine);
                rejectLine.Product = data.Rows[i][10].ToString();
                rejectLine.Code    = data.Rows[i][9].ToString();
                rejectLine.Cost    = NullableConvert.ToDecimal(data.Rows[i][13].ToString());
                rejectLine.Ordered = NullableConvert.ToUInt32(data.Rows[i][14].ToString());
                var rejected = NullableConvert.ToUInt32(data.Rows[i][15].ToString());
                rejectLine.Rejected = rejected != null ? rejected.Value : 0;
            }
        }
Example #14
0
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file, Encoding.GetEncoding(866), true, false);

            new DbfParser()
            .DocumentHeader(h => h.ProviderDocumentId, "NUM_NAKL")
            .DocumentHeader(h => h.DocumentDate, "DATA_NAKL")
            .Line(l => l.Code, "KOD")
            .Line(l => l.Product, "NAME")
            .Line(l => l.Producer, "PROIZV")
            .Line(l => l.Country, "COUNTRY")
            .Line(l => l.ProducerCostWithoutNDS, "CENAFACT")
            .Line(l => l.SupplierCost, "CENASNDS")
            .Line(l => l.Quantity, "KOLVO")
            .Line(l => l.RegistryCost, "CENAREG")
            .Line(l => l.Certificates, "SERTIF")
            .Line(l => l.SerialNumber, "SERII")
            .Line(l => l.VitallyImportant, "JNVLS")
            .Line(l => l.NdsAmount, "SUMMANDS")
            .Line(l => l.Amount, "SUMMA")
            .Line(l => l.Period, "DATAEND")
            .ToDocument(document, data);

            return(document);
        }
Example #15
0
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file, Encoding.GetEncoding(866), true, false);

            new DbfParser()
            .DocumentHeader(d => d.ProviderDocumentId, "NUM_NAKL")
            .DocumentHeader(d => d.DocumentDate, "DATA_NAKL")
            .Line(l => l.Code, "KOD")
            .Line(l => l.Product, "NAME")
            .Line(l => l.Producer, "PROIZV")
            .Line(l => l.Country, "COUNTRY")
            .Line(l => l.Quantity, "KOLVO")
            .Line(l => l.ProducerCostWithoutNDS, "CENAPROIZ")
            .Line(l => l.RegistryCost, "REESTR")
            .Line(l => l.SupplierPriceMarkup, "NADBPROC")
            .Line(l => l.SupplierCostWithoutNDS, "CENABNDS")
            .Line(l => l.Nds, "NDSPOSTAV")
            .Line(l => l.SupplierCost, "CENASNDS")
            .Line(l => l.NdsAmount, "SUMMANDS")
            .Line(l => l.Amount, "SUMMA")
            .Line(l => l.SerialNumber, "SERII")
            .Line(l => l.Certificates, "SERTIF")
            .Line(l => l.CertificatesEndDate, "SERTDATE")
            .Line(l => l.CertificatesDate, "SERTGIVE")
            .Line(l => l.CertificateAuthority, "SERTORG")
            .Line(l => l.Period, "SROK_GODN", "DATAEND")
            .ToDocument(document, data);
            return(document);
        }
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file, Encoding);

            new DbfParser()
            .DocumentHeader(h => h.ProviderDocumentId, "TTN")
            .DocumentHeader(h => h.DocumentDate, "TTN_DATE")
            .Line(l => l.Code, "SP_PRD_IDV")
            .Line(l => l.Product, "NAME_POST")
            .Line(l => l.EAN13, "SCAN_CODE")
            .Line(l => l.Quantity, "KOL_VO")
            .Line(l => l.Producer, "PRZV_POST")
            .Line(l => l.Period, "SGODN")
            .Line(l => l.SupplierCost, "PR_W_NDS")
            .Line(l => l.SupplierCostWithoutNDS, "PR_WO_NDS")
            .Line(l => l.ProducerCost, "PR_MAK_NDS")
            .Line(l => l.ProducerCostWithoutNDS, "PR_MAK")
            .Line(l => l.VitallyImportant, "ZV")
            .Line(l => l.RegistryCost, "PR_REE")
            .Line(l => l.RegistryDate, "DATE_REG")
            .Line(l => l.BillOfEntryNumber, "GTD")
            .Line(l => l.Certificates, "SERT")
            .Line(l => l.CertificatesEndDate, "SERT_DATE")
            .Line(l => l.CertificateAuthority, "SERT_AUTH")
            .Line(l => l.SerialNumber, "SERIA")

            .Invoice(i => i.InvoiceNumber, "head_id")
            .Invoice(i => i.RecipientName, "apt_af")
            .ToDocument(document, data);
            return(document);
        }
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file, Encoding);

            if (document.Invoice == null)
            {
                document.SetInvoice();
            }

            document.Lines = data.Rows.Cast <DataRow>().Select(r => {
                document.ProviderDocumentId = r["NOMNAKL"].ToString();
                if (!Convert.IsDBNull(r["DATANAKL"]))
                {
                    document.DocumentDate = Convert.ToDateTime(r["DATANAKL"]);
                }
                document.Invoice.BuyerName = r["KONTR"].ToString();

                var line          = document.NewLine();
                line.Quantity     = Convert.ToUInt32(r["KOL"]);
                line.Code         = r["KOD1C"].ToString();
                line.SupplierCost = Convert.ToDecimal(r["PRICE"], CultureInfo.InvariantCulture);
                line.NdsAmount    = Convert.ToDecimal(r["NDS"], CultureInfo.InvariantCulture);
                line.Country      = r["PROIZV"].ToString();
                line.Certificates = r["SERT"].ToString();
                line.Amount       = Convert.ToDecimal(r["SUMMMA"], CultureInfo.InvariantCulture);
                line.SetNds(Convert.ToDecimal(r["STNDS"], CultureInfo.InvariantCulture));

                // NAME - Производитель " / " Название товара (первый слеш с пробелами с двух сторон является разделяющим символом)
                line.Product  = re.Match(r["NAME"].ToString()).Groups["product"].Value;
                line.Producer = re.Match(r["NAME"].ToString()).Groups["producer"].Value;

                return(line);
            }).ToList();
            return(document);
        }
		public Document Parse(string file, Document document)
		{
			var data = Dbf.Load(file, Encoding);

			document.Lines = data.Rows.Cast<DataRow>().Select(r => {
				document.ProviderDocumentId = Convert.ToString(r["NUM_DOC"], CultureInfo.InvariantCulture);
				document.DocumentDate = DateTime.Parse(r["DATE_DOC"].ToString());

				var invoice = document.SetInvoice();
				invoice.BuyerName = r["USER"].ToString();
				invoice.SellerName = r["PRODAVEC"].ToString();

				var line = document.NewLine();
				line.Code = r["CODE_TOVAR"].ToString();
				line.Product = r["NAME_TOVAR"].ToString();
				line.Producer = r["PROIZ"].ToString();
				line.SupplierCostWithoutNDS = Convert.ToDecimal(r["CENABEZNDS"], CultureInfo.InvariantCulture);
				line.SupplierCost = Convert.ToDecimal(r["PRICE"], CultureInfo.InvariantCulture);
				line.Amount = Convert.ToDecimal(r["SUMMA"], CultureInfo.InvariantCulture);
				line.NdsAmount = Convert.ToDecimal(r["SUMMA_NDS"], CultureInfo.InvariantCulture);
				line.Quantity = Convert.ToUInt32(r["VOLUME"], CultureInfo.InvariantCulture);
				line.Unit = r["EDINIZM"].ToString();
				line.Certificates = r["DOCUMENT"].ToString();
				line.CertificatesDate = DateTime.Parse(r["SROKSERT"].ToString()).ToShortDateString();
				line.Nds = Convert.ToUInt32(r["PCT_NDS"].ToString().Replace("%", string.Empty), CultureInfo.InvariantCulture);
				return line;
			}).ToList();

			return document;
		}
        public void Parse()
        {
            Assert.IsTrue(PulsFKParser.CheckFileFormat(Dbf.Load(@"..\..\Data\Waybills\249137.dbf")));

            var document = WaybillParser.Parse(@"..\..\Data\Waybills\249137.dbf");

            Assert.That(document.Lines.Count, Is.EqualTo(7));
            Assert.That(document.ProviderDocumentId, Is.EqualTo("249137"));
            Assert.That(document.DocumentDate, Is.EqualTo(Convert.ToDateTime("26.07.2012")));

            Assert.That(document.Invoice.InvoiceNumber, Is.EqualTo("249137"));
            Assert.That(document.Invoice.InvoiceDate, Is.EqualTo(Convert.ToDateTime("26.07.2012")));
            Assert.That(document.Invoice.AmountWithoutNDS, Is.EqualTo(1535.62));
            Assert.That(document.Invoice.RecipientAddress, Is.EqualTo("42667"));

            Assert.That(document.Lines[0].Code, Is.EqualTo("11187"));
            Assert.That(document.Lines[0].Product, Is.EqualTo("911 Венолгон гель д/ног 100мл"));
            Assert.That(document.Lines[0].Producer, Is.EqualTo("Твинс Тэк"));
            Assert.That(document.Lines[0].Country, Is.EqualTo("РОССИЯ"));
            Assert.That(document.Lines[0].Quantity, Is.EqualTo(3));
            Assert.That(document.Lines[0].SupplierCostWithoutNDS, Is.EqualTo(36.56));
            Assert.That(document.Lines[0].SupplierCost, Is.EqualTo(43.14));
            Assert.That(document.Lines[0].Nds, Is.EqualTo(18));
            Assert.That(document.Lines[0].Amount, Is.EqualTo(129.42));
            Assert.That(document.Lines[0].NdsAmount, Is.EqualTo(19.74));
            Assert.That(document.Lines[0].EAN13, Is.EqualTo(4607010242558));
            Assert.That(document.Lines[0].BillOfEntryNumber, Is.EqualTo(null));
            Assert.That(document.Lines[0].VitallyImportant, Is.EqualTo(false));
            Assert.That(document.Lines[0].SerialNumber, Is.EqualTo("0612"));
            Assert.That(document.Lines[0].Period, Is.EqualTo("01.12.2013"));
            Assert.That(document.Lines[0].Certificates, Is.EqualTo("POCC  RU.АГ50.Д00016"));
            Assert.That(document.Lines[0].CertificateAuthority, Is.EqualTo("ОС ООО \"ЕВРОСТРОЙ\""));
            Assert.That(document.Lines[0].CertificatesDate, Is.EqualTo("17.11.2011"));
            Assert.That(document.Lines[0].OrderId, Is.EqualTo(31539501));
        }
Example #20
0
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file);

            new DbfParser()
            .DocumentHeader(h => h.ProviderDocumentId, "DOCNO")
            .DocumentHeader(h => h.DocumentDate, "DOCDAT")
            .Line(l => l.Code, "CODTOVAR")
            .Line(l => l.Product, "TOVARNAME")
            .Line(l => l.Producer, "PROIZV")
            .Line(l => l.Country, "STRANA")
            .Line(l => l.Quantity, "KOLVO")
            .Line(l => l.Nds, "NDS")
            .Line(l => l.SupplierCostWithoutNDS, "CENAPOST")
            .Line(l => l.SupplierCost, "CENASNDS")
            .Line(l => l.SerialNumber, "SERIA")
            .Line(l => l.Certificates, "SERT")
            .Line(l => l.CertificatesDate, "DATAOT")
            .Line(l => l.CertificatesEndDate, "DATADO")
            .Line(l => l.CertificateAuthority, "ORGAN")
            .Line(l => l.Period, "SROK")
            .Line(l => l.RegistryCost, "CENAREESTR")
            .Line(l => l.ProducerCostWithoutNDS, "CENAPROIZ")
            .Line(l => l.VitallyImportant, "PV")
            .Line(l => l.EAN13, "SHTRIH")
            .Line(l => l.UnitCode, "KODEI")
            .Line(l => l.CertificateFilename, "SERTFILE")
            .Line(l => l.BillOfEntryNumber, "GTD")
            .Line(l => l.OrderId, "DOC_ID")
            .Line(l => l.CountryCode, "KODSTRANA")
            .ToDocument(document, data);
            return(document);
        }
        public void Parse()
        {
            Assert.IsTrue(AptekaHoldingSPBParser.CheckFileFormat(Dbf.Load(@"..\..\Data\Waybills\NKL_1892886.dbf")));
            var document = WaybillParser.Parse("NKL_1892886.dbf");

            Assert.That(document.ProviderDocumentId, Is.EqualTo("АХ1-1892886/0"));
            Assert.That(document.DocumentDate.Value.ToShortDateString(), Is.EqualTo("01.12.2011"));

            var line = document.Lines[0];

            Assert.That(line.Code, Is.EqualTo("8667"));
            Assert.That(line.Product, Is.EqualTo("Анаферон детск. табл. д/рассасыв. N20 Россия"));

            Assert.That(line.ProducerCost, Is.EqualTo(103.2));
            Assert.That(line.SupplierCostWithoutNDS, Is.EqualTo(102.95));

            Assert.That(line.Nds, Is.EqualTo(10));
            Assert.That(line.Quantity, Is.EqualTo(5));

            Assert.That(line.Amount, Is.EqualTo(566.25));
            Assert.That(line.NdsAmount, Is.EqualTo(51.50));

            Assert.That(line.Producer, Is.EqualTo("Материа Медика ПФ ЗАО"));
            Assert.That(line.Country, Is.EqualTo("Россия"));

            Assert.That(line.Period, Is.EqualTo("01.09.2014"));
            Assert.That(line.Certificates, Is.EqualTo("РОСС RU.ФМ05.Д99156"));
            Assert.That(line.CertificatesDate, Is.EqualTo("22.08.2011"));

            Assert.That(line.EAN13, Is.EqualTo(4607009581071));
            Assert.That(line.BillOfEntryNumber, Is.EqualTo(null));

            Assert.That(line.SerialNumber, Is.EqualTo("5030811"));
            Assert.That(line.VitallyImportant, Is.EqualTo(true));
        }
Example #22
0
        public void Parse()
        {
            Assert.IsTrue(BioFarmVolgaParser.CheckFileFormat(Dbf.Load(@"..\..\Data\Waybills\260254.dbf")));

            var document = WaybillParser.Parse(@"..\..\Data\Waybills\260254.dbf");

            Assert.That(document.Lines.Count, Is.EqualTo(1));
            Assert.That(document.ProviderDocumentId, Is.EqualTo("Рн-ЙО00000260254"));
            Assert.That(document.DocumentDate.Value.ToShortDateString(), Is.EqualTo("06.09.2011"));

            var line = document.Lines[0];

            Assert.That(line.Code, Is.EqualTo("М13845"));
            Assert.That(line.Product, Is.EqualTo("Валосердин 25мл"));
            Assert.That(line.Quantity, Is.EqualTo(10));
            Assert.That(line.RegistryCost, Is.EqualTo(0.00));
            Assert.That(line.ProducerCostWithoutNDS, Is.EqualTo(24.20));
            Assert.That(line.SupplierCostWithoutNDS, Is.EqualTo(22.77));
            Assert.That(line.SupplierCost, Is.EqualTo(25.05));
            Assert.That(line.Nds, Is.EqualTo(10));
            Assert.That(line.NdsAmount, Is.EqualTo(22.77));
            Assert.That(line.Amount, Is.EqualTo(250.50));
            Assert.That(line.SerialNumber, Is.EqualTo("210311"));
            Assert.That(line.Certificates, Is.EqualTo("РОСС.RU.ФМ01.Д07977"));
            Assert.That(line.CertificatesDate, Is.EqualTo("01.03.2013"));
            Assert.That(line.Producer, Is.EqualTo("Московская фарм. ф-к"));
            Assert.That(line.Period, Is.EqualTo("01.03.2013"));
            Assert.That(line.Country, Is.EqualTo("РОССИЯ"));
            Assert.That(line.BillOfEntryNumber, Is.Null);
            Assert.That(line.VitallyImportant, Is.False);
        }
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file, Encoding.GetEncoding(866), true, false);

            new DbfParser()
            .DocumentHeader(d => d.ProviderDocumentId, "DOCNO")
            .DocumentHeader(d => d.DocumentDate, "DOCDAT")
            .Line(l => l.Code, "CODE")
            .Line(l => l.Product, "TOVAR")
            .Line(l => l.SerialNumber, "SERIA")
            .Line(l => l.Quantity, "KOL")
            .Line(l => l.SupplierCostWithoutNDS, "TZENA")
            .Line(l => l.NdsAmount, "NDS")
            .Line(l => l.Certificates, "SERTIF")
            .Line(l => l.CertificatesDate, "SERTOT")
            .Line(l => l.Period, "GODEN")
            .Line(l => l.Country, "STRANA")
            .Line(l => l.RegistryCost, "REG")
            .Line(l => l.ProducerCostWithoutNDS, "ZAVOD")
            .Line(l => l.SupplierPriceMarkup, "TORGNADB")
            .Line(l => l.Producer, "PROIZV")
            .Line(l => l.SupplierCost, "TZENANDS")
            .Line(l => l.Amount, "SUMMANDS")
            .Line(l => l.Nds, "NDSSTAVK")
            .Line(l => l.VitallyImportant, "PV")
            .Line(l => l.EAN13, "EAN13")
            .Line(l => l.BillOfEntryNumber, "GTD")
            .Line(l => l.OrderId, "NZAKAZ")
            .ToDocument(document, data);
            return(document);
        }
Example #24
0
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file, Encoding);

            new DbfParser()
            .DocumentHeader(h => h.ProviderDocumentId, "NDOC")
            .DocumentHeader(h => h.DocumentDate, "DATEDOC")
            .Invoice(i => i.InvoiceNumber, "BILLNUM")
            .Invoice(i => i.InvoiceDate, "BILLDT")
            .Invoice(i => i.RecipientAddress, "PODR")
            .Line(l => l.Code, "CODEPST")
            .Line(l => l.Product, "NAME")
            .Line(l => l.Producer, "FIRM")
            .Line(l => l.Country, "CNTR")
            .Line(l => l.SupplierCost, "PRICE")
            .Line(l => l.ProducerCostWithoutNDS, "PRICEMAN")
            .Line(l => l.Amount, "SUMSNDS")
            .Line(l => l.NdsAmount, "SUMNDS")
            .Line(l => l.Quantity, "QNT")
            .Line(l => l.Period, "GDATE")
            .Line(l => l.Certificates, "SERTIF")
            .Line(l => l.SerialNumber, "SER")
            .Line(l => l.EAN13, "EAN13")
            .Line(l => l.BillOfEntryNumber, "GTD")
            .Line(l => l.Nds, "NDS")
            .Line(l => l.VitallyImportant, "ISLIFE")
            .ToDocument(document, data);

            return(document);
        }
Example #25
0
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file);

            new DbfParser()
            .DocumentHeader(h => h.ProviderDocumentId, "NOM_SHET")
            .DocumentHeader(h => h.DocumentDate, "DATA_SCHET")
            .Line(l => l.Code, "KOD")
            .Line(l => l.Product, "NAME")
            .Line(l => l.Producer, "ZAVOD")
            .Line(l => l.Country, "STRANA")
            .Line(l => l.Period, "GOGEN_DO")
            .Line(l => l.Quantity, "KOLVO")
            .Line(l => l.SupplierCost, "CENA_OPT")
            .Line(l => l.SupplierCostWithoutNDS, "CENA_BNDS")
            .Line(l => l.ProducerCostWithoutNDS, "CENA_ZAV")
            .Line(l => l.Nds, "NDS")
            .Line(l => l.VitallyImportant, "JV")
            .Line(l => l.RegistryCost, "REESTR")
            .Line(l => l.Certificates, "SERTIF")
            .Line(l => l.SerialNumber, "SERIA")
            .ToDocument(document, data);

            return(document);
        }
Example #26
0
        public List <Payment> Parser(int branchOfficeId, PaymentChannel paymentChannel, IFormFile file)
        {
            var listPayments = new List <Payment>();

            using var ms = new MemoryStream();
            file.CopyTo(ms);
            var dbf = new Dbf(Encoding.GetEncoding(866));

            dbf.Read(ms);

            var recordList = paymentChannel.TotalRecord == FileTotalRow.Last
                ? dbf.Records.GetRange(0, dbf.Records.Count - 1)
                : dbf.Records.GetRange(Convert.ToInt16(paymentChannel.TotalRecord), dbf.Records.Count - Convert.ToInt16(paymentChannel.TotalRecord));

            foreach (DbfRecord record in recordList)
            {
                listPayments.Add(
                    new Payment(
                        DateTime.ParseExact(record[paymentChannel.DateFieldName].ToString(), paymentChannel.TextDateFormat, new CultureInfo(CultureInfo.CurrentCulture.ToString())),
                        Convert.ToDecimal(record[paymentChannel.SumFieldName].ToString()),
                        _branchOfficeService.GetOne(branchOfficeId).CurrentPeriodId,
                        paymentChannel.PaymentsType,
                        string.Join(" ", paymentChannel.PersonFieldName.Split("+").Select(x => record[x]).ToList()),
                        _ercContext.AccountingPoints.FirstOrDefault(x => x.Name == record[paymentChannel.RecordpointFieldName.Trim()].ToString())?.Id,
                        record[paymentChannel.RecordpointFieldName].ToString()
                        )
                    );
            }

            return(listPayments);
        }
        public Document Parse(string file, Document document)
        {
            var data = Dbf.Load(file);

            new DbfParser()
            .DocumentHeader(d => d.DocumentDate, "DATA_NAKL")
            .DocumentHeader(h => h.ProviderDocumentId, "NUM_NAKL")
            .Invoice(i => i.RecipientAddress, "ADDRESS")
            .Invoice(i => i.InvoiceNumber, "SF")
            .Line(l => l.Code, "KOD")
            .Line(l => l.Product, "NAME")
            .Line(l => l.Producer, "PROIZV")
            .Line(l => l.Country, "COUNTRY")
            .Line(l => l.ProducerCostWithoutNDS, "CENAPROIZ")
            .Line(l => l.ProducerCost, "CENAPRNDS")
            .Line(l => l.RegistryCost, "REESTR")
            .Line(l => l.SupplierCostWithoutNDS, "CENABNDS")
            .Line(l => l.SupplierCost, "CENASNDS")
            .Line(l => l.Quantity, "KOLVO")
            .Line(l => l.SerialNumber, "SERII")
            .Line(l => l.Period, "EXPDATE", "SROK_GODN")
            .Line(l => l.Nds, "NDSPOSTAV")
            .Line(l => l.NdsAmount, "SUMMANDS")
            .Line(l => l.Amount, "SUMMA")
            .Line(l => l.Certificates, "SERTIF")
            .Line(l => l.CertificatesDate, "DATAEND")
            .Line(l => l.CertificateAuthority, "SERTORG")
            .Line(l => l.BillOfEntryNumber, "N_DECLAR")
            .Line(l => l.VitallyImportant, "PV")
            .ToDocument(document, data);
            return(document);
        }
        public void Parse()
        {
            Assert.IsTrue(Vazakor_144_Parser.CheckFileFormat(Dbf.Load(@"..\..\Data\Waybills\00387_1.DBF")));
            var document = WaybillParser.Parse("00387_1.DBF");

            Assert.That(document.Lines.Count, Is.EqualTo(1));
            Assert.That(document.ProviderDocumentId, Is.EqualTo("0000000387"));
            Assert.That(document.DocumentDate.Value.ToShortDateString(), Is.EqualTo("20.02.2012"));

            var invoice = document.Invoice;

            Assert.That(invoice, Is.Not.Null);
            Assert.That(invoice.BuyerName, Is.EqualTo("Акватик ООО"));
            Assert.That(invoice.SellerName, Is.EqualTo("ООО \"ВАЗАКОР\""));

            var line = document.Lines[0];

            Assert.That(line.Code, Is.EqualTo("132"));
            Assert.That(line.Product, Is.EqualTo("Шприц 1 мл инсулиновый HELMJECT U-40/100"));
            Assert.That(line.Unit, Is.EqualTo("шт"));
            Assert.That(line.SupplierCostWithoutNDS, Is.EqualTo(2.94));
            Assert.That(line.SupplierCost, Is.EqualTo(3.23));
            Assert.That(line.Nds, Is.EqualTo(10));
            Assert.That(line.Quantity, Is.EqualTo(200));
            Assert.That(line.Amount, Is.EqualTo(646.8));
            Assert.That(line.NdsAmount, Is.EqualTo(58.8));
            Assert.That(line.Producer, Is.EqualTo("HELM Medical GmbH"));
            Assert.That(line.Certificates, Is.EqualTo("РОСС.DE.ИМ08.Д00165"));
            Assert.That(line.CertificatesDate, Is.EqualTo("09.12.2014"));
        }
        public Document Parse(string file, Document document)
        {
            string vitallyImportantColumn = null;
            string certificatesColumn     = null;
            string registryCostColumn     = null;

            var data = Dbf.Load(file, Encoding);

            if (data.Columns.Contains("LIFE_REQ"))
            {
                vitallyImportantColumn = "LIFE_REQ";
            }

            if (data.Columns.Contains("REESTR"))
            {
                registryCostColumn = "REESTR";
            }

            if (data.Columns.Contains("SERT"))
            {
                certificatesColumn = "SERT";
            }

            document.Lines = data.Rows.Cast <DataRow>().Select(r => {
                document.ProviderDocumentId = r["NUM_DOC"].ToString();
                if (!Convert.IsDBNull(r["DATA_DOC"]))
                {
                    document.DocumentDate = Convert.ToDateTime(r["DATA_DOC"]);
                }
                var line      = document.NewLine();
                line.Code     = r["CODE"].ToString();
                line.Product  = r["GOOD"].ToString();
                line.Producer = r["ENTERP"].ToString();
                line.Country  = r["COUNTRY"].ToString();
                line.ProducerCostWithoutNDS = Convert.IsDBNull(r["PRICEENT"]) ? null : (decimal?)Convert.ToDecimal(r["PRICEENT"], CultureInfo.InvariantCulture);
                line.SupplierCostWithoutNDS = Convert.ToDecimal(r["PRICEWONDS"], CultureInfo.InvariantCulture);
                line.SupplierCost           = Convert.ToDecimal(r["PRICE"], CultureInfo.InvariantCulture);
                line.Quantity = Convert.ToUInt32(r["QUANT"]);
                line.Period   = Convert.IsDBNull(r["DATEB"]) ? null : Convert.ToDateTime(r["DATEB"]).ToShortDateString();

                if (!String.IsNullOrEmpty(registryCostColumn))
                {
                    line.RegistryCost = Convert.IsDBNull(r[registryCostColumn]) ? null : (decimal?)Convert.ToDecimal(r[registryCostColumn], CultureInfo.InvariantCulture);
                }

                if (!String.IsNullOrEmpty(certificatesColumn))
                {
                    line.Certificates = Convert.IsDBNull(r[certificatesColumn]) ? null : r[certificatesColumn].ToString();
                }

                line.SerialNumber = Convert.IsDBNull(r["SERIAL"]) ? null : r["SERIAL"].ToString();
                line.Nds          = Convert.ToUInt32(r["NDS"], CultureInfo.InvariantCulture);
                if (!String.IsNullOrEmpty(vitallyImportantColumn))
                {
                    line.VitallyImportant = Convert.IsDBNull(r[vitallyImportantColumn]) ? null : (bool?)(Convert.ToUInt32(r[vitallyImportantColumn]) == 1);
                }
                return(line);
            }).ToList();
            return(document);
        }
Example #30
0
        public void Parse()
        {
            Assert.IsTrue(BikovCheboksary12649Parser.CheckFileFormat(Dbf.Load(@"..\..\Data\Waybills\Б0001213.DBF")));
            var document = WaybillParser.Parse("Б0001213.DBF");

            Assert.That(document.ProviderDocumentId, Is.EqualTo("Б0001213"));
            Assert.That(document.DocumentDate.Value.ToShortDateString(), Is.EqualTo("24.04.2012"));

            var invoice = document.Invoice;

            Assert.That(invoice, Is.Not.Null);
            Assert.That(invoice.InvoiceNumber, Is.EqualTo("Б0001213"));
            Assert.That(invoice.InvoiceDate.Value.ToShortDateString(), Is.EqualTo("24.04.2012"));
            Assert.That(invoice.BuyerName, Is.EqualTo("ИП Шахвердиева Валентина Александровна"));

            var line = document.Lines[0];

            Assert.That(line.Code, Is.EqualTo("3244"));
            Assert.That(line.Product, Is.EqualTo("911 Непотин гель д/ног 100 мл антиперспирант"));
            Assert.That(line.ProducerCost, Is.EqualTo(45.35));
            Assert.That(line.SupplierCost, Is.EqualTo(49.88));
            Assert.That(line.Nds, Is.EqualTo(18));
            Assert.That(line.Quantity, Is.EqualTo(1));
            Assert.That(line.NdsAmount, Is.EqualTo(0));
            Assert.That(line.Producer, Is.EqualTo("Твинс Тэк Россия"));
            Assert.That(line.Period, Is.EqualTo("01.08.2013"));
            Assert.That(line.SerialNumber, Is.EqualTo("0212"));
            Assert.That(line.Certificates, Is.EqualTo("РОСС RU.АИ86.Д00149"));
            Assert.That(line.CertificatesDate, Is.EqualTo("16.04.2011"));
            Assert.IsNull(line.BillOfEntryNumber);
        }
Example #31
0
		public Mercadorias(DataSet dataSetVelho, DataSet dataSetNovo, Dbf dbfOrigem)
		{
            tabelaNova = dataSetNovo.Tables["mercadoria"];
			tabelaVelha = dataSetVelho.Tables["cadmer"];
			dbf = dbfOrigem;

            foreach (DataRow linha in tabelaNova.Rows)
                linha["foradelinha"] = true;
		}
Example #32
0
		public CodBarras(string caminhoCompletoArquivo)
		{
			System.IO.FileInfo informaçõesArquivo;

			informaçõesArquivo = new System.IO.FileInfo(caminhoCompletoArquivo);
			nomeTabelaDbf = informaçõesArquivo.Name.Remove(informaçõesArquivo.Name.Length - informaçõesArquivo.Extension.Length, informaçõesArquivo.Extension.Length).ToUpper();
			dbf = new Dbf(informaçõesArquivo.Directory.FullName);
			
			if (System.IO.File.Exists(informaçõesArquivo.FullName))
				System.IO.File.Delete(informaçõesArquivo.FullName);

			dsVelho = new DataSet();
			dsNovo = new DataSet();

			dbf.ExecutaComando("CREATE TABLE " + nomeTabelaDbf + " (refe varchar(30), codi DECIMAL(11), peso DECIMAL(4,2))");
			dbf.AdicionarTabelaAoDataSet(dsVelho, nomeTabelaDbf);

			dsNovo = ObterDataSetMapeamentoCódigoBarras();
		}
Example #33
0
        private void button1_Click(object sender, EventArgs e)
        {
            Dbf dbf = new Dbf(txtArquivo.Text);
            DataSet dataSetDbf = new DataSet();
            DataSet dataSetMysql = new DataSet();
            
            AdicionarTabelaAoDataSet(dataSetMysql, "cadcli");

            DataTable tabelaCadCliMysql = dataSetMysql.Tables["cadcli"];

            dbf.AdicionarTabelaAoDataSet(dataSetDbf, "cadcli");

            DataRowCollection coleção = dataSetDbf.Tables["cadcli"].Rows;
            Apresentação.Formulários.Aguarde janelaAguarde = new Aguarde("Transpondo", coleção.Count);
            janelaAguarde.Show();

            foreach (DataRow item in coleção)
            {
                janelaAguarde.Passo();

                DataRow novo;

                novo = tabelaCadCliMysql.NewRow();
                novo["cod"] = item["CL_COD"];
                novo["dig"] = item["CL_DIG"];
                novo["nosso"] = item["CL_NOSSO"];
                novo["nome"] = item["CL_NOME"];
                novo["regiao"] = item["CL_REGIAO"];
                novo["end"] = item["CL_END"];
                novo["bairro"] = item["CL_BAIRRO"];
                novo["cep"] = item["CL_CEP"];
                novo["cid"] = item["CL_CID"];
                novo["uf"] = item["CL_UF"];
                novo["cgc"] = item["CL_CGC"];
                novo["cpf"] = item["CL_CPF"];
                novo["insc"] = item["CL_INSC"];
                novo["endcob"] = item["CL_ENDCOB"];
                novo["cidcob"] = item["CL_CIDCOB"];
                novo["cepcob"] = item["CL_CEPCOB"];
                novo["ufcob"] = item["CL_UFCOB"];
                novo["contato"] = item["CL_CONTATO"];
                novo["fone"] = item["CL_FONE"];
                novo["fax"] = item["CL_FAX"];
                novo["conta"] = item["CL_CONTA"];
                novo["classe"] = item["CL_CLASSE"];
                novo["categor"] = item["CL_CATEGOR"];
                novo["obs"] = item["CL_OBS"].ToString() + "\n" +
                    item["CL_OBS1"].ToString() + "\n" +
                    item["CL_OBS2"].ToString() + "\n" +
                    item["CL_OBS3"].ToString() + "\n" +
                    item["CL_OBS4"].ToString() + "\n" +
                    item["CL_OBS5"].ToString() + "\n" +
                    item["CL_OBS6"].ToString() + "\n" + 
                    item["CL_OBS7"].ToString();

                    
                //novo["obs"] = "retirado no codigo fonte!";
                
                tabelaCadCliMysql.Rows.Add(novo);
            }
            janelaAguarde.Passo("Gravando...");
            GravarDataSet(dataSetMysql, "cadcli");
            janelaAguarde.Close();
            MessageBox.Show("Fim");
        }
Example #34
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            // Tabelas do mysql
            DataSet dataSetMysql, dataSetDbf;

            Apresentação.Formulários.Aguarde aguarde;

            aguarde = new Apresentação.Formulários.Aguarde("Recuperando mysql... ", 7, "Transpondo banco de dados", "Aguarde enquanto o banco de dados é sincronizado.");
            aguarde.Abrir();
            dataSetMysql = new DataSet();
            List<IDbConnection> conexõesRemovidas = new List<IDbConnection>();
            MySQL.AdicionarTabelaAoDataSet(dataSetMysql, "pessoa", conexõesRemovidas);
            MySQL.AdicionarTabelaAoDataSet(dataSetMysql, "venda", conexõesRemovidas);
            MySQL.AdicionarTabelaAoDataSet(dataSetMysql, "vendaitem", conexõesRemovidas);

            aguarde.Passo("Obtendo pagamentos do dbf"); aguarde.Refresh();
            Dbf dbf = new Dbf(diretório);

            dataSetDbf = new DataSet();
            dbf.AdicionarTabelaAoDataSet(dataSetDbf, "pedcom");

            Transpor(dataSetMysql, dataSetDbf);

            aguarde.Close();

            Apresentação.Formulários.AguardeDB.Mostrar();

            MySQL.GravarDataSetTodasTabelas(dataSetMysql);

            MySQL.AdicionarConexõesRemovidas(conexõesRemovidas);            
            Apresentação.Formulários.AguardeDB.Fechar();

            System.Windows.Forms.MessageBox.Show(this, "Operação bem sucedida", "fim", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Example #35
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            // Tabelas do mysql
            DataSet dataSetMysql, dataSetDbf;

            Apresentação.Formulários.Aguarde aguarde;

            aguarde = new Apresentação.Formulários.Aguarde("Recuperando do novo bd para que seja atualizado", 8, "Transpondo banco de dados", "Aguarde enquanto o banco de dados é sincronizado.");
            aguarde.Abrir();
            dataSetMysql = new DataSet();
            List<IDbConnection> conexõesRemovidas = new List<IDbConnection>();
            MySQL.AdicionarTabelaAoDataSet(dataSetMysql, "pessoa", conexõesRemovidas); aguarde.Passo();
            MySQL.AdicionarTabelaAoDataSet(dataSetMysql, "pagamento", conexõesRemovidas); aguarde.Passo();
            MySQL.AdicionarTabelaAoDataSet(dataSetMysql, "cheque", conexõesRemovidas); aguarde.Passo();
            MySQL.AdicionarTabelaAoDataSet(dataSetMysql, "dinheiro", conexõesRemovidas); aguarde.Passo();
            MySQL.AdicionarTabelaAoDataSet(dataSetMysql, "notapromissoria", conexõesRemovidas); aguarde.Passo();
            MySQL.AdicionarTabelaAoDataSet(dataSetMysql, "venda", conexõesRemovidas); aguarde.Passo();
            //MySql.AdicionarTabelaAoDataSet(dataSetMysql, "vinculovendapagamento"); aguarde.Passo();

            aguarde.Passo("Lendo DBF"); aguarde.Refresh();
            Dbf dbf = new Dbf(diretório);

            dataSetDbf = new DataSet();
            dbf.AdicionarTabelaAoDataSet(dataSetDbf, "vendcli");

            Transpor(dataSetDbf, dataSetMysql);

            aguarde.Close();

            Apresentação.Formulários.AguardeDB.Mostrar();

            MySQL.GravarDataSetTodasTabelas(dataSetMysql);
            MySQL.AdicionarConexõesRemovidas(conexõesRemovidas);
            Apresentação.Formulários.AguardeDB.Fechar();
            System.Windows.Forms.MessageBox.Show(this, "Operação bem sucedida", "fim", MessageBoxButtons.OK, MessageBoxIcon.Information);

        }