Esempio n. 1
0
def analyseSale_html():
    if request.method == 'POST':
        result1 = ""
        resultTuple1 = NikeHandler.analyseSaleDataBySeason(request.form['season'],request.form['year'],request.form['region'])
        result1=Markup('<script>var pieDataSex1 = [{value: %s, color:"#F7464A", \
                            highlight: "#FF5A5E", label: "Level 1"},{value: %s, color: "#46BFBD", \
                            highlight: "#5AD3D1", label: "Level 2"},{value: %s, color: "#F08080", \
                            highlight: "#FA8072", label: "Level 3"}]; \
                            window.onload = function(){ \
                            var ctSex1 = document.getElementById("chart-area").getContext("2d"); \
                            window.myPie = new Chart(ctSex1).Pie(pieDataSex1); };</script>'%(resultTuple1[0],resultTuple1[1],resultTuple1[2]))        
        return render_template('AnalyseSale.html',result1=result1)

    else:
        return render_template('AnalyseSale.html')
Esempio n. 2
0
def forecastSale_html():
    if request.method == "POST":
        result = ""
        resultList = NikeHandler.predictSaleBySeason(int(request.form['year']),request.form['region'])
        result = Markup('<script> var data = {labels: ["Q 1", "Q 2", "Q 3", \
                        "Q 4", ],datasets: [{label: "Level1", \
                                fillColor: "rgba(252,159,159,0.2)", \
                                strokeColor: "rgba(252,159,159,1)", \
                                pointColor: "rgba(252,159,159,1)", \
                                pointStrokeColor: "#fff", \
                                pointHighlightFill: "#fff", \
                                pointHighlightStroke: "rgba(220,220,220,1)", \
                                data: [%s, %s, %s, %s] \
                            },{label: "Level2", \
                                fillColor: "rgba(115,208,115,0.2)", \
                                strokeColor: "rgba(115,208,115,1)", \
                                pointColor: "rgba(115,208,115,1)", \
                                pointStrokeColor: "#fff", \
                                pointHighlightFill: "#fff", \
                                pointHighlightStroke: "rgba(151,187,205,1)", \
                                data: [%s, %s, %s, %s]\
                                },{label: "Level3", \
                                fillColor: "rgba(151,187,205,0.2)", \
                                strokeColor: "rgba(151,187,205,1)", \
                                pointColor: "rgba(151,187,205,1)", \
                                pointStrokeColor: "#fff", \
                                pointHighlightFill: "#fff", \
                                pointHighlightStroke: "rgba(151,187,205,1)", \
                                data: [%s, %s, %s, %s]\
                            }]};window.onload = function(){ \
                    var ctx = document.getElementById("chart-area").getContext("2d"); \
                    window.myLineChart = new Chart(ctx).Line(data); \
                    }; </script>' % (str(resultList[0][0]), str(resultList[1][0]), str(resultList[2][0]), str(resultList[3][0]),
                                      str(resultList[0][1]), str(resultList[1][1]), str(resultList[2][1]), str(resultList[3][1]),   
                                      str(resultList[0][2]), str(resultList[1][2]), str(resultList[2][2]), str(resultList[3][2])))
        return render_template('ForecastSale.html', result = result)
    else:
        return render_template('ForecastSale.html')
Esempio n. 3
0
def analyseCRM_html():
    if request.method == "POST":

        result1 = ""
        resultTuple1 = NikeHandler.analyseCRMDataBySeasonAndSex(request.form['season'],request.form['year'],request.form['region'])
        resultTuple3 = NikeHandler.analyseCRMDataBySeasonAndAge(request.form['season'],request.form['year'],request.form['region'])
        resultTuple2 = NikeHandler.analyseCRMDataBySeasonAndStore(request.form['season'],request.form['year'],request.form['region'])


        if request.form['standard'] == 'gender':

            string='<script>var pieDataSex1 = [{value: %s, color:"#F7464A", \
                            highlight: "#FF5A5E", label: "Female"},{value: %s, color: "#46BFBD", \
                            highlight: "#5AD3D1", label: "Male"}]; \
                            window.onload = function(){ \
                            var ctSex1 = document.getElementById("chart-area").getContext("2d"); \
                            window.myPie = new Chart(ctSex1).Pie(pieDataSex1); };</script>'

            if request.form['level'] == '1':

             
                result1 = Markup(string % (resultTuple1[0][0], resultTuple1[1][0]))
                return render_template('AnalyseCRM.html', result1 = result1)

            elif request.form['level'] == '2':

                result1 = Markup(string % (resultTuple1[0][1], resultTuple1[1][1]))
                return render_template('AnalyseCRM.html', result1 = result1)
                

            else:
                result1 = Markup(string % (resultTuple1[0][2], resultTuple1[1][2]))
                return render_template('AnalyseCRM.html', result1 = result1)


        elif request.form['standard'] == 'store':

            string='<script>var pieDataSex1 = [{value: %s, color:"#F7464A", \
                            highlight: "#FF5A5E", label: "Exclusive Shop"},{value: %s, color: "#46BFBD", \
                            highlight: "#5AD3D1", label: "Distributor"},{value: %s, color: "#1E90FF", \
                            highlight: "#191970", label: "Outlet"}]; \
                            window.onload = function(){ \
                            var ctSex1 = document.getElementById("chart-area").getContext("2d"); \
                            window.myPie = new Chart(ctSex1).Pie(pieDataSex1); };</script>'

            if request.form['level'] == '1':
                result1 = Markup(string % (resultTuple2[0][0], resultTuple2[1][0],resultTuple2[2][0]))
                return render_template('AnalyseCRM.html', result1 = result1)

            elif request.form['level'] == '2':

                result1 = Markup(string % (resultTuple2[0][1], resultTuple2[1][1],resultTuple2[2][1]))
                return render_template('AnalyseCRM.html', result1 = result1)
                

            else:
                result1 = Markup(string % (resultTuple2[0][2], resultTuple2[1][2],resultTuple2[2][2]))
                return render_template('AnalyseCRM.html', result1 = result1)    

        elif request.form['standard'] == 'age':

            string='<script>var pieDataSex1 = [{value: %s, color:"#F7464A", \
                            highlight: "#FF5A5E", label: "0-12"},{value: %s, color: "#46BFBD", \
                            highlight: "#5AD3D1", label: "13-24"},{value: %s, color: "#1E90FF", \
                            highlight: "#191970", label: "25-36"},{value: %s, color: "#F08080", \
                            highlight: "#FA8072", label: "37-48"},{value: %s, color: "#808080", \
                            highlight: "#696969", label: "49-60"},{value: %s, color: "#66CDAA", \
                            highlight: "#20B2AA", label: "60~"}]; \
                            window.onload = function(){ \
                            var ctSex1 = document.getElementById("chart-area").getContext("2d"); \
                            window.myPie = new Chart(ctSex1).Pie(pieDataSex1); };</script>'

            if request.form['level'] == '1':
                result1 = Markup(string % (resultTuple3[0][0], resultTuple3[1][0],resultTuple3[2][0],
                                resultTuple3[3][0], resultTuple3[4][0],resultTuple3[5][0]))
                return render_template('AnalyseCRM.html', result1 = result1)

            elif request.form['level'] == '2':
                result1 = Markup(string % (resultTuple3[0][1], resultTuple3[1][1],resultTuple3[2][1],
                                resultTuple3[3][1], resultTuple3[4][1],resultTuple3[5][1]))
                return render_template('AnalyseCRM.html', result1 = result1)

            else:
                result1 = Markup(string % (resultTuple3[0][2], resultTuple3[1][2],resultTuple3[2][2],
                                resultTuple3[3][2], resultTuple3[4][2],resultTuple3[5][2]))
                return render_template('AnalyseCRM.html', result1 = result1)
                                   
        else:
            return render_template('AnalyseCRM.html')
    else:
        return render_template('AnalyseCRM.html')
Esempio n. 4
0
def forecastCRM_html():
    if request.method == "POST":
        result = ""
        resultList = NikeHandler.predictCRMBySeason(int(request.form['year']),request.form['region'],request.form['type'])

        string='<script> var data = {labels: ["Q 1", "Q 2", "Q 3", \
                                    "Q 4", ],datasets: [{label: "Level1", \
                                    fillColor: "rgba(252,159,159,0.2)", \
                                    strokeColor: "rgba(252,159,159,1)", \
                                    pointColor: "rgba(252,159,159,1)", \
                                    pointStrokeColor: "#fff", \
                                    pointHighlightFill: "#fff", \
                                    pointHighlightStroke: "rgba(220,220,220,1)", \
                                    data: [%s, %s, %s, %s] \
                                },{label: "Level2", \
                                    fillColor: "rgba(115,208,115,0.2)", \
                                    strokeColor: "rgba(115,208,115,1)", \
                                    pointColor: "rgba(115,208,115,1)", \
                                    pointStrokeColor: "#fff", \
                                    pointHighlightFill: "#fff", \
                                    pointHighlightStroke: "rgba(151,187,205,1)", \
                                    data: [%s, %s, %s, %s]\
                                    },{label: "Level3", \
                                    fillColor: "rgba(151,187,205,0.2)", \
                                    strokeColor: "rgba(151,187,205,1)", \
                                    pointColor: "rgba(151,187,205,1)", \
                                    pointStrokeColor: "#fff", \
                                    pointHighlightFill: "#fff", \
                                    pointHighlightStroke: "rgba(151,187,205,1)", \
                                    data: [%s, %s, %s, %s]\
                                }]};window.onload = function(){ \
                                var ctx = document.getElementById("chart-area").getContext("2d"); \
                                window.myLineChart = new Chart(ctx).Line(data); \
                                }; </script>'

        if request.form['type'] == "male":
            result = Markup(string % (str(resultList[0][0]), str(resultList[2][0]), str(resultList[4][0]), str(resultList[6][0]),
                                          str(resultList[0][1]), str(resultList[2][1]), str(resultList[4][1]), str(resultList[6][1]),   
                                          str(resultList[0][2]), str(resultList[2][2]), str(resultList[4][2]), str(resultList[6][2])))
            return render_template('ForecastCRM.html', result = result)

        elif request.form['type'] == "female":
            result = Markup(string % (str(resultList[1][0]), str(resultList[3][0]), str(resultList[5][0]), str(resultList[7][0]),
                                          str(resultList[1][1]), str(resultList[3][1]), str(resultList[5][1]), str(resultList[7][1]),   
                                          str(resultList[1][2]), str(resultList[3][2]), str(resultList[5][2]), str(resultList[7][2])))
            return render_template('ForecastCRM.html', result = result)

        elif request.form['type'] == "1":
            result = Markup(string % (str(resultList[0][0]), str(resultList[6][0]), str(resultList[12][0]), str(resultList[18][0]),
                                          str(resultList[0][1]), str(resultList[6][1]), str(resultList[12][1]), str(resultList[18][1]),   
                                          str(resultList[0][2]), str(resultList[6][2]), str(resultList[12][2]), str(resultList[18][2])))
            return render_template('ForecastCRM.html', result = result)
        
        elif request.form['type'] == "2":
            result = Markup(string % (str(resultList[1][0]), str(resultList[7][0]), str(resultList[13][0]), str(resultList[19][0]),
                                          str(resultList[1][1]), str(resultList[7][1]), str(resultList[13][1]), str(resultList[19][1]),   
                                          str(resultList[1][2]), str(resultList[7][2]), str(resultList[13][2]), str(resultList[19][2])))
            return render_template('ForecastCRM.html', result = result)

        elif request.form['type'] == "3":
            result = Markup(string % (str(resultList[2][0]), str(resultList[8][0]), str(resultList[14][0]), str(resultList[20][0]),
                                          str(resultList[2][1]), str(resultList[8][1]), str(resultList[14][1]), str(resultList[20][1]),   
                                          str(resultList[2][2]), str(resultList[8][2]), str(resultList[14][2]), str(resultList[20][2])))
            return render_template('ForecastCRM.html', result = result)

        elif request.form['type'] == "4":
            result = Markup(string % (str(resultList[3][0]), str(resultList[9][0]), str(resultList[15][0]), str(resultList[21][0]),
                                          str(resultList[3][1]), str(resultList[9][1]), str(resultList[15][1]), str(resultList[21][1]),   
                                          str(resultList[3][2]), str(resultList[9][2]), str(resultList[15][2]), str(resultList[21][2])))
            return render_template('ForecastCRM.html', result = result)

        elif request.form['type'] == "5":
            result = Markup(string % (str(resultList[4][0]), str(resultList[10][0]), str(resultList[16][0]), str(resultList[22][0]),
                                          str(resultList[4][1]), str(resultList[10][1]), str(resultList[16][1]), str(resultList[22][1]),   
                                          str(resultList[4][2]), str(resultList[10][2]), str(resultList[16][2]), str(resultList[22][2])))
            return render_template('ForecastCRM.html', result = result)

        elif request.form['type'] == "6":
            result = Markup(string % (str(resultList[5][0]), str(resultList[11][0]), str(resultList[17][0]), str(resultList[23][0]),
                                          str(resultList[5][1]), str(resultList[11][1]), str(resultList[17][1]), str(resultList[23][1]),   
                                          str(resultList[5][2]), str(resultList[11][2]), str(resultList[17][2]), str(resultList[23][2])))
            return render_template('ForecastCRM.html', result = result)

        elif request.form['type'] == "A":
            result = Markup(string % (str(resultList[0][0]), str(resultList[1][0]), str(resultList[2][0]), str(resultList[3][0]),
                                          str(resultList[0][1]), str(resultList[1][1]), str(resultList[2][1]), str(resultList[3][1]),   
                                          str(resultList[0][2]), str(resultList[1][2]), str(resultList[2][2]), str(resultList[3][2])))
            return render_template('ForecastCRM.html', result = result)

        elif request.form['type'] == "B":
            result = Markup(string % (str(resultList[4][0]), str(resultList[5][0]), str(resultList[6][0]), str(resultList[7][0]),
                                          str(resultList[4][1]), str(resultList[5][1]), str(resultList[6][1]), str(resultList[7][1]),   
                                          str(resultList[4][2]), str(resultList[5][2]), str(resultList[6][2]), str(resultList[7][2])))
            return render_template('ForecastCRM.html', result = result)

        elif request.form['type'] == "C":
            result = Markup(string % (str(resultList[8][0]), str(resultList[9][0]), str(resultList[10][0]), str(resultList[11][0]),
                                          str(resultList[8][1]), str(resultList[9][1]), str(resultList[10][1]), str(resultList[11][1]),   
                                          str(resultList[8][2]), str(resultList[9][2]), str(resultList[10][2]), str(resultList[11][2])))
            return render_template('ForecastCRM.html', result = result)


        else:
            return render_template('ForecastCRM.html')
    else:
        return render_template('ForecastCRM.html')