Esempio n. 1
0
        public static string getCompanyinfo(string json)
        {
            StringBuilder jsonstr       = new StringBuilder(json);
            GTXResult     resultCompany = GTXMethod.GetCompany();

            if (resultCompany.IsSuccess)
            {
                JObject company = (JObject)JsonConvert.DeserializeObject(resultCompany.Data.ToString());
                if (company.HasValues)
                {
                    jsonstr.Replace("@@ZCDZ", (company["ZCDZ"] == null ? "" : company["ZCDZ"].ToString()))
                    .Replace("@@JYFW", (company["JYFW"] == null ? "" : company["JYFW"].ToString()))
                    .Replace("@@GBHY", (company["GBHY"] == null ? "" : company["GBHY"].ToString()))
                    .Replace("@@SCJYDZ", (company["SCJYDZ"] == null ? "" : company["SCJYDZ"].ToString()))
                    .Replace("@@ZGDSSWJFJMC", (company["ZGDSSWJFJMC"] == null ? "" : company["ZGDSSWJFJMC"].ToString()))
                    .Replace("@@DJZCLX", (company["DJZCLX"] == null ? "" : company["DJZCLX"].ToString()))
                    .Replace("@@LXDH", (company["LXDH"] == null ? "" : company["LXDH"].ToString()))
                    .Replace("@@NSRSBH", (company["NSRSBH"] == null ? "" : company["NSRSBH"].ToString()))
                    .Replace("@@NSRMC", (company["NSRMC"] == null ? "" : company["NSRMC"].ToString()));
                }
            }

            GTXResult resultCompanyPerson = GTXMethod.GetCompanyPerson();

            if (resultCompanyPerson.IsSuccess)
            {
                JArray jrperson = (JArray)JsonConvert.DeserializeObject(resultCompanyPerson.Data.ToString());
                if (jrperson.Count > 0)
                {
                    for (int i = 0; i < jrperson.Count; i++)
                    {
                        JObject joperson = JObject.Parse(jrperson[i].ToString());
                        if (joperson["PersonType"] != null && joperson["PersonType"].ToString() == "0")
                        {
                            jsonstr.Replace("@@FDDB", (joperson["Name"] == null ? "" : joperson["Name"].ToString()))
                            .Replace("@@FDID", (joperson["IDCardNum"] == null ? "" : joperson["IDCardNum"].ToString()))
                            .Replace("@@FDSJ", (joperson["MobilePhone"] == null ? "" : joperson["MobilePhone"].ToString()));
                        }
                        if (joperson["PersonType"] != null && joperson["PersonType"].ToString() == "2")
                        {
                            jsonstr.Replace("@@BSR", (joperson["Name"] == null ? "" : joperson["Name"].ToString()))
                            .Replace("@@BSID", (joperson["IDCardNum"] == null ? "" : joperson["IDCardNum"].ToString()))
                            .Replace("@@BSSJ", (joperson["MobilePhone"] == null ? "" : joperson["MobilePhone"].ToString()));
                        }
                    }
                }
            }
            return(jsonstr.ToString());
        }
Esempio n. 2
0
        public static JObject getZzsReportData(string table_name)
        {
            JObject   return_json = new JObject();
            string    StrTaskName = "增值税一般纳税人申报";
            string    id          = "";
            GTXResult resultq     = GTXMethod.GetHeBeiYSBQC();

            if (resultq.IsSuccess)
            {
                List <GDTXHeBeiUserYSBQC> ysbqclist = JsonConvert.DeserializeObject <List <GDTXHeBeiUserYSBQC> >(resultq.Data.ToString());
                if (ysbqclist.Count > 0)
                {
                    foreach (GDTXHeBeiUserYSBQC item in ysbqclist)
                    {
                        if (item.TaskName == StrTaskName)
                        {
                            id = item.Id.ToString();
                        }
                    }
                }
            }

            GTXResult gr = GTXMethod.GetUserReportData(id, table_name);

            if (gr.IsSuccess == true)
            {
                JArray jarr = new JArray();
                jarr = JsonConvert.DeserializeObject <JArray>(gr.Data.ToString());

                if (jarr.Count > 0)
                {
                    byte[]  bytes     = Convert.FromBase64String(jarr[0]["dataValue"].ToString().Replace(" ", "+"));
                    string  dataValue = Encoding.Default.GetString(bytes);
                    JObject jv        = JsonConvert.DeserializeObject <JObject>(dataValue);

                    return_json = jv;
                }
            }
            return(return_json);
        }
Esempio n. 3
0
        public static bool zzsSave(string table_name, string ReportData)
        {
            string StrTaskName = "增值税一般纳税人申报";

            string    id      = "";
            string    TBZT    = "";
            GTXResult resultq = GTXMethod.GetHeBeiYSBQC();

            if (resultq.IsSuccess)
            {
                List <GDTXHeBeiUserYSBQC> ysbqclist = JsonConvert.DeserializeObject <List <GDTXHeBeiUserYSBQC> >(resultq.Data.ToString());
                if (ysbqclist.Count > 0)
                {
                    foreach (GDTXHeBeiUserYSBQC item in ysbqclist)
                    {
                        if (item.TaskName == StrTaskName)
                        {
                            id   = item.Id.ToString();
                            TBZT = item.TBZT;
                        }
                    }
                }
            }

            List <GTXNameValue> nameList = new List <GTXNameValue>();
            GTXNameValue        nv       = new GTXNameValue();

            nv.key = "data";
            byte[] bytes   = Encoding.Default.GetBytes(ReportData);
            string _result = Convert.ToBase64String(bytes);

            nv.value = _result;
            nameList.Add(nv);
            GTXResult saveresult = GTXMethod.SaveUserReportData(JsonConvert.SerializeObject(nameList), id, table_name);

            if (saveresult.IsSuccess)
            {
                JArray  ja     = new JArray();
                JObject add_jo = new JObject();

                if (table_name == "001")
                {
                    XmlDocument xd        = new XmlDocument();
                    JObject     input_jo  = JsonConvert.DeserializeObject <JObject>(ReportData);
                    JValue      j3xmlData = (JValue)input_jo["jsonData"]["j3xmlData"];

                    JArray j     = JsonConvert.DeserializeObject <JArray>(j3xmlData.ToString());
                    string bbxml = j[0]["bbxml"].ToString();
                    xd.LoadXml(bbxml);

                    XmlNodeList xml_zbGridlbVO = xd.SelectSingleNode("zzssyyybnsr_zb").SelectSingleNode("zbGrid").SelectNodes("zbGridlbVO");
                    XmlNode     xml_bqybtse    = xml_zbGridlbVO[0]["bqybtse"];
                    string      bqybtse        = xml_bqybtse.InnerText;

                    GTXMethod.UpdateSBSE(id, bqybtse);
                }

                if (TBZT != null)
                {
                    ja = JsonConvert.DeserializeObject <JArray>(TBZT);
                    foreach (JObject jo in ja)
                    {
                        if (jo["bbid"].ToString().Equals(table_name))
                        {
                            jo["status"] = 1;
                            GTXMethod.UpdateYSBQCtbzt(id, "", JsonConvert.SerializeObject(ja));
                            return(true);
                        }
                    }

                    add_jo.Add("bbid", table_name);
                    add_jo.Add("status", 1);
                    ja.Add(add_jo);

                    GTXMethod.UpdateYSBQCtbzt(id, "", JsonConvert.SerializeObject(ja));
                }
                else
                {
                    add_jo.Add("bbid", table_name);
                    add_jo.Add("status", 1);
                    ja.Add(add_jo);

                    GTXMethod.UpdateYSBQCtbzt(id, "", JsonConvert.SerializeObject(ja));
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reportCode"></param>
        /// <param name="ysbqcId"></param>
        /// <param name="useYSBQCId"></param>
        /// <returns></returns>
        public static List <GDTXHeBeiUserYSBQCReportData> GetReportData(string reportCode, string ysbqcId, string useYSBQCId)
        {
            GTXResult reportDataConfig = GTXMethod.GetAHReportDataConfig(reportCode);
            string    dzjsonName       = JsonConvert.SerializeObject(new JArray());
            string    gsjsonName       = JsonConvert.SerializeObject(new JArray());
            string    lsjsonName       = JsonConvert.SerializeObject(new JArray());
            string    dzjsonName_use   = JsonConvert.SerializeObject(new JArray());

            List <GDTXHeBeiReportDataConfig>    configData        = new List <GDTXHeBeiReportDataConfig>(); //需要排除的name(包括等值匹配、公式匹配)
            List <GDTXHeBeiReportDataConfig>    dzConfigData      = new List <GDTXHeBeiReportDataConfig>(); //等值匹配
            List <GDTXHeBeiReportDataConfig>    gsConfigData      = new List <GDTXHeBeiReportDataConfig>(); //公式匹配
            List <GDTXHeBeiUserYSBQCReportData> dzReportData      = new List <GDTXHeBeiUserYSBQCReportData>();
            List <GDTXHeBeiUserYSBQCReportData> gsReportData      = new List <GDTXHeBeiUserYSBQCReportData>();
            List <GDTXHeBeiUserYSBQCReportData> currentReportData = new List <GDTXHeBeiUserYSBQCReportData>();//学员当前报表匹配好的数据集合

            #region 获取期初累计的数据集合
            //List<GDTXAHReportQiChu> qichuReportData = new List<GDTXAHReportQiChu>();//报表期初累计数据
            //GTXResult qichuList = GTXMethod.LoadDLReportQiChu("", ysbqcId, reportCode);
            //if (qichuList.IsSuccess)
            //{
            //    qichuReportData = JsonConvert.DeserializeObject<List<GDTXAHReportQiChu>>(qichuList.Data.ToString());
            //    foreach (GDTXAHReportQiChu item in qichuReportData)
            //    {
            //        GDTXAHUserYSBQCReportData newData = new GDTXAHUserYSBQCReportData();
            //        newData.ReportCode = reportCode;
            //        newData.UserId = CurrentUser.GetInstance().GetCurrentUserId;
            //        newData.UserYSBQCId = int.Parse(useYSBQCId);
            //        newData.DataKey = item.Name;
            //        newData.DataValue = item.Value;
            //        currentReportData.Add(newData);
            //    }
            //}
            #endregion
            #region 获取等值匹配和公式匹配的数据集合
            if (reportDataConfig.IsSuccess)
            {
                configData   = JsonConvert.DeserializeObject <List <GDTXHeBeiReportDataConfig> >(reportDataConfig.Data.ToString());
                dzConfigData = configData.Where(o => o.ConfigType.Equals(1)).ToList();
                gsConfigData = configData.Where(o => o.ConfigType.Equals(2)).ToList();
                #region 获取等值匹配数据集合
                var dzobj_use = from n in dzConfigData
                                select new
                {
                    reportCode = n.FromReportCode,
                    name       = "data"
                };
                dzjsonName_use = JsonConvert.SerializeObject(dzobj_use);
                GTXResult dzloadData = GTXMethod.LoadAHReportData(dzjsonName_use, useYSBQCId);
                if (dzloadData.IsSuccess)
                {
                    dzReportData = JsonConvert.DeserializeObject <List <GDTXHeBeiUserYSBQCReportData> >(dzloadData.Data.ToString());
                    if (dzReportData.Count > 0)
                    {
                        foreach (GDTXHeBeiReportDataConfig item in dzConfigData)
                        {
                            foreach (GDTXHeBeiUserYSBQCReportData data in dzReportData)
                            {
                                if (data.ReportCode == item.FromReportCode)
                                {
                                    byte[]   outputb   = Convert.FromBase64String(data.DataValue);
                                    string   orgStr    = System.Web.HttpUtility.UrlDecode(Encoding.Default.GetString(outputb));
                                    string[] datavalue = orgStr.Split('&');
                                    string   _key;
                                    string   _value = "";
                                    for (int i = 0; i < datavalue.Length - 1; i++)
                                    {
                                        _key   = datavalue[i].Split('=')[0];
                                        _value = datavalue[i].Replace(datavalue[i].Split('=')[0] + "=", "");
                                        if (item.FromReportName == _key)
                                        {
                                            GDTXHeBeiUserYSBQCReportData newData = new GDTXHeBeiUserYSBQCReportData();
                                            newData.ReportCode = reportCode;
                                            newData.UserId     = CurrentUser.GetInstance().GetCurrentUserId;
                                            newData.DataKey    = item.ToReportName;
                                            newData.DataValue  = _value;
                                            currentReportData.Add(newData);
                                            break;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                #endregion
                #region 获取公式匹配数据集合
                foreach (GDTXHeBeiReportDataConfig item in gsConfigData)
                {
                    string   value = "0";
                    string[] name  = item.Parameter.Split('#');
                    JArray   ja    = new JArray();
                    JObject  jo    = new JObject();
                    jo.Add("reportCode", item.FromReportCode);
                    jo.Add("name", "data");
                    ja.Add(jo);
                    gsjsonName = JsonConvert.SerializeObject(ja);
                    GTXResult gsloadData = GTXMethod.LoadAHReportData(gsjsonName, useYSBQCId);
                    if (gsloadData.IsSuccess)
                    {
                        gsReportData = JsonConvert.DeserializeObject <List <GDTXHeBeiUserYSBQCReportData> >(gsloadData.Data.ToString());
                    }
                    if (gsReportData.Count != 0)
                    {
                        foreach (string key in name)
                        {
                            foreach (GDTXHeBeiUserYSBQCReportData oitem in gsReportData)
                            {
                                byte[] outputb = Convert.FromBase64String(oitem.DataValue);
                                string orgStr  = System.Web.HttpUtility.UrlDecode(Encoding.Default.GetString(outputb));
                                if (orgStr.Contains(key + "="))
                                {
                                    string[] datavalue = orgStr.Split('&');
                                    string   _key;
                                    string   _value = "";
                                    for (int i = 0; i < datavalue.Length - 1; i++)
                                    {
                                        _key   = datavalue[i].Split('=')[0];
                                        _value = datavalue[i].Replace(datavalue[i].Split('=')[0] + "=", "");
                                        if (key == _key)
                                        {
                                            item.FromReportName = item.FromReportName.Replace(key, _value);
                                            break;
                                        }
                                    }
                                }
                                else
                                {
                                    item.FromReportName = item.FromReportName.Replace(key, "0");
                                }
                            }
                        }
                        value = new DataTable().Compute(item.FromReportName, "").ToString();
                    }
                    GDTXHeBeiUserYSBQCReportData newData = new GDTXHeBeiUserYSBQCReportData();
                    newData.ReportCode = reportCode;
                    newData.UserId     = CurrentUser.GetInstance().GetCurrentUserId;
                    newData.DataKey    = item.ToReportName;
                    newData.DataValue  = value;
                    currentReportData.Add(newData);
                }
                #endregion
            }
            #endregion
            return(currentReportData);
        }