Skip to content
Light
English

Importing orders through the Integrator

In version 3.3 of the Synchronizer, it is possible to import ERP orders through scripts created in the Integrator. Below is a step-by-step guide on how the functionality is implemented. First, you need to create the script for the two tables separately. A script for table 16 - REQUEST and a script for table 17 - ITEMPEIDO. Attached are example scripts:

SELECT ‘16’ as ID,

“ as RequestIdentifier,

“ as NumberOrder,

“ the Payment Form,

“ the Payment Conditions,

“ as StatusOrder,

“ as CodeFilial,

“ as CodigoCliente,

“ the CNPJClient,

“ as ListPrice,

“ as CodeSeller,

“ as CodePortador,

“ as NumberOrder,

“ as SequentialSeller,

“ as NumeroOrdemPra,

“ as DateTimeIssuance,

“ as ValorProdutosComAcrescimoOUDescontoUnitario,

“ as ValorProdutosSemAcrescimoORDescontoUnitario,

“ the Order Item Quantity,

“ as DeviceIdentifier,

“ as OeracaoFiscalUtilizadaNoPedido,

“ the Internal Observation,

“ as CampoLivre1,

“ as CampoLivre2,

“ as CampoLivre3,

“ as CodeTypeOrder,

“Delivery Forecast,

“ as CodeVendorIssuer,

“ the Latitude,

“ the Longitude,

“ as OriginRequest,

“ as ValordoFrete,

“ as TotalOrderValue,

“ as Shipping Type,

“ as ValorTotalIPI,

“ as ValorTotalICMSST,

“ as Canceled,

“ the Customer Observations,

“ as TypeDiscount,

“ as PercentageDiscountLevelOrder,

“ as ValueDiscountLevelOrder,

“ as PercentageDiscountInterestConditionPayment,

“InformacaoCapturaGPS,

“ as ValorComissao,

“ as CodigoTransportadora,

“ as CodigoTransportadoraRedespacho,

“ as UniqueIdDeliveryAddress,

“ as Segment,

“ as idERP,

“ the UsedDiscountTable,

“ as CodeTypeDiscount,

“ as TotalValueAdditionalRate,

“ as ValorAbaterBaseCalculoCommission,

“ as NumPedidoPrincipal,

“ as CodigoMixProdutos,

“ as IDUnicoClienteDemander

FROM TABLE_ORDER

SELECT ‘17’ as Identifier,

“ as CodeItemOrder,

“ as CodigoProduto,

“ as OrderCode,

“ as PercentDiscountItem,

“ as PercentIncreaseItem,

“ as ValorTotalProdutosDesconto,

“ as ValorUnitarioSemDesconto,

“ as ValorUnitarioComDesconto,

“ the Quantity of the Product,

“ as OrderIdentifier,

“ the Observations,

“ as ValorTotaldoIPI,

“ as ValorTotalICMSST,

“ as TotalItemValueWithTaxes,

“ as ValorUnitarioComTaxes,

“ as ProratedDiscountValue,

“ as ValorTotalProdutosSemRateio,

“ as ValorUnitarioVendaSemRateio,

“ the Quantity Canceled,

“ the Invoiced Quantity,

“ as ValorFlexMovimented,

“ as ValueProductsWithoutDiscountAdditionConditionPayment,

“ as NumOfFixedPriceOptionUsed,

“ as DataTimeInsercaoItemAoPedido,

“ as PercentageCommission,

“ as ValorComissao,

“ the QuantityPerPackage,

“ the UsedDiscount table,

“ as ValorUnitarioDaListaPrico,

“ as ValueAdditionalRate,

“ asValueAbaterdaBasedeCalculoCommission,

“Commission Percentage discounting Bonuses

FROM TABELA_ITEMPEDIDO

With the scripts correctly configured, it is possible to generate the file. Example:

3.10

17|45155286|2645|300057|0.0|0.0|59.6|29.8|29.8|2.0|2373352||||59.6|29.8||59.6|29.8||||59.6||||||||||| 17|45155287|454|300057|0.0|0.0|95.6|47.8|47.8|2.0|2373352||||95.6|47.8||95.6|47.8||||95.6||||||||||| 17 | 45155288 17|45155289|689|300057|0.0|0.0|7.96|3.98|3.98|2.0|2373352||||7.96|3.98||7.96|3.98||||7.96||||||||||| 17 | 17|45155291|2645|300058|0.0|0.0|59.6|29.8|29.8|2.0|2373353||||59.6|29.8||59.6|29.8||||59.6||||||||||| 17|45155292|454|300058|0.0|0.0|95.6|47.8|47.8|2.0|2373353||||95.6|47.8||95.6|47.8||||95.6||||||||||| 17 |45155293 17|45155294|689|300058|0.0|0.0|7.96|3.98|3.98|2.0|2373353||||7.96|3.98||7.96|3.98||||7.96|||||||||||16|2373352|300057||58||1|73|056.518.729-57|3|3||300057|||2017-11-23 12:00:00|276.24|276.24|5|||||||1|||||1|35623.00|35899.24|1|||0||||||||||||||||||| 16|2373353|300058||46||1|1090|038.642.377-69|3|3||300058|||2017-11-23 12:00:00|191.12|191.12|4|||||||1|||||1|21321.00|21512.12|2|||0|||||||||||||||||||

As when importing into Demander, each Order must come with its respective items, the example above will cause an error in the import. To prevent this problem from happening, the following rule was created:

In the ORDER table script, it is essential to set the OrderIdentifier field with a unique number. In the ITEMPEDIC table script, it is also necessary to set the field OrderIdentifier with the same unique number set in the corresponding order. Note: It is not necessary to set this field with the idPedido generated by Demander. With the fields filled in correctly, the Synchronizer will read this file and organize the Order by placing its items below. Example:

01|3.7|

16|2373352|300057||58||1|73|056.518.729-57|3|3||300057|||2017-11-23 12:00:00|276.24|276.24|5|||||||1|||||1|35623.00|35899.24|1|||0||||||||||||||||||| 17|45155286|2645|300057|0.0|0.0|59.6|29.8|29.8|2.0|2373352||||59.6|29.8||59.6|29.8||||59.6|||||||||| 17|45155287|454|300057|0.0|0.0|95.6|47.8|47.8|2.0|2373352||||95.6|47.8||95.6|47.8||||95.6|||||||||| 17 |45155288 | 17|45155289|689|300057|0.0|0.0|7.96|3.98|3.98|2.0|2373352||||7.96|3.98||7.96|3.98||||7.96||||||||||| 17 |

16|2373353|300058||46||1|1090|038.642.377-69|3|3||300058|||2017-11-23 12:00:00|191.12|191.12|4|||||||1|||||1|21321.00|21512.12|2|||0||||||||||||||||||| 17|45155291|2645|300058|0.0|0.0|59.6|29.8|29.8|2.0|2373353||||59.6|29.8||59.6|29.8||||59.6|||||||||| 17|45155292|454|300058|0.0|0.0|95.6|47.8|47.8|2.0|2373353||||95.6|47.8||95.6|47.8||||95.6|||||||||| 17 | 45155293 17|45155294|689|300058|0.0|0.0|7.96|3.98|3.98|2.0|2373353||||7.96|3.98||7.96|3.98||||7.96|||||||||||

With the file in this organization, it will be possible to import it.