本文整理汇总了Python中utility.Utility.nvlGet方法的典型用法代码示例。如果您正苦于以下问题:Python Utility.nvlGet方法的具体用法?Python Utility.nvlGet怎么用?Python Utility.nvlGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Utility
的用法示例。
在下文中一共展示了Utility.nvlGet方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dispatch
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def dispatch(request):
util = Utility(post=request.POST, get=request.GET)
c = util.nvlGet('c');
par = util.nvlGet('q', '')
if c is not None:
if 'formledger' == c:
return HttpResponse(json.dumps({'html': render_to_string('inventory/form_ledger.html')}))
if 'taccount_bdi_form' == c:
barang_id = util.nvlGet('barang_id', 0)
inventory_id = util.nvlGet('inventory_id', 1)
tgl = util.nvlDate('tanggal', None)
if(tgl is None):
return HttpResponseServerError('Request Parameter Invalid')
bj = barangJurnal()
debet = bj.getMonthlyJurnal(barang_id, inventory_id, tgl, 'D')
kredit = bj.getMonthlyJurnal(barang_id, inventory_id, tgl, 'K')
saldoawal = bj.getMonthlyStartSaldo(barang_id, inventory_id, tgl)
saldoakhir = bj.getMonthlyEndSaldo(barang_id, inventory_id, tgl)
saldototal = bj.getMonthlyTotalTransaction(barang_id, inventory_id, tgl)
range = calendar.monthrange(tgl.year, tgl.month)
tglsaldoawal = date(tgl.year, tgl.month, 1)
tglsaldoakhir = date(tgl.year, tgl.month, range[1])
print 'range %s ' % (range[0])
if tglsaldoakhir > date.today():
tglsaldoakhir = date.today()
data = {'debet': debet, 'kredit': kredit, 'saldoawal': saldoawal, 'saldoakhir': saldoakhir,
'saldototal': saldototal
, 'tglsaldoawal': tglsaldoawal, 'tglsaldoakhir': tglsaldoakhir}
return HttpResponse(
json.dumps({'html': render_to_string('inventory/t_account_barang_inventory.html', data)}))
return HttpResponse('tes respons')
示例2: simpanItemMutasi
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def simpanItemMutasi(reqData):
requtil = Utility(reqData=reqData);
id = requtil.nvlGet('id', 0)
idBrg = requtil.nvlGet('barang_id', 0)
pbl = None
if id == 0:
pbl = initMutasi(reqData)
else:
pbls = models.Mutasi.objects.filter(id__exact=id)
if len(pbls):
pbl = pbls[0]
#prepare barang
brg = None
brgs = models.Barang.objects.filter(id__exact=idBrg)
if len(brgs):
brg = brgs[0]
else:
raise StandardError('Barang ini tidak ditemukan')
ipbl = models.ItemMutasi()
ipbl.barang = brg
ipbl.mutasi = pbl
ipbl.harga = brg.harga
ipbl.jumlah = requtil.nvlGet('barang_qty', 0)
ipbl.save()
return ipbl
示例3: simpanItemOpname
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def simpanItemOpname(reqData):
requtil = Utility(reqData=reqData);
id = requtil.nvlGet('id', 0)
idBrg = requtil.nvlGet('barang_id', 0)
pbl = None
if id == 0:
pbl = initOpname(reqData)
else:
pbls = models.Opname.objects.filter(id__exact=id)
if len(pbls):
pbl = pbls[0]
#prepare barang
brg = None
brgs = models.Barang.objects.filter(id__exact=idBrg)
if len(brgs):
brg = brgs[0]
else:
raise StandardError('Barang ini tidak ditemukan')
iops = models.ItemOpname.objects.filter(barang__id=idBrg)
itemopname = models.ItemOpname()
if iops is not None:
for iop in iops:
itemopname = iop
break
itemopname.barang = brg
itemopname.opname = pbl
itemopname.saldo = requtil.nvlGet('saldo')
itemopname.inspeksi = requtil.nvlGet('opname')
itemopname.keterangan = requtil.nvlGet('keterangan')
itemopname.harga = brg.harga
itemopname.save()
return itemopname
示例4: saveUpdateBarangDiInventory
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def saveUpdateBarangDiInventory(reqData):
requtil = Utility(reqData=reqData)
if requtil.nvlGet('id', None) is None:
#barang baru di inventory
#init barang di inventory object
bdi = models.BarangDiInventory()
#init barang object
brg = models.Barang()
brg = requtil.bindRequestModel(brg)
brg.save()
#safe harga
hrg = models.Harga();
hrg = requtil.bindRequestModel(hrg)
hrg.awal = date.today();
hrg.barang = brg;
hrg.keterangan = 'initial value'
hrg.save()
#set default inventory to main ware house in case it doesn't exists;
inventory_id = requtil.nvlGet('inventory_id', settings.MAIN_WAREHOUSE)
#check the inventory entry
inv = models.Inventory.objects.filter(id__exact=inventory_id)
#the inventory will be defined by reference later
if inv is not None and len(inv) > 0:
bdi.inventory = inv[0]
bdi.barang = brg
bdi.saldo = 0
bdi.save()
return requtil.modelToDicts([inv, hrg, brg, bdi])
示例5: simpanItemPemasukanPabean
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def simpanItemPemasukanPabean(reqData):
requtil = Utility(reqData=reqData);
id = requtil.nvlGet('id', 0)
idBrg = requtil.nvlGet('barang_id', 0)
print 'observer barang id'
print idBrg
pbl = None
if id == 0:
pbl = initPengeluaranPabean(reqData)
else:
pbls = models.DokumenPabean.objects.filter(id__exact=id)
if len(pbls):
pbl = pbls[0]
#prepare barang
brg = None
brgs = models.Barang.objects.filter(id__exact=idBrg)
if len(brgs):
brg = brgs[0]
else:
raise StandardError('Barang ini tidak ditemukan')
docpb = models.ItemDokumenPabean()
#reset the id
docpb = requtil.bindRequestModel(docpb)
docpb.id = None#reset the id
docpb.barang = brg
docpb.dokumen = pbl
docpb.harga = requtil.nvlGet('barang_harga', 0)
docpb.jumlah = requtil.nvlGet('barang_qty', 0)
docpb.save()
return docpb
示例6: initMutasi
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def initMutasi(reqData):
requtil = Utility(reqData=reqData);
_apu = appUtil()
#prepare inventory
pbl = models.Mutasi()
pbl.nomor = ('00000000000000%s' % (_apu.getIncrement(4)))[-6:]
pbl.asal = getInvById(requtil.nvlGet('inventory_asal_id'))
pbl.tujuan = getInvById(requtil.nvlGet('inventory_tujuan_id'))
pbl.save()
return pbl
示例7: prepareFormInventory
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def prepareFormInventory(reqData):
requtil = Utility(reqData=reqData)
jresp = dict({'html': render_to_string('inventory/form_inventory.html', {})})
data = {}
if 'id' in reqData:
id = requtil.nvlGet('id')
if id > 0:
pas = models.Inventory.objects.get(id__exact=requtil.nvlGet('id'))
data = requtil.modelToDict(pas)
jresp.update({'data': data})
return jresp
示例8: prepareFormRencanaPembelian
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def prepareFormRencanaPembelian(reqData):
requtil = Utility(reqData=reqData)
jresp = dict({'html': render_to_string('inventory/form_rencana_pembelian.html', {})})
data = {}
if 'id' in reqData:
id = requtil.nvlGet('id')
if id > 0:
cust = models.Customer.objects.get(id__exact=requtil.nvlGet('id'))
data = requtil.modelToDicts([cust])
jresp.update({'data': data});
return jresp
示例9: prepareFormBarang
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def prepareFormBarang(reqData):
requtil = Utility(reqData=reqData)
jresp = dict({'html': render_to_string('inventory/form_mutasi.html', {})})
data = {}
if 'id' in reqData:
id = requtil.nvlGet('id')
if id > 0:
brg = models.Barang.objects.get(id__exact=requtil.nvlGet('id'))
data = requtil.modelToDicts([brg])
jresp.update({'data': data});
return jresp
示例10: prepareFormSupplier
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def prepareFormSupplier(reqData):
requtil = Utility(reqData=reqData)
jresp = dict({'html': render_to_string('inventory/form_supplier.html', {})})
data = {}
if 'id' in reqData:
id = requtil.nvlGet('id')
if id > 0:
sup = models.Supplier.objects.get(id__exact=requtil.nvlGet('id'))
data = requtil.modelToDicts([sup])
jresp.update({'data': data});
return jresp
示例11: dispatch
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def dispatch(request):
util = Utility(post=request.POST, get=request.GET)
c = util.nvlGet('c');
par = util.nvlGet('q', '')
if c is not None:
if 'referensi' == c:
grup = util.nvlGet('grup', 0)
field = util.nvlGet('field')
refs = models.Referensi.objects.filter(grup__exact=grup)
jrefs = []
for ref in refs:
jrefs.append(util.modelToDict(ref))
return HttpResponse(json.dumps({'data': jrefs}))
示例12: prepareListSupplierByKataKunci
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def prepareListSupplierByKataKunci((reqData)):
requtil = Utility(reqData=reqData)
kunci = requtil.nvlGet('kunci', None)
jsups = []
if kunci is not None:
sups = models.Supplier.objects.filter(
Q(nama__icontains=kunci) | Q(alamat__icontains=kunci))[
:requtil.nvlGet('a', 8)]
else:
sups = models.Supplier.objects.all()[:requtil.nvlGet('a', 8)]
for sup in sups:
jsup = requtil.modelToDict(sup)
jsups.append(jsup)
return jsups;
示例13: prepareListPartnerByKataKunci
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def prepareListPartnerByKataKunci((reqData)):
requtil = Utility(reqData=reqData)
kunci = requtil.nvlGet('kunci', None)
if kunci is not None:
custs = models.Partner.objects.filter(
Q(nama__icontains=kunci) | Q(alamat__icontains=kunci))[
:requtil.nvlGet('a', 8)]
else:
custs = models.Partner.objects.all()[:requtil.nvlGet('a', 8)]
jcusts = [];
for cust in custs:
jcust = requtil.modelToDict(cust)
jcusts.append(jcust)
return jcusts;
示例14: dispatch
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def dispatch(request):
util = Utility(post=request.POST, get=request.GET)
c = util.nvlGet('c');
par = util.nvlGet('q', '')
if c is not None:
if 'formpartner' == c:
return HttpResponse(json.dumps(prepareFormPartner(util.data)))
if 'formpencarianpartner' == c:
return render_to_response('inventory/form_partner_browse.html')
if 'pencarianpartner' == c:
return HttpResponse(json.dumps({'data': pencarianPartner(util.data)}))
if 'partnersider' == c:
return HttpResponse(json.dumps({'html': getPartnerSider(util.data)}))
if 'caripartner' == c:
return render_to_response('inventory/cari_kata_kunci.html')
if 'lookuppartner' == c:
return HttpResponse(json.dumps(
lookupPartner(util.nvlGet('katakunci', None), util.nvlGet('id', None), util.nvlGet('max', None))));
if 'formlistpartner' == c:
return HttpResponse(json.dumps(dict(
{'html': render_to_string('inventory/list_partner.html'),
'data': prepareListPartnerByKataKunci(util.data)})))
if 'partnerbyname' == c:
par = util.nvlGet('q', '')
namas = []
#g=500/0
nama = 'noname'
if len(par) > 2:
pas = models.Partner.objects.filter(nama__icontains=par)[:util.nvlGet('a', 8)]
for p in pas:
nama = util.modelToDicts([p])
namas.append(nama)
#return HttpResponseServerError('error dari server lhoo')
data = dict({'eventid': util.nvlGet('eventid'), 'data': namas})
return HttpResponse(json.dumps(data))
if 'partnerbyid' == c:
cuss = models.Partner.objects.filter(id__exact=par)
for cus in cuss:
return HttpResponse(json.dumps(util.modelToDict(cus)))
return HttpResponse({'message': 'no partner'})
if 'partner_bynamalamat' == c:
jresp = dict({'data': prepareListPartnerByKataKunci(util.data), 'eventid': util.nvlGet('eventid')})
return HttpResponse(json.dumps(jresp))
if 'hapuspartner' == c:
custs = models.Supplier.objects.filter(id__exact=util.nvlGet('id', 0));
dp = {}
if custs:
#hapus semua barang di inventory
dp = util.modelToDict(custs[0])
custs[0].delete()
return HttpResponse(json.dumps(dp))
if 'updatesupplier' == c:
#hanya untuk mengupdate data barang, bukan barang di inventory
return HttpResponse(json.dumps(saveUpdatePartner(util.data)))
if 'simpanpartner' == c:
#simpanPasien(request.POST)
return HttpResponse(json.dumps(saveUpdatePartner(util.data)))
return HttpResponseServerError('can''t find param')
示例15: prepareListBarangByKataKunci
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlGet [as 别名]
def prepareListBarangByKataKunci((reqData)):
requtil = Utility(reqData=reqData)
kunci = requtil.nvlGet('kunci', None)
barangs = []
if kunci is not None:
barangs = models.Barang.objects.filter(
Q(nama__icontains=kunci) | Q(merk__icontains=kunci) | Q(tag__icontains=kunci))[
:requtil.nvlGet('a', 8)]
else:
barangs = models.Barang.objects.all()[:requtil.nvlGet('a', 8)]
jbarangs = [];
for barang in barangs:
jbarang = requtil.modelToDict(barang)
jbarangs.append(jbarang)
return jbarangs;