_costsSet

Modifies details of Quote costs.

Parameters

id

The ID of the Quote.

costs

JSON values containing the new cost values. See the example for more details.

Example

$costs = ['stock' => [
           ['sid' => 1,
            'amt' => 10,
            'cost' => 100,
            'price' => 50,
            'tax' => 20,
            'gross' => 60],
           ['sid' => 9,
            'amt' => 5,
            'cost' => 15,
            'price' => 25,
            'tax' => 15,
            'gross' => 28.75],
           ['sid' => 10,
            'amt' => 20,
            'cost' => 5,
            'price' => 10,
            'tax' => 25,
            'gross' => 12.5]
          ],
          'total_cost' => 12430,
          'other' => [
            ['description' => 'Other Thing One',
             'amt' => 50,
             'cost' => 200,
             'price' => 100,
             'tax' => 20,
             'gross' => 120],
            ['description' => 'Other Thing Two',
             'amt' => 100,
             'cost' => 5,
             'price' => 250,
             'tax' => 30,
             'gross' => 325]
          ],
          'verbose' => [
            ['summary' => 'First summary.',
             'verbose_descr' => 'First description.',
             'net_price' => '500',
             'gross' => 600],
            ['summary' => 'Second summary.',
            'verbose_descr' => 'Second description.',
            'net_price' => '250',
            'gross' => 300]
          ],
          'stock_total_cost' => 1175,
          'stock_total_price' => 825,
          'stock_total_gross' => 993.75,
          'sor' => [
            ['sid' => 1,
             'amt' => 1,
             'cost' => 5,
             'tax' => 20,
             'price' => 6]
            ],
          'sor_total_cost' => 5,
          'sor_total_price' => 6,
          'other_total_cost' => 10500,
          'other_total_price' => 30000,
          'other_total_gross' => 38500,
          'verbose_total_cost' => 750,
          'verbose_total_price' => 750,
          'verbose_total_gross' => 900];
FM_api('Quote_costsSet', ['id' => '1', 'costs' => json_encode($costs));

Result

On Success

{'ok':1}

On Failure

If the User is not logged in: {'error':'not logged in'}

If no ID is supplied: {'error':'no id'}

If the specified Quote does not exist: {'error':'no such quote'}

Last updated