Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tcc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,7 @@ class Bill(models.Model):

"""
job_no = models.IntegerField(editable =False)
date = models.DateField(auto_now_add=True)
education_tax = models.IntegerField(blank=True,null=True)
higher_education_tax = models.IntegerField(blank=True,null=True)
service_tax = models.IntegerField(blank=True,null=True)
Expand Down
Binary file modified tcc/models.pyc
Binary file not shown.
4 changes: 4 additions & 0 deletions tcc/registers.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@ def main_register(request):
'job__client__client__address', 'job__client__client__city',
'job__clientjob__material__name',
'job__client__client__company').order_by('job__id')
for x in amount:
if year > 2013 and month > 3:
x['job__id'] -= 1763

admin_charge_temp = Amount.objects.filter(job_id__in=job).\
filter(report_type ='General_report').aggregate(Sum(\
'admin_charge'))
Expand Down
186 changes: 106 additions & 80 deletions tcc/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""

from ofau.tcc.header import *
from datetime import datetime
from datetime import *
import itertools

from django.views.decorators.cache import patch_cache_control
Expand Down Expand Up @@ -420,30 +420,28 @@ def selectfield(request):
added to same job_no and thus the job_no in clientadd remains
same.
"""
try :
client =UserProfile.objects.get(id=request.GET['id'])
user = request.user
jobno = request.GET.get('job','')
if jobno =='':
id = Bill.objects.aggregate(Max('job_no'))
maxid =id['job_no__max']
if maxid== None :
maxid = 1
else:
maxid = maxid + 1
client =UserProfile.objects.get(id=request.GET['id'])
user = request.user
jobno = request.GET.get('job','')
if jobno =='':
id = Bill.objects.aggregate(Max('id'))
maxid =id['id__max']
get_last_jobno = Bill.objects.get(id = maxid)
last_jobno = get_last_jobno.job_no
if last_jobno== None :
last_jobno = 1
else:
maxid = jobno
m = Clientadd(client = client,user=user,job_no=maxid)
m.save()
client = Clientadd.objects.aggregate(Max('id'))
client =client['id__max']
temp = {'client':client}
return render_to_response('tcc/typeofwork.html',
dict(temp.items() + tmp.items()), context_instance=
RequestContext(request))
except Exception:
return render_to_response('tcc/profile_first.html',tmp,
context_instance = RequestContext(request))
last_jobno = last_jobno + 1
else:
last_jobno = jobno
m = Clientadd(client = client,user=user,job_no=last_jobno)
m.save()
client = Clientadd.objects.aggregate(Max('id'))
client =client['id__max']
temp = {'client':client}
return render_to_response('tcc/typeofwork.html',
dict(temp.items() + tmp.items()), context_instance=
RequestContext(request))

@stop_caching
@login_required
Expand Down Expand Up @@ -926,19 +924,21 @@ def job_ok(request):
tds amount etc.
"""
material =request.GET.get('id', '')
id = Job.objects.aggregate(Max('job_no'))
maxid =id['job_no__max']
job_no = maxid
id = Job.objects.aggregate(Max('id'))
maxid =id['id__max']
last_job_no = Job.objects.get(id=maxid)
get_job_no = last_job_no.job_no
date = last_job_no.date
value =Job.objects.values_list('testtotal__unit_price',flat=True)\
.filter(job_no=maxid)
.filter(job_no=get_job_no).filter(date=date)
price = sum(value)
from ofau.tcc.variable import *
try:
trans_value = Job.objects.values_list('suspence__rate',flat=\
True).filter(job_no=maxid)
True).filter(job_no=get_job_no).filter(date=date)
trans_total = sum(trans_value)
discount_value = Job.objects.values_list('discount',flat=True)\
.filter(job_no=maxid)
.filter(job_no=get_job_no).filter(date=date)
discount_total = sum(discount_value)
trans_net_total = price + trans_total - discount_total
service_tax= round(servicetax * trans_net_total)
Expand All @@ -948,17 +948,17 @@ def job_ok(request):
net_total = trans_net_total + higher_education_tax +\
education_tax + service_tax
bal = Job.objects.values_list('tds',flat=True).\
filter(job_no=maxid)
filter(job_no=get_job_no).filter(date=date)
tdstotal = sum(bal)
balance = net_total - tdstotal
m = Bill(job_no = job_no, price = price, service_tax=service_tax,
m = Bill(job_no = get_job_no, price = price, service_tax=service_tax,
higher_education_tax = higher_education_tax, education_tax =
education_tax, net_total = net_total, balance =
education_tax, net_total = net_total, date = date, balance =
balance,trans_total=trans_total,trans_net_total=trans_net_total,
discount_total=discount_total)
except Exception:
discount_value = Job.objects.values_list('discount',flat=True).\
filter(job_no=maxid)
filter(job_no=get_job_no).filter(date=date)
discount_total = sum(discount_value)
trans_net_total = price - discount_total
service_tax= round(servicetax * trans_net_total)
Expand All @@ -968,16 +968,17 @@ def job_ok(request):
net_total = trans_net_total + higher_education_tax +\
education_tax + service_tax
bal = Job.objects.values_list('tds',flat=True).\
filter(job_no=maxid)
filter(job_no=get_job_no).filter(date=date)
tdstotal = sum(bal)
balance = net_total - tdstotal
m = Bill(job_no = job_no, price = price, service_tax=service_tax,
m = Bill(job_no = get_job_no, price = price, service_tax=service_tax,
higher_education_tax = higher_education_tax, education_tax =
education_tax, net_total = net_total, balance = balance,
education_tax, net_total = net_total, date = date,balance = balance,
discount_total=discount_total,trans_net_total=trans_net_total,)
m.save()
amt = Job.objects.filter(job_no=maxid).values('amount__report_type')
temp = {"maxid":maxid,'amt':amt}
amt = Job.objects.filter(job_no=get_job_no).values('amount__report_type').\
filter(date=date)
temp = {"maxid":get_job_no,'amt':amt}
if request.user.is_staff == 1 and request.user.is_active == 1 and \
request.user.is_superuser == 1 :
return HttpResponseRedirect('job_ok_show')
Expand All @@ -987,22 +988,27 @@ def job_ok(request):
@stop_caching
def job_ok_show(request):
material =request.GET.get('id', '')
id = Job.objects.aggregate(Max('job_no'))
maxid =id['job_no__max']
job_no = maxid
amt = Job.objects.filter(job_no=maxid).values('amount__report_type')
temp = {"maxid":maxid,'amt':amt}
id = Job.objects.aggregate(Max('id'))
maxid =id['id__max']
job = Job.objects.get(id=maxid)
last_job_no = job.job_no
date=job.date
amt = Job.objects.filter(job_no=last_job_no).filter(date=date).\
values('amount__report_type')
temp = {"maxid":last_job_no,'amt':amt}
return render_to_response('tcc/job_ok.html',dict(temp.items() +
tmp.items()), context_instance=RequestContext(request))

@stop_caching
def client_job_ok_show(request):
material =request.GET.get('id', '')
id = Job.objects.aggregate(Max('job_no'))
maxid =id['job_no__max']
job_no = maxid
amt = Job.objects.filter(job_no=maxid).values('amount__report_type')
temp = {"maxid":maxid,'amt':amt}
id = Job.objects.aggregate(Max('id'))
maxid =id['id__max']
job = Job.objects.get(id=maxid)
last_job_no = job.job_no
date=job.date
amt = Job.objects.filter(job_no=last_job_no).filter(date=date).\
values('amount__report_type')
temp = {"maxid":last_job_no,'amt':amt}
return render_to_response('tcc/client_job_ok.html', dict(temp.items() +
tmp.items()), context_instance=RequestContext(request))

Expand Down Expand Up @@ -1048,17 +1054,17 @@ def bill(request):
jobid = job.id
job_no = job.job_no
job_date =job.date
getjob = Job.objects.all().filter(job_no=job_no).values(
'clientjob__material__name','date','testtotal__unit_price','site',
getjob = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\
values( 'clientjob__material__name','date','testtotal__unit_price','site',
'suspencejob__field__name','report_type', 'clientjob__other_test',
'clientjob__material__matcomment_id','suspencejob__field__matcomment_id',
'sample','letter_no','letter_date', 'suspencejob__other',
'clientjob__material__id','suspencejob__field__id',
'suspencejob__other_test',).distinct()
testname = Job.objects.all().filter(job_no=job_no).values(
testname = Job.objects.all().filter(job_no=job_no).filter(date=job_date).values(
'clientjob__test__name','clientjob__test__material',
'suspencejob__test__material','suspencejob__test__name' ).distinct()
gettest = Job.objects.all().filter(job_no=job_no).values(
gettest = Job.objects.all().filter(job_no=job_no).filter(date=job_date).values(
'clientjob__material__test__name','clientjob__material__id',
'clientjob__material__test__name')
getadd = Job.objects.all().filter(id = jobid).values(
Expand All @@ -1067,7 +1073,9 @@ def bill(request):
'client__client__city', 'client__client__company',
'client__client__state','site',).distinct()
from ofau.tcc.variable import *
bill = Bill.objects.get(job_no=job_no)
get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\
values('id')
bill = Bill.objects.get(id=get_bill_id)
matcomment= MatComment.objects.all()
servicetaxprint = servicetaxprint
educationtaxprint = educationtaxprint
Expand Down Expand Up @@ -1103,25 +1111,27 @@ def suspence_bill(request):
jobid = job.id
job_no = job.job_no
job_date =job.date
getjob = Job.objects.all().filter(job_no=job_no).values(
'clientjob__material__name','date','testtotal__unit_price','site',
'suspencejob__field__name','report_type',
'clientjob__material__matcomment_id','suspencejob__field__matcomment_id',
'sample','letter_no','letter_date', 'suspencejob__other',
'clientjob__material__id','suspencejob__field__id').distinct()
testname = Job.objects.all().filter(job_no=job_no).values(
'clientjob__test__name','clientjob__test__material',
getjob = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\
values('clientjob__material__name','date','testtotal__unit_price','site',
'suspencejob__field__name','report_type', 'clientjob__material__matcomment_id',
'suspencejob__field__matcomment_id','sample','letter_no','letter_date',
'suspencejob__other','clientjob__material__id',
'suspencejob__field__id').distinct()
testname = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\
values('clientjob__test__name','clientjob__test__material',
'suspencejob__test__material','suspencejob__test__name' ).distinct()
gettest = Job.objects.all().filter(job_no=job_no).values(
'clientjob__material__test__name','clientjob__material__id',
gettest = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\
values('clientjob__material__test__name','clientjob__material__id',
'clientjob__material__test__name')
getadd = Job.objects.all().filter(id = jobid).values(
'client__client__first_name', 'client__client__middle_name',
'client__client__last_name','client__client__address',
'client__client__city', 'client__client__company',
'client__client__state','site',).distinct()
from ofau.tcc.variable import *
bill = Bill.objects.get(job_no=job_no)
get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\
values('id')
bill = Bill.objects.get(id=get_bill_id)
matcomment= MatComment.objects.all()
servicetaxprint = servicetaxprint
educationtaxprint = educationtaxprint
Expand Down Expand Up @@ -1166,11 +1176,13 @@ def receipt_report(request):
'client__client__first_name', 'client__client__middle_name',
'client__client__last_name','client__client__address',
'client__client__city','client__client__company')
mate = Job.objects.all().filter(job_no=job_no).values(
'clientjob__material__name','suspencejob__field__name',
mate = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\
values('clientjob__material__name','suspencejob__field__name',
'report_type','date','clientjob__material__matcomment_id',
'suspencejob__field__matcomment_id').distinct()
bill = Bill.objects.get(job_no=job_no)
get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\
values('id')
bill = Bill.objects.get(id=get_bill_id)
matcomment= MatComment.objects.all()
balance = bill.balance
net_total_eng = num2eng(balance)
Expand All @@ -1197,10 +1209,17 @@ def additional(request):
maxid =id['id__max']
job = Job.objects.get(id = maxid)
job_no = job.job_no
bill = Bill.objects.get(job_no=job_no)
job_date = job.date
if (job_date >= date(2014,4,1)):
voucher_no = job.id-1763;
else:
voucher_no = job.id;
get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\
values('id')
bill = Bill.objects.filter(id=get_bill_id)[0];
template = {'job':job,'job_no': job_no ,'bill':bill,'servicetaxprint' : servicetaxprint,
'highereducationtaxprint' : highereducationtaxprint,'educationtaxprint'
:educationtaxprint,}
:educationtaxprint,'voucher_no':voucher_no, }
return render_to_response('tcc/additional.html',dict(template.items() + tmp.items()),
context_instance = RequestContext(request))

Expand All @@ -1222,8 +1241,8 @@ def s_report(request):
jobid = job.id
job_no = job.job_no
job_date = job.date
getjob = Job.objects.all().filter(job_no=job_no).values(
'clientjob__material__name','testtotal__unit_price','site',
getjob = Job.objects.all().filter(job_no=job_no).filter(date=job_date).\
values('clientjob__material__name','testtotal__unit_price','site',
'suspencejob__field__name','report_type','sample','pay',
'check_number','check_dd_date','clientjob__material__matcomment_id',
'suspencejob__field__matcomment_id').distinct()
Expand All @@ -1233,8 +1252,11 @@ def s_report(request):
'client__client__city', 'client__client__state','site','letter_no',
'letter_date','client__client__company').distinct()
from ofau.tcc.variable import *
bill = Bill.objects.get(job_no=job_no)
bal = Job.objects.values_list('tds',flat=True).filter(job_no=job_no)
get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\
values('id')
bill = Bill.objects.get(id=get_bill_id)
bal = Job.objects.values_list('tds',flat=True).filter(job_no=job_no).\
filter(date=job_date)
tdstotal = sum(bal)
net_total1 = bill.balance
from ofau.tcc.convert_function import *
Expand Down Expand Up @@ -1279,10 +1301,14 @@ def rep(request):
amount = Amount.objects.all().get(job_id =query)
user = Job.objects.all().get(id=query)
job = user.job_no
id = Job.objects.aggregate(Max('id'))
maxid =id['id__max']
jobid = Job.objects.get(id = maxid)
bill = Bill.objects.all().get(job_no=job)
job_date = user.date
if (job_date >= date(2014,4,1)):
voucher_no = user.id-1763;
else:
voucher_no = user.id;
get_bill_id = Bill.objects.filter(job_no=job).filter(date=job_date).\
values('id')
bill = Bill.objects.get(id=get_bill_id)
name = Job.objects.all().filter(id=query).values(\
'client__client__first_name', 'client__client__middle_name',
'client__client__last_name','client__client__address',
Expand Down Expand Up @@ -1311,7 +1337,7 @@ def rep(request):
amount,'con_type':con_type, 'ratio1':ratio1, 'ratio2':ratio2,
'collegeincome':collegeincome, 'admincharge' : admincharge, 'user'
:user, 'name':name, 'mate':mate, 'staff':staff,'bill':bill,'job':job,
'jobid':jobid}
'jobid':user, 'voucher_no':voucher_no }
return render_to_response('tcc/report.html', dict(template.items() +
tmp.items()), context_instance = RequestContext(request))

Expand Down
Binary file modified tcc/views.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion templates/tcc/additional.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<div style="font-size:24px" align='center'><b>{{address.name}}</b></div>
<div style="font-size:24px" align='center'>{{title.name}}</div><br>
<div style="position:absolute;right:0px;margin-top:45px;">No.TCC Job/Voucher : {{ job_no }}/{{job.id}} </div>
<div style="position:absolute;right:0px;margin-top:45px;">No.TCC Job/Voucher : {{ job_no }}/{{ voucher_no }} </div>
<div style="position:absolute;right:0px;margin-top:65px;">Dated : {{job.date}} </div>
<br><br>
<body>
Expand Down
2 changes: 1 addition & 1 deletion templates/tcc/report.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<body>
<br>

<div style="position:absolute;right:0px;top:75px;">No.TCC Job/Voucher : {{ user.job_no }}/{{user.id}} </div>
<div style="position:absolute;right:0px;top:75px;">No.TCC Job/Voucher : {{ user.job_no }}/{{ voucher_no }} </div>
<div style="position:absolute;right:0px;top:95px;">Dated : {{user.date}} </div>
<div style="position:absolute;left:7px;top:105px;">Director,</div>
<br></br><br/>
Expand Down