026 ceiling
This commit is contained in:
@@ -4,64 +4,7 @@
|
||||
<cfset hours=dateDiff('h',dt_start,dt_finish)/>
|
||||
<cfset tenant_wz_index=val(mid(request.auth.wz,3,5))/><!--- cut off WZ --->
|
||||
|
||||
<!--- <cffunction name="snake2camel"
|
||||
returntype="string"
|
||||
output="false"
|
||||
hint="convert snake style name to camel style name">
|
||||
<cfargument name="snake" type="string" required="true" />
|
||||
<cfreturn #reReplace(ARGUMENTS.snake,"_([a-z])","\u\1","ALL")#/>
|
||||
</cffunction>
|
||||
|
||||
<cffunction name="camel2snake"
|
||||
returntype="string"
|
||||
output="false"
|
||||
hint="convert camel style name to snake style name">
|
||||
<cfargument name="camel" type="string" required="true" />
|
||||
<cfreturn #reReplace(ARGUMENTS.camel,"([A-Z])","_\l\1","ALL")#/>
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="iso8601dtFormat"
|
||||
returntype="string"
|
||||
output="false"
|
||||
hint="formates date and time like this: 2023-12-18T15:41:42.516+0300">
|
||||
<cfargument name="input" required="true" />
|
||||
<cfreturn "#dateFormat( input, "yyyy-mm-dd" )#T#timeFormat( input, "HH:mm:ss.lXX" )#"/>
|
||||
</cffunction>
|
||||
|
||||
|
||||
<cffunction name="query2array"
|
||||
output="false"
|
||||
hint="print query in json format as array of structures">
|
||||
<cfargument name="qry" type="query" required="true"/><!--- column names should not contain commas --->
|
||||
<cfargument name="convertSnakeToCamel" type="boolean" default=true/>
|
||||
|
||||
<cfset var columnsIn=#arguments.qry.columnList()#/>
|
||||
<cfset var columnsOut=""/>
|
||||
|
||||
<cfif arguments.convertSnakeToCamel>
|
||||
<cfloop list=#columnsIn# item="col">
|
||||
<cfset columnsOut=listAppend(columnsOut,snake2camel(lcase(col)))/>
|
||||
</cfloop>
|
||||
|
||||
<cfset var outArray=arrayNew(1)/>
|
||||
<!--- //copy fields to structure, renaming fields, this preserves data type --->
|
||||
<cfloop query=#arguments.qry#>
|
||||
<cfset var structRow=structNew()/>
|
||||
<cfloop index="i" from="1" to=#listLen(columnsOut)#>
|
||||
<cfset structInsert(structRow,"#listGetAt(#columnsOut#,i)#",arguments.qry["#listGetAt(#columnsIn#,i)#"])/>
|
||||
</cfloop>
|
||||
<cfset arrayAppend(outArray,structRow)/>
|
||||
</cfloop>
|
||||
<!--- <cfdump var=#outArray#/> --->
|
||||
<cfreturn outArray/>
|
||||
<cfelse>
|
||||
<cfreturn #arguments.qry.reduce((result, row) => {
|
||||
result.append(row);
|
||||
return result;
|
||||
}, [])#/>
|
||||
</cfif>
|
||||
</cffunction> --->
|
||||
|
||||
<cfscript>
|
||||
function gaussianRound(numeric number, numeric precision = 0) {
|
||||
@@ -117,7 +60,7 @@ function gaussianRound(numeric number, numeric precision = 0) {
|
||||
<!--- <cfset var accum_metric_component = 0/> --->
|
||||
|
||||
<cfset "temp.service"=["svc"="#svc#"
|
||||
,"serviceСode"="#service_code#"
|
||||
,"serviceCode"="#service_code#"
|
||||
,"serviceCustomName"="#serviceCustomName#"
|
||||
<!--- ,"note"="#(serviceHash EQ '')?'не найдено в договоре':''#" --->
|
||||
,"hash"="#serviceHash#"
|
||||
@@ -155,7 +98,7 @@ function gaussianRound(numeric number, numeric precision = 0) {
|
||||
</cfoutput><!--- dimension_1 --->
|
||||
|
||||
<!--- считаем, что free_tier NOT NULL (вместо NULL 0) --->
|
||||
<cfset var payable_metric_dimension_1 = (isNumeric(accum_metric_dimension_1))? round(max(accum_metric_dimension_1 - free_tier, 0),3):javaCast("null",0)/>
|
||||
<cfset var payable_metric_dimension_1 = (isNumeric(accum_metric_dimension_1))? max(ceiling(accum_metric_dimension_1) - free_tier, 0):javaCast("null",0)/>
|
||||
<cfset var cost_dimension_1 = precisionEvaluate("gaussianRound(payable_metric_dimension_1*gaussianRound(discounted_price, 2), 2)")/>
|
||||
<cfset accum_cost_svc = precisionEvaluate("accum_cost_svc + cost_dimension_1")/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user