AnsweredAssumed Answered

How to create tax rate relationship in Quotes module to be used in reports

Question asked by Brett Zufelt on Nov 20, 2015

The Quotes database table has a taxrate_id field but there doesn't appear to be a vardef for the relationship between the quotes and taxrates tables. I want to be able to be able to use the related tax rate record in reports but Tax Rates does not show as a Related Module in the Report Wizard under the Quotes module. I have tried creating my own custom vardef definition for the relationship to get it to show up in the Report Wizard as a Related Module but have had no luck.

 

Here is the contents of my vardef file which I placed at custom/Extension/modules/Quotes/Ext/Vardefs/cstm_taxrates_relationship.php

 

$dictionary['Quote']['fields']['taxrate_name_c'] = array (

      'name' => 'taxrate_name_c',

      'vname' => 'LBL_TAXRATE_NAME',

      'type' => 'relate',

      'reportable' => false,

      'source' => 'non-db',

      'rname' => 'name',

      'table' => 'taxrates',

      'id_name' => 'taxrate_id',

      'module' => 'TaxRates',

      'link' => 'taxrates_link',

      'duplicate_merge' => 'disabled',

      'massupdate' => false,

    );

$dictionary['Quote']['fields']['taxrate_id'] = array (

      'name' => 'taxrate_id',

      'rname' => 'id',

      'id_name' => 'taxrate_id',

      'vname' => 'LBL_TAXRATE_ID',

      'type' => 'id',

      'table' => 'taxrates',

      'isnull' => 'true',

      'dbType' => 'id',

      'reportable' => false,

      'massupdate' => false,

      'module' => 'TaxRates',

      'duplicate_merge' => 'disabled',

    );

$dictionary['Quote']['fields']['taxrates_link'] = array (

      'name' => 'taxrates_link',

      'type' => 'link',

      'relationship' => 'quotes_taxrate_c',

      'vname' => 'LBL_TAXRATES',

      'link_type' => 'one',

      'module' => 'TaxRates',

      'bean_name' => 'TaxRate',

      'source' => 'non-db',

    );

$dictionary['Quote']['relationships']['quotes_taxrate_c'] = array (

      'lhs_module' => 'TaxRates',

      'lhs_table' => 'taxrates',

      'lhs_key' => 'id',

      'rhs_module' => 'Quotes',

      'rhs_table' => 'quotes',

      'rhs_key' => 'taxrate_id',

      'relationship_type' => 'one-to-many',

    );

 

I have run a repair/rebuild and the Tax Rates module still does not show under the Related Modules of the Quotes module in the Report Wizard. What am I missing?

 

Thanks.

Outcomes