My Products
Help
kashyap
PARTNER

How to get product vat percentage

by kashyap

While creating product we select VAT and accoutning group. 

We need to know VAT%, while fetching same product using Graph-QL API. 

3 REPLIES 3
omelhus
PARTNER

by omelhus
query WithVatRate($cid: Int!, $accountSet: Int = 0) {
  useCompany(no: $cid) {
    companyInformation {
      items {
        defaultAccountSet @export(as: "accountSet")
      }
    }
    product(
      first: 50
      after: ""
      filter: {_and: [{changedDateTime: {_gte: "2023-04-20T12:12:00"}}]}
    ) {
      items {
        productNo
        description
        productType1
        productPriceGroup1
        changedDateAsDate
        changedTimeAsTime
        productPriceGroup2
        quantityPerUnit
        productCategoryNo1
        productCategoryNo2
        taxAndAccountingGroup: joinup_TaxAndAccountingGroup_via_TaxAndAccGroup {
          taxAndAccountingInformation: joindown_TaxAndAccountingInformation_via_TaxAndAccGroup(
            filter: {accountSet: {_eq: $accountSet}}
          ) {
            items {
              taxCode: joinup_TaxCode_via_TaxCodeSales {
                vat: joinup_Vat {
                  rate
                }
              }
            }
          }
        }
        joinup_ProductCategory_via_ProductCategory1 {
          productCategoryNo
          description
        }
      }
      totalCount
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
    }
  }
}
omelhus
PARTNER

by omelhus

if it’s only vat rate you are after you can find it in vat. Order by after date and filter for valid ones. If afterdate is set and passed use newrate, else rate.

useCompany(no: 123){

vat {
vatNo # VatNo
rate # Rt
fromDate # AfterDt
newRate # NewRt

}
}

 

If you need customer specific prices, or vat rate for that matter, I’ve created an extension on for the bnxt api that adds customerPrice as a property on product. You can test the extension by swapping the endpoint url to https://api.vbnxt.rocks/graphql, and if you grant isv_onit_vbnxt_service access to your bnxt client you will get customer prices available within 5 minutes.

kashyap
PARTNER

by kashyap

 

We need Vat rate% in the below product query. We only able to get taxAndAccountingGroup which may be MVA code.

 

 

QUERY

{
  useCompany(no: xxxxxx) {
    product(
      first: 50
      after: ""
      filter: {_and: [{changedDateTime: {_gte: "2023-04-20T12:12:00"}}]}
    ) {
      items {
        productNo
        description
        taxAndAccountingGroup
        productType1
        productPriceGroup1
        changedDateAsDate
        changedTimeAsTime
        productPriceGroup2
        quantityPerUnit
        productCategoryNo1
        productCategoryNo2
        joinup_TaxAndAccountingGroup_via_TaxAndAccGroup {
          description
          taxAndAccountingGroupNo
        }
        joinup_ProductCategory_via_ProductCategory1 {
          productCategoryNo
          description
        }
      }
      totalCount
      pageInfo {
        hasNextPage
        hasPreviousPage
        startCursor
        endCursor
      }
    }
  }
}

 

{
  "data": {
    "useCompany": {
      "product": {
        "items": [
          {
            "productNo": "04052023",
            "description": "TestProduct-Parth",
            "taxAndAccountingGroup": 3,
            "productType1": 0,
            "productPriceGroup1": 0,
            "changedDateAsDate": "2023-05-04",
            "changedTimeAsTime": "09:49",
            "productPriceGroup2": 0,
            "quantityPerUnit": 100,
            "productCategoryNo1": 1,
            "productCategoryNo2": 2,
            "joinup_TaxAndAccountingGroup_via_TaxAndAccGroup": {
              "description": "Handelsvarer over lager",
              "taxAndAccountingGroupNo": 3
            },
            "joinup_ProductCategory_via_ProductCategory1": {
              "productCategoryNo": 1,
              "description": "Test-Category"
            }
          },
          {
            "productNo": "101",
            "description": "Titleist Vokey Wedge",
            "taxAndAccountingGroup": 23,
            "productType1": 0,
            "productPriceGroup1": 1,
            "changedDateAsDate": "2023-07-14",
            "changedTimeAsTime": "11:42",
            "productPriceGroup2": 0,
            "quantityPerUnit": 0,
            "productCategoryNo1": 0,
            "productCategoryNo2": 0,
            "joinup_TaxAndAccountingGroup_via_TaxAndAccGroup": {
              "description": "Medlemskontingent",
              "taxAndAccountingGroupNo": 23
            },
            "joinup_ProductCategory_via_ProductCategory1": null
          }
        ]
      }
    }
  }
}

 

 

Sample response