QuickBooks Import Items&发票

时间:2013-03-12 00:40:58

标签: quickbooks

我有QuickBooks 2010专业版,因为标题建议我需要导入产品&发票进入Quickbooks。

一些背景......

我们是一家在线公司,我们在线销售产品,我的客户希望将所有产品导入quickbooks,并将每个在线销售导入quickbooks,我们的网站使用ASP.NET构建,并以SQL Server作为后盾。

我是quickbooks的新手,所以我不知道该怎么做......

我听说过IIF import& SDK,遗憾的是我无法找到它们并提供有价值的文档。任何人都可以请我正确的方向(可能是一些示例代码)?请不要给我quickbooks网站的SDK网址。

由于

1 个答案:

答案 0 :(得分:6)

如果您不愿意查看QuickBooks SDK,那么您将面临巨大的损害。

实现您尝试执行的操作的最简单方法是通过SDK和Web连接器。我们的维基上有the QuickBooks Web Connector的基本概述。它专门用于将数据从在线网站转移到QuickBooks for Windows(就像您正在尝试的那样)。基本的想法是它轮询你的网站,要求做的事情,你可以提供XML请求做东西(添加客户,添加发票等)。

基本协议如下所示:

  

// Web连接器要求您的SOAP服务对Web连接器进行身份验证   => SOAP服务器:使用用户名“xyz”和密码“bla”进行身份验证(authenticate)        如果身份验证成功,SOAP服务器将返回故障单值并继续该过程

     

// Web连接器要求做什么Web连接器=>肥皂   服务器:嘿SOAP服务器,你有什么我要做的?   (sendRequestXML)        SOAP服务器生成并返回qbXML请求

     

// Web连接器将请求转发给QuickBooks,并收到一个   来自QuickBooks Web Connector的响应=> QuickBooks:嘿   QuickBooks,SOAP服务器给了我这个请求,可以请你   过程呢?        QuickBooks处理请求,并返回对Web连接器的响应

     

// Web连接器将QuickBooks的响应中继回SOAP   server Web Connector => SOAP服务器:嘿SOAP服务器,这里是   来自QuickBooks的最后一个请求的响应(receiveResponseXML)        SOAP服务器处理响应,处理任何错误并对响应执行任何操作        SOAP服务器返回完成的百分比,如果小于100%,则此过程继续...

     

//进程重新开始,Web连接器询问SOAP   服务器用于下一个请求... Web连接器=> SOAP服务器:嘿   SOAP服务器,你还有什么我要做的? (sendRequestXML)        SOAP服务器生成并返回qbXML请求

     

......等等......

如果您下载QuickBooks SDK(哎呀,抱歉!),您会发现它包含您要求的一些内容。具体来说,它会在此目录中删除示例代码:

C:\Program Files (x86)\Intuit\IDN\QBSDK12.0\samples\qbdt\c-sharp\qbXML\WCWebService

以下是该示例代码中已清理,删除的版本:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.IO;
using System.Security.Cryptography;
using Microsoft.Win32;
using System.Xml;
using System.Text.RegularExpressions;

namespace WCWebService
{
    /// <summary>
    /// Web Service Namespace="http://developer.intuit.com/"
    /// Web Service Name="WCWebService"
    /// Web Service Description="Sample WebService in ASP.NET to 
    /// demonstrate QuickBooks WebConnector"
    /// </summary>
    [WebService(
         Namespace="http://developer.intuit.com/",
         Name="WCWebService",
         Description="Sample WebService in ASP.NET to demonstrate " + 
                "QuickBooks WebConnector")]

    // Important Note:  
    // You should keep the namespace as http://developer.intuit.com/ for all web 
    // services that communicates with QuickBooks Web Connector. 


    public class WCWebService : System.Web.Services.WebService
    {
        ...

        #region WebMethods
        [WebMethod]
        /// <summary>
        /// WebMethod - authenticate()
        /// To verify username and password for the web connector that is trying to connect
        /// Signature: public string[] authenticate(string strUserName, string strPassword)
        /// 
        /// IN: 
        /// string strUserName 
        /// string strPassword
        ///
        /// OUT: 
        /// string[] authReturn
        /// Possible values: 
        /// string[0] = ticket
        /// string[1]
        /// - empty string = use current company file
        /// - "none" = no further request/no further action required
        /// - "nvu" = not valid user
        /// - any other string value = use this company file
        /// </summary>
        public string[] authenticate(string strUserName, string strPassword)
        {
            string[] authReturn = new string[2];

            // Code below uses a random GUID to use as session ticket
            // An example of a GUID is {85B41BEE-5CD9-427a-A61B-83964F1EB426}
            authReturn[0]= System.Guid.NewGuid().ToString();

            // For simplicity of sample, a hardcoded username/password is used.
            // In real world, you should handle authentication in using a standard way. 
            // For example, you could validate the username/password against an LDAP 
            // or a directory server
            string pwd="password";

            if (strUserName.Trim().Equals("username") && strPassword.Trim().Equals(pwd))
            {
                // An empty string for authReturn[1] means asking QBWebConnector 
                // to connect to the company file that is currently openned in QB
                authReturn[1]="";
            }
            else
            {
                authReturn[1]="nvu";
            }

            // You could also return "none" to indicate there is no work to do
            // or a company filename in the format C:\full\path\to\company.qbw
            // based on your program logic and requirements.
            return authReturn;
        }

        [ WebMethod(Description="This web method facilitates web service to send request XML to QuickBooks via QBWebConnector",EnableSession=true) ]
        /// <summary>
        /// WebMethod - sendRequestXML()
        /// Signature: public string sendRequestXML(string ticket, string strHCPResponse, string strCompanyFileName, 
        /// string Country, int qbXMLMajorVers, int qbXMLMinorVers)
        /// 
        /// IN: 
        /// int qbXMLMajorVers
        /// int qbXMLMinorVers
        /// string ticket
        /// string strHCPResponse 
        /// string strCompanyFileName 
        /// string Country
        /// int qbXMLMajorVers
        /// int qbXMLMinorVers
        ///
        /// OUT:
        /// string request
        /// Possible values: 
        /// - “any_string” = Request XML for QBWebConnector to process
        /// - "" = No more request XML 
        /// </summary>
        public string sendRequestXML(string ticket, string strHCPResponse, string strCompanyFileName, 
            string qbXMLCountry, int qbXMLMajorVers, int qbXMLMinorVers)
        {
            ... build some qbXML request here and return it ...

            return request;
        }



        [ WebMethod(Description="This web method facilitates web service to receive response XML from QuickBooks via QBWebConnector",EnableSession=true) ]
        /// <summary>
        /// WebMethod - receiveResponseXML()
        /// Signature: public int receiveResponseXML(string ticket, string response, string hresult, string message)
        /// 
        /// IN: 
        /// string ticket
        /// string response
        /// string hresult
        /// string message
        ///
        /// OUT: 
        /// int retVal
        /// Greater than zero  = There are more request to send
        /// 100 = Done. no more request to send
        /// Less than zero  = Custom Error codes
        /// </summary>
        public int receiveResponseXML(string ticket, string response, string hresult, string message)
        {
            ... process the response from QuickBooks here, and return an integer ... 

            return retVal;
        }
        #endregion

    } // class: WCWebService
} // namespace: WCWebService

QuickBooks SDK还包含 98页Web连接器文档PDF ,详细描述了实现,以及600页可能有用的一般QuickBooks SDK文档。