Beispiel #1
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);
        }
Beispiel #2
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);
        }