Esempio n. 1
0
 private XmlDocument DaiKaiZYFPZuofeiCreateXml(List <SWDKDMHM> fpList)
 {
     if ((fpList != null) && (fpList.Count != 0))
     {
         try
         {
             XmlDocument    document = new XmlDocument();
             XmlDeclaration newChild = document.CreateXmlDeclaration("1.0", "UTF-8", "");
             document.AppendChild(newChild);
             System.Xml.XmlNode node = document.CreateNode(XmlNodeType.Element, "INVALID", "");
             document.AppendChild(node);
             foreach (SWDKDMHM swdkdmhm in fpList)
             {
                 System.Xml.XmlNode node2 = document.CreateElement("FP");
                 node.AppendChild(node2);
                 System.Xml.XmlNode node3 = document.CreateElement("FPHM");
                 node3.InnerText = ShareMethods.FPHMTo8Wei(swdkdmhm.fphm);
                 node2.AppendChild(node3);
                 System.Xml.XmlNode node4 = document.CreateElement("FPDM");
                 node4.InnerText = swdkdmhm.fpdm;
                 node2.AppendChild(node4);
             }
             fpList = null;
             return(document);
         }
         catch (Exception exception)
         {
             this.loger.Error("税务代开发票作废构造XML异常:" + exception.ToString());
         }
     }
     return(null);
 }
Esempio n. 2
0
 public void SaveAllFPxxToTxt(List <Fpxx> fpList, string Path, DateTime StartDt, DateTime EndDt)
 {
     try
     {
         if ((fpList == null) || (fpList.Count == 0))
         {
             MessageManager.ShowMsgBox("FPCX-000039");
         }
         else
         {
             using (StreamWriter writer = new StreamWriter(Path, false, ToolUtil.GetEncoding()))
             {
                 writer.WriteLine("//发票主体明细信息");
                 writer.WriteLine("//" + StartDt.ToString("yyyyMMdd") + "~~" + EndDt.ToString("yyyyMMdd"));
                 int num = 0;
                 foreach (Fpxx fpxx in fpList)
                 {
                     num++;
                     writer.WriteLine("//发票" + num.ToString());
                     string str = fpxx.fpdm + "~~" + ShareMethods.FPHMTo8Wei(fpxx.fphm) + "~~" + fpxx.kpjh.ToString() + "~~" + fpxx.gfmc + "~~" + fpxx.gfsh + "~~" + fpxx.xfsh + "~~" + Aisino.Fwkp.Fpkj.Common.Tool.ObjectToDateTime(fpxx.kprq).ToString("yyyy-MM-dd") + "~~" + fpxx.je + "~~" + fpxx.se + "~~" + ToolUtil.GetString(Convert.FromBase64String(fpxx.bz)) + "~~" + (fpxx.zfbz ? "1" : "0");
                     writer.WriteLine(str);
                 }
             }
             fpList = null;
         }
     }
     catch (Exception exception)
     {
         this.loger.Error(exception.Message);
     }
 }
Esempio n. 3
0
        private XmlDocument genPackageFpxxXml(List <Fpxx> xxfps, SelectSSQ selectSsq, TaxCard TaxCardInstance, int start, int end)
        {
            XmlDocument document = new XmlDocument();

            document.CreateXmlDeclaration("1.0", "GBK", "yes");
            XmlDeclaration newChild = document.CreateXmlDeclaration("1.0", "GBK", null);

            document.AppendChild(newChild);
            System.Xml.XmlNode      node      = document.CreateElement("taxML");
            System.Xml.XmlAttribute attribute = document.CreateAttribute("cnName");
            attribute.InnerText = "增值税发票开具明细";
            node.Attributes.Append(attribute);
            System.Xml.XmlAttribute attribute2 = document.CreateAttribute("xmlns");
            attribute2.InnerText = "http://www.chinatax.gov.cn/dataspec/";
            node.Attributes.Append(attribute2);
            System.Xml.XmlAttribute attribute3 = document.CreateAttribute("name");
            attribute3.InnerText = "slSbbtjZzsfpkjmxRequest";
            node.Attributes.Append(attribute3);
            System.Xml.XmlAttribute attribute4 = document.CreateAttribute("version");
            attribute4.InnerText = "SW5001-2006";
            node.Attributes.Append(attribute4);
            System.Xml.XmlAttribute attribute5 = document.CreateAttribute("xsi", "type", "http://www.w3.org/2001/XMLSchema-instance");
            attribute5.InnerText = "slSbbtjZzsfpkjmxRequest";
            node.Attributes.Append(attribute5);
            document.AppendChild(node);
            System.Xml.XmlNode node2 = document.CreateElement("sbbZzsfpkjmx");
            node.AppendChild(node2);
            System.Xml.XmlNode node3 = document.CreateElement("head");
            node2.AppendChild(node3);
            System.Xml.XmlNode node4 = document.CreateElement("publicHead");
            node3.AppendChild(node4);
            System.Xml.XmlNode node5 = document.CreateElement("nsrsbh");
            System.Xml.XmlNode node6 = document.CreateElement("nsrmc");
            node5.InnerText = TaxCardInstance.TaxCode;
            node6.InnerText = TaxCardInstance.Corporation;
            System.Xml.XmlNode node7 = document.CreateElement("tbrq");
            node7.InnerText = selectSsq.tbrq;
            System.Xml.XmlNode node8 = document.CreateElement("sssq");
            node4.AppendChild(node5);
            node4.AppendChild(node6);
            node4.AppendChild(node7);
            node4.AppendChild(node8);
            System.Xml.XmlNode node9  = document.CreateElement("rqQ");
            System.Xml.XmlNode node10 = document.CreateElement("rqZ");
            node9.InnerText  = selectSsq.ssqQ.Replace("-", "");
            node10.InnerText = selectSsq.ssqZ.Replace("-", "");
            node8.AppendChild(node9);
            node8.AppendChild(node10);
            System.Xml.XmlNode node11 = document.CreateElement("body");
            node2.AppendChild(node11);
            System.Xml.XmlNode node13 = document.CreateElement("zyfpkjhjxx");
            System.Xml.XmlNode node12 = document.CreateElement("zyfpkjmx");
            node11.AppendChild(node12);
            System.Xml.XmlNode node14 = document.CreateElement("zyfpkjhjs");
            System.Xml.XmlNode node15 = document.CreateElement("zzszyfphjJe");
            System.Xml.XmlNode node16 = document.CreateElement("zzszyfphjSe");
            node13.AppendChild(node14);
            node13.AppendChild(node15);
            node13.AppendChild(node16);
            System.Xml.XmlNode node17 = document.CreateElement("ptfpkjmx");
            System.Xml.XmlNode node18 = document.CreateElement("ptfpkjhjxx");
            System.Xml.XmlNode node19 = document.CreateElement("ptfpkjhjs");
            System.Xml.XmlNode node20 = document.CreateElement("ptfpkjhjJe");
            System.Xml.XmlNode node21 = document.CreateElement("ptfpkjhjSe");
            node18.AppendChild(node19);
            node18.AppendChild(node20);
            node18.AppendChild(node21);
            node11.AppendChild(node12);
            node11.AppendChild(node13);
            node11.AppendChild(node17);
            node11.AppendChild(node18);
            int     num  = 0;
            decimal num2 = 0M;
            decimal num3 = 0M;
            int     num4 = 0;
            decimal num5 = 0M;
            decimal num6 = 0M;

            for (int i = start; i <= end; i++)
            {
                Fpxx fpxx = xxfps[i];
                System.Xml.XmlNode node22 = document.CreateElement("mxxx");
                System.Xml.XmlNode node23 = document.CreateElement("xh");
                System.Xml.XmlNode node24 = document.CreateElement("fpdm");
                System.Xml.XmlNode node25 = document.CreateElement("fphm");
                System.Xml.XmlNode node26 = document.CreateElement("kprq");
                System.Xml.XmlNode node27 = document.CreateElement("gmfnsrsbh");
                System.Xml.XmlNode node28 = document.CreateElement("je");
                System.Xml.XmlNode node29 = document.CreateElement("se");
                System.Xml.XmlNode node30 = document.CreateElement("zfbz");
                node24.InnerText = fpxx.fpdm;
                node25.InnerText = ShareMethods.FPHMTo8Wei(fpxx.fphm.ToString());
                node27.InnerText = fpxx.gfsh;
                node28.InnerText = fpxx.je.ToString();
                node29.InnerText = fpxx.se.ToString();
                if (fpxx.zfbz)
                {
                    node30.InnerText = "Y";
                }
                else
                {
                    node30.InnerText = "N";
                }
                node27.InnerText = fpxx.gfsh;
                node26.InnerText = fpxx.kprq.Replace("-", "");
                node22.AppendChild(node23);
                node22.AppendChild(node24);
                node22.AppendChild(node25);
                node22.AppendChild(node26);
                node22.AppendChild(node27);
                node22.AppendChild(node28);
                node22.AppendChild(node29);
                node22.AppendChild(node30);
                if (fpxx.fplx == 0)
                {
                    num++;
                    node23.InnerText = num.ToString();
                    num2            += decimal.Parse(fpxx.je);
                    num3            += decimal.Parse(fpxx.se);
                    node12.AppendChild(node22);
                }
                else if (fpxx.fplx == (FPLX)2)
                {
                    num4++;
                    node23.InnerText = num4.ToString();
                    num5            += decimal.Parse(fpxx.je);
                    num6            += decimal.Parse(fpxx.se);
                    node17.AppendChild(node22);
                }
                node22.AppendChild(node23);
            }
            node14.InnerText = num.ToString();
            node15.InnerText = num2.ToString();
            node16.InnerText = num3.ToString();
            node19.InnerText = num4.ToString();
            node20.InnerText = num5.ToString();
            node21.InnerText = num6.ToString();
            return(document);
        }
Esempio n. 4
0
        public void SaveSelectToTxt(DataGridViewSelectedRowCollection selectRows, string Path, DateTime StartDt, DateTime EndDt, bool IsWenjian)
        {
            try
            {
                if ((selectRows == null) || (selectRows.Count == 0))
                {
                    MessageManager.ShowMsgBox("FPCX-000039");
                    return;
                }
                List <Fpxx> fpList = new List <Fpxx>();
                if (IsWenjian)
                {
                    using (StreamWriter writer = new StreamWriter(Path + ".txt", false, ToolUtil.GetEncoding()))
                    {
                        writer.WriteLine("//发票主体明细信息");
                        writer.WriteLine("//" + StartDt.ToString("yyyyMMdd") + "~~" + EndDt.ToString("yyyyMMdd"));
                        int num = 0;
                        foreach (DataGridViewRow row in selectRows)
                        {
                            num++;
                            if (row.Cells["FPDM"].Value != null)
                            {
                                string fPZL = row.Cells["FPZL"].Value.ToString();
                                string fPDM = row.Cells["FPDM"].Value.ToString();
                                string data = row.Cells["FPHM"].Value.ToString();
                                Fpxx   item = this.xxfpChaXunBll.GetModel(fPZL, fPDM, Aisino.Fwkp.Fpkj.Common.Tool.ObjectToInt(data), "");
                                if (item != null)
                                {
                                    writer.WriteLine("//发票" + num.ToString());
                                    string str4 = item.fpdm + "~~" + ShareMethods.FPHMTo8Wei(item.fphm) + "~~" + item.kpjh.ToString() + "~~" + item.gfmc + "~~" + item.gfsh + "~~" + item.xfsh + "~~" + Aisino.Fwkp.Fpkj.Common.Tool.ObjectToDateTime(item.kprq).ToString("yyyy-MM-dd") + "~~" + item.je + "~~" + item.se + "~~" + ToolUtil.GetString(Convert.FromBase64String(item.bz)) + "~~" + (item.zfbz ? "1" : "0");
                                    writer.WriteLine(str4);
                                    fpList.Add(item);
                                }
                                else
                                {
                                    this.loger.Error("[SaveToTxt函数]:代码:" + fPDM + ", 发票号码:" + data + "在数据库库没有查到");
                                }
                            }
                        }
                        goto Label_03EC;
                    }
                }
                foreach (DataGridViewRow row2 in selectRows)
                {
                    string str5  = row2.Cells["FPZL"].Value.ToString();
                    string str6  = row2.Cells["FPDM"].Value.ToString();
                    string str7  = row2.Cells["FPHM"].Value.ToString();
                    Fpxx   fpxx2 = this.xxfpChaXunBll.GetModel(str5, str6, Aisino.Fwkp.Fpkj.Common.Tool.ObjectToInt(str7), "");
                    if (fpxx2 != null)
                    {
                        fpList.Add(fpxx2);
                    }
                    else
                    {
                        this.loger.Error("[SaveToTxt函数]:代码:" + str6 + ", 发票号码:" + str7 + "在数据库库没有查到");
                    }
                }
Label_03EC:
                if (fpList.Count > 0)
                {
                    this.EncryptXML(fpList, Path + ".Dat");
                }
                fpList = null;
            }
            catch (Exception exception)
            {
                this.loger.Error(exception.Message);
            }
        }