本文整理汇总了Python中utility.Utility.nvlDate方法的典型用法代码示例。如果您正苦于以下问题:Python Utility.nvlDate方法的具体用法?Python Utility.nvlDate怎么用?Python Utility.nvlDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Utility
的用法示例。
在下文中一共展示了Utility.nvlDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dispatch
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlDate [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: browseMutasi
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import nvlDate [as 别名]
def browseMutasi(reqData):
requtil = Utility(reqData=reqData)
farg = {};
if requtil.nvlGet('par_nomor') is not None:
farg['nomor__icontains'] = requtil.nvlGet('par_nomor')
if requtil.nvlDate('par_tanggal_awal', None) is not None:
farg['tanggal__gte'] = requtil.nvlDate('par_tanggal_awal')
if requtil.nvlDate('par_tanggal_akhir', None) is not None:
farg['tanggal__lte'] = requtil.nvlDate('par_tanggal_akhir')
if requtil.nvlGet('init') is not None:
pas = models.Mutasi.objects.all(
).order_by(
'tanggal')[0:requtil.nvlGet('n', 40)]
else: pas = models.Mutasi.objects.filter(**farg).order_by(
'waktu')[0:requtil.nvlGet('n', 40)]
jdatas = [];
for pa in pas:
jdata = (Utility()).modelToDicts([pa])
jdatas.append(jdata);
return jdatas;