2013-03-29 2 views
1

Можно ли добавить налог на добавленную стоимость с помощью QBFC?Добавить налог с оборота с использованием QBFC

Пример: продаж Налог на 4% налог

В продаже 10%

можно добавить его легко от Quickbooks, но мне нужен способ, чтобы добавить от внешнего приложения с помощью QBFC.

Любая помощь будет принята с благодарностью.

ответ

1

Вы можете добавить каждый элемент налога в качестве позиции. Удостоверьтесь, что вы выставили счет-фактуру на налог 0, поэтому налог не рассчитывается сверх налога.

Вы бы позиции налога с продаж и другие позиции налога с продаж B.

1

Вы можете найти хороший пример в On Screen Reference.

В верхней части экрана выберите «ItemSalesTaxAdd» в раскрывающемся меню «Выбрать сообщение». Оттуда нажмите на вкладку C#, и вы увидите следующий пример кода:

//The following sample code is generated as an illustration of 
//Creating requests and parsing responses ONLY 
//This code is NOT intended to show best practices or ideal code 
//Use at your most careful discretion 

using System; 
using System.Net; 
using System.Drawing; 
using System.Collections; 
using System.ComponentModel; 
using System.Windows.Forms; 
using System.Data; 
using System.IO; 
using Interop.QBFC10; 

namespace com.intuit.idn.samples 
{ 
    public class Sample 
    { 
     public void DoItemSalesTaxAdd() 
     { 
      bool sessionBegun = false; 
      bool connectionOpen = false; 
      QBSessionManager sessionManager = null; 

      try 
      { 
       //Create the session Manager object 
       sessionManager = new QBSessionManager(); 

       //Create the message set request object to hold our request 
       IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US",1,.0); 
       requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue; 

       BuildItemSalesTaxAddRq(requestMsgSet); 

       //Connect to QuickBooks and begin a session 
       sessionManager.OpenConnection("","Sample Code from OSR"); 
       connectionOpen = true; 
       sessionManager.BeginSession("", ENOpenMode.omDontCare); 
       sessionBegun = true; 

       //Send the request and get the response from QuickBooks 
       IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet); 

       //End the session and close the connection to QuickBooks 
       sessionManager.EndSession(); 
       sessionBegun = false; 
       sessionManager.CloseConnection(); 
       connectionOpen = false; 

       WalkItemSalesTaxAddRs(responseMsgSet); 

      } 
      catch (Exception e) 
      { 
       MessageBox.Show(e.Message, "Error"); 
       if (sessionBegun) 
       { 
        sessionManager.EndSession(); 
       } 
       if (connectionOpen) 
       { 
        sessionManager.CloseConnection(); 
       } 
      } 
     } 


     void BuildItemSalesTaxAddRq(IMsgSetRequest requestMsgSet) 
     { 
      IItemSalesTaxAdd ItemSalesTaxAddRq= requestMsgSet.AppendItemSalesTaxAddRq(); 
      //Set field value for Name 
      ItemSalesTaxAddRq.Name.SetValue("ab"); 
      //Set field value for BarCodeValue 
      ItemSalesTaxAddRq.BarCode.BarCodeValue.SetValue("ab"); 
      //Set field value for AssignEvenIfUsed 
      ItemSalesTaxAddRq.BarCode.AssignEvenIfUsed.SetValue(true); 
      //Set field value for AllowOverride 
      ItemSalesTaxAddRq.BarCode.AllowOverride.SetValue(true); 
      //Set field value for IsActive 
      ItemSalesTaxAddRq.IsActive.SetValue(true); 
      //Set field value for ListID 
      ItemSalesTaxAddRq.ClassRef.ListID.SetValue("200000-1011023419"); 
      //Set field value for FullName 
      ItemSalesTaxAddRq.ClassRef.FullName.SetValue("ab"); 
      //Set field value for ItemDesc 
      ItemSalesTaxAddRq.ItemDesc.SetValue("ab"); 
      //Set field value for TaxRate 
      ItemSalesTaxAddRq.TaxRate.SetValue(20.00); 
      //Set field value for ListID 
      ItemSalesTaxAddRq.TaxVendorRef.ListID.SetValue("200000-1011023419"); 
      //Set field value for FullName 
      ItemSalesTaxAddRq.TaxVendorRef.FullName.SetValue("ab"); 
      //Set field value for ExternalGUID 
      ItemSalesTaxAddRq.ExternalGUID.SetValue(Guid.NewGuid().ToString()); 
      //Set field value for IncludeRetElementList 
      //May create more than one of these if needed 
      ItemSalesTaxAddRq.IncludeRetElementList.Add("ab"); 
     } 


     void WalkItemSalesTaxAddRs(IMsgSetResponse responseMsgSet) 
     { 
      if (responseMsgSet == null) return; 

      IResponseList responseList = responseMsgSet.ResponseList; 
      if (responseList == null) return; 

      //if we sent only one request, there is only one response, we'll walk the list for this sample 
      for (int i=0; i<responseList.Count; i++) 
      { 
       IResponse response = responseList.GetAt(i); 
       //check the status code of the response, 0=ok, >0 is warning 
       if (response.StatusCode >= 0) 
       { 
        //the request-specific response is in the details, make sure we have some 
        if (response.Detail != null) 
        { 
         //make sure the response is the type we're expecting 
         ENResponseType responseType = (ENResponseType)response.Type.GetValue(); 
         if (responseType == ENResponseType.rtItemSalesTaxAddRs) 
         { 
          //upcast to more specific type here, this is safe because we checked with response.Type check above 
          IItemSalesTaxRet ItemSalesTaxRet = (IItemSalesTaxRet)response.Detail; 
          WalkItemSalesTaxRet(ItemSalesTaxRet); 
         } 
        } 
       } 
      } 
     } 


     void WalkItemSalesTaxRet(IItemSalesTaxRet ItemSalesTaxRet) 
     { 
      if (ItemSalesTaxRet == null) return; 

      //Go through all the elements of IItemSalesTaxRet 
      //Get value of ListID 
      string ListID1 = (string)ItemSalesTaxRet.ListID.GetValue(); 
      //Get value of TimeCreated 
      DateTime TimeCreated2 = (DateTime)ItemSalesTaxRet.TimeCreated.GetValue(); 
      //Get value of TimeModified 
      DateTime TimeModified3 = (DateTime)ItemSalesTaxRet.TimeModified.GetValue(); 
      //Get value of EditSequence 
      string EditSequence4 = (string)ItemSalesTaxRet.EditSequence.GetValue(); 
      //Get value of Name 
      string Name5 = (string)ItemSalesTaxRet.Name.GetValue(); 
      //Get value of BarCodeValue 
      if (ItemSalesTaxRet.BarCodeValue != null) 
      { 
       string BarCodeValue6 = (string)ItemSalesTaxRet.BarCodeValue.GetValue(); 
      } 
      //Get value of IsActive 
      if (ItemSalesTaxRet.IsActive != null) 
      { 
       bool IsActive7 = (bool)ItemSalesTaxRet.IsActive.GetValue(); 
      } 
      if (ItemSalesTaxRet.ClassRef != null) 
      { 
       //Get value of ListID 
       if (ItemSalesTaxRet.ClassRef.ListID != null) 
       { 
        string ListID8 = (string)ItemSalesTaxRet.ClassRef.ListID.GetValue(); 
       } 
       //Get value of FullName 
       if (ItemSalesTaxRet.ClassRef.FullName != null) 
       { 
        string FullName9 = (string)ItemSalesTaxRet.ClassRef.FullName.GetValue(); 
       } 
      } 
      //Get value of ItemDesc 
      if (ItemSalesTaxRet.ItemDesc != null) 
      { 
       string ItemDesc10 = (string)ItemSalesTaxRet.ItemDesc.GetValue(); 
      } 
      //Get value of TaxRate 
      if (ItemSalesTaxRet.TaxRate != null) 
      { 
       double TaxRate11 = (double)ItemSalesTaxRet.TaxRate.GetValue(); 
      } 
      if (ItemSalesTaxRet.TaxVendorRef != null) 
      { 
       //Get value of ListID 
       if (ItemSalesTaxRet.TaxVendorRef.ListID != null) 
       { 
        string ListID12 = (string)ItemSalesTaxRet.TaxVendorRef.ListID.GetValue(); 
       } 
       //Get value of FullName 
       if (ItemSalesTaxRet.TaxVendorRef.FullName != null) 
       { 
        string FullName13 = (string)ItemSalesTaxRet.TaxVendorRef.FullName.GetValue(); 
       } 
      } 
      //Get value of ExternalGUID 
      if (ItemSalesTaxRet.ExternalGUID != null) 
      { 
       string ExternalGUID14 = (string)ItemSalesTaxRet.ExternalGUID.GetValue(); 
      } 
      if (ItemSalesTaxRet.DataExtRetList != null) 
      { 
       for (int i15 = 0; i15 < ItemSalesTaxRet.DataExtRetList.Count; i15++) 
       { 
        IDataExtRet DataExtRet = ItemSalesTaxRet.DataExtRetList.GetAt(i15); 
        //Get value of OwnerID 
        if (DataExtRet.OwnerID != null) 
        { 
         string OwnerID16 = (string)DataExtRet.OwnerID.GetValue(); 
        } 
        //Get value of DataExtName 
        string DataExtName17 = (string)DataExtRet.DataExtName.GetValue(); 
        //Get value of DataExtType 
        ENDataExtType DataExtType18 = (ENDataExtType)DataExtRet.DataExtType.GetValue(); 
        //Get value of DataExtValue 
        string DataExtValue19 = (string)DataExtRet.DataExtValue.GetValue(); 
       } 
      } 
     } 


    } 
} 
Смежные вопросы