003 costs/ number clean

This commit is contained in:
msyu 2025-06-19 14:59:50 +03:00
parent a07522702c
commit 62de4c0de6
7 changed files with 29 additions and 7 deletions

View File

@ -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.002"/>
<cfset request.APP_VERSION="0.00.003"/>
<cflock scope="application" type="readonly" timeout=3>
<cfset request.APP_NAME=this.Name/>

View File

@ -204,6 +204,7 @@
,iv.specification_item_version /*it is printable name not number*/
,iv.quantity
,iv.price
,iv.price*iv.quantity as cost
,iv.dt_from
,iv.dt_to
,i.specification_id
@ -282,6 +283,7 @@
<th>Дата по</th>
<th>Кол-во</th>
<th>Цена</th>
<th>Стоимость</th>
<th>&nbsp;</th>
@ -322,6 +324,7 @@
<td class="c">#dateFormat(dt_to,'DD.MM.YYYY')#</td>
<td class="r">#quantity#</td>
<td class="r">#price#</td>
<td class="r">#cost#</td>
<td></td>

View File

@ -183,7 +183,11 @@
,(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
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.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
@ -232,6 +236,7 @@
<th>Дата по</th>
<th>Количество</th>
<th>Цена</th>
<th>Стоимость</th>
<th>Имя для печати</th>
<!--- <th>Компонентов</th> --->
<th></th>
@ -257,6 +262,7 @@
<td class="c">#dateFormat(dt_to,'DD.MM.YYYY')#</td>
<td class="r">#quantity#</td>
<td class="r">#price#</td>
<td class="r">#cost#</td>
<td>#specification_item#</td>
<td class="c">
<c:link_del canWrite=#pageInfo.writePermitted()# entity="specification_item" key="specification_item_uid" id=#specification_item_uid# fwx=#tr.fwx#/>

View File

@ -183,6 +183,7 @@
select
siv.price
,siv.quantity
,siv.price*siv.quantity as cost
,siv.specification_item_version
,siv.agreement_version
,siv.dt_from
@ -226,6 +227,7 @@
<th>Услуга (для печати)</th>
<th>Кол-во</th>
<th>Цена</th>
<th>Стоимость</th>
<th></th>
</tr>
</thead>
@ -245,6 +247,7 @@
<td>#specification_item_version#</td>
<td class="r">#quantity#</td>
<td class="r">#price#</td>
<td class="r">#cost#</td>
<td class="c">
<cfif pageInfo.writePermitted()>
<a href="specification_item_version_del.cfm?specification_item_uid=#specification_item_uid#&agreement_version=#agreement_version#&#tr.fwx#">

View File

@ -43,11 +43,13 @@
<d:field title="Дата по">siv.dt_to</d:field>
<d:field title="Кол-во">siv.quantity</d:field>
<d:field title="Цена">siv.price</d:field>
<d:field title="Стоимость">siv.price*siv.quantity as cost</d:field>
<d:field title="Кол-во прошлое">ver.quantity as quantity_prev</d:field>
<d:field title="Цена прошлая">ver.price as price_prev</d:field>
<d:field title="Цена прошлая">ver.price as price_prev</d:field>
<d:field title="Ст-ть прошлая">ver.price*ver.quantity as cost_prev</d:field>
<d:field title="Версия прошлая">ver.agreement_version as version_prev</d:field>
<d:field title="Изменение стоимости">COALESCE(siv.price*siv.quantity,0) - COALESCE(ver.price*ver.quantity,0) as cost_diff</d:field>
<d:field title="Изменение с вер.">(COALESCE(siv.price*siv.quantity,0) - COALESCE(ver.price*ver.quantity,0))*a.probability_perc/100 as cost_diff_prob</d:field>
<d:field title="Изм-е с верoят.">(COALESCE(siv.price*siv.quantity,0) - COALESCE(ver.price*ver.quantity,0))*a.probability_perc/100 as cost_diff_prob</d:field>
</d:field_set>
from specification_item_version siv
join specification_item si on (siv.specification_item_uid=si.specification_item_uid)
@ -199,9 +201,11 @@ select count(*) as cnt from specification_item where 1=1
<c:column width="3%" field="agreement_version"><c:td class="c"/></c:column>
<c:column width="3%" field="quantity"><c:td class="r"/></c:column>
<c:column width="3%" field="price"><c:td class="r"/></c:column>
<c:column width="3%" field="cost"><c:td class="r"/></c:column>
<c:column width="3%" field="f_version_prev"><c:td class="c"/></c:column>
<c:column width="3%" field="quantity_prev"><c:td class="r"/></c:column>
<c:column width="3%" field="price_prev"><c:td class="r"/></c:column>
<c:column width="3%" field="cost_prev"><c:td class="r"/></c:column>
<c:column width="3%" field="cost_diff"><c:td class="r"/></c:column>
<c:column width="3%" field="cost_diff_prob"><c:td class="r"/></c:column>
<c:column width="1%" sortable="false">

View File

@ -50,7 +50,7 @@
<d:param field="specification_item_version" type="varchar" size="1023" init="#qLastVersion.specification_item_version#" preprocessor=#cleanInput#/>
<d:param field="quantity" type="numeric" init=#qLastVersion.quantity#/>
<d:param field="price" type="numeric" init=#qLastVersion.price#/>
<d:param field="price" type="numeric" init=#qLastVersion.price# preprocessor=#request.stripWhiteSpace#/>
<d:param field="dt_from" type="timestamp" format="yyyy-MM-dd" forNull="" init="#dateFormat(Now(),'YYYY-MM-DD')#"/> <!--- !!! Important yyyy-MM-dd NOT YYYY-MM-DD --->
<d:param field="dt_to" type="timestamp" format="yyyy-MM-dd" forNull="" init=""/> <!--- !!! Important yyyy-MM-dd NOT YYYY-MM-DD --->
@ -197,6 +197,12 @@
<layout:detail_line title="Цена">
<input type="text" name="price" id="price" value="#d.price#" size="7" class="r"/>
<cfif len(d.price)>
<cftry>
Стоимость: <b>#d.quantity*d.price#</b>
<cfcatch type="any"></cfcatch>
</cftry>
</cfif>
</layout:detail_line>
<layout:detail_line title="Создано">

View File

@ -20,10 +20,10 @@
<d:bean readonly=#!pageInfo.writePermitted()# table="svc" datasource="#request.DS#" output="d" status="pageInfo.status">
<d:param field="svc_id" type="integer" key /><!--- autoincrement --->
<d:param field="svc" type="varchar" size="255" required preprocessor=#cleanInput#/>
<d:param field="svc_short" type="varchar" size="255" required preprocessor=#cleanInput#/>
<d:param field="svc_short" type="varchar" size="255" preprocessor=#cleanInput#/>
<d:param field="code" type="varchar" size="255" preprocessor=#cleanInput#/>
<d:param field="version" type="varchar" size="255" preprocessor=#cleanInput#/>
<d:param field="orchestrator_name" type="varchar" size="255" required preprocessor=#cleanInput#/>
<d:param field="orchestrator_name" type="varchar" size="255" preprocessor=#cleanInput#/>
<d:param field="is_production_ready" type="boolean" default="0"/>
<d:param field="sort" type="integer" forNull=""/>
<d:param field="descr" type="varchar" preprocessor=#plain2HtmClean#/>