011 some totals
This commit is contained in:
+20
-3
@@ -188,11 +188,15 @@
|
||||
,(select siv.price from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as price,
|
||||
(select siv.price*siv.quantity from specification_item_version siv
|
||||
order by siv.agreement_version desc limit 1) as price
|
||||
,(select siv.price*siv.quantity from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as cost
|
||||
,(select siv.price*siv.quantity*a.probability_perc/100 from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
order by siv.agreement_version desc limit 1) as cost_p
|
||||
,(select siv.dt_from from specification_item_version siv
|
||||
join agreement a on (siv.agreement_version=a.agreement_version AND a.contract_id=s.contract_id)
|
||||
where siv.specification_item_uid=i.specification_item_uid AND a.is_actual
|
||||
@@ -211,6 +215,10 @@
|
||||
order by 2
|
||||
</cfquery>
|
||||
|
||||
<cfquery dbtype="query" name="qTotal">
|
||||
select sum(cost) as cost, sum(cost_p) as cost_p from qItem
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>
|
||||
<p>
|
||||
Фактура - строки спецификации, актуальная версия (#qItem.recordCount#)
|
||||
@@ -238,6 +246,7 @@
|
||||
<th>Количество</th>
|
||||
<th>Цена</th>
|
||||
<th>Стоимость</th>
|
||||
<th>Ст-сть с вер.</th>
|
||||
|
||||
<th> </th>
|
||||
|
||||
@@ -264,7 +273,7 @@
|
||||
<td class="r">#quantity#</td>
|
||||
<td class="r">#price#</td>
|
||||
<td class="r">#cost#</td>
|
||||
|
||||
<td class="r">#cost_p#</td>
|
||||
|
||||
<td class="c"></td>
|
||||
<td class="c">#item_version_count#</td>
|
||||
@@ -281,6 +290,14 @@
|
||||
</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
<cfoutput query="qTotal">
|
||||
<tr>
|
||||
<td colspan="8"></td>
|
||||
<td class="r" style="font-size:120%">#cost#</td>
|
||||
<td class="r" style="font-size:120%">#cost_p#</td>
|
||||
<td colspan="8"></td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
Можно собрать версию спецификации на произвольную дату, а можно по версии определенного соглашения (это возможно, потому что соглашение меняет каждую строку не более 1 раза)
|
||||
|
||||
Reference in New Issue
Block a user