Snoopy 3 жил өмнө
parent
commit
618c76222e

+ 25 - 0
TCCInvoice.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.32112.339
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TCCInvoice", "TCCInvoice\TCCInvoice.csproj", "{D0081CCA-054E-4BB0-8F56-12FB54B98D99}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{D0081CCA-054E-4BB0-8F56-12FB54B98D99}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{D0081CCA-054E-4BB0-8F56-12FB54B98D99}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{D0081CCA-054E-4BB0-8F56-12FB54B98D99}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{D0081CCA-054E-4BB0-8F56-12FB54B98D99}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {9C459733-FCFF-4739-9258-BD78C369DD73}
+	EndGlobalSection
+EndGlobal

+ 14 - 0
TCCInvoice/App.config

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
+    </startup>
+  <runtime>
+    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
+      <dependentAssembly>
+        <assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
+      </dependentAssembly>
+    </assemblyBinding>
+  </runtime>
+</configuration>

+ 415 - 0
TCCInvoice/InvoiceGenerator.cs

@@ -0,0 +1,415 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Net.Http;
+using System.Net.Http.Json;
+using System.Text;
+using System.Threading.Tasks;
+using System.Xml.Linq;
+
+namespace TCCInvoice
+{
+    internal class InvoiceGenerator
+    {
+        #region Fields
+        private string dataNumber;
+        private DateTime dataDate = DateTime.Today;
+        private string sellerId = SELLER_ID;
+        private string buyerId;
+        private string buyerName;
+        private string customsClearanceMark;
+        private int salesAmount;
+        private int freeTaxSalesAmount = FREE_ZERO_TAX_SALES_AMOUNT;
+        private int zeroTaxSalesAmount = FREE_ZERO_TAX_SALES_AMOUNT;
+        private string invoiceType = INVOICE_TYPE;
+        private int taxType = TAX_TYPE;
+        private double taxRate = TAX_RATE;
+        private int taxAmount;
+        private int totalAmount;
+        private string printMark = DEFAULT_PRINT_MARK;
+        private string carrierType;
+        private string carrierId1;
+        private string carrierId2;
+        private string mainRemark;
+        private int donateMark;
+        private string nPOBAN;
+        private string contactEmail;
+        private string contactAddress;
+        private string contactPhone;
+        private List<InvoiceItem> invoiceItems = new List<InvoiceItem>();
+
+        private FileSystemWatcher xmlWatcher;
+        #endregion
+
+        #region Constants
+        private const string SELLER_ID = "83196607";
+        private const string UNKNOWN_BUYER_NAME = "    "; // 未查詢到的營業人名稱
+        private const string DEFAULT_BUYER_NAME = "xxxx"; // 一般消費者
+        private const string DEFAULT_BUYER_ID = "0000000000";
+        private const int FREE_ZERO_TAX_SALES_AMOUNT = 0;
+        private const string INVOICE_TYPE = "07";
+        private const int TAX_TYPE = 1;
+        private const double TAX_RATE = 0.05;
+        private const string DEFAULT_PRINT_MARK = "N";
+        /// <summary>
+        /// WEB : http://gcis.nat.g0v.tw/id/30435973
+        /// API : http://gcis.nat.g0v.tw/api/show/30435973
+        /// </summary>
+        private const string BUSINESS_NAME_API = "http://gcis.nat.g0v.tw/api/show/";
+        private const string CARRIER_TYPE_BARCODE = "3J0002";
+        private const string DEFAULT_LOVECODE = "";
+
+        private const string PREINVOICE_PATH = @"C:\UXB2B_EIVO\PreInvoice\";
+        private const string INVOICE_RESPONSE_PATH = @"C:\UXB2B_EIVO\PreInvoice(Response)\";
+        private const string INVOICE_FAILURE_PATH = @"C:\UXB2B_EIVO\PreInvoice(Failure)\";
+        #endregion
+
+        #region Properties
+        /// <summary>
+        /// (必填)單據號碼,須為唯一值,長度上限20
+        /// </summary>
+        public string DataNumber
+        {
+            set => dataNumber = value;
+        }
+        /// <summary>
+        /// (必填)發票日期
+        /// </summary>
+        public DateTime DataDate
+        {
+            set => dataDate = value;
+        }
+        /// <summary>
+        /// (選填)賣方統編,預設值83196607
+        /// </summary>
+        public string SellerId
+        {
+            set => sellerId = value;
+        }
+        /// <summary>
+        /// (必填)買方統編,若無統編請填null或空字串,系統自動帶入預設值0000000000
+        /// </summary>
+        public string BuyerId
+        {
+            set
+            {
+                buyerId = string.IsNullOrEmpty(value) ? DEFAULT_BUYER_ID : value;
+
+                if (buyerId.Equals(DEFAULT_BUYER_ID)) // 一般消費者
+                {
+                    buyerName = DEFAULT_BUYER_NAME;
+                }
+                else // 有統編
+                {
+                    GetBuyerNameFromBuyerIdAsync().Wait();
+                }
+            }
+        }
+        /// <summary>
+        /// (必填)含稅總額
+        /// </summary>
+        public int TotalAmount
+        {
+            set
+            {
+                totalAmount = value;
+
+                if (string.IsNullOrEmpty(buyerId))
+                {
+                    BuyerId = null;
+                }
+
+                if (buyerId.Equals(DEFAULT_BUYER_ID)) // 一般消費者
+                {
+                    salesAmount = totalAmount;
+                    taxAmount = 0;
+                }
+                else
+                {
+                    salesAmount = (int)Math.Round((double)totalAmount / (1 + taxRate), 0, MidpointRounding.AwayFromZero);
+                    taxAmount = totalAmount - salesAmount;
+                }
+            }
+        }
+        /// <summary>
+        /// (必填)手機條碼載具,若無手機條碼請填null
+        /// </summary>
+        public string CarrierId1 
+        {
+            set
+            {
+                carrierId1 = value;
+                carrierId2 = carrierId1;
+                carrierType = String.IsNullOrEmpty(carrierId1) ? null : CARRIER_TYPE_BARCODE;
+            }
+        }
+        /// <summary>
+        /// (選填)總備註,最多200字
+        /// </summary>
+        public string MainRemark 
+        { 
+            set => mainRemark = value; 
+        }
+        /// <summary>
+        /// (必填)不捐贈發票填0,捐贈發票填1
+        /// </summary>
+        public int DonateMark 
+        {
+            set
+            {
+                donateMark = value;
+                nPOBAN = donateMark == 1 ? DEFAULT_LOVECODE : null;
+            }
+        }
+        /// <summary>
+        /// (選填)消費者的email address
+        /// </summary>
+        public string ContactEmail 
+        { 
+            set => contactEmail = value; 
+        }
+        /// <summary>
+        /// (選填)消費者的聯絡地址
+        /// </summary>
+        public string ContactAddress 
+        { 
+            set => contactAddress = value; 
+        }
+        /// <summary>
+        /// (選填)消費者的聯絡電話
+        /// </summary>
+        public string ContactPhone 
+        { 
+            set => contactPhone = value; 
+        }
+        #endregion
+
+        #region Constructors
+        public InvoiceGenerator()
+        {
+            xmlWatcher = new FileSystemWatcher();
+            xmlWatcher.Path = INVOICE_RESPONSE_PATH;
+            xmlWatcher.Filter = "*.xml";
+            xmlWatcher.IncludeSubdirectories = false;
+            xmlWatcher.EnableRaisingEvents = true;
+            xmlWatcher.Created += InvoiceXmlCreated;
+        }
+        #endregion
+
+        #region Events & EventHandlers
+        public delegate void InvoiceGenerateEventHandler(string dataNumber, string invoiceNumber, 
+                                                         string invoiceDate, string invoiceTime, string carrierNumber);
+        public event InvoiceGenerateEventHandler InvoiceGenerated;
+
+        private void InvoiceXmlCreated(object sender, FileSystemEventArgs e)
+        {
+            string datanumber = null;
+            string invoicenumber = null;
+            string invoicedate = null;
+            string invoicetime = null;
+            string carriernumber = null;
+
+            XDocument xDoc = XDocument.Load(e.FullPath);
+            
+            string status = xDoc.Descendants("Status").ElementAt(0).Value;
+            if (status == "1")
+            {
+                invoicenumber = xDoc.Descendants("InvoiceNumber").ElementAt(0).Value;
+                datanumber = xDoc.Descendants("DataNumber").ElementAt(0).Value;
+                invoicedate = xDoc.Descendants("InvoiceDate").ElementAt(0).Value;
+                invoicetime = xDoc.Descendants("InvoiceTime").ElementAt(0).Value;
+                // carriernumber = xDoc.Descendants("CarrierId1").ElementAt(0).Value;
+            }
+            else
+            {
+                // Failure
+            }    
+
+            InvoiceGenerated?.Invoke(datanumber, invoicenumber, invoicedate, invoicetime, carriernumber);
+        }
+        #endregion
+
+        #region Instance Methods
+        /// <summary>
+        /// 加入S消費品項明細
+        /// </summary>
+        /// <param name="sequenceNumber">發票明細之排列序號</param>
+        /// <param name="description">產品名稱</param>
+        /// <param name="quantity">數量 decimal(16,4)</param>
+        /// <param name="unit">單位,若不填請輸入null</param>
+        /// <param name="unitPrice">單價 decimal(16,4)</param>
+        /// <param name="amount">總金額 decimal(16,4)</param>
+        /// <param name="remark">單一欄位備註,若不填請輸入null</param>
+        public void AddInvoiceItem(int sequenceNumber, string description, double quantity, 
+                                   string unit, double unitPrice, double amount, string remark)
+        {
+            InvoiceItem item = new InvoiceItem()
+            {
+                SequenceNumber = sequenceNumber,
+                Description = description,
+                Quantity = quantity,
+                Unit = unit,
+                UnitPrice = unitPrice,
+                Amount = amount,
+                Remark = remark
+            };
+
+            invoiceItems.Add(item);
+        }
+
+        /// <summary>
+        /// 產生Preinvoice檔案,交由網優Gateway開立發票,並重置InvoiceGenerator物件的欄位值
+        /// </summary>
+        public void GetInvoiceResponse()
+        {
+            try
+            {
+                GeneratePreinvoiceXML();
+            }
+            catch (Exception ex)
+            {
+                ;
+            }
+            
+            ResetPreInvoiceInfo();
+        }
+
+        private void GeneratePreinvoiceXML()
+        {
+            XDocument xDoc = new XDocument();
+            xDoc.Declaration = new XDeclaration("1.0", "UTF-8", "");
+
+            XElement root = new XElement("InvoiceRoot");
+            root.Add(new XElement("Invoice", 
+                                  new XElement("DataNumber", dataNumber),
+                                  new XElement("DataDate", dataDate.ToString("yyyy/MM/dd")),
+                                  new XElement("SellerId", sellerId),
+                                  new XElement("BuyerId", buyerId),
+                                  new XElement("BuyerName", buyerName),
+                                  new XElement("CustomsClearanceMark", customsClearanceMark),
+                                  new XElement("SalesAmount", salesAmount),
+                                  new XElement("FreeTaxSalesAmount", freeTaxSalesAmount),
+                                  new XElement("ZeroTaxSalesAmount", zeroTaxSalesAmount),
+                                  new XElement("InvoiceType", invoiceType),
+                                  new XElement("TaxType", taxType),
+                                  new XElement("TaxRate", taxRate),
+                                  new XElement("TaxAmount", taxAmount),
+                                  new XElement("TotalAmount", totalAmount),
+                                  new XElement("PrintMark", printMark),
+                                  new XElement("CarrierType", carrierType),
+                                  new XElement("CarrierId1", carrierId1),
+                                  new XElement("CarrierId2", carrierId2),
+                                  new XElement("MainRemark", mainRemark),
+                                  new XElement("DonateMark", donateMark),
+                                  new XElement("NPOBAN", nPOBAN),
+                                  new XElement("Contact",
+                                               new XElement("Email", contactEmail),
+                                               new XElement("Address", contactAddress),
+                                               new XElement("TEL", contactPhone)
+                                              )
+                                 )
+                    );
+
+            foreach (InvoiceItem item in invoiceItems)
+            {
+                XElement invoice = root.Element("Invoice");
+                invoice.Add(new XElement("InvoiceItem",
+                                         new XElement("SequenceNumber", item.SequenceNumber),
+                                         new XElement("Description", item.Description),
+                                         new XElement("Quantity", item.Quantity),
+                                         new XElement("Unit", item.Unit),
+                                         new XElement("UnitPrice", item.UnitPrice),
+                                         new XElement("Amount", item.Amount),
+                                         new XElement("Remark", item.Remark)
+                                        )
+                           );
+            }
+
+            xDoc.Add(root);
+            xDoc.Save(PREINVOICE_PATH + dataNumber + ".xml");
+        }
+
+        private void ResetPreInvoiceInfo()
+        {
+            dataNumber = null;
+            dataDate = DateTime.Today;
+            buyerId = null;
+            buyerName = null;
+            customsClearanceMark = null;
+            salesAmount = 0;
+            taxAmount = 0;
+            totalAmount = 0;
+            carrierType = null;
+            carrierId1 = null;
+            carrierId2 = null;
+            mainRemark = null;
+            donateMark = 0;
+            nPOBAN = null;
+            contactEmail = null;
+            contactAddress = null;
+            contactPhone = null;
+            invoiceItems.Clear();
+        }
+
+        private async Task GetBuyerNameFromBuyerIdAsync()
+        {
+            using (var client = new HttpClient())
+            {
+                try
+                {
+                    var result = await client.GetFromJsonAsync<BusinessName>(BUSINESS_NAME_API + buyerId);
+
+                    buyerName = UNKNOWN_BUYER_NAME;
+                    if (result.data != null && result.data.財政部 != null)
+                    {
+                        buyerName = result.data.財政部.營業人名稱; // 1st try
+                        if (string.IsNullOrEmpty(buyerName))
+                        {
+                            buyerName = result.data.財政部.單位名稱; // 2nd try
+                            if (string.IsNullOrEmpty(buyerName))
+                            {
+                                buyerName = result.data.名稱; // last try
+                            }
+                        }
+                    }
+                }
+                catch (Exception)
+                {
+                    buyerName = UNKNOWN_BUYER_NAME;
+                }
+            };
+        }
+        #endregion
+
+        #region Nested Classes
+        internal class InvoiceItem
+        {
+            public int SequenceNumber { get; set; }
+            public string Description { get; set; }
+            public double Quantity { get; set; }
+            public string Unit { get; set; }
+            public double UnitPrice { get; set; }
+            public double Amount { get; set; }
+            public string Remark { get; set; }
+        }
+        internal class BusinessName
+        {
+            public Data data { get; set; }
+        }
+
+        internal class Data
+        {
+            public string 名稱 { get; set; }
+            public 財政部 財政部 { get; set; }
+        }
+
+        internal class 財政部
+        {
+            public string 營業人名稱 { get; set; }
+            public string 單位名稱 { get; set; }
+        }
+        #endregion
+    }
+}

+ 59 - 0
TCCInvoice/Program.cs

@@ -0,0 +1,59 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace TCCInvoice
+{
+    internal class Program
+    {
+        static void Main(string[] args)
+        {
+            // 建立InvoiceGenerator類別的物件
+            InvoiceGenerator myInvoice = new InvoiceGenerator();
+
+            // 註冊發票號碼已開立的事件
+            myInvoice.InvoiceGenerated += MyInvoice_InvoiceGenerated;
+
+            // 填具待開立發票的相關資料(Preinvoice)
+            myInvoice.DataNumber = "2022020388888887";
+            myInvoice.DataDate = DateTime.Today;
+            myInvoice.BuyerId = "null"; // 一般消費者
+            myInvoice.TotalAmount = 524;
+            myInvoice.CarrierId1 = null;
+            myInvoice.DonateMark = 0;
+            myInvoice.ContactEmail = "snoopy.h.huang@outlook.com";
+            myInvoice.ContactPhone = "0929168960";
+            myInvoice.AddInvoiceItem(0, "充電服務費", 41.5793, "度", 12, 499, "每度12元");
+            myInvoice.AddInvoiceItem(1, "占用費", 0.5, "小時", 50, 25, "每小時50元");
+            //開立發票
+            myInvoice.GetInvoiceResponse();
+
+            //下一張
+            //myInvoice.DataNumber = "202202031234567890";
+            //myInvoice.DataDate = DateTime.Today;
+            //myInvoice.BuyerId = "30435973"; //營業人
+            //myInvoice.TotalAmount = 1204;
+            //myInvoice.CarrierId1 = "/CPDF.O2";
+            //myInvoice.DonateMark = 0;
+            //myInvoice.ContactEmail = "snoopy_huang@phihong.com.tw";
+            //myInvoice.ContactPhone = "0972637981";
+            //myInvoice.AddInvoiceItem(0, "充電服務費", 120.4130, "度", 10, 1204, "每度10元");
+            //myInvoice.GetInvoiceResponse();
+
+            Console.WriteLine("Press enter to exit");
+            Console.ReadLine();
+        }
+
+        private static void MyInvoice_InvoiceGenerated(string dataNumber, string invoiceNumber,
+                                                       string invoiceDate, string invoiceTime, string carrierNumber)
+        {
+            Console.WriteLine("單據編號:" + dataNumber);
+            Console.WriteLine("發票號碼:" + invoiceNumber);
+            Console.WriteLine("發票日期:" + invoiceDate);
+            Console.WriteLine("發票時間:" + invoiceTime);
+            Console.WriteLine("載具號碼:" + carrierNumber);
+        }
+    }
+}

+ 36 - 0
TCCInvoice/Properties/AssemblyInfo.cs

@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// 組件的一般資訊是由下列的屬性集控制。
+// 變更這些屬性的值即可修改組件的相關
+// 資訊。
+[assembly: AssemblyTitle("TCCInvoice")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("TCCInvoice")]
+[assembly: AssemblyCopyright("Copyright ©  2022")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 將 ComVisible 設為 false 可對 COM 元件隱藏
+// 組件中的類型。若必須從 COM 存取此組件中的類型,
+// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
+[assembly: ComVisible(false)]
+
+// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
+[assembly: Guid("d0081cca-054e-4bb0-8f56-12fb54b98d99")]
+
+// 組件的版本資訊由下列四個值所組成:
+//
+//      主要版本
+//      次要版本
+//      組建編號
+//      修訂
+//
+// 您可以指定所有的值,也可以使用 '*' 將組建和修訂編號
+// 設為預設,如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 95 - 0
TCCInvoice/TCCInvoice.csproj

@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{D0081CCA-054E-4BB0-8F56-12FB54B98D99}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <RootNamespace>TCCInvoice</RootNamespace>
+    <AssemblyName>TCCInvoice</AssemblyName>
+    <TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+    <NuGetPackageImportStamp>
+    </NuGetPackageImportStamp>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.6.0.2-mauipre.1.22054.8\lib\net461\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
+    </Reference>
+    <Reference Include="System" />
+    <Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Core" />
+    <Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Net.Http.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Net.Http.Json.6.0.0\lib\net461\System.Net.Http.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Numerics" />
+    <Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.2-mauipre.1.22054.8\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Text.Encodings.Web, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Text.Encodings.Web.6.0.2-mauipre.1.22054.8\lib\net461\System.Text.Encodings.Web.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Text.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Text.Json.6.0.2-mauipre.1.22054.8\lib\net461\System.Text.Json.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
+    </Reference>
+    <Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
+    </Reference>
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="InvoiceGenerator.cs" />
+    <Compile Include="Program.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+    <None Include="packages.config" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+  <Import Project="..\packages\System.Text.Json.6.0.2-mauipre.1.22054.8\build\System.Text.Json.targets" Condition="Exists('..\packages\System.Text.Json.6.0.2-mauipre.1.22054.8\build\System.Text.Json.targets')" />
+  <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+    <PropertyGroup>
+      <ErrorText>此專案參考這部電腦上所缺少的 NuGet 套件。請啟用 NuGet 套件還原,以下載該套件。如需詳細資訊,請參閱 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的檔案是 {0}。</ErrorText>
+    </PropertyGroup>
+    <Error Condition="!Exists('..\packages\System.Text.Json.6.0.2-mauipre.1.22054.8\build\System.Text.Json.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\System.Text.Json.6.0.2-mauipre.1.22054.8\build\System.Text.Json.targets'))" />
+  </Target>
+</Project>

+ 13 - 0
TCCInvoice/packages.config

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Microsoft.Bcl.AsyncInterfaces" version="6.0.2-mauipre.1.22054.8" targetFramework="net48" />
+  <package id="System.Buffers" version="4.5.1" targetFramework="net48" />
+  <package id="System.Memory" version="4.5.4" targetFramework="net48" />
+  <package id="System.Net.Http.Json" version="6.0.0" targetFramework="net48" />
+  <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.2-mauipre.1.22054.8" targetFramework="net48" />
+  <package id="System.Text.Encodings.Web" version="6.0.2-mauipre.1.22054.8" targetFramework="net48" />
+  <package id="System.Text.Json" version="6.0.2-mauipre.1.22054.8" targetFramework="net48" />
+  <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
+  <package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
+</packages>