Exemplo n.º 1
0
 public Declar(DeclarConfigModel config, Purchases pocupki, Sells prodazbi)
 {
     Config    = config;
     Purchases = pocupki;
     Sells     = prodazbi;
 }
Exemplo n.º 2
0
        public static void GenrateDeclarF(IDataBaseContext context, int month, int year, DeclarConfigModel model)
        {
            EntityFramework.Models.Declar d = new EntityFramework.Models.Declar(model,
                                                                                context.GetPurchases(month, year),
                                                                                context.GetSales(month, year));

            var           firma = ConfigTempoSinglenton.GetInstance().CurrentFirma;
            StringBuilder sb    = new StringBuilder();

            sb.AppendFormat("{0,-15}", firma.DDSnum);                   //1
            sb.AppendFormat("{0,-50}", firma.Name);                     //2
            sb.AppendFormat("{0:D4}", year);                            //3
            sb.AppendFormat("{0:D2}", month);                           //
            sb.AppendFormat("{0,-50}", firma.NameBoss);                 //4
            sb.AppendFormat("{0,15}", d.CountSells);                    //6 ?
            sb.AppendFormat("{0,15}", d.CountPurchases);                //5 ?
            sb.AppendFormat("{0,15}", d.Kl01.ToString(Vf.LevFormatUI)); //7
            sb.AppendFormat("{0,15}", d.Kl20.ToString(Vf.LevFormatUI)); //8
            sb.AppendFormat("{0,15}", d.Kl11.ToString(Vf.LevFormatUI)); //9
            sb.AppendFormat("{0,15}", d.Kl21.ToString(Vf.LevFormatUI)); //10
            sb.AppendFormat("{0,15}", d.Kl12.ToString(Vf.LevFormatUI)); //11
            sb.AppendFormat("{0,15}", d.Kl22.ToString(Vf.LevFormatUI)); //12
            sb.AppendFormat("{0,15}", d.Kl23.ToString(Vf.LevFormatUI)); //13
            sb.AppendFormat("{0,15}", d.Kl13.ToString(Vf.LevFormatUI)); //14
            sb.AppendFormat("{0,15}", d.Kl24.ToString(Vf.LevFormatUI)); //15
            sb.AppendFormat("{0,15}", d.Kl14.ToString(Vf.LevFormatUI)); //16
            sb.AppendFormat("{0,15}", d.Kl15.ToString(Vf.LevFormatUI)); //17
            sb.AppendFormat("{0,15}", d.Kl16.ToString(Vf.LevFormatUI)); //18
            sb.AppendFormat("{0,15}", d.Kl17.ToString(Vf.LevFormatUI)); //19
            sb.AppendFormat("{0,15}", d.Kl18.ToString(Vf.LevFormatUI)); //20
            sb.AppendFormat("{0,15}", d.Kl19.ToString(Vf.LevFormatUI)); //21
            //pokupki
            sb.AppendFormat("{0,15}", d.Kl30.ToString(Vf.LevFormatUI)); //22
            sb.AppendFormat("{0,15}", d.Kl31.ToString(Vf.LevFormatUI)); //23
            sb.AppendFormat("{0,15}", d.Kl41.ToString(Vf.LevFormatUI)); //24
            sb.AppendFormat("{0,15}", d.Kl32.ToString(Vf.LevFormatUI)); //25
            sb.AppendFormat("{0,15}", d.Kl42.ToString(Vf.LevFormatUI)); //26
            sb.AppendFormat("{0,15}", d.Kl43.ToString(Vf.LevFormatUI)); //27
            //resultat
            sb.AppendFormat("{0,4}", d.Kl33.ToString(Vf.LevFormatUI));  //28
            sb.AppendFormat("{0,15}", d.Kl40.ToString(Vf.LevFormatUI)); //29
            sb.AppendFormat("{0,15}", d.Kl50.ToString(Vf.LevFormatUI)); //30
            sb.AppendFormat("{0,15}", d.Kl60.ToString(Vf.LevFormatUI)); //31
            sb.AppendFormat("{0,15}", d.Kl70.ToString(Vf.LevFormatUI)); //32
            sb.AppendFormat("{0,15}", d.Kl71.ToString(Vf.LevFormatUI)); //33
            sb.AppendFormat("{0,15}", d.Kl80.ToString(Vf.LevFormatUI)); //34
            sb.AppendFormat("{0,15}", d.Kl81.ToString(Vf.LevFormatUI)); //35
            sb.AppendFormat("{0,15}", d.Kl82.ToString(Vf.LevFormatUI)); //36
            sb.AppendLine();
            var      path = AppDomain.CurrentDomain.BaseDirectory + "Deklar.txt";
            Encoding srcEncodingFormat = Encoding.Unicode;
            Encoding dstEncodingFormat = Encoding.GetEncoding("windows-1251");

            byte[] originalByteString  = srcEncodingFormat.GetBytes(sb.ToString());
            byte[] convertedByteString = Encoding.Convert(srcEncodingFormat, dstEncodingFormat, originalByteString);
            string finalString         = dstEncodingFormat.GetString(convertedByteString);

            using (StreamWriter sw = new StreamWriter(path, false, dstEncodingFormat))
            {
                sw.Write(finalString);
            }
            //Process.Start(path);
        }
Exemplo n.º 3
0
        public static void GenerateVies(IDataBaseContext context, int month, int year, DeclarConfigModel model)
        {
            Dictionary <string, string> declar = new Dictionary <string, string>();
            var firma = ConfigTempoSinglenton.GetInstance().CurrentFirma;

            declar.Add("data", string.Format("{0:D2}/{1:D4}", month, year));
            declar.Add("firma", firma.Name);
            declar.Add("address", firma.Address);
            declar.Add("tel", firma.Telefon);
            declar.Add("dds", firma.DDSnum);
            declar.Add("iddds", firma.Bulstad);
            declar.Add("city", firma.CityName);
            declar.Add("p", firma.PresentorYN == 1 ? "X" : " ");
            declar.Add("pr", firma.PresentorYN == 0 ? "X" : " ");
            declar.Add("zip", firma.Zip);
            declar.Add("egn", firma.EGN);
            declar.Add("address1", firma.Address2);
            if (firma.PresentorYN == 0)
            {
                declar.Add("mol", firma.NameBoss);
            }
            else
            {
                declar.Add("mol", firma.Names);
            }
            string actual;

            actual = DeklarviewModel.ReturnViesDeclar(declar, context.GetVies(month, year, declar));
            var path = AppDomain.CurrentDomain.BaseDirectory + "Vies1.txt";

            using (StreamWriter sw = new StreamWriter(path))
            {
                sw.Write(actual);
            }
            Process.Start(path);
        }
Exemplo n.º 4
0
        public static void GenerateViesF(IDataBaseContext context, int month, int year, DeclarConfigModel model)
        {
            Dictionary <string, string> declar = new Dictionary <string, string>();
            var firma = ConfigTempoSinglenton.GetInstance().CurrentFirma;

            declar.Add("data", string.Format("{0:D2}/{1}", month, year));
            declar.Add("firma", firma.Name);
            declar.Add("address", firma.Address);
            declar.Add("tel", firma.Telefon);
            declar.Add("dds", firma.DDSnum);
            declar.Add("iddds", firma.Bulstad);
            declar.Add("city", firma.CityName);
            declar.Add("p", firma.PresentorYN == 1 ? "X" : " ");
            declar.Add("pr", firma.PresentorYN == 0 ? "X" : " ");
            declar.Add("zip", firma.Zip);
            declar.Add("egn", firma.EGN);
            declar.Add("address1", firma.Address2);
            if (firma.PresentorYN == 0)
            {
                declar.Add("mol", firma.NameBoss);
                declar.Add("presentor", "A");
            }
            else
            {
                declar.Add("mol", firma.Names);
                declar.Add("presentor", "R");
            }

            var           path = AppDomain.CurrentDomain.BaseDirectory + "VIES.TXT";
            var           list = context.GetVies(month, year, declar);
            StringBuilder sb   = new StringBuilder();

            sb.AppendFormat("{0,3}", "VHR");              //1
            sb.AppendFormat("{0,7}", declar["data"]);     //2
            sb.AppendFormat("{0,5}", declar["count"]);    //3
            sb.AppendLine();
            sb.AppendFormat("{0,3}", "VDR");
            sb.AppendFormat("{0,-15}", declar["egn"]);
            sb.AppendFormat("{0,-150}", declar["mol"]);
            sb.AppendFormat("{0,-50}", declar["city"]);
            sb.AppendFormat("{0,4}", declar["zip"]);
            sb.AppendFormat("{0,-150}", declar["address1"]);
            sb.AppendFormat("{0,1}", declar["presentor"]);
            sb.AppendLine();
            sb.AppendFormat("{0,3}", "VTR");
            sb.AppendFormat("{0,-15}", declar["dds"]);
            sb.AppendFormat("{0,-150}", declar["mol"]);
            sb.AppendFormat("{0,-200}", declar["address"]);
            sb.AppendLine();
            sb.AppendFormat("{0,3}", "TTR");
            sb.AppendFormat("{0,12}", declar["sumak1k2k3"]);
            sb.AppendFormat("{0,12}", declar["sumak3"]);
            sb.AppendLine();
            foreach (var l in list)
            {
                sb.AppendFormat("VIR{0,5}{1,-15}{2,12}{3,12}{4,12}{5,7}", l.PorNom, l.Name, l.K3, l.K4, l.K5, " ");
                sb.AppendLine();
            }
            Encoding srcEncodingFormat = Encoding.UTF8;
            Encoding dstEncodingFormat = Encoding.GetEncoding("windows-1251");

            byte[] originalByteString  = srcEncodingFormat.GetBytes(sb.ToString());
            byte[] convertedByteString = Encoding.Convert(srcEncodingFormat, dstEncodingFormat, originalByteString);
            string finalString         = dstEncodingFormat.GetString(convertedByteString);

            using (StreamWriter sw = new StreamWriter(path, false, dstEncodingFormat))
            {
                sw.Write(finalString);
            }
            //Process.Start(path);
        }
Exemplo n.º 5
0
        public static void GenrateDeclar(IDataBaseContext context, int month, int year, DeclarConfigModel model)
        {
            Dictionary <string, string> declar = new Dictionary <string, string>();

            EntityFramework.Models.Declar d = new EntityFramework.Models.Declar(model,
                                                                                context.GetPurchases(month, year),
                                                                                context.GetSales(month, year));

            var firma = ConfigTempoSinglenton.GetInstance().CurrentFirma;

            declar.Add("data", string.Format("{0:D2}/{1}", month, year));
            declar.Add("firma", firma.Name);
            declar.Add("adress", firma.Address);
            declar.Add("tel", firma.Telefon);
            declar.Add("dds", firma.DDSnum);
            declar.Add("iddds", firma.Bulstad);
            declar.Add("kl01", d.Kl01.ToString(Vf.LevFormatUI));
            declar.Add("kl11", d.Kl11.ToString(Vf.LevFormatUI));
            declar.Add("kl12", d.Kl12.ToString(Vf.LevFormatUI));
            declar.Add("kl13", d.Kl13.ToString(Vf.LevFormatUI));
            declar.Add("kl14", d.Kl14.ToString(Vf.LevFormatUI));
            declar.Add("kl15", d.Kl15.ToString(Vf.LevFormatUI));
            declar.Add("kl16", d.Kl16.ToString(Vf.LevFormatUI));
            declar.Add("kl17", d.Kl17.ToString(Vf.LevFormatUI));
            declar.Add("kl18", d.Kl18.ToString(Vf.LevFormatUI));
            declar.Add("kl19", d.Kl19.ToString(Vf.LevFormatUI));

            declar.Add("kl20", d.Kl20.ToString(Vf.LevFormatUI));
            declar.Add("kl21", d.Kl21.ToString(Vf.LevFormatUI));
            declar.Add("kl22", d.Kl22.ToString(Vf.LevFormatUI));
            declar.Add("kl23", d.Kl23.ToString(Vf.LevFormatUI));
            declar.Add("kl24", d.Kl24.ToString(Vf.LevFormatUI));

            declar.Add("kl30", d.Kl30.ToString(Vf.LevFormatUI));
            declar.Add("kl31", d.Kl31.ToString(Vf.LevFormatUI));
            declar.Add("kl32", d.Kl32.ToString(Vf.LevFormatUI));
            declar.Add("kl33", d.Kl33.ToString(Vf.LevFormatUI));

            declar.Add("kl40", d.Kl40.ToString(Vf.LevFormatUI));
            declar.Add("kl41", d.Kl41.ToString(Vf.LevFormatUI));
            declar.Add("kl42", d.Kl42.ToString(Vf.LevFormatUI));
            declar.Add("kl43", d.Kl43.ToString(Vf.LevFormatUI));

            declar.Add("kl50", d.Kl50.ToString(Vf.LevFormatUI));
            declar.Add("kl60", d.Kl60.ToString(Vf.LevFormatUI));
            declar.Add("kl70", d.Kl70.ToString(Vf.LevFormatUI));
            declar.Add("kl71", d.Kl71.ToString(Vf.LevFormatUI));

            declar.Add("kl80", d.Kl80.ToString(Vf.LevFormatUI));
            declar.Add("kl81", d.Kl81.ToString(Vf.LevFormatUI));
            declar.Add("kl82", d.Kl82.ToString(Vf.LevFormatUI));

            declar.Add("DateTimeNow", DateTime.Now.ToShortDateString());
            declar.Add("pr", firma.PresentorYN == 1 ? "X" : " ");
            declar.Add("kl", d.Kl70 > 0 || d.Kl80 > 0 || d.Kl81 > 0 || d.Kl82 > 0 ? "X" : " ");
            declar.Add("mol", firma.NameBoss);
            declar.Add("dl", firma.Tel);
            string expected = string.Empty; // TODO: Initialize to an appropriate value
            string actual;

            actual = DeklarviewModel.ReturnDeklar(declar);
            var path = AppDomain.CurrentDomain.BaseDirectory + "Deklar1.txt";

            using (StreamWriter sw = new StreamWriter(path))
            {
                sw.Write(actual);
            }
            Process.Start(path);
        }