agreement list added

This commit is contained in:
msyu
2025-06-14 12:32:09 +03:00
parent 38b621bc44
commit 13cc175dc3
47 changed files with 362 additions and 5932 deletions
+24 -47
View File
@@ -18,7 +18,8 @@
<!--- так... а у нас ключ составной, prepare_detail несколько сложнее --->
<cfparam name="specification_item_uid" type="guid"/>
<cfparam name="agreement_version" type="integer" default="-1"/>
<cfparam name="agreement_version" default=""/>
<m:prepare_detail
entity="specification_item_version"
key="undefined"
@@ -27,17 +28,29 @@
defaultBackUrl="specification_item.cfm?specification_item_uid=#specification_item_uid#"
/>
<cfquery name="qLastVersion">
select agreement_version, quantity, price, specification_item_version
from specification_item_version
where specification_item_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#specification_item_uid#" null=#!IsValid('guid',specification_item_uid)#/>
order by agreement_version desc limit 1
</cfquery>
<cfif qLastVersion.recordCount EQ 0>
<cfset queryAddRow(qLastVersion,[0,1,0,""])/>
<!--- <cfdump var=#lastVersion#/> --->
</cfif>
<!--- <cfdump var=#pageInfo#/>
<cfdump var=#specification_item_version#/>
<cfabort/> --->
<d:bean readonly=#!pageInfo.writePermitted()# table="#pageInfo.entity#" datasource="#request.DS#" output="d" status="status">
<d:param field="specification_item_uid" type="guid" key/>
<d:param field="agreement_version" type="integer" key/>
<d:param field="agreement_version" type="integer" key/> <!--- init=#qLastVersion.agreement_version# --->
<d:param field="specification_item_version" type="varchar" size="1023" preprocessor=#cleanInput#/>
<d:param field="quantity" type="numeric" init="1"/>
<d:param field="price" type="numeric" init="0"/>
<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="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 --->
@@ -60,7 +73,7 @@
<!--- контекст строки всегда известен при создании версии, полный ключ не нужен для него - соответственно, джойн с основной таблицей. При этом мы собираем неверсионную часть данных, а версионная образует параллельную ветку --->
<!--- можно обратить внимание на то, что это один джойн, который растет сверху вниз (возможно, ветвится), добавляются таблицы и поля. На самом деле джойны внешние только для удобства отладки - так ошибки виднее --->
<cfquery name="qSpecificationItem" datasource="#request.DS#">
<cfquery name="qSpecificationItem">
select i.svc_id, v.svc
,s.specification_id, s.specification, s.contract_id
,d.contract, d.dt_contract, d.contragent_id
@@ -74,45 +87,8 @@
</cfquery>
<!--- <cfquery name="qCost" datasource="#request.DS#">
select sum(sip.price*sip.quantity) as cost
from specification_item_version_param sip
where sip.specification_item_version_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.specification_item_version_id#" null=#!isNumeric(d.specification_item_version_id)#/>
</cfquery> --->
<!--- <cfquery name="qSpecificationItemParam" datasource="#request.DS#">
select
sip.specification_item_version_param_id
,sp.service_param_id
,sp.param_id
,sip.price
,sip.quantity
,p.param_id
,p.param
,p.param_short
,p.code
,p.precision
,c.param_class
,m.measure_short
,spp.min_price
from service_param sp
left outer join specification_item_version_param sip
on (sp.service_param_id=sip.service_param_id AND sip.specification_item_version_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.specification_item_version_id#"/>)
left outer join param p on (sp.param_id=p.param_id)
left outer join abstract_service_param_class ac on (sp.abstract_service_param_class_id=ac.abstract_service_param_class_id)
left outer join param_class c on (ac.param_class_id=c.param_class_id)
left outer join measure m on (c.measure_id=m.measure_id)
left outer join service_param_price spp on
(sp.service_param_id=spp.service_param_id) /***из-за полиморфизма тут надо сложнее*/
where sp.service_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#d.service_id#"/>
order by c.param_class, p.param
</cfquery> --->
<!--- Здесь выборка строится от шаблона, и на него уже накручиваются реквизиты экземпляра --->
<!--- <cfdump var=#qSpecificationItemParam#/> --->
<!--- decoration --->
<cfquery name="qDecoration" datasource="#request.DS#">
<cfquery name="qDecoration">
select
a.login as creator, a.shortname as creator_shortname, m.login as updater, m.shortname as updater_shortname
from specification_item_version e
@@ -169,7 +145,7 @@
select a.agreement_version, a.agreement, a.dt_agreement
from agreement a
where a.contract_id=<cfqueryparam cfsqltype="cf_sql_integer" value="#qSpecificationItem.contract_id#" null=#!isValid('integer',qSpecificationItem.contract_id)#/>
order by 1
order by 1 desc
</cfquery>
<c:combo
query=#qList#
@@ -203,6 +179,7 @@
<layout:detail_line title="Дата по">
<input type="date" name="dt_to" id="dt_to" value="#dateFormat(d.dt_to,"YYYY-MM-DD")#"/>
<button type="button" onclick="document.getElementById('dt_to').value='#DateFormat(Now(), 'YYYY-MM-DD')#';">Сегодня</button>
<i>Если оставлено пустым, то версия действует до начала действия следующей. Заполнять, если хотим прекратить услугу постоянно или временно</i>
</layout:detail_line>
<layout:detail_line title="Имя для печати">
@@ -211,11 +188,11 @@
</layout:detail_line>
<layout:detail_line title="Количество">
<input type="text" name="quantity" value="#d.quantity#" size="10" class="r"/><!---*** Халява с точностью ---><!--- <cftry>#round(d.quantity,qService.precision)#<cfcatch type="ANY"></cfcatch></cftry> --->
<input type="text" name="quantity" value="#d.quantity#" size="7" class="r"/><!---*** Халява с точностью ---><!--- <cftry>#round(d.quantity,qService.precision)#<cfcatch type="ANY"></cfcatch></cftry> --->
</layout:detail_line>
<layout:detail_line title="Цена">
<input type="text" name="price" id="price" value="#d.price#" size="10" class="r"/>
<input type="text" name="price" id="price" value="#d.price#" size="7" class="r"/>
</layout:detail_line>
<layout:detail_line title="Создано">