Skip to content

Commit

Permalink
Se agrega conversión a monto de reporte de declaración municipal
Browse files Browse the repository at this point in the history
  • Loading branch information
yamelsenih committed Jul 30, 2020
1 parent 2ce2e0f commit 2cb439f
Show file tree
Hide file tree
Showing 3 changed files with 193 additions and 2 deletions.
3 changes: 2 additions & 1 deletion db/ddlutils/oracle/views/LVE_RV_C_Invoice_Day_Summary.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ SELECT il.AD_Client_ID, il.AD_Org_ID,
MAX(i.DocumentNo) AS EndingDocumentNo,
MIN(i.ControlNo) AS BeginingControlNo,
MAX(i.ControlNo) AS EndingControlNo,
dt.DocBaseType
dt.DocBaseType,
SUM(currencyBase(il.LineNetAmt, i.C_Currency_ID, i.DateAcct, i.AD_Client_ID, i.AD_Org_ID)) AS ConvertedAmt
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON(i.C_Invoice_ID = il.C_Invoice_ID)
INNER JOIN C_DocType dt ON(dt.C_DocType_ID = il.C_DocTypeTarget_ID)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ SELECT il.AD_Client_ID, il.AD_Org_ID,
MAX(i.DocumentNo) AS EndingDocumentNo,
MIN(i.ControlNo) AS BeginingControlNo,
MAX(i.ControlNo) AS EndingControlNo,
dt.DocBaseType
dt.DocBaseType,
SUM(currencyBase(il.LineNetAmt, i.C_Currency_ID, i.DateAcct, i.AD_Client_ID, i.AD_Org_ID)) AS ConvertedAmt
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON(i.C_Invoice_ID = il.C_Invoice_ID)
INNER JOIN C_DocType dt ON(dt.C_DocType_ID = il.C_DocTypeTarget_ID)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Migrations>
<Migration EntityType="LVE" Name="Add Converted Amount for LVE_RV_C_Invoice_Day_Summary view" ReleaseNo="3.9.4" SeqNo="81000520">
<Comments>Add Converted Amount for view of summary amount of invoices</Comments>
<Step DBType="Postgres" Parse="N" SeqNo="10" StepType="SQL">
<SQLStatement>CREATE OR REPLACE VIEW LVE_RV_C_Invoice_Day_Summary
(AD_Client_ID, AD_Org_ID, DateInvoiced, LineNetAmt,
LineListAmt, LineLimitAmt, LineDiscountAmt, LineDiscount, LineOverLimitAmt,
LineOverLimit, IsSOTrx, DocStatus, DocNoSequence_ID, ControlNoSequence_ID, IsFiscalDocument, BeginingDocumentNo, EndingDocumentNo, BeginingControlNo, EndingControlNo, DocBaseType)
AS
SELECT il.AD_Client_ID, il.AD_Org_ID,
firstOf(il.DateInvoiced, 'DD') AS DateInvoiced, -- DD Day, DY Week, MM Month
SUM(il.LineNetAmt) AS LineNetAmt,
SUM(il.LineListAmt) AS LineListAmt,
SUM(il.LineLimitAmt) AS LineLimitAmt,
SUM(il.LineDiscountAmt) AS LineDiscountAmt,
CASE WHEN SUM(il.LineListAmt)=0 THEN 0 ELSE
ROUND((SUM(il.LineListAmt)-SUM(il.LineNetAmt))/SUM(il.LineListAmt)*100,2) END AS LineDiscount,
SUM(il.LineOverLimitAmt) AS LineOverLimitAmt,
CASE WHEN SUM(il.LineNetAmt)=0 THEN 0 ELSE
100-ROUND((SUM(il.LineNetAmt)-SUM(il.LineOverLimitAmt))/SUM(il.LineNetAmt)*100,2) END AS LineOverLimit,
il.IsSOTrx, il.DocStatus, COALESCE(dt.DefiniteSequence_ID, dt.DocNoSequence_ID) AS DocNoSequence_ID, dt.ControlNoSequence_ID,
i.IsFiscalDocument,
MIN(i.DocumentNo) AS BeginingDocumentNo,
MAX(i.DocumentNo) AS EndingDocumentNo,
MIN(i.ControlNo) AS BeginingControlNo,
MAX(i.ControlNo) AS EndingControlNo,
dt.DocBaseType,
SUM(currencyBase(il.LineNetAmt, i.C_Currency_ID, i.DateAcct, i.AD_Client_ID, i.AD_Org_ID)) AS ConvertedAmt
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON(i.C_Invoice_ID = il.C_Invoice_ID)
INNER JOIN C_DocType dt ON(dt.C_DocType_ID = il.C_DocTypeTarget_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, firstOf(il.DateInvoiced, 'DD'), il.IsSOTrx, COALESCE(dt.DefiniteSequence_ID, dt.DocNoSequence_ID), dt.ControlNoSequence_ID, il.DocStatus, i.IsFiscalDocument, dt.DocBaseType;</SQLStatement>
<RollbackStatement>CREATE OR REPLACE VIEW LVE_RV_C_Invoice_Day_Summary
(AD_Client_ID, AD_Org_ID, DateInvoiced, LineNetAmt,
LineListAmt, LineLimitAmt, LineDiscountAmt, LineDiscount, LineOverLimitAmt,
LineOverLimit, IsSOTrx, DocStatus, DocNoSequence_ID, ControlNoSequence_ID, IsFiscalDocument, BeginingDocumentNo, EndingDocumentNo, BeginingControlNo, EndingControlNo, DocBaseType)
AS
SELECT il.AD_Client_ID, il.AD_Org_ID,
firstOf(il.DateInvoiced, 'DD') AS DateInvoiced, -- DD Day, DY Week, MM Month
SUM(il.LineNetAmt) AS LineNetAmt,
SUM(il.LineListAmt) AS LineListAmt,
SUM(il.LineLimitAmt) AS LineLimitAmt,
SUM(il.LineDiscountAmt) AS LineDiscountAmt,
CASE WHEN SUM(il.LineListAmt)=0 THEN 0 ELSE
ROUND((SUM(il.LineListAmt)-SUM(il.LineNetAmt))/SUM(il.LineListAmt)*100,2) END AS LineDiscount,
SUM(il.LineOverLimitAmt) AS LineOverLimitAmt,
CASE WHEN SUM(il.LineNetAmt)=0 THEN 0 ELSE
100-ROUND((SUM(il.LineNetAmt)-SUM(il.LineOverLimitAmt))/SUM(il.LineNetAmt)*100,2) END AS LineOverLimit,
il.IsSOTrx, il.DocStatus, COALESCE(dt.DefiniteSequence_ID, dt.DocNoSequence_ID) AS DocNoSequence_ID, dt.ControlNoSequence_ID,
i.IsFiscalDocument,
MIN(i.DocumentNo) AS BeginingDocumentNo,
MAX(i.DocumentNo) AS EndingDocumentNo,
MIN(i.ControlNo) AS BeginingControlNo,
MAX(i.ControlNo) AS EndingControlNo,
dt.DocBaseType
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON(i.C_Invoice_ID = il.C_Invoice_ID)
INNER JOIN C_DocType dt ON(dt.C_DocType_ID = il.C_DocTypeTarget_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, firstOf(il.DateInvoiced, 'DD'), il.IsSOTrx, COALESCE(dt.DefiniteSequence_ID, dt.DocNoSequence_ID), dt.ControlNoSequence_ID, il.DocStatus, i.IsFiscalDocument, dt.DocBaseType;</RollbackStatement>
</Step>
<Step DBType="Oracle" Parse="N" SeqNo="10" StepType="SQL">
<SQLStatement>CREATE OR REPLACE VIEW LVE_RV_C_Invoice_Day_Summary
(AD_Client_ID, AD_Org_ID, DateInvoiced, LineNetAmt,
LineListAmt, LineLimitAmt, LineDiscountAmt, LineDiscount, LineOverLimitAmt,
LineOverLimit, IsSOTrx, DocStatus, DocNoSequence_ID, ControlNoSequence_ID, IsFiscalDocument, BeginingDocumentNo, EndingDocumentNo, BeginingControlNo, EndingControlNo, DocBaseType)
AS
SELECT il.AD_Client_ID, il.AD_Org_ID,
firstOf(il.DateInvoiced, 'DD') AS DateInvoiced, -- DD Day, DY Week, MM Month
SUM(il.LineNetAmt) AS LineNetAmt,
SUM(il.LineListAmt) AS LineListAmt,
SUM(il.LineLimitAmt) AS LineLimitAmt,
SUM(il.LineDiscountAmt) AS LineDiscountAmt,
CASE WHEN SUM(il.LineListAmt)=0 THEN 0 ELSE
ROUND((SUM(il.LineListAmt)-SUM(il.LineNetAmt))/SUM(il.LineListAmt)*100,2) END AS LineDiscount,
SUM(il.LineOverLimitAmt) AS LineOverLimitAmt,
CASE WHEN SUM(il.LineNetAmt)=0 THEN 0 ELSE
100-ROUND((SUM(il.LineNetAmt)-SUM(il.LineOverLimitAmt))/SUM(il.LineNetAmt)*100,2) END AS LineOverLimit,
il.IsSOTrx, il.DocStatus, COALESCE(dt.DefiniteSequence_ID, dt.DocNoSequence_ID) AS DocNoSequence_ID, dt.ControlNoSequence_ID,
i.IsFiscalDocument,
MIN(i.DocumentNo) AS BeginingDocumentNo,
MAX(i.DocumentNo) AS EndingDocumentNo,
MIN(i.ControlNo) AS BeginingControlNo,
MAX(i.ControlNo) AS EndingControlNo,
dt.DocBaseType,
SUM(currencyBase(il.LineNetAmt, i.C_Currency_ID, i.DateAcct, i.AD_Client_ID, i.AD_Org_ID)) AS ConvertedAmt
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON(i.C_Invoice_ID = il.C_Invoice_ID)
INNER JOIN C_DocType dt ON(dt.C_DocType_ID = il.C_DocTypeTarget_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, firstOf(il.DateInvoiced, 'DD'), il.IsSOTrx, COALESCE(dt.DefiniteSequence_ID, dt.DocNoSequence_ID), dt.ControlNoSequence_ID, il.DocStatus, i.IsFiscalDocument, dt.DocBaseType;</SQLStatement>
<RollbackStatement>CREATE OR REPLACE VIEW LVE_RV_C_Invoice_Day_Summary
(AD_Client_ID, AD_Org_ID, DateInvoiced, LineNetAmt,
LineListAmt, LineLimitAmt, LineDiscountAmt, LineDiscount, LineOverLimitAmt,
LineOverLimit, IsSOTrx, DocStatus, DocNoSequence_ID, ControlNoSequence_ID, IsFiscalDocument, BeginingDocumentNo, EndingDocumentNo, BeginingControlNo, EndingControlNo, DocBaseType)
AS
SELECT il.AD_Client_ID, il.AD_Org_ID,
firstOf(il.DateInvoiced, 'DD') AS DateInvoiced, -- DD Day, DY Week, MM Month
SUM(il.LineNetAmt) AS LineNetAmt,
SUM(il.LineListAmt) AS LineListAmt,
SUM(il.LineLimitAmt) AS LineLimitAmt,
SUM(il.LineDiscountAmt) AS LineDiscountAmt,
CASE WHEN SUM(il.LineListAmt)=0 THEN 0 ELSE
ROUND((SUM(il.LineListAmt)-SUM(il.LineNetAmt))/SUM(il.LineListAmt)*100,2) END AS LineDiscount,
SUM(il.LineOverLimitAmt) AS LineOverLimitAmt,
CASE WHEN SUM(il.LineNetAmt)=0 THEN 0 ELSE
100-ROUND((SUM(il.LineNetAmt)-SUM(il.LineOverLimitAmt))/SUM(il.LineNetAmt)*100,2) END AS LineOverLimit,
il.IsSOTrx, il.DocStatus, COALESCE(dt.DefiniteSequence_ID, dt.DocNoSequence_ID) AS DocNoSequence_ID, dt.ControlNoSequence_ID,
i.IsFiscalDocument,
MIN(i.DocumentNo) AS BeginingDocumentNo,
MAX(i.DocumentNo) AS EndingDocumentNo,
MIN(i.ControlNo) AS BeginingControlNo,
MAX(i.ControlNo) AS EndingControlNo,
dt.DocBaseType
FROM RV_C_InvoiceLine il
INNER JOIN C_Invoice i ON(i.C_Invoice_ID = il.C_Invoice_ID)
INNER JOIN C_DocType dt ON(dt.C_DocType_ID = il.C_DocTypeTarget_ID)
GROUP BY il.AD_Client_ID, il.AD_Org_ID, firstOf(il.DateInvoiced, 'DD'), il.IsSOTrx, COALESCE(dt.DefiniteSequence_ID, dt.DocNoSequence_ID), dt.ControlNoSequence_ID, il.DocStatus, i.IsFiscalDocument, dt.DocBaseType;</RollbackStatement>
</Step>
<Step SeqNo="20" StepType="AD">
<PO AD_Table_ID="101" Action="I" Record_ID="96663" Table="AD_Column">
<Data AD_Column_ID="359" Column="AD_Client_ID">0</Data>
<Data AD_Column_ID="112" Column="Description">Converted Amount</Data>
<Data AD_Column_ID="548" Column="IsActive">true</Data>
<Data AD_Column_ID="90939" Column="AD_Image_ID" isNewNull="true"/>
<Data AD_Column_ID="549" Column="Created">2020-07-30 15:18:43.939</Data>
<Data AD_Column_ID="3388" Column="ValueMin" isNewNull="true"/>
<Data AD_Column_ID="551" Column="Updated">2020-07-30 15:18:43.939</Data>
<Data AD_Column_ID="3389" Column="ValueMax" isNewNull="true"/>
<Data AD_Column_ID="109" Column="AD_Column_ID">96663</Data>
<Data AD_Column_ID="126" Column="IsIdentifier">false</Data>
<Data AD_Column_ID="111" Column="Name">Converted Amount</Data>
<Data AD_Column_ID="124" Column="IsMandatory">false</Data>
<Data AD_Column_ID="125" Column="IsTranslated">false</Data>
<Data AD_Column_ID="117" Column="DefaultValue" isNewNull="true"/>
<Data AD_Column_ID="1179" Column="VFormat" isNewNull="true"/>
<Data AD_Column_ID="120" Column="IsParent">false</Data>
<Data AD_Column_ID="6244" Column="IsSelectionColumn">false</Data>
<Data AD_Column_ID="6483" Column="IsSyncDatabase">N</Data>
<Data AD_Column_ID="119" Column="IsKey">false</Data>
<Data AD_Column_ID="6245" Column="ReadOnlyLogic" isNewNull="true"/>
<Data AD_Column_ID="56352" Column="FormatPattern" isNewNull="true"/>
<Data AD_Column_ID="50218" Column="MandatoryLogic" isNewNull="true"/>
<Data AD_Column_ID="110" Column="Version">0</Data>
<Data AD_Column_ID="13448" Column="ColumnSQL" isNewNull="true"/>
<Data AD_Column_ID="116" Column="ColumnName">ConvertedAmt</Data>
<Data AD_Column_ID="113" Column="Help">The Converted Amount is the result of multiplying the Source Amount by the Conversion Rate for this target currency.</Data>
<Data AD_Column_ID="3360" Column="IsUpdateable">true</Data>
<Data AD_Column_ID="1692" Column="Callout" isNewNull="true"/>
<Data AD_Column_ID="11617" Column="IsAlwaysUpdateable">false</Data>
<Data AD_Column_ID="128" Column="IsEncrypted">N</Data>
<Data AD_Column_ID="54358" Column="InfoFactoryClass" isNewNull="true"/>
<Data AD_Column_ID="56187" Column="IsAllowLogging">true</Data>
<Data AD_Column_ID="56149" Column="IsAutocomplete">false</Data>
<Data AD_Column_ID="68024" Column="IsRange">false</Data>
<Data AD_Column_ID="62199" Column="IsAllowCopy">true</Data>
<Data AD_Column_ID="127" Column="SeqNo">0</Data>
<Data AD_Column_ID="6482" Column="EntityType">LVE</Data>
<Data AD_Column_ID="360" Column="AD_Org_ID">0</Data>
<Data AD_Column_ID="59702" Column="AD_Chart_ID" isNewNull="true"/>
<Data AD_Column_ID="114" Column="AD_Table_ID">54742</Data>
<Data AD_Column_ID="550" Column="CreatedBy">100</Data>
<Data AD_Column_ID="2608" Column="AD_Element_ID">1555</Data>
<Data AD_Column_ID="227" Column="AD_Reference_Value_ID" isNewNull="true"/>
<Data AD_Column_ID="115" Column="AD_Val_Rule_ID" isNewNull="true"/>
<Data AD_Column_ID="118" Column="FieldLength">0</Data>
<Data AD_Column_ID="226" Column="AD_Reference_ID">12</Data>
<Data AD_Column_ID="552" Column="UpdatedBy">100</Data>
<Data AD_Column_ID="84306" Column="UUID">bc130988-e36b-40b4-b193-341a7c4b1d7c</Data>
<Data AD_Column_ID="3369" Column="AD_Process_ID" isNewNull="true"/>
</PO>
</Step>
<Step SeqNo="30" StepType="AD">
<PO AD_Table_ID="752" Action="I" Record_ID="96663" Table="AD_Column_Trl">
<Data AD_Column_ID="12960" Column="Created">2020-07-30 15:18:45.399</Data>
<Data AD_Column_ID="12959" Column="IsActive">true</Data>
<Data AD_Column_ID="12952" Column="Updated">2020-07-30 15:18:45.399</Data>
<Data AD_Column_ID="12955" Column="AD_Column_ID">96663</Data>
<Data AD_Column_ID="12954" Column="IsTranslated">false</Data>
<Data AD_Column_ID="12957" Column="Name">Converted Amount</Data>
<Data AD_Column_ID="12961" Column="AD_Client_ID">0</Data>
<Data AD_Column_ID="12951" Column="AD_Org_ID">0</Data>
<Data AD_Column_ID="12958" Column="UpdatedBy">100</Data>
<Data AD_Column_ID="12956" Column="CreatedBy">100</Data>
<Data AD_Column_ID="12953" Column="AD_Language">es_MX</Data>
<Data AD_Column_ID="84310" Column="UUID">2949b479-a6b8-4162-8485-af9291637815</Data>
</PO>
</Step>
</Migration>
</Migrations>

0 comments on commit 2cb439f

Please sign in to comment.