QuicksBooks导入物品和发票

hig*_*ers 0 quickbooks

我有QuickBooks 2010专业版,因为标题建议我需要将产品和发票导入Quickbooks.

一些背景......

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

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

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

谢谢

Kei*_*Jr. 6

如果您不愿意查看QuickBooks SDK,那么您自己会受到很大的伤害.

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

基本协议如下所示:

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

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

// Web连接器将请求转发给QuickBooks,并从QuickBooks Web Connector => QuickBooks接收响应:嘿QuickBooks,SOAP服务器给了我这个请求,请你处理它吗?QuickBooks处理请求,并返回对Web连接器的响应

// Web连接器将QuickBooks的响应中继回SOAP服务器Web连接器=> 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
Run Code Online (Sandbox Code Playgroud)

这是示例代码中的清理版本:

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
Run Code Online (Sandbox Code Playgroud)

QuickBooks SDK还包含一个98页的Web连接器文档PDF,它详细描述了实现,以及600页的一般QuickBooks SDK文档,可能会有所帮助.