Beispiel #1
0
        public string ExportDistrict(string pathFile, string separator)
        {
            string path = pathFile.Remove(pathFile.LastIndexOf(@"\"));

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            DataTable exportData = this.bmkhDAL.GetExportData();

            if (exportData.Rows.Count == 0)
            {
                return("没有行政区");
            }
            StringBuilder builder = new StringBuilder();

            using (StreamWriter writer = new StreamWriter(pathFile, false, ToolUtil.GetEncoding()))
            {
                writer.WriteLine("{行政区编码}[分隔符]\"" + separator + "\"");
                writer.WriteLine("// 每行格式 :");
                string str2 = "// 编码,名称";
                writer.WriteLine(str2.Replace(",", separator));
                for (int i = 0; i < exportData.Rows.Count; i++)
                {
                    builder.Remove(0, builder.Length);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["BM"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["MC"].ToString(), separator));
                    builder.Append(separator);
                    builder.Replace(",,", ",\"\",");
                    writer.WriteLine(builder.ToString());
                }
            }
            return("0");
        }
Beispiel #2
0
        public string ExportData(string pathFile, string separator, DataTable khTable = null)
        {
            DataTable exportData;
            string    path = pathFile.Remove(pathFile.LastIndexOf(@"\"));

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            if (khTable == null)
            {
                exportData = this.bmkhDAL.GetExportData();
            }
            else
            {
                exportData = khTable;
            }
            if (exportData.Rows.Count == 0)
            {
                return("没有客户");
            }
            StringBuilder builder = new StringBuilder();

            using (StreamWriter writer = new StreamWriter(pathFile, false, ToolUtil.GetEncoding()))
            {
                writer.WriteLine("{客户编码}[分隔符]\"" + separator + "\"");
                writer.WriteLine("// 每行格式 :");
                string str2 = "// 编码,名称,简码,税号,地址电话,银行账号,邮件地址,备注,身份证校验";
                writer.WriteLine(str2.Replace(",", separator));
                for (int i = 0; i < exportData.Rows.Count; i++)
                {
                    builder.Remove(0, builder.Length);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["BM"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["MC"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["JM"].ToString(), separator));
                    if (exportData.Rows[i]["WJ"].ToString() == "1")
                    {
                        builder.Append(separator);
                        builder.Append(exportData.Rows[i]["SH"]);
                        builder.Append(separator);
                        string item = exportData.Rows[i]["DZDH"].ToString().Replace("\r\n", "#|#");
                        builder.Append(GetSafeData.ExportItem(item, separator));
                        builder.Append(separator);
                        string str4 = exportData.Rows[i]["YHZH"].ToString().Replace("\r\n", "#|#");
                        builder.Append(GetSafeData.ExportItem(str4, separator));
                        builder.Append(separator);
                        builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["YJDZ"].ToString(), separator));
                        builder.Append(separator);
                        builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["BZ"].ToString(), separator));
                        builder.Append(separator);
                        builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["SFZJY"].ToString(), separator));
                    }
                    builder.Replace(",,", ",\"\",");
                    writer.WriteLine(builder.ToString());
                }
            }
            return("0");
        }
Beispiel #3
0
        public string ExportData(string pathFile, string separator, DataTable khTable = null)
        {
            string path = pathFile.Remove(pathFile.LastIndexOf(@"\"));

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            DataTable exportData = this.bmfyxmDAL.GetExportData();

            if (exportData.Rows.Count == 0)
            {
                return("没有费用项目");
            }
            StringBuilder builder = new StringBuilder();

            using (StreamWriter writer = new StreamWriter(pathFile, false, ToolUtil.GetEncoding()))
            {
                writer.WriteLine("{费用项目编码}[分隔符]\"" + separator + "\"");
                writer.WriteLine("// 每行格式 :");
                string str2 = "";
                if (Flbm.IsYM())
                {
                    str2 = "// 编码~~名称~~简码~~商品分类~~是否享受优惠政策~~税收分类名称~~优惠政策类型~~编码版本号";
                }
                else
                {
                    str2 = "// 编码~~名称~~简码";
                }
                writer.WriteLine(str2.Replace(",", separator));
                string maxBMBBBH = new SPFLService().GetMaxBMBBBH();
                for (int i = 0; i < exportData.Rows.Count; i++)
                {
                    builder.Remove(0, builder.Length);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["BM"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["MC"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["JM"].ToString(), separator));
                    if (Flbm.IsYM())
                    {
                        builder.Append(separator);
                        builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["SPFL"].ToString(), separator));
                        builder.Append(separator);
                        builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["YHZC"].ToString(), separator));
                        builder.Append(separator);
                        builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["SPFLMC"].ToString(), separator));
                        builder.Append(separator);
                        builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["YHZCMC"].ToString(), separator));
                        builder.Append(separator);
                        builder.Append(GetSafeData.ExportItem(maxBMBBBH, separator));
                    }
                    builder.Replace(",,", ",\"\",");
                    writer.WriteLine(builder.ToString());
                }
            }
            return("0");
        }
Beispiel #4
0
        public string ExportGoodsTax(string pathFile, string separator)
        {
            string path = pathFile.Remove(pathFile.LastIndexOf(@"\"));

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            DataTable exportData = this.bmkhDAL.GetExportData();

            if (exportData.Rows.Count == 0)
            {
                return("没有商品税目");
            }
            StringBuilder builder = new StringBuilder();

            using (StreamWriter writer = new StreamWriter(pathFile, false, ToolUtil.GetEncoding()))
            {
                writer.WriteLine("{商品税目编码}[分隔符]\"" + separator + "\"");
                writer.WriteLine("// 每行格式 :");
                string str2 = "// 税种,编码,名称,税率,征收率,数量计税,计税单位,税额,非核定标志";
                writer.WriteLine(str2.Replace(",", separator));
                for (int i = 0; i < exportData.Rows.Count; i++)
                {
                    builder.Remove(0, builder.Length);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["SZ"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["BM"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["MC"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["SLV"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["ZSL"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["SLJS"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["JSDW"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["SE"].ToString(), separator));
                    builder.Append(separator);
                    builder.Append(GetSafeData.ExportItem(exportData.Rows[i]["FHDBZ"].ToString(), separator));
                    builder.Append(separator);
                    builder.Replace(",,", ",\"\",");
                    writer.WriteLine(builder.ToString());
                }
            }
            return("0");
        }