Skip to content

Commit

Permalink
Se agrega organizacion padre en Reportes Detalle de Retenciones y
Browse files Browse the repository at this point in the history
Retenciones Generadas
  • Loading branch information
carlosaparadam committed Jan 17, 2025
1 parent 0237d46 commit 07c6385
Show file tree
Hide file tree
Showing 4 changed files with 1,098 additions and 8 deletions.
16 changes: 11 additions & 5 deletions db/ddlutils/postgresql/views/LVE_RV_Withholding.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ SELECT
w.C_Currency_ID,
w.PricePrecision,
ROUND(w.TaxLineTotal * w.CurrencyRate,w.PricePrecision) TaxLineTotal,
w.DateDoc
w.DateDoc,
w.Parent_Org_ID
FROM (
SELECT
whDoc.AD_Client_ID,
Expand Down Expand Up @@ -98,10 +99,12 @@ FROM (
wh.C_ConversionType_ID,
wh.C_Currency_ID,
it.TaxLineTotal,
whDoc.DateAcct DateDoc
whDoc.DateAcct DateDoc,
o.Parent_Org_ID
FROM C_Invoice whDoc
INNER JOIN C_InvoiceLine whDocLine ON (whDoc.C_Invoice_ID = whDocLine.C_Invoice_ID)
INNER JOIN C_BPartner bp ON (whDoc.C_BPartner_ID = bp.C_BPartner_ID)
INNER JOIN AD_Org o ON (whDoc.AD_Org_ID = o.AD_Org_ID)
INNER JOIN AD_OrgInfo oi ON (whDoc.AD_Org_ID = oi.AD_Org_ID)
INNER JOIN WH_Withholding wh ON (wh.C_Invoice_ID = whDoc.C_Invoice_ID AND wh.C_InvoiceLine_ID = whDocLine.C_InvoiceLine_ID)
INNER JOIN WH_Setting whs ON (wh.WH_Setting_ID = whs.WH_Setting_ID)
Expand Down Expand Up @@ -180,7 +183,8 @@ w.AD_Client_ID,
w.C_Currency_ID,
w.PricePrecision,
ROUND(w.TaxLineTotal * w.CurrencyRate,w.PricePrecision) TaxLineTotal,
w.DateAcct DateDoc
w.DateAcct DateDoc,
w.Parent_Org_ID
FROM (
SELECT pr.AD_Client_ID,
pr.AD_Org_ID,
Expand Down Expand Up @@ -228,18 +232,20 @@ FROM (
pr.C_Currency_ID,
cu.StdPrecision AS PricePrecision,
0::NUMERIC(10, 0) AS TaxLineTotal,
pr.DateAcct DateDoc
pr.DateAcct DateDoc,
org.Parent_Org_ID
FROM HR_Process pr
INNER JOIN C_Currency cu ON(cu.C_Currency_ID = pr.C_Currency_ID)
INNER JOIN HR_Movement m ON(m.HR_Process_ID = pr.HR_Process_ID)
INNER JOIN HR_ProcessReportLine prl ON(prl.HR_Concept_ID = m.HR_Concept_ID)
INNER JOIN HR_Concept c ON(c.HR_Concept_ID = m.HR_Concept_ID)
INNER JOIN WH_Type wt ON(wt.HR_ProcessReport_ID = prl.HR_ProcessReport_ID)
INNER JOIN C_BPartner bp ON(bp.C_BPartner_ID = m.C_BPartner_ID)
INNER JOIN AD_Org org ON (org.AD_Org_ID = pr.AD_Org_ID)
INNER JOIN AD_OrgInfo o ON(o.AD_Org_ID = pr.AD_Org_ID)
WHERE wt.WH_Type_ID IS NOT NULL
AND pr.DocStatus IN('CO', 'CL')
GROUP BY pr.AD_Client_ID, pr.AD_Org_ID, pr.DocumentNo, pr.DateAcct, pr.Name, prl.PrintName, bp.PersonType, bp.TaxID, o.TaxID, wt.WH_Type_ID, pr.C_ConversionType_ID, pr.C_Currency_ID, cu.StdPrecision
GROUP BY pr.AD_Client_ID, pr.AD_Org_ID, pr.DocumentNo, pr.DateAcct, pr.Name, prl.PrintName, bp.PersonType, bp.TaxID, o.TaxID, wt.WH_Type_ID, pr.C_ConversionType_ID, pr.C_Currency_ID, cu.StdPrecision, org.Parent_Org_ID
HAVING SUM(CASE WHEN c.Type <> 'R' THEN m.Amount ELSE 0 END) > 0
) AS w
;
7 changes: 5 additions & 2 deletions db/ddlutils/postgresql/views/LVE_RV_WithholdingGenerated.sql
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ SELECT
ROUND(wh.TaxAmt * wh.CurrencyRate,wh.PricePrecision) TaxAmt,
wh.CurrencyRate,
wh.PricePrecision,
wh.DateAcct
wh.DateAcct,
wh.Parent_Org_ID
FROM
(
SELECT wh.AD_Client_ID,
Expand Down Expand Up @@ -103,7 +104,8 @@ FROM
COALESCE(ot.TaxAmt, it.TaxAmt) TaxAmt,
COALESCE(CurrencyRate(COALESCE(i.C_Currency_ID, o.C_Currency_ID), COALESCE(iw.C_Currency_ID,ash.C_Currency_ID), COALESCE(i.DateAcct, o.DateAcct), COALESCE(i.C_ConversionType_ID, o.C_ConversionType_ID), COALESCE(i.AD_Client_ID, o.AD_Client_ID), COALESCE(i.AD_Org_ID, o.AD_Org_ID)),1) CurrencyRate,
pl.PricePrecision,
COALESCE(o.DateAcct, i.DateAcct) DateAcct
COALESCE(o.DateAcct, i.DateAcct) DateAcct,
org.Parent_Org_ID
FROM
WH_Withholding wh
INNER JOIN AD_ClientInfo ci ON (wh.AD_Client_ID = ci.AD_Client_ID)
Expand All @@ -116,4 +118,5 @@ FROM
LEFT JOIN C_Invoice iw ON (iw.C_Invoice_ID = wh.C_Invoice_ID AND iw.DocStatus NOT IN ('VO','RE'))
LEFT JOIN C_InvoiceLine ilw ON (ilw.C_InvoiceLine_ID = wh.C_InvoiceLine_ID)
LEFT JOIN M_PriceList pl ON (pl.M_PriceList_ID = COALESCE(i.M_PriceList_ID,o.M_PriceList_ID))
LEFT JOIN AD_Org org ON (org.AD_Org_ID = COALESCE(i.AD_Org_ID, o.AD_Org_ID))
) AS wh;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Migrations>
<Migration EntityType="D" Name="Se agrega fecha contable de Retencion Generada" ReleaseNo="1.0" SeqNo="81001170">
<Migration EntityType="LVE" Name="Se agrega fecha contable de Retencion Generada" ReleaseNo="1.0" SeqNo="81001170">
<Comments>"</Comments>
<Step SeqNo="10" StepType="AD">
<PO AD_Table_ID="285" Action="I" Record_ID="59215" Table="AD_Process_Para">
Expand Down
Loading

0 comments on commit 07c6385

Please sign in to comment.