Commit 0747710b authored by Frank Bergmann's avatar Frank Bergmann

- Sales Pipeline experiments

parent 3e48553b
<div id=@diagram_id@></div>
<script type='text/javascript'>
// Ext.Loader.setConfig({enabled: true});
Ext.Loader.setPath('Ext.ux', '/sencha-v411/examples/ux');
Ext.Loader.setPath('PO.model', '/sencha-core/model');
Ext.Loader.setPath('PO.store', '/sencha-core/store');
Ext.Loader.setPath('PO.class', '/sencha-core/class');
Ext.Loader.setPath('PO.view.gantt', '/sencha-core/view/gantt');
Ext.Loader.setPath('PO.controller', '/sencha-core/controller');
Ext.require([
'Ext.data.*',
'Ext.grid.*',
'Ext.tree.*',
'PO.class.CategoryStore',
'PO.store.project.ProjectMainStore'
]);
function launchDiagram(){
var statusStore = Ext.StoreManager.get('projectStatusStore');
var projectMainStore = Ext.StoreManager.get('projectMainStore');
var store1 = Ext.create('Ext.data.JsonStore', {
fields: ['x_axis', 'y_axis', 'color', 'diameter', 'caption'],
data: [
{x_axis: 909000.00, y_axis: 60.00, color: 'blue', diameter: 95.3414914924242200, caption: 'Play House (2014-05-09)'},
{x_axis: 146400.00, y_axis: 80.00, color: 'blue', diameter: 38.2622529394179800, caption: 'Special Machine Half (2014-05-13)'},
{x_axis: 57000.00, y_axis: 50.00, color: 'blue', diameter: 23.8746727726266400, caption: 'SCRUM Generic 1 (2014-05-14)'}
]
});
function createHandler(fieldName) {
return function(sprite, record, attr, index, store) {
return Ext.apply(attr, {
radius: record.get('diameter'),
fill: record.get('color')
});
};
};
var chart = new Ext.chart.Chart({
width: 300,
height: 300,
animate: true,
store: store1,
renderTo: '@diagram_id@',
axes: [{
type: 'Numeric', position: 'left', fields: ['y_axis'], grid: true
}, {
type: 'Numeric', position: 'bottom', fields: ['x_axis']
}],
series: [{
type: 'scatter',
axis: 'left',
xField: 'x_axis',
yField: 'y_axis',
highlight: true,
markerConfig: { type: 'circle' },
renderer: createHandler('xxx'),
label: {
display: 'under',
field: 'caption',
'text-anchor': 'left',
color: '#000'
}
}]
});
};
Ext.onReady(function() {
Ext.QuickTips.init();
var statusStore = Ext.create('PO.store.project.ProjectStatusStore');
var projectMainStore = Ext.create('PO.store.project.ProjectMainStore');
var coordinator = Ext.create('PO.controller.StoreLoadCoordinator', {
stores: [
'projectStatusStore',
'projectMainStore'
],
listeners: {
load: function() {
// Check if the application was launched before
if ("boolean" == typeof this.loadedP) { return; }
// Launch the actual application.
launchDiagram();
// Mark the application as launched
this.loadedP = true;
}
}
});
});
</script>
</div>
# /packages/sencha-reporting-portfolio/lib/sales-pipeline.tcl
#
# Copyright (C) 2011 ]project-open[
#
# All rights reserved. Please check
# http://www.project-open.com/license/ for details.
# ----------------------------------------------------------------------
#
# ---------------------------------------------------------------------
# The following variables are expected in the environment
# defined by the calling /tcl/*.tcl libary:
# program_id
# diagram_width
# diagram_height
# sql Defines the columns x_axis, y_axis, color and diameter
# Create a random ID for the diagram
set diagram_id "sales_pipelin_[expr round(rand() * 100000000.0)]"
set x_axis 0
set y_axis 0
set color "yellow"
set diameter 5
set title ""
......@@ -38,6 +38,8 @@ ad_proc -public sencha_scatter_diagram {
return [string trim $result]
}
ad_proc -public sencha_milestone_tracker {
-project_id:required
{-diagram_width 300 }
......@@ -197,3 +199,28 @@ ad_proc -public sencha_main_project_colors_helper {
}
return [array get hash]
}
ad_proc -public sencha_sales_pipeline {
{-diagram_width 300 }
{-diagram_height 300 }
{-diagram_caption "" }
} {
Returns a HTML code with a Sencha diagram showing
the current projects in status "Potential", together
with presales_probability and presales_value.
} {
# Sencha check and permissions
if {![im_sencha_extjs_installed_p]} { return "" }
im_sencha_extjs_load_libraries
set params [list \
[list diagram_width $diagram_width] \
[list diagram_height $diagram_height] \
[list diagram_caption $diagram_caption]
]
set result [ad_parse_template -params $params "/packages/sencha-reporting-portfolio/lib/sales-pipeline"]
return [string trim $result]
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment