014 agreement_sum
This commit is contained in:
parent
ef3e2ca0e3
commit
0634f4b6c7
@ -69,7 +69,7 @@
|
||||
<!--- <cfset this.datasources["#this.datasource#"]=getDS("#this.datasource#","datasource_#this.datasource#")/> --->
|
||||
|
||||
<cfset request.RECORDS_PER_PAGE=500/>
|
||||
<cfset request.APP_VERSION="0.00.013"/>
|
||||
<cfset request.APP_VERSION="0.00.014"/>
|
||||
|
||||
<cflock scope="application" type="readonly" timeout=3>
|
||||
<cfset request.APP_NAME=this.Name/>
|
||||
|
@ -33,6 +33,8 @@
|
||||
<d:field title="Дата договора">d.dt_contract</d:field>
|
||||
<d:field title="Контрагент">k.contragent</d:field>
|
||||
<d:field title="Строк изменено">(select count(*) from specification_item_version siv join specification_item si on (siv.specification_item_uid=si.specification_item_uid) join specification s on (si.specification_id=s.specification_id) where a.contract_id=s.contract_id AND a.agreement_version=siv.agreement_version) as change_cnt</d:field>
|
||||
<d:field title="Сумма">(select sum(quantity*price) from specification_item_version siv join specification_item si on (siv.specification_item_uid=si.specification_item_uid) join specification s on (si.specification_id=s.specification_id) where a.contract_id=s.contract_id AND a.agreement_version=siv.agreement_version) as agreement_sum</d:field>
|
||||
<d:field title="Сумма с в.">(select sum(quantity*price)*a.probability_perc/100 from specification_item_version siv join specification_item si on (siv.specification_item_uid=si.specification_item_uid) join specification s on (si.specification_id=s.specification_id) where a.contract_id=s.contract_id AND a.agreement_version=siv.agreement_version) as agreement_sum_p</d:field>
|
||||
</d:field_set>
|
||||
from agreement a
|
||||
join contract d on (a.contract_id=d.contract_id)
|
||||
@ -107,6 +109,15 @@ select count(*) as cnt from agreement where 1=1
|
||||
</cfsavecontent>
|
||||
</cfoutput>
|
||||
|
||||
<cffunction name="_nFmt">
|
||||
<cfargument name="n"/>
|
||||
<cfif n EQ 0 OR !isNumeric(n)>
|
||||
<cfreturn "">
|
||||
<cfelse>
|
||||
<cfreturn replace(NumberFormat(n, ",.00"), ",", " ", "ALL")/>
|
||||
</cfif>
|
||||
</cffunction>
|
||||
|
||||
<c:table query=#qRead# recordsPerPage=#pageInfo.recordsPerPage# nStart=#pageInfo.nStart# titleMap=#titleMap# sortArray=#pageInfo.settings.sort.sortArray# class="worktable wide">
|
||||
<c:column width="1%" sortable="false"><!---*** class="c" не пробрасывается --->
|
||||
<c:th><!--- <a href="agreement.cfm?contract_id=&agreement_version="><img src="img/add.gif"/></a> ---></c:th>
|
||||
@ -123,12 +134,15 @@ select count(*) as cnt from agreement where 1=1
|
||||
<c:column width="5%" field="dt_agreement" formatter=#function(dt){return dateformat(dt,"YYYY-MM-DD");}#><c:td class="c"/></c:column>
|
||||
<c:column width="15%" field="descr"/>
|
||||
<c:column width="2%" field="change_cnt"><c:td class="c"/></c:column>
|
||||
<c:column width="2%" field="agreement_sum" formatter=#_nFmt#><c:td class="r"/></c:column>
|
||||
<c:column width="2%" field="agreement_sum_p" formatter=#_nFmt#><c:td class="r"/></c:column>
|
||||
<c:column width="1%" sortable="false">
|
||||
<c:td field="f_link_del" class="c"/>
|
||||
</c:column>
|
||||
</c:table>
|
||||
<cfoutput>#gridFooter#</cfoutput>
|
||||
Создавать сделки (соглашения) нужно из договоров
|
||||
Под суммой понимается здесь сумма измененных позиций, а не изменение суммы от предыдущей версии!
|
||||
Создавать сделки (соглашения) нужно из договоров (потому что у нас сделка - это базовая или дополнительная версия фактуры договора с вероятностью, дополнительное или базовое соглашение к договору)
|
||||
|
||||
</cfif>
|
||||
<layout:page section="footer"/>
|
||||
|
@ -147,12 +147,15 @@
|
||||
a.contract_id
|
||||
,a.agreement_version
|
||||
,a.agreement
|
||||
,a.probability_perc
|
||||
,a.dt_agreement
|
||||
,a.is_actual
|
||||
,(select count(*) from specification_item_version iv
|
||||
join specification_item i on (iv.specification_item_uid=i.specification_item_uid AND iv.agreement_version=a.agreement_version)
|
||||
join specification s on (i.specification_id=s.specification_id AND s.contract_id=a.contract_id)
|
||||
) as items_changed
|
||||
,(select sum(quantity*price) from specification_item_version siv join specification_item si on (siv.specification_item_uid=si.specification_item_uid) join specification s on (si.specification_id=s.specification_id) where a.contract_id=s.contract_id AND a.agreement_version=siv.agreement_version) as agreement_sum
|
||||
,(select sum(quantity*price)*a.probability_perc/100 from specification_item_version siv join specification_item si on (siv.specification_item_uid=si.specification_item_uid) join specification s on (si.specification_id=s.specification_id) where a.contract_id=s.contract_id AND a.agreement_version=siv.agreement_version) as agreement_sum_p
|
||||
from agreement a
|
||||
where a.contract_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.contract_id#" null=#!isValid('integer', d.contract_id)#/>
|
||||
order by a.agreement_version
|
||||
@ -179,8 +182,11 @@
|
||||
<th>Номер соглашения (версия)</th>
|
||||
<th>Название</th>
|
||||
<th>Дата</th>
|
||||
<th>Вероятность</th>
|
||||
<th>Действует</th>
|
||||
<th>Строк изменено</th>
|
||||
<th>Сумма измененных</th>
|
||||
<th>Сумма изм. с в.</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@ -192,8 +198,11 @@
|
||||
<td class="r">#agreement_version#</td>
|
||||
<td>#agreement#</td>
|
||||
<td>#dateFormat(dt_agreement,'DD.MM.YYYY')#</td>
|
||||
<td class="r"><cfif probability_perc GT 0>#probability_perc#</cfif></td>
|
||||
<td class="c"><cfif is_actual GT 0><img src="img/ok.png"/></cfif></td>
|
||||
<td class="c"><cfif items_changed GT 0>#items_changed#</cfif></td>
|
||||
<td class="r">#nFmt(agreement_sum)#</td>
|
||||
<td class="r">#nFmt(agreement_sum_p)#</td>
|
||||
<td class="c">
|
||||
<a href="agreement_del.cfm?contract_id=#contract_id#&agreement_version=#agreement_version#&#tr.fwx#"><img src="img/del.gif"/></a>
|
||||
</td>
|
||||
|
Loading…
Reference in New Issue
Block a user