033 improvements

This commit is contained in:
2026-04-02 18:31:08 +03:00
parent 997813d115
commit 353f5ce5c2
5 changed files with 407 additions and 47 deletions
+6 -6
View File
@@ -75,7 +75,13 @@
<!--- global settings --->
<cfset request.RECORDS_PER_PAGE=500/>
<cfset request.APP_VERSION="0.00.033"/>
<cfset request.STAND=getStand()/>
<cflock scope="application" type="readonly" timeout=3>
<cfset request.APP_NAME=this.Name/>
</cflock>
<!--- <cfdump var=#GetApplicationSettings()#/> --->
@@ -96,13 +102,7 @@
<!--- <cfdump var=#this.datasources#/> --->
<cfset request.RECORDS_PER_PAGE=500/>
<cfset request.APP_VERSION="0.00.032"/>
<cfset request.STAND=getStand()/>
<cflock scope="application" type="readonly" timeout=3>
<cfset request.APP_NAME=this.Name/>
</cflock>
<!--- application constants --->
+254
View File
@@ -0,0 +1,254 @@
<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# <a href="contragent.cfm?__id=#d.__id#&#tr.fwx#">подробнее...</a></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="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.__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
,p.price
,p.cnt as p_cnt
,p.ed_izm
,p.code
,p.discount as p_discount
,p.__id as p_uid
,p.name
,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)
join elma.service_parametrs p ON (p.__id = ANY (siv.params) AND p."__deletedAt" IS NULL)
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
AND a.is_actual
AND date_nop <= CURRENT_TIMESTAMP
AND COALESCE(date_end,CURRENT_TIMESTAMP) >= CURRENT_TIMESTAMP
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="20%">user_description</th>
<th width="25%">Компоненты</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>__index</th> --->
<th width="5%">date_nop</th>
<th width="5%">date_end</th>
<th width="7%">additional_agreement</th>
</tr>
</thead>
<cfoutput query="qService" group="__index">
<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>
<table class="wide">
<cfset cost=0/>
<cfoutput group="p_uid">
<cfif p_cnt NEQ 0>
<tr>
<td class="nw">#code#</td>
<td>#name#</td>
<td>#p_cnt#</td>
<td>#ed_izm#</td>
<td class="r nw">#nFmt(price,3)#</td>
<td class="r">#p_discount#%</td>
</tr>
<cfset cost+=price*p_cnt*(100-(isNumeric(p_discount)?p_discount:0))/100 />
</cfif>
</cfoutput>
</table>
</td>
<td class="c">#cnt#</td>
<!--- <td class="c">#discount#%</td> --->
<td class="r">#nFmt(cost*cnt*(100-(isNumeric(discount)?discount:0))/100)#</td>
<td class="l">
#abstractive_service_code#.#modifier_code#
</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">#__index#</td> --->
<td class="c">#dateFormat(date_nop,'YYYY-MM-DD')#</td>
<td class="c<cfif isDate(date_end) AND date_end LT Now()> err</cfif>">#dateFormat(date_end,'YYYY-MM-DD')#</td>
<td class="c"><a href="additional_agreement.cfm?__id=#additional_agreement_uid#&#tr.fwx#">#additional_agreement#</a></td>
</tr>
</cfoutput>
</table>
<!--- ----------------------------------------------------------------- --->
<!--- ----------------------------------------------------------------- --->
<!--- ----------------------------------------------------------------- --->
</cfif><!--- len(d.__id) --->
<layout:page section="footer"/>
+50 -37
View File
@@ -5,12 +5,10 @@
<cfimport prefix="layout" taglib="layout"/>
</cfsilent>
<m:prepare_ls entity="crm2cloud" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
<m:prepare_ls entity="crm2cloud" settingsKey="crm2cloud" accessObject="" pageInfoOut="pageInfo" trackOut="tr"/>
<cfquery name="qReconciliation">
<cfquery name="qRead">
WITH
status(status, status_id, probability_pc) as (VALUES
('Закрыта неуспешно',7,0),('Закрыта успешно',6,100),('Договор подписан',5,100),('Договор на подписании',15,90),('Договор на согласовании',12,70),
@@ -56,7 +54,7 @@ stair as ( -- рабочая лесенка (инстансы строк, име
select * FROM (
SELECT *,
MIN(dt_from) OVER (PARTITION BY line_key ORDER BY deal_index desc) running_min_dt
FROM line --WHERE probability_pc > 0
FROM line WHERE probability_pc > 0
) t
WHERE t.dt_from = t.running_min_dt
AND t.dt_to > CURRENT_TIMESTAMP OR t.dt_to IS NULL
@@ -128,9 +126,12 @@ select
<d:field title="CPU Elma">c.quantity as cpu_sold</d:field>
<d:field title="CPU Cloud">a.cpu as cpu_alloc</d:field>
<d:field title="CPU Cloud ON">a.cpu_on as cpu_alloc_on</d:field>
<d:field title="Коды Дисков">d.quantity as disk_sold</d:field>
<d:field title="Диски GB Elma">da.disk_alloc</d:field>
<d:field title="Диски Cloud">d.codes as disk_codes</d:field>
<d:field title="Коды Дисков">d.codes as disk_codes</d:field>
<d:field title="Диски GB Elma">d.quantity as disk_sold</d:field>
<d:field title="Диски Cloud">da.disk_alloc</d:field>
<d:field>z.__name as alloc_company</d:field>
<d:field>z.__id as alloc_company_uid</d:field>
</d:field_set>
from sold_ram r
join deal_stat ds on (r.wz=ds.wz)
@@ -138,18 +139,20 @@ join sold_cpu c on (r.wz=c.wz)
left join sold_disk d on (r.wz=d.wz)
full join alloc a on (r.wz=a.wz)
left join disk_alloc da on (a.wz=da.wz)
left join elma.companies z on (lower(a.wz)=lower(z.id_klienta))
where 1=1 <m:filter_build filter=#pageInfo.settings.filter#/>
order by 1,3
</cfquery>
<!--- QoQ does not support join syntax, at least of Lucee 5.4--->
<cfif isDefined("output_xls")>
<layout:xml qRead=#qReconciliation# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/>
<layout:xml qRead=#qRead# titleMap=#titleMap# filename="#pageInfo.entity#.xml"/>
<cfabort/>
</cfif><cfif isDefined("output_json")>
<layout:json qRead=#qReconciliation# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
<layout:json qRead=#qRead# titleMap=#titleMap# filename="#pageInfo.entity#.json"/>
<cfabort/>
</cfif><!---
---><layout:page section="header" pageInfo=#pageInfo#>
@@ -157,16 +160,13 @@ order by 1,3
<layout:attribute name="title">
<cfoutput><b>Сверка CRM - Cloud</b></cfoutput>
</layout:attribute>
<layout:attribute name="controls">
<!---skip filter link, filter is not implemented--->
<!---<layout:language_switch/>--->
</layout:attribute>
</layout:page>
<!--- <cfdump var=#qReconciliation# abort=true/> --->
<!--- <cfdump var=#qRead# abort=true/> --->
<cfoutput>
<!--- <form method="post" action="">
<!---<cfoutput> <form method="post" action="">
Период с <input type="text" name="dt_start" value="#dateFormat(dt_start,'YYYY-MM-DD')#"/>
по <input type="text" name="dt_finish" value="#dateFormat(dt_finish,'YYYY-MM-DD')#"/>
<input type="submit" style="cursor:pointer;"/>
@@ -179,30 +179,37 @@ VCD Storage: <b>#dateFormat(qStorageAge.dt_load,'YYYY-MM-DD')# #timeFormat(qStor
S3 хранение: <b>#dateFormat(qS3VolAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3VolAge.dt_load,'HH:MM:SS')#</b>
S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-MM-DD')# #timeFormat(qS3OpsTrfAge.dt_load,'HH:MM:SS')#</b>
--->
<br/>
<!--- <br/>
<a href="#request.thisPage#?output_xls" title="экспорт в Excel" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/xls.gif" style="vertical-align:text-bottom;"/></a>
<a href="#request.thisPage#?output_json" title="экспорт в json" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/json.svg" style="vertical-align:text-bottom;" width="13" height="13"/></a>
</cfoutput>
<a href="#request.thisPage#?output_json" title="экспорт в json" style="margin-left:.5em; height:100%;" target="_blank"><img src="img/json.svg" style="vertical-align:text-bottom;" width="13" height="13"/></a></cfoutput>
<br/> --->
<layout:grid_summary
recordCount=#qRead.recordCount#
footerOut="gridFooter"
excelLink="Yes"
jsonLink="Yes"
/>
<table class="worktable">
<thead>
<layout:grid_head titleMap=#titleMap# sortArray=#pageInfo.settings.sort.sortArray#>
<th width="7%"><layout:column_head name="wz_sold"/></th>
<th width="5%"><layout:column_head name="wz_sold"/></th>
<th width="10%"><layout:column_head name="client_sold"/></th>
<th width="7%"><layout:column_head name="wz_alloc"/></th>
<th width="5%"><layout:column_head name="wz_alloc"/></th>
<th width="3%"><layout:column_head name="status_ids"/></th>
<th width="15%"><layout:column_head name="ram_codes"/></th>
<th width="10%"><layout:column_head name="ram_codes"/></th>
<th width="3%"><layout:column_head name="ram_sold"/></th>
<th width="3%"><layout:column_head name="ram_alloc"/></th>
<th width="3%"><layout:column_head name="ram_alloc_on"/></th>
<th width="15%"><layout:column_head name="cpu_codes"/></th>
<th width="10%"><layout:column_head name="cpu_codes"/></th>
<th width="3%"><layout:column_head name="cpu_sold"/></th>
<th width="3%"><layout:column_head name="cpu_alloc"/></th>
<th width="3%"><layout:column_head name="cpu_alloc_on"/></th>
<th width="15%"><layout:column_head name="disk_codes"/></th>
<th width="10%"><layout:column_head name="disk_codes"/></th>
<th width="3%"><layout:column_head name="disk_sold"/></th>
<th width="3%"><layout:column_head name="disk_alloc"/></th>
@@ -211,28 +218,34 @@ S3 операции и трафик: <b>#dateFormat(qS3OpsTrfAge.dt_load,'YYYY-M
<cfflush/>
<cfoutput query="qReconciliation">
<cfoutput query="qRead">
<tr>
<td>#wz_sold#</td>
<td><a href="contragent.cfm?__id=#company_uid#&#tr.fwx#">#client_sold#</a></td>
<td>
<cfif len(wz_sold)>
<a href="contragent_rpt.cfm?__id=#company_uid#&#tr.fwx#">#client_sold#</a>
<cfelse>
<a href="contragent_rpt.cfm?__id=#alloc_company_uid#&#tr.fwx#">#alloc_company#</a>
</cfif>
</td>
<td>#wz_alloc#</td>
<td>#status_ids#</td>
<td>#ram_codes#</td>
<td>#ram_sold#</td>
<td>#ram_alloc#</td>
<td>#ram_alloc_on#</td>
<td class="r"<cfif ram_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#ram_sold#</td>
<td class="r"<cfif ram_sold LT ram_alloc> style="background:lightcoral;"</cfif>>#ram_alloc#</td>
<td class="r"<cfif ram_sold LT ram_alloc_on> style="background:lightcoral;"</cfif>>#ram_alloc_on#</td>
<td>#cpu_codes#</td>
<td>#cpu_sold#</td>
<td>#cpu_alloc#</td>
<td>#cpu_alloc_on#</td>
<td class="r"<cfif cpu_sold GT ram_alloc> style="background:lightgreen;"</cfif>>#cpu_sold#</td>
<td class="r"<cfif cpu_sold LT cpu_alloc> style="background:lightcoral;"</cfif>>#cpu_alloc#</td>
<td class="r"<cfif cpu_sold LT cpu_alloc_on> style="background:lightcoral;"</cfif>>#cpu_alloc_on#</td>
<td>#disk_codes#</td>
<td>#disk_sold#</td>
<td>#disk_alloc#</td>
<td class="r"<cfif disk_sold GT disk_alloc> style="background:lightgreen;"</cfif>>#disk_sold#</td>
<td class="r"<cfif disk_sold LT disk_alloc> style="background:lightcoral;"</cfif>>#disk_alloc#</td>
</tr>
+92
View File
@@ -0,0 +1,92 @@
<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">
<m:prepare_filter entity="crm2cloud" accessObject="" lsPage="crm2cloud" pageInfoOut="pageInfo" trackOut="tr"/>
<m:filter_settings target="crm2cloud"><!---*** вводит в заблуждение--->
<m:filterparam filter=#filter# param="contragent_id" ftype="guid" compare="EQ" field="z.__id" default=""/>
<m:filterparam filter=#filter# param="contragent" ftype="string" compare="LIKE%" field="z.__name" default=""/>
<m:filterparam filter=#filter# param="wz" ftype="string" compare="LIKE%" field="z.id_klienta" default=""/>
</m:filter_settings>
<cfif isDefined("resetAndClose") or isDefined("saveAndClose")>
<cflocation url="#tr.backUrl#" addtoken="No"/>
</cfif>
</m:silent><!--- ----------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------
---><layout:page section="header" pageInfo=#pageInfo#>
<layout:attribute name="title"><cfoutput>Сверка - фильтр</cfoutput></layout:attribute>
</layout:page>
<script type="text/javascript"/>
$(document).ready(function() {
try {
$("#contragent_id").searchable({maxMultiMatch: 50});
} catch (e) {alert(e)}
});
</script>
<cfoutput>
<input type="hidden" name="track" value="#tr.self#"/>
<div class="detail">
<div class="tr">
<div class="th"></div>
<div class="td">
<button type="button" name="reset" onClick="document.location.href='#request.thisPage#?reset=yes&track=#tr.self#'">#i18("Очистить","Clear")#</button>
</div>
</div>
<div class="tr">
<div class="th">Контрагент</div>
<div class="td">
<input type="text" name="contragent" value="#contragent#" size="50"/>
<i>#i18("по вхождению подстроки","by substring")#</i>
</div>
</div>
<div class="tr">
<div class="th">WZ</div>
<div class="td">
<input type="text" name="wz" value="#wz#" size="50"/>
<i>#i18("по вхождению подстроки","by substring")#</i>
</div>
</div>
<div class="tr">
<div class="th">Контрагент</div>
<div class="td" style="vertical-align:top;">
<cfquery name="qList">
select __id::text as __id, __name, id_klienta
from elma.companies
order by __name
</cfquery>
<!--- <cfdump var=#qList#/> --->
<c:combo
query=#qList#
combo="contragent_id"
id="contragent_id"
key="__id"
displayf="##__name## ##id_klienta##"
selected=#contragent_id#
empty=""
/>
</div>
</div>
</div><!--- detail --->
</cfoutput>
<layout:page section="footer" closeForm="Yes"/>
<!--- <cfdump var=#filter#> --->
+3 -2
View File
@@ -1,12 +1,13 @@
<cfsilent>
<!--- v0.03 20260402--->
<cfimport prefix="m" taglib="../lib"/>
<cfimport prefix="c" taglib="../lib/controls"/>
<cfparam name="ATTRIBUTES.useSummary" default="yes"/>
<cfparam name="ATTRIBUTES.addtionalUrlParams" type="string" default=""/>
<cfparam name="ATTRIBUTES.self" default=""/>
<cfparam name="ATTRIBUTES.recordCount" default="0"/>
<cfparam name="ATTRIBUTES.totalCount" default="0"/>
<cfparam name="ATTRIBUTES.recordCount" default="-1"/>
<cfparam name="ATTRIBUTES.totalCount" default="-1"/>
<cfparam name="ATTRIBUTES.recordsPerPage" default="500"/>
<cfparam name="ATTRIBUTES.footerOut" default=""/>
<cfparam name="ATTRIBUTES.excelLink" default="No"/>