Created
March 21, 2015 18:41
-
-
Save jespoz/2df8ecf6bb20591a95f5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.contrib import admin | |
| # Register your models here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('master', '0024_sector_grupo'), | |
| ] | |
| operations = [ | |
| migrations.CreateModel( | |
| name='AccLocal', | |
| fields=[ | |
| ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
| ('codLocal', models.CharField(max_length=20)), | |
| ('clienteLocal', models.CharField(max_length=200)), | |
| ('promedio', models.FloatField(default=0)), | |
| ('desviacion', models.FloatField(default=0)), | |
| ('minimo', models.IntegerField(default=0)), | |
| ('maximo', models.IntegerField(default=0)), | |
| ('ventaPromedio', models.FloatField(default=0)), | |
| ('semCalculo', models.IntegerField(default=0)), | |
| ('categoria', models.ForeignKey(to='master.CategoriaCliente')), | |
| ('oficina', models.ForeignKey(to='master.OficinaVentas')), | |
| ('periodo', models.ForeignKey(to='master.Periodo')), | |
| ('tipoCliente', models.ForeignKey(to='master.TipoCliente')), | |
| ], | |
| options={ | |
| }, | |
| bases=(models.Model,), | |
| ), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('actions', '0001_initial'), | |
| ] | |
| operations = [ | |
| migrations.AddField( | |
| model_name='acclocal', | |
| name='preventa', | |
| field=models.CharField(default=b'', max_length=200, null=True, blank=True), | |
| preserve_default=True, | |
| ), | |
| migrations.AddField( | |
| model_name='acclocal', | |
| name='supervisor', | |
| field=models.CharField(default=b'', max_length=200, null=True, blank=True), | |
| preserve_default=True, | |
| ), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('master', '0028_localesnulos'), | |
| ('actions', '0002_auto_20150316_1036'), | |
| ] | |
| operations = [ | |
| migrations.AddField( | |
| model_name='acclocal', | |
| name='sector', | |
| field=models.ForeignKey(default=b'', blank=True, to='master.Sector', null=True), | |
| preserve_default=True, | |
| ), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('master', '0028_localesnulos'), | |
| ('actions', '0003_acclocal_sector'), | |
| ] | |
| operations = [ | |
| migrations.CreateModel( | |
| name='AnalisisDescuentoTotales', | |
| fields=[ | |
| ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
| ('codigoMaterial', models.IntegerField()), | |
| ('material', models.CharField(max_length=100)), | |
| ('conDescuento', models.IntegerField()), | |
| ('sinDescuento', models.IntegerField()), | |
| ('sobreprecio', models.IntegerField()), | |
| ('oficina', models.ForeignKey(to='master.OficinaVentas')), | |
| ('periodo', models.ForeignKey(to='master.Periodo')), | |
| ('sector', models.ForeignKey(to='master.Sector')), | |
| ], | |
| options={ | |
| }, | |
| bases=(models.Model,), | |
| ), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('master', '0028_localesnulos'), | |
| ('actions', '0004_analisisdescuentototales'), | |
| ] | |
| operations = [ | |
| migrations.CreateModel( | |
| name='AnalisisDescuentoApertura', | |
| fields=[ | |
| ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
| ('supervisor', models.CharField(default=b'', max_length=200, null=True, blank=True)), | |
| ('preventa', models.CharField(default=b'', max_length=200, null=True, blank=True)), | |
| ('codLocal', models.CharField(max_length=20)), | |
| ('clienteLocal', models.CharField(max_length=200)), | |
| ('codigoMaterial', models.IntegerField()), | |
| ('material', models.CharField(max_length=100)), | |
| ('negocio', models.CharField(max_length=100)), | |
| ('responsable', models.CharField(max_length=100)), | |
| ('uno', models.FloatField(default=0)), | |
| ('dos', models.FloatField(default=0)), | |
| ('trs', models.FloatField(default=0)), | |
| ('cuatro', models.FloatField(default=0)), | |
| ('cinco', models.FloatField(default=0)), | |
| ('seisAdiez', models.FloatField(default=0)), | |
| ('onceAveinte', models.FloatField(default=0)), | |
| ('mayorVeinte', models.FloatField(default=0)), | |
| ('categoria', models.ForeignKey(to='master.CategoriaCliente')), | |
| ('oficina', models.ForeignKey(to='master.OficinaVentas')), | |
| ('periodo', models.ForeignKey(to='master.Periodo')), | |
| ('sector', models.ForeignKey(to='master.Sector')), | |
| ], | |
| options={ | |
| }, | |
| bases=(models.Model,), | |
| ), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('actions', '0005_analisisdescuentoapertura'), | |
| ] | |
| operations = [ | |
| migrations.RenameField( | |
| model_name='analisisdescuentoapertura', | |
| old_name='trs', | |
| new_name='tres', | |
| ), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('master', '0028_localesnulos'), | |
| ('actions', '0006_auto_20150319_1027'), | |
| ] | |
| operations = [ | |
| migrations.CreateModel( | |
| name='Dispersion', | |
| fields=[ | |
| ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | |
| ('responsable', models.CharField(max_length=100)), | |
| ('negocio', models.CharField(max_length=100)), | |
| ('unidad', models.IntegerField(default=0)), | |
| ('diferencia', models.FloatField(default=0)), | |
| ('oficina', models.ForeignKey(to='master.OficinaVentas')), | |
| ('periodo', models.ForeignKey(to='master.Periodo')), | |
| ], | |
| options={ | |
| }, | |
| bases=(models.Model,), | |
| ), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('actions', '0007_dispersion'), | |
| ] | |
| operations = [ | |
| migrations.AddField( | |
| model_name='dispersion', | |
| name='codigoMaterial', | |
| field=models.IntegerField(default=0, null=True, blank=True), | |
| preserve_default=True, | |
| ), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('actions', '0008_dispersion_codigomaterial'), | |
| ] | |
| operations = [ | |
| migrations.RemoveField( | |
| model_name='dispersion', | |
| name='codigoMaterial', | |
| ), | |
| migrations.AddField( | |
| model_name='dispersion', | |
| name='material', | |
| field=models.CharField(default=b'', max_length=100, null=True, blank=True), | |
| preserve_default=True, | |
| ), | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.db import models | |
| from master.models import Periodo, OficinaVentas, TipoCliente, CategoriaCliente, Sector | |
| class AccLocal(models.Model): | |
| periodo = models.ForeignKey(Periodo) | |
| oficina = models.ForeignKey(OficinaVentas) | |
| tipoCliente = models.ForeignKey(TipoCliente) | |
| codLocal = models.CharField(max_length=20) | |
| clienteLocal = models.CharField(max_length=200) | |
| categoria = models.ForeignKey(CategoriaCliente) | |
| promedio = models.FloatField(default=0) | |
| desviacion = models.FloatField(default=0) | |
| minimo = models.IntegerField(default=0) | |
| maximo = models.IntegerField(default=0) | |
| ventaPromedio = models.FloatField(default=0) | |
| semCalculo = models.IntegerField(default=0) | |
| supervisor = models.CharField(max_length=200, default='', null=True, blank=True) | |
| preventa = models.CharField(max_length=200, default='', null=True, blank=True) | |
| sector = models.ForeignKey(Sector, default='', null=True, blank=True) | |
| class AnalisisDescuentoTotales(models.Model): | |
| periodo = models.ForeignKey(Periodo) | |
| oficina = models.ForeignKey(OficinaVentas) | |
| sector = models.ForeignKey(Sector) | |
| codigoMaterial = models.IntegerField() | |
| material = models.CharField(max_length=100) | |
| conDescuento = models.IntegerField() | |
| sinDescuento = models.IntegerField() | |
| sobreprecio = models.IntegerField() | |
| class AnalisisDescuentoApertura(models.Model): | |
| periodo = models.ForeignKey(Periodo) | |
| oficina = models.ForeignKey(OficinaVentas) | |
| supervisor = models.CharField(max_length=200, default='', null=True, blank=True) | |
| preventa = models.CharField(max_length=200, default='', null=True, blank=True) | |
| codLocal = models.CharField(max_length=20) | |
| clienteLocal = models.CharField(max_length=200) | |
| categoria = models.ForeignKey(CategoriaCliente) | |
| sector = models.ForeignKey(Sector) | |
| codigoMaterial = models.IntegerField() | |
| material = models.CharField(max_length=100) | |
| negocio = models.CharField(max_length=100) | |
| responsable = models.CharField(max_length=100) | |
| uno = models.FloatField(default=0) | |
| dos = models.FloatField(default=0) | |
| tres = models.FloatField(default=0) | |
| cuatro = models.FloatField(default=0) | |
| cinco = models.FloatField(default=0) | |
| seisAdiez = models.FloatField(default=0) | |
| onceAveinte = models.FloatField(default=0) | |
| mayorVeinte = models.FloatField(default=0) | |
| class Dispersion(models.Model): | |
| periodo = models.ForeignKey(Periodo) | |
| oficina = models.ForeignKey(OficinaVentas) | |
| responsable = models.CharField(max_length=100) | |
| negocio = models.CharField(max_length=100) | |
| unidad = models.IntegerField(default=0) | |
| diferencia = models.FloatField(default=0) | |
| material = models.CharField(max_length=100, default='', null=True, blank=True) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% extends 'maqueta.html' %} | |
| {% load humanize %} | |
| {% block title %}Accionables Nro Locales{% endblock %} | |
| {% block extrahead %} | |
| <link rel="stylesheet" href="{{ STATIC_URL }}plugins/ionicons/css/ionicons.min.css"/> | |
| <link rel="stylesheet" href="{{ STATIC_URL }}plugins/dataTable/media/css/jquery.dataTables.min.css"/> | |
| <link rel="stylesheet" href="{{ STATIC_URL }}css/estado_resultado.css"/> | |
| <link rel="stylesheet" href="{{ STATIC_URL }}css/accionables.css"/> | |
| {% endblock %} | |
| {% block content_12 %} | |
| <div class="container-fluid"> | |
| <div role="tabpanel"> | |
| <ul class="nav nav-tabs" role="tablist"> | |
| <li role="presentation" class="active"> | |
| <a href="#compra_frecuente" aria-controls="compra_frecuente" role="tab" data-toggle="tab">Compra Frecuente</a> | |
| </li> | |
| <!--<li role="presentation"> | |
| <a href="#otro" aria-controls="otro" role="tab" data-toggle="tab">Otro</a> | |
| </li>--> | |
| </ul> | |
| </div> | |
| <div class="tab-content"> | |
| <div class="filtros"> | |
| {% if periodo_anterior %} | |
| <div class="pull-left"> | |
| <a href="{% url 'accionables_locales' pk=periodo_anterior %}" class="btn btn-primary btn-xs"><< Anterior</a> | |
| </div> | |
| {% else %} | |
| <div class="pull-left"> | |
| <a href="" class="btn btn-primary btn-xs" disabled="disabled"><< Anterior</a> | |
| </div> | |
| {% endif %} | |
| {% if periodo_posterior %} | |
| <div class="pull-left" style="margin-left: 10px;"> | |
| <a href="{% url 'accionables_locales' pk=periodo_posterior %}" class="btn btn-primary btn-xs">Posterior >></a> | |
| </div> | |
| {% else %} | |
| <div class="pull-left" style="margin-left: 10px;"> | |
| <a href="" class="btn btn-primary btn-xs" disabled="disabled">Posterior >></a> | |
| </div> | |
| {% endif %} | |
| <span class="periodo"> | |
| {% for p in periodo %} | |
| {{ p.periodo__periodo }} | |
| {% endfor %} | |
| </span> | |
| <div class="pull-right"> | |
| <a href="#information" data-toggle="modal" class="btn btn-success btn-xs"><i class="fa fa-info-circle" style="padding-right: 5px;"></i>Información</a> | |
| <div class="modal fade" id="information" role="dialog"> | |
| <div class="modal-dialog" style="z-index: 9999;"> | |
| <p class="alert alert-info"> | |
| Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolor eveniet exercitationem incidunt ipsam molestias officia praesentium, reprehenderit rerum sit temporibus ut vitae voluptates? Architecto, provident rerum. Ad, alias, magnam. | |
| </p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <hr/> | |
| <div role="tabpanel" class="tab-pane active" id="compra_frecuente"> | |
| <div class="col-md-12"> | |
| <div class="pull-left"> | |
| <h1>Locales no atendidos esta semana y con movimientos en semanas anteriores</h1> | |
| </div> | |
| <div class="pull-right"> | |
| <h1 class="label label-danger"> | |
| {% for a in adicional %} | |
| Venta Adicional {{ a.suma|floatformat:0|intcomma }} $M | |
| {% endfor %} | |
| </h1> | |
| </div> | |
| </div> | |
| <div class="col-md-6"> | |
| {% for self in totales %} | |
| <section class="box_client {{ self.tipoCliente__tipo|lower }}" data-periodo="{{ self.periodo__id }}" data-id="{{ self.tipoCliente__codigo }}" style="width: {{ ancho }}%;"> | |
| <img src="{{ STATIC_URL }}img/{{ self.tipoCliente__tipo }}.png" width="20" alt=""/> | |
| <p class="header">{{ self.tipoCliente__tipo }}</p> | |
| <hr/> | |
| <section class="local"> | |
| <small>Locales</small> | |
| <span>{{ self.dcount|intcomma }}</span> | |
| </section> | |
| <section class="venta"> | |
| <small>Venta Prom.</small> | |
| {{ self.prom|floatformat:0|intcomma }} $M | |
| </section> | |
| </section> | |
| {% endfor %} | |
| <button id="generar" class="btn btn-primary hidden" type="button"> | |
| <i class="fa fa-spinner fa-spin"></i> | |
| <span>Generar Listado</span> | |
| </button> | |
| </div> | |
| <div class="col-md-6"> | |
| <table class="table table-bordered table-striped"> | |
| <thead> | |
| <th>Categoría Cliente</th> | |
| <th>Locales</th> | |
| <th>Vta. Prom</th> | |
| </thead> | |
| <tbody id="table-categories"> | |
| <td colspan="3">Debe seleccionar un Tipo de Cliente</td> | |
| </tbody> | |
| </table> | |
| </div> | |
| <div id="contenedor_list" class="table-responsive"> | |
| <table id="listado" class="table table-bordered table-striped table-responsive hidden"> | |
| <tr> | |
| <th>Supervisor</th> | |
| <th>Preventa</th> | |
| <th>Cod. Local</th> | |
| <th>Cliente Local</th> | |
| <th>Categoría</th> | |
| <th>Sector</th> | |
| <th>Promedio</th> | |
| <th>Mínimo</th> | |
| <th>Máximo</th> | |
| <th>Vta. Prom. $M</th> | |
| <th>Semanas</th> | |
| </tr> | |
| <tbody id="table-list"></tbody> | |
| </table> | |
| </div> | |
| </div> | |
| <!--<div role="tabpanel" class="tab-pane" id="otro"></div>--> | |
| </div> | |
| </div> | |
| {% endblock %} | |
| {% block extra_script %} | |
| <script src="{{ STATIC_URL }}js/accionable_local.js"></script> | |
| <script src="{{ STATIC_URL }}plugins/dataTable/media/js/jquery.dataTables.min.js"></script> | |
| <script src="{{ STATIC_URL }}plugins/bootstrap/js/bootstrap.min.js"></script> | |
| <script src="{{ STATIC_URL }}admin/js/jquery.base64.js"></script> | |
| <script src="{{ STATIC_URL }}plugins/dataTable/media/js/tableExport.js"></script> | |
| <script> | |
| $("#menu_formula_ingreso").addClass('active'); | |
| </script> | |
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% extends 'maqueta.html' %} | |
| {% load humanize %} | |
| {% block title %}Accionables Precios{% endblock %} | |
| {% block extrahead %} | |
| <link rel="stylesheet" href="{{ STATIC_URL }}plugins/dataTable/media/css/jquery.dataTables.min.css"/> | |
| <link rel="stylesheet" href="{{ STATIC_URL }}css/estado_resultado.css"/> | |
| <link rel="stylesheet" href="{{ STATIC_URL }}css/accionables.css"/> | |
| {% endblock %} | |
| {% block content_12 %} | |
| <div class="container-fluid"> | |
| <div role="tabpanel"> | |
| <ul class="nav nav-tabs" role="tablist"> | |
| <li role="presentation" class="active"> | |
| <a href="#descuentos" aria-controls="descuentos" role="tab" data-toggle="tab">Descuentos</a> | |
| </li> | |
| <li role="presentation"> | |
| <a href="#preciopromedio" aria-controls="preciopromedio" role="tab" data-toggle="tab">Precio Promedio</a> | |
| </li> | |
| </ul> | |
| </div> | |
| <div class="tab-content"> | |
| <div class="filtros"> | |
| {% if periodo_anterior %} | |
| <div class="pull-left"> | |
| <a href="{% url 'accionables_precios' pk=periodo_anterior %}" class="btn btn-primary btn-xs"><< Anterior</a> | |
| </div> | |
| {% else %} | |
| <div class="pull-left"> | |
| <a href="" class="btn btn-primary btn-xs" disabled="disabled"><< Anterior</a> | |
| </div> | |
| {% endif %} | |
| {% if periodo_posterior %} | |
| <div class="pull-left" style="margin-left: 10px;"> | |
| <a href="{% url 'accionables_precios' pk=periodo_posterior %}" class="btn btn-primary btn-xs">Posterior >></a> | |
| </div> | |
| {% else %} | |
| <div class="pull-left" style="margin-left: 10px;"> | |
| <a href="" class="btn btn-primary btn-xs" disabled="disabled">Posterior >></a> | |
| </div> | |
| {% endif %} | |
| <span class="periodo"> | |
| {% for p in periodo %} | |
| {{ p.periodo__periodo }} | |
| {% endfor %} | |
| </span> | |
| <div class="pull-right"> | |
| <a href="#information" data-toggle="modal" class="btn btn-success btn-xs"><i class="fa fa-info-circle" style="padding-right: 5px;"></i>Información</a> | |
| <div class="modal fade" id="information" role="dialog"> | |
| <div class="modal-dialog" style="z-index: 9999;"> | |
| <p class="alert alert-info"> | |
| Lorem ipsum dolor sit amet, consectetur adipisicing elit. Deserunt dolor eveniet exercitationem incidunt ipsam molestias officia praesentium, reprehenderit rerum sit temporibus ut vitae voluptates? Architecto, provident rerum. Ad, alias, magnam. | |
| </p> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <hr/> | |
| <div role="tabpanel" class="tab-pane active" id="descuentos"> | |
| <div class="col-md-6"> | |
| <div id="graph-crudo" style="min-width: 310px; height: 350px; max-width: 100%; margin: 0 auto"></div> | |
| <button class="btn btn-success" id="btn_crudos" data-periodo="{{ periodo_id }}"><i class="fa fa-search"></i> Ver Detalle</button> | |
| </div> | |
| <div class="col-md-6"> | |
| <div id="graph-procesado" style="min-width: 310px; height: 350px; max-width: 100%; margin: 0 auto"></div> | |
| <button class="btn btn-success" id="btn_procesados" data-periodo="{{ periodo_id }}"><i class="fa fa-search"></i> Ver Detalle</button> | |
| </div> | |
| <div class="col-md-12"> | |
| <hr/> | |
| <article class="container-fluid margin_top_20"> | |
| <div id="tabla_material" class="hidden"> | |
| <h4>N° de facturas semanales hechas por sobre y bajo precio vigente.</h4> | |
| <table class="table table-bordered table-striped table-hover" id="ver"> | |
| <thead> | |
| <tr> | |
| <th>Sector</th> | |
| <th>Cod Material</th> | |
| <th>Material</th> | |
| <th>Con descto</th> | |
| <th>Sin descto</th> | |
| <th>Sobreprecio</th> | |
| <th>Ver</th> | |
| </tr> | |
| </thead> | |
| <tbody id="body_table"> | |
| <tr> | |
| <td><button class="apertura">Click</button></td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| </div> | |
| </article> | |
| </div> | |
| </div> | |
| <div role="tabpanel" class="tab-pane active" id="preciopromedio"></div> | |
| </div> | |
| </div> | |
| <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> | |
| <div class="modal-dialog modal-lg"> | |
| <div class="modal-content"> | |
| <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> | |
| <div class="container margin_top_20"> | |
| <h4 id="tituloModal">Detalle de locales con descuento en ...</h4> | |
| <div class="margin_top_20"> | |
| <table id="listado" class="table table-bordered table-striped tabler-hover table-responsive"> | |
| <thead> | |
| <tr> | |
| <th class="primera_cab" colspan="6"></th> | |
| <th colspan="8">Unidades x Transacción</th> | |
| </tr> | |
| <tr> | |
| <th>Supervisor</th> | |
| <th>Preventa</th> | |
| <th>Cod. Local</th> | |
| <th>Cliente Local</th> | |
| <th>Categoria</th> | |
| <th>Responsable</th> | |
| <th>1</th> | |
| <th>2</th> | |
| <th>3</th> | |
| <th>4</th> | |
| <th>5</th> | |
| <th>5 a 10</th> | |
| <th>11 a 20</th> | |
| <th> >20 </th> | |
| </tr> | |
| </thead> | |
| <tbody id="apertura_tabla_modal"></tbody> | |
| </table> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| {% endblock %} | |
| {% block extra_script %} | |
| <script src="{{ STATIC_URL }}plugins/bootstrap/js/bootstrap.min.js"></script> | |
| <script src="{{ STATIC_URL }}plugins/highcharts/js/highcharts.js"></script> | |
| <script src="{{ STATIC_URL }}plugins/dataTable/media/js/jquery.dataTables.min.js"></script> | |
| <script src="{{ STATIC_URL }}admin/js/jquery.base64.js"></script> | |
| <script src="{{ STATIC_URL }}plugins/dataTable/media/js/tableExport.js"></script> | |
| <script src="{{ STATIC_URL }}js/accionable_precio.js"></script> | |
| <script> | |
| $("#menu_formula_ingreso").addClass('active'); | |
| </script> | |
| {% endblock %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.test import TestCase | |
| # Create your tests here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from django.conf.urls import url, patterns | |
| from actions.views import AccLocalView, AccPrecioView | |
| urlpatterns = patterns('', | |
| url(r'^accionables/locales/(?P<pk>\d+)/$', AccLocalView.as_view(), name='accionables_locales'), | |
| url(r'^accionables/locales/(?P<pk>\d+)/(?P<tc>\d+)/$', 'actions.views.accionable_filtro', name='accionables_locales_filtro'), | |
| url(r'^accionables/precios/dispersion/(?P<pk>\d+)/$', 'actions.views.dispersion_view', name='dispersion_view'), | |
| url(r'^accionables/precios/(?P<pk>\d+)/$', AccPrecioView.as_view(), name='accionables_precios'), | |
| url(r'^accionables/precios/negocio/(?P<pk>\d+)/(?P<ng>\d+)/$', 'actions.views.detalle_materiales', name='detalle_materiales'), | |
| url(r'^accionables/precios/negocio/apertura/(?P<pk>\d+)/(?P<mt>\d+)/$', 'actions.views.detalle_materiales_apertura', name='detalle_materiales_apertura'), | |
| ) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import json | |
| from django.contrib.auth.decorators import login_required | |
| from django.core import serializers | |
| from django.db.models import Count, Avg, Sum | |
| from django.http import HttpResponse, Http404 | |
| from django.views.generic import TemplateView, DetailView | |
| from actions.models import AccLocal, Dispersion, AnalisisDescuentoTotales, AnalisisDescuentoApertura | |
| from authenticated.models import Perfil | |
| from data.models import FormulaDeIngreso | |
| from financials.models import PesoTipoCliente | |
| from financials.views import ValuesQuerySetToDict | |
| from master.models import Periodo | |
| class AccPrecioView(DetailView): | |
| template_name = 'precios.html' | |
| model = Periodo | |
| def get_context_data(self, **kwargs): | |
| context = super(AccPrecioView, self).get_context_data(**kwargs) | |
| context['periodo'] = AnalisisDescuentoTotales.objects.values('periodo__periodo', 'periodo__id').filter(periodo__id=self.get_object().pk)[:1] | |
| context['perfil'] = Perfil.objects.all().filter(usuario=self.request.user) | |
| periodo_id = 0 | |
| for per in context['periodo']: | |
| periodo = per['periodo__periodo'] | |
| periodo_id = per['periodo__id'] | |
| context['periodo_id'] = periodo_id | |
| for ofi in context['perfil']: | |
| for of in ofi.oficina.all(): | |
| periodo_anterior = PesoTipoCliente.objects.values('periodo__id').filter(oficina__oficina=of.oficina).annotate(dcount=Count('peso')).filter(periodo__id=periodo_id - 1) | |
| for pa in periodo_anterior: | |
| context['periodo_anterior'] = pa['periodo__id'] | |
| periodo_posterior = PesoTipoCliente.objects.values('periodo__id').filter(oficina__oficina=of.oficina).annotate(dcount=Count('peso')).filter(periodo__id=periodo_id + 1) | |
| for pa in periodo_posterior: | |
| context['periodo_posterior'] = pa['periodo__id'] | |
| return context | |
| class AccLocalView(DetailView): | |
| template_name = 'locales.html' | |
| model = Periodo | |
| def get_context_data(self, **kwargs): | |
| context = super(AccLocalView, self).get_context_data(**kwargs) | |
| context['periodo'] = FormulaDeIngreso.objects.values('periodo__periodo', 'periodo__id').filter(periodo__id=self.get_object().pk)[:1] | |
| context['perfil'] = Perfil.objects.all().filter(usuario=self.request.user) | |
| for per in context['periodo']: | |
| periodo = per['periodo__periodo'] | |
| periodo_id = per['periodo__id'] | |
| for ofi in context['perfil']: | |
| for of in ofi.oficina.all(): | |
| oficina = of.oficina | |
| periodo_anterior = PesoTipoCliente.objects.values('periodo__id').filter(oficina__oficina=of.oficina).annotate(dcount=Count('peso')).filter(periodo__id=periodo_id - 1) | |
| for pa in periodo_anterior: | |
| context['periodo_anterior'] = pa['periodo__id'] | |
| periodo_posterior = PesoTipoCliente.objects.values('periodo__id').filter(oficina__oficina=of.oficina).annotate(dcount=Count('peso')).filter(periodo__id=periodo_id + 1) | |
| for pa in periodo_posterior: | |
| context['periodo_posterior'] = pa['periodo__id'] | |
| context['totales'] = AccLocal.objects.values('tipoCliente__tipo', 'tipoCliente__codigo', 'periodo__id').filter(oficina__oficina=oficina, periodo__periodo=periodo).annotate(dcount=Count('codLocal'), prom=Sum('ventaPromedio')).order_by('tipoCliente') | |
| context['adicional'] = AccLocal.objects.values('periodo__id').filter(oficina__oficina=oficina, periodo__periodo=periodo).annotate(suma=Sum('ventaPromedio')) | |
| if context['totales'].count() == 0: | |
| context['ancho'] = 0 | |
| else: | |
| context['ancho'] = (100 / context['totales'].count()) - 1 | |
| return context | |
| @login_required | |
| def accionable_filtro(request, pk, tc): | |
| if request.is_ajax(): | |
| periodo = FormulaDeIngreso.objects.values('periodo__id').filter(periodo__id=pk)[:1] | |
| for p in periodo: | |
| per = p['periodo__id'] | |
| perfil = Perfil.objects.all().filter(usuario__username=request.user) | |
| for ofi in perfil: | |
| for of in ofi.oficina.all(): | |
| oficina = of.oficina | |
| totales = AccLocal.objects.values('categoria__categoria').filter(oficina__oficina=oficina, periodo__periodo=per, tipoCliente__codigo=tc).exclude(categoria_id=19).annotate(dcount=Count('codLocal'), prom=Sum('ventaPromedio')).order_by('categoria') | |
| totales_dict = ValuesQuerySetToDict(totales) | |
| listado = AccLocal.objects.values('supervisor', 'preventa', 'codLocal', 'clienteLocal', 'categoria__categoria', 'sector__sector', 'promedio', 'minimo', 'maximo', 'ventaPromedio', 'semCalculo').filter(oficina__oficina=oficina, periodo__periodo='Semana 05.2015', tipoCliente__codigo=tc).order_by('-ventaPromedio') | |
| listado_dict = ValuesQuerySetToDict(listado) | |
| json_data = json.dumps({'totales': totales_dict, 'listado': listado_dict}) | |
| return HttpResponse(json_data, content_type='application/json; charset=utf8') | |
| else: | |
| raise Http404 | |
| @login_required | |
| def dispersion_view(request, pk): | |
| perfil = Perfil.objects.all().filter(usuario__username=request.user) | |
| for ofi in perfil: | |
| for of in ofi.oficina.all(): | |
| listado_prev_crudos = Dispersion.objects.extra(select={'x': 'unidad', 'y': 'diferencia', 'dataLabels': 'material'}).values('dataLabels', 'x', 'y').filter(periodo__id=pk, oficina__oficina=of.oficina, negocio='CRUDO', responsable='Preventa') | |
| dict_prev_crudos = ValuesQuerySetToDict(listado_prev_crudos) | |
| listado_vend_crudos = Dispersion.objects.extra(select={'x': 'unidad', 'y': 'diferencia', 'dataLabels': 'material'}).values('dataLabels', 'x', 'y').filter(periodo__id=pk, oficina__oficina=of.oficina, negocio='CRUDO', responsable='Vendedor') | |
| dict_vend_crudos = ValuesQuerySetToDict(listado_vend_crudos) | |
| listado_prev_proc = Dispersion.objects.extra(select={'x': 'unidad', 'y': 'diferencia', 'dataLabels': 'material'}).values('dataLabels', 'x', 'y').filter(periodo__id=pk, oficina__oficina=of.oficina, negocio='PROCESADO', responsable='Preventa') | |
| dict_prev_proc = ValuesQuerySetToDict(listado_prev_proc) | |
| listado_vend_proc = Dispersion.objects.extra(select={'x': 'unidad', 'y': 'diferencia', 'dataLabels': 'material'}).values('dataLabels', 'x', 'y').filter(periodo__id=pk, oficina__oficina=of.oficina, negocio='PROCESADO', responsable='Vendedor') | |
| dict_vend_proc = ValuesQuerySetToDict(listado_vend_proc) | |
| json_data = json.dumps({'preventa_crudo' : dict_prev_crudos, 'vendedor_crudo': dict_vend_crudos, 'preventa_proc' : dict_prev_proc, 'vendedor_proc': dict_vend_proc}) | |
| return HttpResponse(json_data, content_type='application/json; charset=utf8') | |
| @login_required | |
| def detalle_materiales(request, pk, ng): | |
| if request.is_ajax(): | |
| perfil = Perfil.objects.all().filter(usuario__username=request.user) | |
| clase_json = '' | |
| for ofi in perfil: | |
| for of in ofi.oficina.all(): | |
| if ng == '1': | |
| clase_json = AnalisisDescuentoTotales.objects.values('sector__sector', 'codigoMaterial', 'material', 'conDescuento', 'sinDescuento', 'sobreprecio').filter(oficina__oficina=of.oficina, periodo__id=pk, sector__id__range=(1, 3)).order_by('sector__id', 'codigoMaterial') | |
| elif ng == '2': | |
| clase_json = AnalisisDescuentoTotales.objects.values('sector__sector', 'codigoMaterial', 'material', 'conDescuento', 'sinDescuento', 'sobreprecio').filter(oficina__oficina=of.oficina, periodo__id=pk, sector__id__range=(4, 12)).order_by('sector__id', 'codigoMaterial') | |
| clase_list = ValuesQuerySetToDict(clase_json) | |
| json_data = json.dumps({'listado': clase_list}) | |
| return HttpResponse(json_data, content_type='application/json; charset=utf8') | |
| else: | |
| raise Http404 | |
| @login_required | |
| def detalle_materiales_apertura(request, pk, mt): | |
| if request.is_ajax(): | |
| perfil = Perfil.objects.all().filter(usuario__username=request.user) | |
| for ofi in perfil: | |
| for of in ofi.oficina.all(): | |
| clase_json = AnalisisDescuentoApertura.objects.values('supervisor', 'preventa', 'codLocal', 'clienteLocal', 'categoria__categoria', 'responsable', 'uno', 'dos', 'tres', 'cuatro', 'cinco', 'seisAdiez', 'onceAveinte', 'mayorVeinte').filter(oficina__oficina=of.oficina, periodo__id=pk, codigoMaterial=mt) | |
| clase_list = ValuesQuerySetToDict(clase_json) | |
| json_data = json.dumps({'listado': clase_list}) | |
| return HttpResponse(json_data, content_type='application/json; charset=utf8') | |
| else: | |
| raise Http404 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment