Пример #1
0
        public void Translate(DS_Aversi.T_ImportDataTable table)
        {           
            foreach (var row in table)
            {
                if (!row.IsNAM_MATNull())
                    row.NAM_MAT = GeoConvertHelper.Convert(row.NAM_MAT, GeoConvertHelper.Aversi, GeoConvertHelper.Unicode);

                if (!row.IsPRONAMENull())
                    row.PRONAME = GeoConvertHelper.Convert(row.PRONAME, GeoConvertHelper.Aversi, GeoConvertHelper.Unicode);

                if (!row.IsNAM_CONGNull())
                    row.NAM_CONG = GeoConvertHelper.Convert(row.NAM_CONG, GeoConvertHelper.Aversi, GeoConvertHelper.Unicode);
                
                //შესასყიდი ფასი
                //row._UNIT_PRICE_USD = (_UnitPricePct == 0m ? MathHelper.RemoveAddedPct(row.USD_PRICE, _TaxRate) : MathHelper.RemoveAddedPct(MathHelper.AddPct(row.USD_PRICE, _UnitPricePct), _TaxRate));
                //row._UNIT_PRICE_GEL = (_UnitPricePct == 0m ? MathHelper.RemoveAddedPct(row.PRICE, _TaxRate) : MathHelper.RemoveAddedPct(MathHelper.AddPct(row.PRICE, _UnitPricePct), _TaxRate));
            }
        }
Пример #2
0
        public void Translate(DS_PSP.T_DBFDataTable table)
        {
            foreach (var row in table)
            {
                if (!row.IsNAME_GEONull())
                {
                    row.NAME_GEO = GeoConvertHelper.Convert(row.NAME_GEO, GeoConvertHelper.PSP, GeoConvertHelper.Unicode);
                }
                if (!row.IsNAME_MANUFNull())
                {
                    row.NAME_MANUF = GeoConvertHelper.Convert(row.NAME_MANUF, GeoConvertHelper.PSP, GeoConvertHelper.Unicode);
                }
                if (!row.IsCOUNTRYNull())
                {
                    row.COUNTRY = GeoConvertHelper.Convert(row.COUNTRY, GeoConvertHelper.PSP, GeoConvertHelper.Unicode);
                }

                //შესასყიდი ფასი
                row._UNIT_PRICE_USD = (_UnitPricePct == 0m ? MathHelper.RemoveAddedPct(row.SUM_USD, _TaxRate) : MathHelper.RemoveAddedPct(MathHelper.AddPct(row.SUM_USD_D, _UnitPricePct), _TaxRate));
                row._UNIT_PRICE_GEL = (_UnitPricePct == 0m ? MathHelper.RemoveAddedPct(row.SUM_LAR, _TaxRate) : MathHelper.RemoveAddedPct(MathHelper.AddPct(row.SUM_LAR_D, _UnitPricePct), _TaxRate));

                if (!row.IsVADANull())
                {
                    int year;
                    int month;
                    var vada = row.VADA.Split('/');
                    if (vada.Length == 2)
                    {
                        int.TryParse(vada[1].Trim(), out year);
                        int.TryParse(vada[0].Trim(), out month);
                        if (year >= DateTimeHelper.MinDate.Year && year <= DateTimeHelper.MaxDate.Year && month > 0 && month < 13)
                        {
                            row._VADA = new DateTime(year, month, 1);
                        }
                    }
                }
            }
        }
        protected override void BindGrid()
        {
            view.OptionsBehavior.Editable = true;
            using (var cmd = new SqlCommand())
            {
                cmd.CommandText = SelectSql +
                                  @"
*
FROM Production.VW_ProductLocationMIS WITH (NOLOCK)
";

                if (IsFiltered)
                {
                    var where = " WHERE ";
                    string filter = FilterHelper.CreateFilter("BranchID", cboxBranch.Text, bbBranch.RecordValue, SqlDbType.Int, cmd);
                    if (filter.Length > 0)
                    {
                        cmd.CommandText += where + filter;
                        where            = " AND ";
                    }
                }

                ds.VW_ProductLocationMIS.Clear();
                ds.VW_ProductLocationMIS.Merge(DictionaryManager.GetDataTable(cmd));
                foreach (var row in ds.VW_ProductLocationMIS)
                {
                    if (row.Discount != 0m)
                    {
                        row.NewDiscount = row.Discount;
                    }
                    row.MedicamentName = GeoConvertHelper.Convert(row.MedicamentName, "_utf8_", "AcadNusx", "");
                    row.CountryName    = GeoConvertHelper.Convert(row.CountryName, "_utf8_", "AcadNusx", "");
                    row.BrandName      = GeoConvertHelper.Convert(row.BrandName, "_utf8_", "AcadNusx", "");
                }
            }
        }
Пример #4
0
        private void miExportApex(object sender, ItemClickEventArgs e)
        {
            var dlg = new SaveFileDialog()
            {
                Filter = "Xml Files|*.xml|All Files|*.*"
            };

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            try
            {
                Application.DoEvents();
                Cursor = Cursors.WaitCursor;


                var usdRate = DictionaryManager.GetCurrencyRate("USD", BaseGlobalVariable.ServerDateTime);
                //var rate = CurrencyRate != 0 ? CurrencyRate : 1m;
                var dsExport = new DS_Neopharmi();
                foreach (var row in ds.VW_ProductLocation)
                {
                    if (DataSetHelper.IsDataRowDeleted(row))
                    {
                        continue;
                    }

                    var newrow = (DS_Neopharmi.T_NeopharmiRow)DataSetHelper.AddEmptyRow(dsExport.T_Neopharmi);

                    newrow.productsid = row.ProductID.ToString();
                    newrow.products_n = StringHelper.Trim(GeoConvertHelper.Convert(row.MedicamentName, GeoConvertHelper.UnicodeGeo, GeoConvertHelper.StandardGeo), 100);
                    newrow.producer_n = StringHelper.Trim(GeoConvertHelper.Convert(row.BrandName, GeoConvertHelper.UnicodeGeo, GeoConvertHelper.StandardGeo), 40);
                    newrow.country_n  = StringHelper.Trim(GeoConvertHelper.Convert(row.CountryName, GeoConvertHelper.UnicodeGeo, GeoConvertHelper.StandardGeo), 20);
                    newrow.icount     = row.Quantity;
                    newrow.priceg     = row.ListPrice * row.ProductCurrencyRate;
                    newrow.priceu     = newrow.priceg / usdRate;
                    newrow.svg        = row.Quantity * newrow.priceg;
                    newrow.svu        = row.Quantity * newrow.priceu;
                    newrow.discount   = row.DiscountPct * 100m;
                    newrow.vg         = newrow.icount * (row.UnitPrice * row.PurchaseCurrencyRate);
                    newrow.vu         = newrow.icount * ((row.UnitPrice * row.PurchaseCurrencyRate) / usdRate);

                    if (!row.IsValidDateNull())
                    {
                        newrow.lifedate = row.ValidDate;
                    }
                }

                dsExport.Namespace             = " ";
                dsExport.DataSetName           = "VFPData";
                dsExport.T_Neopharmi.TableName = "row";
                DataSetHelper.SetColumnMappingType(dsExport);
                dsExport.WriteXml(dlg.FileName, XmlWriteMode.WriteSchema);
            }
            catch (Exception ex)
            {
                ExceptionHelper.Show(ex);
            }
            finally
            {
                Cursor = Cursors.Default;
            }
        }