303 lines
7.4 KiB
TypeScript
303 lines
7.4 KiB
TypeScript
import { currentDate } from 'client/tools/date';
|
|
import { IQueryToCRMGQL } from 'core/types/Calculation/Requests';
|
|
import { gql } from '@apollo/client';
|
|
|
|
const query = gql`
|
|
query(
|
|
$statecode: Int
|
|
$currentDate: DateTime
|
|
$supplier_account_type: [Int!]
|
|
$supplier_legal_form: Int
|
|
$dealer_account_type: [Int!]
|
|
$dealer_legal_form: Int
|
|
$account_account_type: [Int!]
|
|
$product_relation: [Int!]
|
|
$registration_product_type: Int
|
|
$nsib_product_type: Int
|
|
$tracker_product_type: Int
|
|
$telematic_product_type: Int
|
|
$techcard_product_type: Int
|
|
) {
|
|
selectSupplier: accounts(
|
|
evo_account_type: $supplier_account_type
|
|
statecode: $statecode
|
|
evo_legal_form: $supplier_legal_form
|
|
) {
|
|
name
|
|
accountid
|
|
evo_fin_department_accountid
|
|
}
|
|
selectSupplierCurrency: transactioncurrencies(statecode: $statecode) {
|
|
transactioncurrencyid
|
|
isocurrencycode
|
|
}
|
|
selectClientRisk: evo_client_risks(statecode: $statecode) {
|
|
evo_name
|
|
evo_client_riskid
|
|
}
|
|
selectClientType: evo_client_types(statecode: $statecode) {
|
|
evo_name
|
|
evo_client_typeid
|
|
}
|
|
selectDealer: accounts(
|
|
evo_account_type: $dealer_account_type
|
|
statecode: $statecode
|
|
evo_legal_form: $dealer_legal_form
|
|
) {
|
|
name
|
|
accountid
|
|
}
|
|
selectGPSBrand: evo_gps_brands(statecode: $statecode) {
|
|
evo_name
|
|
evo_gps_brandid
|
|
}
|
|
selectRegionRegistration: evo_regions(statecode: $statecode) {
|
|
evo_name
|
|
evo_regionid
|
|
}
|
|
selectAccount: accounts(
|
|
evo_account_type: $account_account_type
|
|
statecode: $statecode
|
|
) {
|
|
name
|
|
accountid
|
|
evo_client_riskid
|
|
}
|
|
selectBrand: evo_brands(statecode: $statecode) {
|
|
evo_name
|
|
evo_brandid
|
|
evo_importer_reward_perc
|
|
evo_importer_reward_rub
|
|
}
|
|
selectProduct: evo_baseproducts(
|
|
statecode: $statecode
|
|
evo_relation: $product_relation
|
|
evo_datefrom_param: { lte: $currentDate }
|
|
evo_dateto_param: { gte: $currentDate }
|
|
) {
|
|
evo_name
|
|
evo_baseproductid
|
|
evo_id
|
|
evo_leasingobject_types {
|
|
evo_name
|
|
evo_leasingobject_typeid
|
|
evo_id
|
|
}
|
|
evo_brands {
|
|
evo_name
|
|
evo_brandid
|
|
}
|
|
}
|
|
selectRegistration: evo_addproduct_types(
|
|
statecode: $statecode
|
|
evo_product_type: $registration_product_type
|
|
evo_datefrom_param: { lte: $currentDate }
|
|
evo_dateto_param: { gte: $currentDate }
|
|
) {
|
|
evo_id
|
|
evo_name
|
|
evo_addproduct_typeid
|
|
evo_accountid
|
|
evo_graph_price_withoutnds
|
|
evo_cost_service_provider_withoutnds
|
|
evo_retro_bonus_withoutnds
|
|
evo_prime_cost
|
|
evo_graph_price
|
|
evo_max_period
|
|
evo_min_period
|
|
evo_controls_program
|
|
}
|
|
selectInsNSIB: evo_addproduct_types(
|
|
statecode: $statecode
|
|
evo_product_type: $nsib_product_type
|
|
evo_datefrom_param: { lte: $currentDate }
|
|
evo_dateto_param: { gte: $currentDate }
|
|
) {
|
|
evo_id
|
|
evo_name
|
|
evo_addproduct_typeid
|
|
evo_accountid
|
|
evo_graph_price_withoutnds
|
|
evo_cost_service_provider_withoutnds
|
|
evo_retro_bonus_withoutnds
|
|
evo_prime_cost
|
|
evo_graph_price
|
|
evo_max_period
|
|
evo_min_period
|
|
evo_controls_program
|
|
}
|
|
selectTracker: evo_addproduct_types(
|
|
statecode: $statecode
|
|
evo_product_type: $tracker_product_type
|
|
evo_datefrom_param: { lte: $currentDate }
|
|
evo_dateto_param: { gte: $currentDate }
|
|
) {
|
|
evo_id
|
|
evo_name
|
|
evo_addproduct_typeid
|
|
evo_accountid
|
|
evo_graph_price_withoutnds
|
|
evo_cost_service_provider_withoutnds
|
|
evo_retro_bonus_withoutnds
|
|
evo_prime_cost
|
|
evo_graph_price
|
|
evo_max_period
|
|
evo_min_period
|
|
evo_controls_program
|
|
evo_planpayments {
|
|
evo_name
|
|
evo_cost_equipment_withoutnds
|
|
evo_cost_price_telematics_withoutnds
|
|
evo_cost_telematics_withoutnds
|
|
}
|
|
}
|
|
selectTelematic: evo_addproduct_types(
|
|
statecode: $statecode
|
|
evo_product_type: $telematic_product_type
|
|
evo_datefrom_param: { lte: $currentDate }
|
|
evo_dateto_param: { gte: $currentDate }
|
|
) {
|
|
evo_id
|
|
evo_name
|
|
evo_addproduct_typeid
|
|
evo_accountid
|
|
evo_graph_price_withoutnds
|
|
evo_cost_service_provider_withoutnds
|
|
evo_retro_bonus_withoutnds
|
|
evo_prime_cost
|
|
evo_graph_price
|
|
evo_max_period
|
|
evo_min_period
|
|
evo_controls_program
|
|
evo_planpayments {
|
|
evo_name
|
|
evo_cost_equipment_withoutnds
|
|
evo_cost_price_telematics_withoutnds
|
|
evo_cost_telematics_withoutnds
|
|
}
|
|
}
|
|
selectTechnicalCard: evo_addproduct_types(
|
|
statecode: $statecode
|
|
evo_product_type: $techcard_product_type
|
|
evo_datefrom_param: { lte: $currentDate }
|
|
evo_dateto_param: { gte: $currentDate }
|
|
) {
|
|
evo_id
|
|
evo_name
|
|
evo_addproduct_typeid
|
|
evo_accountid
|
|
evo_graph_price_withoutnds
|
|
evo_cost_service_provider_withoutnds
|
|
evo_retro_bonus_withoutnds
|
|
evo_prime_cost
|
|
evo_graph_price
|
|
evo_max_period
|
|
evo_min_period
|
|
evo_controls_program
|
|
evo_helpcard_type
|
|
evo_leasingobject_types {
|
|
evo_leasingobject_typeid
|
|
}
|
|
}
|
|
selectTarif: evo_tarifs(
|
|
statecode: $statecode
|
|
evo_datefrom_param: { lte: $currentDate }
|
|
evo_dateto_param: { gte: $currentDate }
|
|
) {
|
|
evo_name
|
|
evo_tarifid
|
|
evo_baseproductid
|
|
evo_irr
|
|
evo_max_irr
|
|
evo_min_profit
|
|
evo_min_irr
|
|
evo_irr_plan
|
|
evo_ins_type
|
|
evo_min_period
|
|
evo_max_period
|
|
evo_client_risks {
|
|
evo_name
|
|
evo_client_riskid
|
|
}
|
|
evo_client_types {
|
|
evo_name
|
|
evo_client_typeid
|
|
}
|
|
evo_leasingobject_types {
|
|
evo_name
|
|
evo_id
|
|
evo_leasingobject_typeid
|
|
}
|
|
}
|
|
selectRate: evo_rates(
|
|
statecode: $statecode # evo_datefrom_param: { lte: $currentDate } # evo_dateto_param: { gte: $currentDate }
|
|
) {
|
|
evo_id
|
|
evo_rateid
|
|
evo_name
|
|
evo_base_rate
|
|
evo_coeff_12_23
|
|
evo_coeff_24_35
|
|
evo_coeff_36_47
|
|
evo_coeff_7_11
|
|
evo_coeff_48_60
|
|
evo_tarifs {
|
|
evo_tarifid
|
|
evo_name
|
|
}
|
|
}
|
|
selectLeaseObjectType: evo_leasingobject_types(statecode: $statecode) {
|
|
evo_name
|
|
evo_id
|
|
evo_leasingobject_typeid
|
|
evo_depreciation_rate1
|
|
evo_depreciation_rate2
|
|
evo_expluatation_period1
|
|
evo_expluatation_period2
|
|
evo_type_code
|
|
}
|
|
}
|
|
`;
|
|
|
|
const variables = {
|
|
currentDate,
|
|
statecode: 0,
|
|
supplier_account_type: [100000001],
|
|
supplier_legal_form: 100000001,
|
|
dealer_account_type: [100000001],
|
|
dealer_legal_form: 100000001,
|
|
account_account_type: [100000000],
|
|
product_relation: [100000000],
|
|
registration_product_type: 100000001,
|
|
nsib_product_type: 100000002,
|
|
tracker_product_type: 100000003,
|
|
telematic_product_type: 100000004,
|
|
techcard_product_type: 100000000,
|
|
};
|
|
|
|
const toOptions = [
|
|
'selectSupplier',
|
|
'selectSupplierCurrency',
|
|
'selectClientRisk',
|
|
'selectClientType',
|
|
'selectDealer',
|
|
'selectGPSBrand',
|
|
'selectRegionRegistration',
|
|
'selectAccount',
|
|
'selectBrand',
|
|
'selectProduct',
|
|
'selectRegistration',
|
|
'selectInsNSIB',
|
|
'selectTracker',
|
|
'selectTechnicalCard',
|
|
'selectTarif',
|
|
'selectRate',
|
|
'selectLeaseObjectType',
|
|
];
|
|
|
|
export default {
|
|
query,
|
|
variables,
|
|
toOptions,
|
|
} as IQueryToCRMGQL;
|