Árvore de páginas

01. DADOS GERAIS

Produto:

TOTVS Varejo Lojas

Linha de Produto:

Linha Protheus

Segmento:

Varejo

Módulo:Controle de Lojas (SIGALOJA)
Função:

RmiBusca

País:Brasil
Ticket:Não há
Issue:DVARLOJ1-9717

02. SITUAÇÃO/REQUISITO

Ao realizar o envio de uma venda via API RetailSales, após o processamento do serviço LjGrvBatch os valores de impostos eram calculados novamente de acordo com as regras fisciais do Protheus e não obedecendo os valores informados na API.

03. SOLUÇÃO

Foi ajustado no serviço LjGrvBatch para quando for uma venda oriunda de integração, sejam mantidos os impostos escriturados pela emissão do cupom no sistema de origem. 

Para o correto funcionamento da integração, foi adicionado a seguinte TAG no JSON: Source, o conteudo desta tag sempre deve ser preenchido com "N", pois indica que é uma venda oriunda de integração.

A venda será processada somente se a tag SaleSituation for preenchida com "RX".


04. DEMAIS INFORMAÇÕES

Abaixo o JSON de uma venda com as seguintes os seguintes valores:

DescriçãoValor
Valor Bruto da Venda (Somatória dos itens)768,00 R$

Valor de acréscimo

  13,46 R$
Valor do desconto  96,46 R$
Valor Total da Venda684,90 R$

Importante!

O valor total do acréscimo informado na Tag(IncreaseValue) deve ser rateado no itens da venda através da Tag(IncreaseValueProrated).

Quando for aplicado desconto na venda,  o valor total do desconto informado na Tag(DiscountValue), deve ser rateado no itens da venda através da Tag(DiscountTotalProrated).
a Tag: (IncreaseValue) é formada pela soma Expense+Insurance (L1_DESPESA+L1_SEGURO).

Para gravar o L1_DESPESA enviar o valor na Tag: Expense
Para gravar o L1_SEGURO enviar o valor na Tag: Insurange

Json de exemplo:

Json
{
	"BranchId": "01",
	"SellerCode": "000002",
	"ComissionPercent": 0,
	"ComissionValue": 0,
	"CustomerCode": "109474",
	"CustomerStore": "01",
	"GrossPrice": 684.90,
	"CommodityPrice": 768,	
	"TotalPrice": 671.44,
	"NetPrice": 684.9,
	"DiscountValue": 96.56,
	"IncreaseValue": 15.46,
 	"Expense": 11.46,
 	"Insurance": 4,
	"CashValue": 0,
	"ChecksValue": 684.9,
	"CardsValue": 0,
	"DebitValue": 0,
	"CovenantValue": 0,
	"VouchersValue": 0,
	"FinancedValue": 0,
	"OthersValue": 0,
	"InputValue": 684.9,
	"IssueDateDocument": "2023-08-21T10:59:12",
	"EmisNf": "2023-08-21T10:59:12",
	"DateTime": "2023-08-21T10:59:12",
	"InvoiceMessages": "22808",
	"DocumentCode": "000006319",
	"NumCFis": "000006319",
	"SerieCode": "101",
	"DiscountPercent": 0,
	"OperatorCode": "C02",
	"OperatorInternalId": "C02",
	"CurrencyRate": 0,
	"Change": 0,
	"StationCode": "001",
	"PosSerie": "101",
	"DiscountPaymentTerm": 0,
	"CreditValue": 0,
	"KindOfDocument": "NFCE",
	"CarrierCode": "",
	"CarrierInternalId": "",
	"Md5": "",
	"MovementNumber": "",
	"ElectronicInvoiceComplement": "",
	"PersonalIdentification": "08492742496",
	"PurchaserName": "",
	"DocForeignPurchase": "",
	"IsCanceled": false,
	"StationSalePointCode": "001",
	"SaleType": "V",
	"NfceProtocol": "326230667239721",
	"KeyAcessNFe": "26230802115136000253651010000063199658909894",
	"StateTaxBurden": 0,
	"MunicipalTaxBurden": 0,
	"FederalTaxBurden": 0,
	"TaxSource": "string",
	"FreightValue": 0,
	"TypeOrc": "E",
    "Source":"N",
    "SaleSituation": "RX",
	"IcmsValue": 123.28,
	"IcmsRetBasCalc": 0,
	"IcmsRetValue": 0,
	"IpiValue": 0,
	"IpiBasCalc": 0,
	"IssValue": 0,
	"PisValue": 9.27,
	"CofValue": 42.68,
	"CsllValue": 0,
	"IrrfValue": 0,
	"FecpValue": 0,
	"FecpBasCalc": 0,
	"FecpStBasCalc": 0,
	"FecpStValue": 0,
	"ListOfSaleItem": {
		"SaleItem": [
			{
				"ItemCode": "23062022C",
				"ItemOrder": "01",
				"Quantity": 1,
				"ItemTablePrice": 269,
				"UnitPrice": 269,
				"ItemPrice": 269,
				"WarehouseCode": "01",
				"FreightValueProrated": 0,
				"DiscountAmount": 0,
				"DiscountTotalProrated": 48.28,
				"IncreaseValueProrated": 6.73,
				"ItemSold": "S",
				"SellerItem": "263",
				"OperationCode": "5102",
				"DocumentCode": "000006319",
				"SerieCode": "101",
				"StationCode": "001",
				"IsCanceled": false,
				"ItemDeliveryType": "2",
				"ItemDeliveryDate": "",
				"ItemReserveCode": "013989",
				"ReserveBranch": "01",
				"StoreIdentificationCode": "000001",
				"TaxSituation": "500",
				"CodeTaxSituationIcms": "500",
				"CodeTaxSituationPis": "01",
				"CodeTaxSituationCof": "01",
				"IcmsValue": 50.84,
				"IcmsBasCalc": 282.46,
				"IcmsPercentage": 18,
				"IcmsReductBasPercent": 0,
				"IssValue": 0,
				"IssBasCalc": 0,
				"IssPercentage": 0,
				"IpiValue": 0,
				"IpiBasCalc": 0,
				"IpiPercentage": 0,
				"IcmsRetValue": 0,
				"IcmsRetBasCalc": 0,
				"IcmsRetPercentage": 0,
				"PisValue": 0,
				"PisBasCalc": 0,
				"PisPercentage": 0,
				"PisApurValue": 3.82,
				"PisApurBasCalc": 231.62,
				"PisApurPercentage": 1.65,
				"CofValue": 0,
				"CofBasCalc": 0,
				"CofPercentage": 0,
				"CofApurValue": 17.6,
				"CofApurBasCalc": 231.62,
				"CofApurPercentage": 7.6,
				"CsllValue": 0,
				"CsllBasCalc": 0,
				"CsllPercentage": 0,
				"IrrfValue": 0,
				"IrrfBasCalc": 0,
				"IrrfPercentage": 0,
				"FecpValue": 0,
				"FecpBasCalc": 0,
				"FecpPercentage": 0,
				"FecpStValue": 0,
				"FecpStBasCalc": 0,
				"FecpStPercentage": 0
			},
			{
				"ItemCode": "23062022A",
				"ItemOrder": "02",
				"Quantity": 1,
				"ItemTablePrice": 499,
				"UnitPrice": 499,
				"ItemPrice": 499,
				"WarehouseCode": "01",
				"FreightValueProrated": 0,
				"DiscountAmount": 0,
				"DiscountTotalProrated": 48.28,
				"IncreaseValueProrated": 6.73,
				"ItemSold": "S",
				"SellerItem": "263",
				"OperationCode": "5102",
				"DocumentCode": "000006319",
				"SerieCode": "101",
				"StationCode": "001",
				"IsCanceled": false,
				"ItemDeliveryType": "2",
				"ItemDeliveryDate": "",
				"ItemReserveCode": "013990",
				"ReserveBranch": "01",
				"StoreIdentificationCode": "000001",
				"TaxSituation": "500",
				"CodeTaxSituationIcms": "500",
				"CodeTaxSituationPis": "01",
				"CodeTaxSituationCof": "01",
				"IcmsValue": 72.44,
				"IcmsBasCalc": 402.44,
				"IcmsPercentage": 18,
				"IcmsReductBasPercent": 0,
				"IssValue": 0,
				"IssBasCalc": 0,
				"IssPercentage": 0,
				"IpiValue": 0,
				"IpiBasCalc": 0,
				"IpiPercentage": 0,
				"IcmsRetValue": 0,
				"IcmsRetBasCalc": 0,
				"IcmsRetPercentage": 0,
				"PisValue": 0,
				"PisBasCalc": 0,
				"PisPercentage": 0,
				"PisApurValue": 5.45,
				"PisApurBasCalc": 330,
				"PisApurPercentage": 1.65,
				"CofValue": 0,
				"CofBasCalc": 0,
				"CofPercentage": 0,
				"CofApurValue": 25.08,
				"CofApurBasCalc": 330,
				"CofApurPercentage": 7.6,
				"CsllValue": 0,
				"CsllBasCalc": 0,
				"CsllPercentage": 0,
				"IrrfValue": 0,
				"IrrfBasCalc": 0,
				"IrrfPercentage": 0,
				"FecpValue": 0,
				"FecpBasCalc": 0,
				"FecpPercentage": 0,
				"FecpStValue": 0,
				"FecpStBasCalc": 0,
				"FecpStPercentage": 0
			}
		]
	},
	"ListOfSaleCondition": {
		"SaleCondition": [
			{
				"DateOfPayment": "2024-06-24T10:59:12",
				"PaymentValue": 684.90,
				"PaymentMethodCode": "CC",
				"FinancialManagerCode": "",
				"UniqueSerialNumber": "",
				"EftDate": "2023-08-21T10:59:12",
				"EftAutorization": "",
				"EftInstitute": "",
				"EftDocument": ""
			}
		]
	}
}



05. ASSUNTOS RELACIONADOS