Project

General

Profile

Tareas #4784 » QUERY C TAX XLS.txt

Armando Chuto, 05/08/2024 05:44 PM

 
SELECT
org.Name AS org
, tax.Name AS TasaImppuesto
, taxc.Name As categoriaImpuesto
, tax.ValidFrom as validoDesde
,tax.Rate as valorTasa
,'' as tipoOVOC
,co.name as pais
,'' as LECtaxTypeSRI
, vi.sri_taxcodevalue as ValorImpuesto
,'' as codigoTasa
, coalesce(eviv.Value,'') || ' ' || coalesce(eviv.Name,'') AS eImpuestoVender
, coalesce(evic.Value,'') || ' ' || coalesce(evic.Name,'') AS eImpuestoComprar
, coalesce(evgi.Value,'') || ' ' || coalesce(evgi.Name,'') AS eGastosImpuesto


FROM C_Tax tax
JOIN C_TaxCategory taxc ON taxc.C_TaxCategory_ID=tax.C_TaxCategory_ID
JOIN C_Tax_Acct taxa ON taxa.C_Tax_ID=tax.C_Tax_ID AND taxa.isactive='Y'
JOIN C_ValidCombination vciv ON vciv.C_ValidCombination_ID=taxa.t_due_acct /*eImpuestoVender*/
JOIN C_ElementValue eviv ON eviv.C_ElementValue_ID=vciv.account_id
JOIN C_ValidCombination vcic ON vcic.C_ValidCombination_ID=taxa.t_credit_acct /*eImpuestoComprar*/
JOIN C_ElementValue evic ON evic.C_ElementValue_ID=vcic.account_id
JOIN C_ValidCombination vcgi ON vcgi.C_ValidCombination_ID=taxa.t_expense_acct /*eGastosImpuesto*/
JOIN C_ElementValue evgi ON evgi.C_ElementValue_ID=vcgi.account_id
JOIN AD_Org org ON org.AD_Org_ID=tax.AD_Org_ID
JOIN C_Country co on co.C_Country_ID=tax.C_Country_ID
JOIN SRI_TaxCode vi on vi.SRI_TaxCode_ID=tax.SRI_TaxCode_ID

WHERE tax.AD_Client_ID=1000000 --$P{AD_Client_ID}
AND tax.isactive='Y'
ORDER BY categoriaImpuesto, TasaImppuesto
(4-4/6)