397 lines
9.5 KiB
TypeScript
397 lines
9.5 KiB
TypeScript
import { gql } from '@apollo/client';
|
|
import { currentISODate } from 'core/tools/date';
|
|
import { IQueryToCRMGQL } from 'core/types/Calculation/Requests';
|
|
|
|
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
|
|
$fuelcard_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
|
|
evo_id
|
|
}
|
|
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
|
|
evo_fias_id
|
|
evo_businessunit_evolution
|
|
evo_oktmo
|
|
evo_kladr_id
|
|
}
|
|
selectLegalClientRegion: evo_regions(statecode: $statecode) {
|
|
evo_name
|
|
evo_regionid
|
|
evo_fias_id
|
|
evo_businessunit_evolution
|
|
evo_oktmo
|
|
evo_kladr_id
|
|
}
|
|
selectAccount: accounts(
|
|
evo_account_type: $account_account_type
|
|
statecode: $statecode
|
|
) {
|
|
name
|
|
accountid
|
|
evo_client_riskid
|
|
}
|
|
selectBrand: evo_brands(statecode: $statecode) {
|
|
evo_id
|
|
evo_name
|
|
evo_brandid
|
|
evo_brand_owner
|
|
evo_importer_reward_perc
|
|
evo_importer_reward_rub
|
|
evo_vehicle_type
|
|
}
|
|
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
|
|
evo_towtruck
|
|
evo_pts_type
|
|
evo_description
|
|
evo_gibdd_region
|
|
evo_whom_register
|
|
}
|
|
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
|
|
}
|
|
evo_delivery_time
|
|
}
|
|
selectRate: evo_rates(
|
|
statecode: $statecode
|
|
evo_datefrom_param: { lte: $currentDate }
|
|
evo_dateto_param: { gte: $currentDate }
|
|
) {
|
|
createdon
|
|
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
|
|
}
|
|
evo_credit_period
|
|
}
|
|
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
|
|
evo_category
|
|
evo_category_tr
|
|
evo_vehicle_type_tax
|
|
evo_vehicle_type
|
|
}
|
|
selectObjectRegionRegistration: evo_regions(statecode: $statecode) {
|
|
evo_name
|
|
evo_regionid
|
|
evo_fias_id
|
|
evo_businessunit_evolution
|
|
evo_oktmo
|
|
accounts {
|
|
accountid
|
|
}
|
|
}
|
|
selectSubsidy: evo_subsidies(
|
|
statecode: $statecode
|
|
evo_datefrom_param: { lte: $currentDate }
|
|
evo_dateto_param: { gte: $currentDate }
|
|
) {
|
|
evo_name
|
|
evo_subsidyid
|
|
evo_percent_subsidy
|
|
evo_subsidy_summ
|
|
evo_max_subsidy_summ
|
|
evo_get_subsidy_payment
|
|
evo_brands {
|
|
evo_brandid
|
|
}
|
|
evo_models {
|
|
evo_modelid
|
|
}
|
|
evo_leasingobject_types {
|
|
evo_leasingobject_typeid
|
|
}
|
|
accounts {
|
|
accountid
|
|
}
|
|
}
|
|
selectFuelCard: evo_addproduct_types(
|
|
statecode: $statecode
|
|
evo_product_type: $fuelcard_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
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
const variables = {
|
|
currentDate: currentISODate,
|
|
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,
|
|
fuelcard_product_type: 100000005,
|
|
};
|
|
|
|
const toOptions = [
|
|
'selectSupplier',
|
|
'selectSupplierCurrency',
|
|
'selectClientRisk',
|
|
'selectClientType',
|
|
'selectDealer',
|
|
'selectGPSBrand',
|
|
'selectRegionRegistration',
|
|
'selectAccount',
|
|
'selectBrand',
|
|
'selectProduct',
|
|
'selectRegistration',
|
|
'selectInsNSIB',
|
|
'selectTracker',
|
|
'selectTelematic',
|
|
'selectTechnicalCard',
|
|
'selectTarif',
|
|
'selectRate',
|
|
'selectLeaseObjectType',
|
|
'selectObjectRegionRegistration',
|
|
'selectLegalClientRegion',
|
|
'selectSubsidy',
|
|
'selectFuelCard',
|
|
];
|
|
|
|
export default {
|
|
query,
|
|
variables,
|
|
toOptions,
|
|
} as IQueryToCRMGQL;
|