Пример #1
0
def show(request, pid):
    try:
        people = People.objects.get(id=pid)
    except ObjectDoesNotExist:
        return HttpResponseRedirect('/people')
    customfields = boat = None 
    if people.group and people.group.cluster and \
        people.group.cluster.category.name.upper() == 'CAPTURE FISHERIES':
        customfields = Metaform.objects.order_by('id').\
            filter(category=people.group.cluster.category).\
            filter(meta_type='group')
        boat = people.group
    trainings = Training.objects.filter(person=people)[:1]
    training = trainings and trainings[0] or None
    return direct_to_template(request, 'people/show.html', {
        'person': people,
        'boat': boat,
        'customfields': customfields,
        'training': training, 
        'transactions': Transaction.objects.filter(person=people),
        'saldo': saldo(people),
        'products': Product.objects.filter(person=people),
        #'tab_product': destination(people.id, 'product'),
        #'tab_transaction': destination(people.id, 'transaction'),
        'lokasi': default_location(people.geo_pos),
        })
Пример #2
0
def index(request):
    return direct_to_template(
        request, 'microfinance/index.html', {
            'finances': Finance.objects.all(),
            'count': Finance.counter_value(),
            'lokasi': default_location(),
        })
Пример #3
0
def show(request, pid):
    try:
        people = People.objects.get(id=pid)
    except ObjectDoesNotExist:
        return HttpResponseRedirect('/people')
    customfields = boat = None
    if people.group and people.group.cluster and \
        people.group.cluster.category.name.upper() == 'CAPTURE FISHERIES':
        customfields = Metaform.objects.order_by('id').\
            filter(category=people.group.cluster.category).\
            filter(meta_type='group')
        boat = people.group
    trainings = Training.objects.filter(person=people)[:1]
    training = trainings and trainings[0] or None
    return direct_to_template(
        request,
        'people/show.html',
        {
            'person': people,
            'boat': boat,
            'customfields': customfields,
            'training': training,
            'transactions': Transaction.objects.filter(person=people),
            'saldo': saldo(people),
            'products': Product.objects.filter(person=people),
            #'tab_product': destination(people.id, 'product'),
            #'tab_transaction': destination(people.id, 'transaction'),
            'lokasi': default_location(people.geo_pos),
        })
Пример #4
0
def show(request, pid):
    product = Product.objects.get(pk=pid)
    return direct_to_template(request, 'product/show.html', {
        'customfields': Metaform.objects.filter(meta_type='product').\
                filter(category=product.category),
        'product': product,
        'lokasi': default_location(product.geo_pos),
        })
Пример #5
0
def index(request):
    return direct_to_template(
        request, 'product/index.html', {
            'types': Type.objects.all().order_by('-count', 'name'),
            'products': Product.objects.exclude(geo_pos='')[:1000],
            'count': Product.counter_value(),
            'lokasi': default_location(),
        })
Пример #6
0
def show(request, mid):
    mf = Finance.objects.get(pk=mid)

    kontak = [
        ['Nama', mf.contact_name],
        ['Telepon selular', mf.mobile],
        ['Alamat', mf.address],
        ['Kabupaten', mf.district.name],
        ['Kecamatan', mf.sub_district.name],
    ]

    keuangan = [
        ['Tipe LKM', mf.kind_lkm],
        ['Total aset', '%d Rupiah' % mf.total_asset],
        [
            'Total penyediaan dana pinjaman',
            '%d Rupiah' % mf.total_sedia_dana_pinjaman
        ],
        ['Total pencairan',
         '%d Rupiah' % mf.total_penyaluran],
        ['Sektor usaha', mf.sektor_usaha],
        ['Persyaratan pinjaman', mf.persyaratan_pinjaman],
        ['Persyaratan agunan', mf.persyaratan_agunan],
        ['Jangkauan wilayah usaha', mf.jangkauan_wilayah_usaha],
        ['Nilai pinjaman maksimum', mf.nilai_maks_pinjaman],
        ['Jangka waktu pinjaman', mf.jangka_wkt_pinjaman],
        ['Bunga pinjaman', '%s %%' % mf.margin_bunga],
        [
            'Bantuan untuk penerima manfaat JFPR',
            mf.bantuan_penerima_manfaat_jfpr
        ],
        ['Pelatihan', '<none>'],
        ['Pengelolaan usaha',
         '%d kali' % mf.manajemen_usaha],
        ['Pembukuan', '%d kali' % mf.pembukuan],
        ['Akses pasar', '%d kali' % mf.akses_pasar],
        ['Keuangan mikro', '%d kali' % mf.keuangan_mikro],
        ['Penguatan pelayanan', '<none>'],
        ['Petugas akun', '%d kali' % mf.ao],
        ['Layanan pelanggan', '%d kali' % mf.cs],
        ['Kasir', '%d kali' % mf.tl],
        ['Kelayakan usaha', '%d kali' % mf.kelayakan_usaha],
    ]

    return direct_to_template(
        request, 'microfinance/show.html', {
            'microfinance': mf,
            'kontak': kontak,
            'keuangan': keuangan,
            'lokasi': default_location(mf.geo_pos),
        })
Пример #7
0
def index(request):
    limit = 20
    page = 'page' in request.GET and int(request.GET['page']) or 1
    offset = page * limit - limit
    lcs = []
    q = Livelihood.objects.all().order_by('name')
    for lc in q[offset:offset+limit]:
        if lc.allowed:
            lcs.append(lc)
    return direct_to_template(request, 'home.html', {
        'livecenters': lcs, 
        'peoples': People.objects.filter(photo__isnull=False).order_by('-photo_id')[:20],
        'people_count': People.counter_value(),
        'lokasi': default_location(), 
        })
Пример #8
0
def type_show(request, tid):
    limit = 20
    page = 'page' in request.GET and int(request.GET['page']) or 1
    offset = page * limit - limit
    products = []
    q = Product.objects.filter(type=tid).order_by('-updated')
    for product in q[offset:offset + limit]:
        if product.allowed:
            products.append(product)
    return direct_to_template(
        request, 'product/type/show.html', {
            'product_type': Type.objects.get(pk=tid),
            'products': products,
            'lokasi': default_location(),
        })
Пример #9
0
def index(request):
    limit = 20
    page = 'page' in request.GET and int(request.GET['page']) or 1
    offset = page * limit - limit
    groups = []
    q = Group.objects.all().order_by('-updated')
    for group in q[offset:offset+limit]:
        if group.allowed:
            groups.append(group)
    return direct_to_template(request, 'group/index.html', {
        'groups': groups, 
        'count': Group.counter_value(),
        'lokasi': default_location(),
        'next': q[offset+limit:offset+limit+2] and page+1 or None,
        'prev': q[offset and offset-1 or 0:offset] and page-1,
        })
Пример #10
0
def index(request):
    limit = 20
    page = 'page' in request.GET and int(request.GET['page']) or 1 
    offset = page * limit - limit
    peoples = []
    q = People.objects.all().order_by('-updated')
    for people in q[offset:offset+limit]:
        if people.allowed:
            peoples.append(people)
    return direct_to_template(request, 'people/index.html', {
        'peoples': peoples, 
        'count': People.counter_value(),
        'lokasi': default_location(),
        'next': q[offset+limit:offset+limit+2] and page+1 or None,
        'prev': q[offset and offset-1 or 0:offset] and page-1,
        })
Пример #11
0
def index(request):
    limit = 20
    page = 'page' in request.GET and int(request.GET['page']) or 1
    offset = page * limit - limit
    peoples = []
    q = People.objects.all().order_by('-updated')
    for people in q[offset:offset + limit]:
        if people.allowed:
            peoples.append(people)
    return direct_to_template(
        request, 'people/index.html', {
            'peoples': peoples,
            'count': People.counter_value(),
            'lokasi': default_location(),
            'next': q[offset + limit:offset + limit + 2] and page + 1 or None,
            'prev': q[offset and offset - 1 or 0:offset] and page - 1,
        })
Пример #12
0
def index(request):
    limit = 20
    page = 'page' in request.GET and int(request.GET['page']) or 1
    offset = page * limit - limit
    groups = []
    q = Group.objects.all().order_by('-updated')
    for group in q[offset:offset + limit]:
        if group.allowed:
            groups.append(group)
    return direct_to_template(
        request, 'group/index.html', {
            'groups': groups,
            'count': Group.counter_value(),
            'lokasi': default_location(),
            'next': q[offset + limit:offset + limit + 2] and page + 1 or None,
            'prev': q[offset and offset - 1 or 0:offset] and page - 1,
        })
Пример #13
0
def show(request, gid):
    group = Group.objects.get(pk=gid)
    other_groups = [] 
    if group.cluster:
        other_groups = Group.objects.filter(cluster=group.cluster).exclude(pk=group.id)
    if not other_groups[:1]:
        other_groups = Group.objects.filter(livecenter=group.livecenter).exclude(pk=group.id)
    trainings = Training.objects.filter(group=group)[:1]
    training = trainings and trainings[0] or None
    return direct_to_template(request, 'group/show.html', {
        'group': group,
        'members': People.objects.filter(group=group),
        'other_groups': other_groups,
        'customfields': Metaform.objects.filter(meta_type='group').\
                filter(category__in=group.livecenter.category),
        'reports': Report.objects.filter(group=group),
        'training': training, 
        'lokasi': group.geo_pos or default_location(),
        })
Пример #14
0
def show(request, gid):
    group = Group.objects.get(pk=gid)
    other_groups = []
    if group.cluster:
        other_groups = Group.objects.filter(cluster=group.cluster).exclude(
            pk=group.id)
    if not other_groups[:1]:
        other_groups = Group.objects.filter(
            livecenter=group.livecenter).exclude(pk=group.id)
    trainings = Training.objects.filter(group=group)[:1]
    training = trainings and trainings[0] or None
    return direct_to_template(request, 'group/show.html', {
        'group': group,
        'members': People.objects.filter(group=group),
        'other_groups': other_groups,
        'customfields': Metaform.objects.filter(meta_type='group').\
                filter(category__in=group.livecenter.category),
        'reports': Report.objects.filter(group=group),
        'training': training,
        'lokasi': group.geo_pos or default_location(),
        })