025 interface imptovements
This commit is contained in:
@@ -0,0 +1,488 @@
|
||||
<cfsilent>
|
||||
<cfimport prefix="m" taglib="lib"/>
|
||||
<cfimport prefix="c" taglib="lib/controls"/>
|
||||
<cfimport prefix="d" taglib="lib/data"/>
|
||||
<cfimport prefix="layout" taglib="layout"/>
|
||||
</cfsilent><m:silent silent="No">
|
||||
|
||||
<cffunction name="plain2HtmClean">
|
||||
<cfargument name="s" type="string"/>
|
||||
<cfreturn request.plain2htm(request.cleanHtm(s))/>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="cleanInput">
|
||||
<cfargument name="s" type="string"/>
|
||||
<cfreturn htmlEditFormat(s)/>
|
||||
</cffunction>
|
||||
|
||||
<m:prepare_detail entity="contragent" accessObject="" key="__id" pageInfoOut="pageInfo"/>
|
||||
|
||||
<d:bean readonly=true table="elma.companies" datasource="#request.DS#" output="d" status="status">
|
||||
<d:param field="__id" type="uuid" key/>
|
||||
<d:param field="__name" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
|
||||
<d:param field="_inn" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
|
||||
<d:param field="_kpp" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
|
||||
<d:param field="id_klienta" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
|
||||
<!--- *** билдер показывает... <d:param field="wz_id" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/> --->
|
||||
<!--- <d:param field="code_inn" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/>
|
||||
<d:param field="code_kpp" type="varchar" size="255" preprocessor=#cleanInput# forNull=""/> --->
|
||||
</d:bean>
|
||||
|
||||
|
||||
<m:dispatch_detail
|
||||
usePRG="No"<!---*** --->
|
||||
pageInfo=#pageInfo#
|
||||
id="#d.__id#"
|
||||
status=#pageInfo.status#
|
||||
trackOut="tr"
|
||||
idAttributesOut="id"
|
||||
/>
|
||||
|
||||
<!--- decoration --->
|
||||
<!--- <cfquery name="qDecoration" datasource="#request.DS#">
|
||||
select
|
||||
a.login as creator, a.shortname as creator_shortname, m.login as updater, m.shortname as updater_shortname
|
||||
from contragent g
|
||||
left outer join usr a on (g.creator_id=a.usr_id)
|
||||
left outer join usr m on (g.updater_id=m.usr_id)
|
||||
where g.contragent_id=<cfqueryparam attributeCollection=#id#/>
|
||||
</cfquery> --->
|
||||
|
||||
|
||||
</m:silent><!---
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
---><layout:page section="header" pageInfo=#pageInfo#>
|
||||
<layout:attribute name="title">
|
||||
<cfoutput>
|
||||
Контрагент
|
||||
<cfif len(d.__id)>
|
||||
<b>#d.__name#</b>
|
||||
[#d.__id#]
|
||||
</cfif>
|
||||
</cfoutput>
|
||||
</layout:attribute>
|
||||
</layout:page>
|
||||
|
||||
<!--- <cfif status.errorState GT 0>
|
||||
<cfoutput><div class="err">#status.errorMessage#</div></cfoutput>
|
||||
</cfif>
|
||||
--->
|
||||
<cfoutput>
|
||||
<input type="hidden" name="__id" value="#d.__id#"/>
|
||||
<input type="hidden" name="track" value="#tr.self#"/>
|
||||
<input type="hidden" name="pass" value=""/><!--- pass marker to prevent save on submit --->
|
||||
|
||||
<div class="detail">
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">__id</div>
|
||||
<div class="td">#d.__id#</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">__name</div>
|
||||
<div class="td">#d.__name#</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">_inn</div>
|
||||
<div class="td">#d._inn#</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">_kpp</div>
|
||||
<div class="td">#d._kpp#</div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">id_klienta</div>
|
||||
<div class="td">#d.id_klienta#</div>
|
||||
</div>
|
||||
|
||||
<!--- <div class="tr">
|
||||
<div class="th">wz_id</div>
|
||||
<div class="td">#d.wz_id#"/></div>
|
||||
</div> --->
|
||||
|
||||
<!--- <div class="tr">
|
||||
<div class="th">code_inn</div>
|
||||
<div class="td">#d.code_inn#"/></div>
|
||||
</div>
|
||||
|
||||
<div class="tr">
|
||||
<div class="th">code_kpp</div>
|
||||
<div class="td">#d.code_kpp#"/></div>
|
||||
</div> --->
|
||||
|
||||
</div>
|
||||
|
||||
</cfoutput>
|
||||
сюда добавить сделок, договоров и т.д.
|
||||
|
||||
<layout:page section="extension" closeForm="Yes"/>
|
||||
|
||||
<cfif len(d.__id)>
|
||||
|
||||
<cfquery name="qContract">
|
||||
select
|
||||
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
||||
<d:field title="ID" cfSqlType="CF_SQL_OTHER">d.__id</d:field>
|
||||
<d:field title="Внут.номер">d.agreement_id</d:field>
|
||||
<d:field title="Договор">d.__name</d:field>
|
||||
<d:field title="company_uid">d.company_uid</d:field>
|
||||
<d:field title="Дата договора">d.date_of_aggrement</d:field>
|
||||
<d:field title="Дата окончания">d.date_end_aggrement</d:field>
|
||||
<d:field title="Тип договора">d.type_of_agreement</d:field>
|
||||
<d:field title="__index">d.__index</d:field>
|
||||
</d:field_set>
|
||||
from elma.aggrements d
|
||||
where d.company_uid=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid('guid',d.__id)#/>
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>
|
||||
<h4>Договоры (#qContract.recordCount#)</h4>
|
||||
</cfoutput>
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>__id</th>
|
||||
<th>Номер</th>
|
||||
<th>Внут. номер</th>
|
||||
<th>Дата</th>
|
||||
<th>Дата оконч.</th>
|
||||
<th>Тип договора</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<cfoutput query="qContract">
|
||||
<tr>
|
||||
<td><a href="contract.cfm?__id=#__id#&#tr.fwx#">#__id#</a></td>
|
||||
<td>#__name#</td>
|
||||
<td>#agreement_id#</td>
|
||||
<td>#dateFormat(date_of_aggrement,"YYYY-MM-DD")#</td>
|
||||
<td>#dateFormat(date_end_aggrement,"YYYY-MM-DD")#</td>
|
||||
<td class="c">#type_of_agreement#</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
|
||||
<cfquery name="qAdditionalAgreement">
|
||||
with
|
||||
s(status, status_id, probability_pc) as (VALUES
|
||||
('Закрыта неуспешно',7,0),('Закрыта успешно',6,100),('Договор подписан',5,100),('Договор на подписании',15,90),('Договор на согласовании',12,70),
|
||||
('Тестирование',8,50),('Отправлено ТКП',10,20),('Внутреннее согласование',37,10),('Проработка решения',4,10),('Сбор потребностей',1,0)
|
||||
),
|
||||
component as (select siv.deal as deal_uids, siv.type, (siv.cnt*(100-COALESCE(siv.discount,0))/100*p.price*p.cnt*(100-COALESCE(p.discount,0))) as param_cost
|
||||
from elma.deals_services siv
|
||||
join elma.service_parametrs p on (p.__id = ANY(siv.params))
|
||||
where p."__deletedAt" IS NULL AND siv."__deletedAt" IS NULL AND siv.is_actual
|
||||
)
|
||||
select
|
||||
a.__id::text
|
||||
,a.__name as additional_agreement
|
||||
,a.__index
|
||||
,a.contract_uid::text
|
||||
,a.is_actual
|
||||
,a.last_aa
|
||||
,a.deal_uid::text
|
||||
,c.__name as contract
|
||||
,c.agreement_id
|
||||
,c.date_of_aggrement
|
||||
,d.__id as deal_uid
|
||||
,d.__name as deal
|
||||
,d.__status_status
|
||||
,s.status
|
||||
,s.probability_pc
|
||||
,u.__name as owner
|
||||
,(select sum(param_cost)
|
||||
from component p
|
||||
where d.__id = p.deal_uids[1] AND p.type IN (1)
|
||||
) as install
|
||||
,(select sum(param_cost)
|
||||
from component p
|
||||
where d.__id = p.deal_uids[1] AND p.type IN (2)
|
||||
) as periodical
|
||||
,(select sum(param_cost)
|
||||
from component p
|
||||
where d.__id = p.deal_uids[1] AND p.type IN (3)
|
||||
) as metered
|
||||
from elma.additional_agreements a
|
||||
join elma.aggrements c on (a.contract_uid=c.__id)
|
||||
join elma.deals d on (a.deal_uid=d.__id)
|
||||
left outer join s on (d.__status_status=s.status_id)
|
||||
left outer join elma.comp_users_ext u on (d._owner=c.__id)
|
||||
where c.company_uid=<cfqueryparam cfsqltype="cf_sql_other" value=#d.__id# null=#!isValid("guid",d.__id)#/>
|
||||
AND s.probability_pc > 0
|
||||
order by a.__index
|
||||
</cfquery>
|
||||
|
||||
|
||||
<cfoutput>
|
||||
<h4>Доп. соглашения (#qAdditionalAgreement.recordCount#)
|
||||
- исключены соглашения, сделки которых имеют нулевую вероятность
|
||||
</h4>
|
||||
</cfoutput>
|
||||
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>__id</th>
|
||||
<th>__index</th>
|
||||
<th>Доп. соглашение</th>
|
||||
<th>Внут. н-р дог.</th>
|
||||
<th>Дата договора</th>
|
||||
<th>Сделка</th>
|
||||
<th>Статус сделки</th>
|
||||
<th>Вер-ть %</th>
|
||||
<th>Ответственный</th>
|
||||
<th>Инсталл</th>
|
||||
<th>Ежемес</th>
|
||||
<th>Тариф.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<cfoutput query="qAdditionalAgreement">
|
||||
<tr>
|
||||
<td><a href="additional_agreement.cfm?__id=#__id#&#tr.fwx#">#__id#</a></td>
|
||||
<td><a href="additional_agreement.cfm?__id=#__id#&#tr.fwx#">#__index#</a></td>
|
||||
<td>#additional_agreement#</td>
|
||||
<td><a href="contract.cfm?__id=#contract_uid#&#tr.fwx#">#agreement_id#</a></td>
|
||||
<td>#dateFormat(date_of_aggrement,"YYYY-MM-DD")#</td>
|
||||
<td><a href="deal.cfm?__id=#deal_uid#&#tr.fwx#">#deal#</a></td>
|
||||
<td>#status#</td>
|
||||
<td>#probability_pc#</td>
|
||||
<td>#owner#</td>
|
||||
<td class="r nw">#nFmt(install)#</td>
|
||||
<td class="r nw">#nFmt(periodical)#</td>
|
||||
<td class="r nw">#nFmt(metered)#</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
<!--- ----------------------------------------------------------------- --->
|
||||
|
||||
<cfquery name="qDeal">
|
||||
with
|
||||
status(status, status_id, probability_pc) as (VALUES
|
||||
('Закрыта неуспешно',7,0),('Закрыта успешно',6,100),('Договор подписан',5,100),('Договор на подписании',15,90),('Договор на согласовании',12,70),
|
||||
('Тестирование',8,50),('Отправлено ТКП',10,20),('Внутреннее согласование',37,10),('Проработка решения',4,10),('Сбор потребностей',1,0)
|
||||
),
|
||||
component as (select siv.deal as deal_uids, siv.type, (siv.cnt*(100-COALESCE(siv.discount,0))/100*p.price*p.cnt*(100-COALESCE(p.discount,0))) as param_cost
|
||||
from elma.deals_services siv
|
||||
join elma.service_parametrs p on (p.__id = ANY(siv.params))
|
||||
where p."__deletedAt" IS NULL AND siv."__deletedAt" IS NULL AND siv.is_actual
|
||||
)
|
||||
select
|
||||
<d:field_set titleMapOut="titleMap" lengthOut="fieldCount">
|
||||
<d:field title="ID" cfSqlType="CF_SQL_OTHER">d.__id</d:field>
|
||||
<d:field title="index" cfSqlType="CF_SQL_INTEGER">d.__index</d:field>
|
||||
<d:field title="Название">d.__name</d:field>
|
||||
<d:field title="company_uid">d._companies</d:field>
|
||||
<d:field title="Создана">d."__createdAt" as __createdAt</d:field><!--- *** косяк d:field, если взять в кавычки имя поля, оно не попадает в массив полей --->
|
||||
<d:field title="Контрагент">k.__name as contragent</d:field>
|
||||
<d:field title="Контрагент">k.__id as contragent_uid</d:field>
|
||||
<d:field title="WZ">k.id_klienta as wz</d:field>
|
||||
<d:field title="status_id">d.__status_status</d:field>
|
||||
<d:field title="Статус">s.status</d:field>
|
||||
<d:field title="Вероятность%">s.probability_pc</d:field>
|
||||
<d:field title="Ответственный">c.__name as owner</d:field>
|
||||
<d:field title="Допник">a.__name as additional_agreement</d:field>
|
||||
<d:field title="Допник">a.__id as additional_agreement_uid</d:field>
|
||||
<d:field title="Договор">g.__name as contract</d:field>
|
||||
<d:field title="Договор">g.__id as contract_uid</d:field>
|
||||
<d:field title="Договор">g.date_of_aggrement</d:field>
|
||||
<d:field title="Договор">g.agreement_id</d:field>
|
||||
<d:field title="Дата дог.">g.date_of_aggrement as dt_contract</d:field>
|
||||
<d:field>(select sum(param_cost)
|
||||
from component
|
||||
where d.__id = ANY(component.deal_uids) AND component.type IN (1)
|
||||
) as install
|
||||
</d:field>
|
||||
<d:field>(select sum(param_cost)
|
||||
from component
|
||||
where d.__id = ANY(component.deal_uids) AND component.type IN (2)
|
||||
) as periodical
|
||||
</d:field>
|
||||
<d:field>(select sum(param_cost)
|
||||
from component
|
||||
where d.__id = ANY(component.deal_uids) AND component.type IN (3)
|
||||
) as metered
|
||||
</d:field>
|
||||
</d:field_set>
|
||||
from elma.deals d
|
||||
left outer join elma.companies k on (d._companies=k.__id)
|
||||
left outer join status s on (d.__status_status=s.status_id)
|
||||
left outer join elma.comp_users_ext c on (d._owner=c.__id)
|
||||
left outer join elma.additional_agreements a on (d.__id=a.deal_uid)
|
||||
left outer join elma.aggrements g on (a.contract_uid = g.__id)
|
||||
where d._companies=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid('guid',d.__id)#/>
|
||||
AND s.probability_pc > 0
|
||||
order by d.__index
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>
|
||||
<h4>Сделки (#qDeal.recordCount#) - исключены сделки с нулевой вероятностью</h4>
|
||||
</cfoutput>
|
||||
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>__id</th>
|
||||
<th>__index</th>
|
||||
<th>Сделка</th>
|
||||
<th>Статус сделки</th>
|
||||
<th>Вер-ть %</th>
|
||||
<th>Ответственный</th>
|
||||
<th>Допник</th>
|
||||
<th>Договор</th>
|
||||
<th>Внут. н-р дог.</th>
|
||||
<th>Дата договора</th>
|
||||
<th>Инсталл</th>
|
||||
<th>Ежемес</th>
|
||||
<th>Тариф.</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<cfoutput query="qDeal">
|
||||
<tr>
|
||||
<td><a href="deal.cfm?__id=#__id#&#tr.fwx#">#__id#</a></td>
|
||||
<td>#__index#</td>
|
||||
<td><a href="deal.cfm?__id=#__id#&#tr.fwx#">#__name#</a></td>
|
||||
<td>#status#</td>
|
||||
<td>#probability_pc#</td>
|
||||
<td>#owner#</td>
|
||||
<td>#additional_agreement#</td>
|
||||
<td>#contract#</td>
|
||||
<td><a href="contract.cfm?__id=#contract_uid#&#tr.fwx#">#agreement_id#</a></td>
|
||||
<td>#dateFormat(date_of_aggrement,"YYYY-MM-DD")#</td>
|
||||
<td class="r nw">#nFmt(install)#</td>
|
||||
<td class="r nw">#nFmt(periodical)#</td>
|
||||
<td class="r nw">#nFmt(metered)#</td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
|
||||
<!--- ----------------------------------------------------- --->
|
||||
<!--- ----------------------------------------------------- --->
|
||||
<!--- ----------------------------------------------------- --->
|
||||
|
||||
<cfquery name="qService">
|
||||
with
|
||||
status(status, status_id, probability_pc) as (VALUES
|
||||
('Закрыта неуспешно',7,0),('Закрыта успешно',6,100),('Договор подписан',5,100),('Договор на подписании',15,90),('Договор на согласовании',12,70),
|
||||
('Тестирование',8,50),('Отправлено ТКП',10,20),('Внутреннее согласование',37,10),('Проработка решения',4,10),('Сбор потребностей',1,0)
|
||||
)
|
||||
select
|
||||
siv.__id
|
||||
,siv.__name
|
||||
,siv.user_description
|
||||
,siv.discount
|
||||
,siv.cnt
|
||||
,siv.modifier_code
|
||||
,siv.abstractive_service_code
|
||||
,siv.is_actual
|
||||
,siv.type
|
||||
,siv.hash
|
||||
,siv.version
|
||||
,siv.name_version
|
||||
,siv.date_accept
|
||||
,siv.__index
|
||||
,siv.date_nop
|
||||
,siv.date_end
|
||||
,siv.is_easy
|
||||
,siv.params::text
|
||||
,a.__id::text as additional_agreement_uid
|
||||
,a.__name as additional_agreement
|
||||
,(select
|
||||
sum(siv.cnt*(100-COALESCE(siv.discount,0))/100*p.price*p.cnt*(100-COALESCE(p.discount,0))/100)
|
||||
from elma.service_parametrs p
|
||||
where p.__id = ANY (siv.params)
|
||||
AND p."__deletedAt" IS NULL
|
||||
) as line_cost
|
||||
,(select count(*)
|
||||
from elma.service_parametrs p
|
||||
where p.__id = ANY (siv.params)
|
||||
AND p."__deletedAt" IS NULL
|
||||
) as param_cnt
|
||||
,s.probability_pc
|
||||
,d.__index
|
||||
,d.__id as deal_uid
|
||||
from elma.deals_services siv
|
||||
join elma.deals d on d.__id=ANY(siv.deal)
|
||||
join status s on (d.__status_status=s.status_id)
|
||||
left outer join elma.additional_agreements a on (a.__id=ANY(siv.additional_agreement))
|
||||
where d._companies=<cfqueryparam cfsqltype="cf_sql_other" value="#d.__id#" null=#!isValid("guid",d.__id)#/>
|
||||
and siv.is_actual
|
||||
order by version::int
|
||||
</cfquery>
|
||||
|
||||
<cfoutput>
|
||||
<h4>Услуги (версии строк спецификации, только актуальные) (#qService.recordCount#) *** здесь не учтено дублирование строк в новых версиях</h4>
|
||||
</cfoutput>
|
||||
|
||||
<!--- <layout:render_query query=#qService#/> --->
|
||||
<table class="worktable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>__index</th>
|
||||
<!--- <th>__name</th> --->
|
||||
<th width="12%">user_description</th>
|
||||
<th>Кол-во</th>
|
||||
<th>Скидка%</th>
|
||||
<th width="5%">Сумма</th>
|
||||
<th>Код</th>
|
||||
<th>type</th>
|
||||
<th>is_actual</th>
|
||||
<th>hash</th>
|
||||
<th>version</th>
|
||||
<th>name_version</th>
|
||||
<th>date_accept</th>
|
||||
<th>__index</th>
|
||||
<th width="5%">date_nop</th>
|
||||
<th width="5%">date_end</th>
|
||||
<th>is_easy</th>
|
||||
<th>Компонентов</th>
|
||||
<th width="12%">additional_agreement</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<cfoutput query="qService">
|
||||
<tr>
|
||||
<td class="c"><a href="deal_service.cfm?__id=#__id#&#tr.fwx#" title="__id">#__index#</a></td>
|
||||
<!--- <td class="c">#__name#</td> --->
|
||||
<td class="l">#user_description#</td>
|
||||
<td class="c">#cnt#</td>
|
||||
<td class="c">#discount#</td>
|
||||
<td class="r">#nFmt(line_cost)#</td>
|
||||
<td class="l">
|
||||
#abstractive_service_code#.#modifier_code#<!--- <cfswitch expression=#type#>
|
||||
<cfcase value=1>-i</cfcase>
|
||||
<cfcase value=2>-f</cfcase>
|
||||
<cfcase value=3>-m</cfcase>
|
||||
</cfswitch> --->
|
||||
</td>
|
||||
<td class="c">#type#</td>
|
||||
<td class="c">#is_actual#</td>
|
||||
<td class="c">#hash#</td>
|
||||
<td class="c">#version#</td>
|
||||
<td class="c">#name_version#</td>
|
||||
<td class="c">#date_accept#</td>
|
||||
<td class="c">#__index#</td>
|
||||
<td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td>
|
||||
<td class="c">#dateFormat(date_end,'YYYY-MM-DD')#</td>
|
||||
<td class="c">#is_easy#</td>
|
||||
<td class="c">#param_cnt#</td>
|
||||
|
||||
<!--- <td class="c">#additional_agreement_uid#</td> --->
|
||||
<td class="c"><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a></td>
|
||||
</tr>
|
||||
</cfoutput>
|
||||
</table>
|
||||
|
||||
</cfif>
|
||||
<layout:page section="footer"/>
|
||||
Reference in New Issue
Block a user