Documentation

crm.vat.add

crm.vat.add(fields)

Create new tax rate.

Parameters

Parameter Description
fields Set of fields is an array of the array("field"=>"value"[, ...]) type, containing the values of the tax rate.

Example

 var current = new Date();
 var date2str = function(d)
 {
  return d.getFullYear() + '-' + paddatepart(1 + d.getMonth()) + '-' + paddatepart(d.getDate()) + 'T' + paddatepart(d.getHours())
   + ':' + paddatepart(d.getMinutes()) + ':' + paddatepart(d.getSeconds()) + '+03:00';
 };
 var paddatepart = function(part)
 {
  return part >= 10 ? part.toString() : '0' + part.toString();
 };
 BX24.callMethod(
  "crm.vat.add",
  {
   "FIELDS":
   {
    "TIMESTAMP_X": date2str(current),
    "ACTIVE": "Y",
    "C_SORT": 110,
    "NAME": "VAT 13%",
    "RATE": 13.00
   }
  },
  function(result)
  {
   if(result.error())
    console.error(result.error());
   else
    console.info("New tax rate has been created with ID " + result.data());
  }
 );



© «Bitrix24», 2001-2024