def get_compras_table(request): objects = Compra.objects.all() list_display = ['fecha', 'tipo', 'identificador', 'proveedor.razon_social', 'neto', 'iva', 'total', 'estado'] list_global_search = ['proveedor__razon_social', 'numero'] data_struct = dict(enumerate(map(lambda x: x.replace(".", "__"), list_display))) recordsTotal = objects.count() objects = filtering(request.GET, objects, data_struct, list_global_search) objects = ordering(request.GET, objects, data_struct) recordsFiltered = objects.count() # finally, slice according to length sent by dataTables: start = int(request.GET['start']) length = int(request.GET['length']) objects = objects[start: (start + length)] # extract information data = make_data(objects, list_display) # define response response = { 'data': data, 'recordsTotal': recordsTotal, 'recordsFiltered': recordsFiltered, 'draw': request.GET['draw'] } return JsonResponse(response)
def get_compras_table(request): objects = Compra.objects.all() list_display = [ 'fecha', 'tipo', 'identificador', 'proveedor.razon_social', 'neto', 'iva', 'total', 'estado' ] list_global_search = ['proveedor__razon_social', 'numero'] data_struct = dict( enumerate(map(lambda x: x.replace(".", "__"), list_display))) recordsTotal = objects.count() objects = filtering(request.GET, objects, data_struct, list_global_search) objects = ordering(request.GET, objects, data_struct) recordsFiltered = objects.count() # finally, slice according to length sent by dataTables: start = int(request.GET['start']) length = int(request.GET['length']) objects = objects[start:(start + length)] # extract information data = make_data(objects, list_display) # define response response = { 'data': data, 'recordsTotal': recordsTotal, 'recordsFiltered': recordsFiltered, 'draw': request.GET['draw'] } return JsonResponse(response)
def get_articulos_table(request): objects = Articulo.objects.all() desde = request.GET['desde'] es_b = True if 'es_b' in request.GET else False if desde == 'seleccionArticulo': list_display = [ 'pk', 'codigo', 'codigo_fabrica', 'denominacion', 'rubro.nombre', 'precio_venta' ] # list_filter = ['codigo', 'codigo_fabrica','denominacion'] elif desde == 'mainArticulos': list_display = [ 'codigo', 'codigo_fabrica', 'denominacion', 'linea.nombre', 'subrubro.nombre', 'ultima_actualizacion_precio' ] list_global_search = ['denominacion', 'codigo', 'codigo_fabrica'] data_struct = dict(enumerate(list_display)) # Cuenta total de articulos: recordsTotal = objects.count() # Filtrado de los articulos objects = filtering(request.GET, objects, data_struct, list_global_search) # Ordenado objects = ordering(request.GET, objects, data_struct) # Conteo de articulos despues dle filtrado recordsFiltered = objects.count() # finally, slice according to length sent by dataTables: start = int(request.GET['start']) length = int(request.GET['length']) objects = objects[start:(start + length)] # extract information data = make_data(objects, list_display, "editarArticulo", "suspenderArticulo", "habilitarArticulo") # define response response = { 'data': data, 'recordsTotal': recordsTotal, 'recordsFiltered': recordsFiltered, 'draw': request.GET['draw'] } # serialize to json s = StringIO() json.dump(response, s) s.seek(0) return HttpResponse(s.read())
def get_clientes_table(request): objects = Cliente.objects.all() list_display = [ 'cuit', 'razon_social', 'localidad', 'get_provincia_display()', 'telefono' ] list_global_search = list_display[1:2] data_struct = dict(enumerate(list_display)) # Cuenta total de articulos: recordsTotal = objects.count() # Filtrado general de los articulos objects = filtering(request.GET, objects, data_struct, list_global_search) # Ordenado objects = ordering(request.GET, objects, data_struct) # Conteo de articulos despues dle filtrado recordsFiltered = objects.count() # finally, slice according to length sent by dataTables: start = int(request.GET['start']) length = int(request.GET['length']) objects = objects[start:(start + length)] # extract information detalle = u'''<u>SALDO</u>: <strong>%(saldo)s</strong><br> <u>Información fiscal</u>: Condición IVA: %(get_cond_iva_display())s - IIBB: %(codigo_ingresos_brutos)s<br> <u>Dirección</u>: %(direccion)s, %(localidad)s (%(get_provincia_display())s) -- CP: %(codigo_postal)s<br> <u>Contacto</u>: TE: %(telefono)s FAX: %(fax)s<br> </u>Información extra</u>:<br> %(notas)s''' data = make_data(objects, list_display, 'editarCliente', 'suspenderCliente', 'habilitarCliente', detalle) # define response response = { 'data': data, 'recordsTotal': recordsTotal, 'recordsFiltered': recordsFiltered, 'draw': request.GET['draw'] } # serialize to json s = StringIO() json.dump(response, s) s.seek(0) return HttpResponse(s.read())
def get_proveedores_table(request): # SETEOS INICIALES objects = Proveedor.objects.all() list_display = ['razon_social', 'localidad', 'telefono', 'email'] list_global_search = ['razon_social'] data_struct = dict(enumerate(list_display)) # Cuenta total de articulos: recordsTotal = objects.count() # Filtrado de los bancos objects = filtering(request.GET, objects, data_struct, list_global_search) # Ordenado objects = ordering(request.GET, objects, data_struct) # Conteo de articulos despues dle filtrado recordsFiltered = objects.count() # finally, slice according to length sent by dataTables: start = int(request.GET['start']) length = int(request.GET['length']) objects = objects[start:(start + length)] # extract information data = make_data(objects, list_display, "editarProveedor", "suspenderProveedor", "habilitarProveedor") print data # define response response = { 'data': data, 'recordsTotal': recordsTotal, 'recordsFiltered': recordsFiltered, 'draw': request.GET['draw'] } # serialize to json s = StringIO() json.dump(response, s) s.seek(0) return HttpResponse(s.read())
def get_proveedores_table(request): # SETEOS INICIALES objects = Proveedor.objects.all() list_display = ['razon_social', 'localidad', 'telefono', 'email'] list_global_search = ['razon_social'] data_struct = dict(enumerate(list_display)) # Cuenta total de articulos: recordsTotal = objects.count() # Filtrado de los bancos objects = filtering(request.GET, objects, data_struct, list_global_search) # Ordenado objects = ordering(request.GET, objects, data_struct) # Conteo de articulos despues dle filtrado recordsFiltered = objects.count() # finally, slice according to length sent by dataTables: start = int(request.GET['start']) length = int(request.GET['length']) objects = objects[start: (start + length)] # extract information data = make_data(objects, list_display, "editarProveedor", "suspenderProveedor", "habilitarProveedor") print data # define response response = { 'data': data, 'recordsTotal': recordsTotal, 'recordsFiltered': recordsFiltered, 'draw': request.GET['draw'] } # serialize to json s = StringIO() json.dump(response, s) s.seek(0) return HttpResponse(s.read())
def get_condiciones_venta_table(request): objects = Condicion_venta.objects.all() list_display = ['descripcion'] list_global_search = list_display data_struct = dict(enumerate(list_display)) # Cuenta total de articulos: recordsTotal = objects.count() # Filtrado de los articulos objects = filtering(request.GET, objects, data_struct, list_global_search) # Ordenado objects = ordering(request.GET, objects, data_struct) # Conteo de articulos despues dle filtrado recordsFiltered = objects.count() # finally, slice according to length sent by dataTables: start = int(request.GET['start']) length = int(request.GET['length']) objects = objects[start:(start + length)] data = make_data(objects, list_display, 'editarCondicionVenta') # define response response = { 'data': data, 'recordsTotal': recordsTotal, 'recordsFiltered': recordsFiltered, 'draw': request.GET['draw'] } # serialize to json s = StringIO() json.dump(response, s) s.seek(0) return HttpResponse(s.read())
def get_subrubros_table(request): objects = SubRubro.objects.all() list_display = ['rubro.nombre', 'nombre', 'get_iva_display()'] list_global_search = ['rubro__nombre', 'nombre'] data_struct = {0: 'rubro__nombre', 1: 'nombre', 2: 'iva'} # Cuenta total de articulos: recordsTotal = objects.count() # Filtrado de los articulos objects = filtering(request.GET, objects, data_struct, list_global_search) # Ordenado objects = ordering(request.GET, objects, data_struct) # Conteo de articulos despues dle filtrado recordsFiltered = objects.count() # finally, slice according to length sent by dataTables: start = int(request.GET['start']) length = int(request.GET['length']) objects = objects[start:(start + length)] data = make_data(objects, list_display, 'editarSubrubro') # define response response = { 'data': data, 'recordsTotal': recordsTotal, 'recordsFiltered': recordsFiltered, 'draw': request.GET['draw'] } # serialize to json s = StringIO() json.dump(response, s) s.seek(0) return HttpResponse(s.read())