diff --git a/__init__.pyc b/__init__.pyc index fc5ca90..6dc5e9e 100644 Binary files a/__init__.pyc and b/__init__.pyc differ diff --git a/apache/django.wsgi b/apache/django.wsgi deleted file mode 100755 index aff5e11..0000000 --- a/apache/django.wsgi +++ /dev/null @@ -1,9 +0,0 @@ -import os -import sys - -os.environ['DJANGO_SETTINGS_MODULE'] = 'ofau.settings' - -import django.core.handlers.wsgi -application = django.core.handlers.wsgi.WSGIHandler() -sys.path.append('mpath') - diff --git a/report/__init__.pyc b/report/__init__.pyc index 433b07e..3b3fd88 100644 Binary files a/report/__init__.pyc and b/report/__init__.pyc differ diff --git a/report/choices.pyc b/report/choices.pyc index e794443..0bebf7d 100644 Binary files a/report/choices.pyc and b/report/choices.pyc differ diff --git a/report/forms.pyc b/report/forms.pyc index 77ba0c2..c481175 100644 Binary files a/report/forms.pyc and b/report/forms.pyc differ diff --git a/report/models.pyc b/report/models.pyc index 7910575..6ce5bdf 100644 Binary files a/report/models.pyc and b/report/models.pyc differ diff --git a/report/pdf.pyc b/report/pdf.pyc index e9dad8e..42f91fb 100644 Binary files a/report/pdf.pyc and b/report/pdf.pyc differ diff --git a/report/search.pyc b/report/search.pyc index edc654f..09cc7c8 100644 Binary files a/report/search.pyc and b/report/search.pyc differ diff --git a/report/urls.pyc b/report/urls.pyc index 0da8573..7f04075 100644 Binary files a/report/urls.pyc and b/report/urls.pyc differ diff --git a/report/views.pyc b/report/views.pyc index 65b5569..bbfbc85 100644 Binary files a/report/views.pyc and b/report/views.pyc differ diff --git a/settings.py b/settings.py deleted file mode 100755 index 0ce7632..0000000 --- a/settings.py +++ /dev/null @@ -1,142 +0,0 @@ -# Django settings for Automation project. - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -ADMINS = ( - #('Your Name', 'your_email@domain.com'), -) - -MANAGERS = ADMINS - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'db_name', # Or path to database file if using sqlite3. - 'USER': 'db_user', # Not used with sqlite3. - 'PASSWORD': 'db_password', - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. - } -} - -# Local time zone for this installation. Choices can be found here: -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name -# although not all choices may be available on all operating systems. -# On Unix systems, a value of None will cause Django to use the same -# timezone as the operating system. -# If running in a Windows environment this must be set to the same as your -# system time zone. -TIME_ZONE = 'Asia/Kolkata' - -# Language code for this installation. All choices can be found here: -# http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'en-us' - -SITE_ID = 1 -DEFAULT_FROM_EMAIL = 'user@host.com' -EMAIL_HOST = 'smtp.host.com' -EMAIL_HOST_USER = 'user@host.com' -EMAIL_HOST_PASSWORD = 'user@host.com' -EMAIL_USE_TLS = True -EMAIL_PORT = "587" - -SESSION_KEY = '_auth_user_id' -BACKEND_SESSION_KEY = '_auth_user_backend' -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. -USE_I18N = True - -# If you set this to False, Django will not format dates, numbers and -# calendars according to the current locale -USE_L10N = True - -# Absolute path to the directory that holds media. -# Example: "/home/media/media.lawrence.com/" -MEDIA_ROOT = '/usr/local/lib/python2.7/dist-packages/django/contrib/admin/media/' -STATIC_ROOT = 'mpath/ofau/static/' - -LOCAL_URL = 'http://localhost/' -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash if there is a path component (optional in other cases). -# Examples: "http://media.lawrence.com", "http://example.com/media/" -MEDIA_URL = 'http://localhost/media/' -#MEDIA_URL = 'http://localhost/media/' -STATIC_URL = '/static/' -# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a -# trailing slash. -# Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = '/media/' - -AUTH_PROFILE_MODULE = 'tcc.UserProfile' - -# Additional locations of static files -STATICFILES_DIRS = ( - # Put strings here, like "/home/html/static" or "C:/www/django/static". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) - -# List of finder classes that know how to find static files in -# various locations. -STATICFILES_FINDERS = ( - 'django.contrib.staticfiles.finders.FileSystemFinder', - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', -) - -# Make this unique, and don't share it with anybody. -SECRET_KEY = '@3t%hg=e4%fuwrxhq#qm4gp!%0albmve6natdxiqoxcx8#8$wd' - -EASY_MAPS_GOOGLE_KEY = "AIzaSyDRekokepCbXBsF7DC8uyR_95pikeWdPqc" -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -# 'django.template.loaders.eggs.Loader', -) - -TEMPLATE_CONTEXT_PROCESSORS = ( - "django.contrib.auth.context_processors.auth", - "ofau.tcc.context_processors.base_template", -) - -MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.cache.UpdateCacheMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.cache.FetchFromCacheMiddleware', -) - -ROOT_URLCONF = 'ofau.urls' - -TEMPLATE_DIRS = ("mpath/ofau/templates" - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) - - -INSTALLED_APPS = ( - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.messages', - # Uncomment the next line to enable the admin: - 'django.contrib.admin', - 'django.contrib.humanize', - 'registration', - 'ofau.tcc', - 'tagging', -) - - -ACCOUNT_ACTIVATION_DAYS = 2 - - -LOGIN_REDIRECT_URL = '/automation/tcc/index' diff --git a/tcc/models.py b/tcc/models.py index 8db4f34..caa3149 100644 --- a/tcc/models.py +++ b/tcc/models.py @@ -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) diff --git a/tcc/views.py b/tcc/views.py index 22777ff..78a2be9 100644 --- a/tcc/views.py +++ b/tcc/views.py @@ -30,14 +30,14 @@ def home(request): active is the normal user. Depending upon there status different views are created in index1.html and index2.html respectively. ''' - + id = Job.objects.aggregate(Max('job_no')) maxid = id['job_no__max'] ''' id is assigned the max value of job_no which is an attribute of relation Job. id gets an array in result and max value is actually stored in id['job_no__max'] ''' - + if maxid == None : maxid = 1 else: @@ -145,7 +145,6 @@ def view_profile(request): @stop_caching @login_required -@login_required def profile(request): """ ** profile ** @@ -303,12 +302,14 @@ def non_payment_job(request): means the job that describes the work to be done without making any payment. """ - id = NonPaymentJob.objects.aggregate(Max('job_no')) - maxid =id['job_no__max'] - if maxid== None : - maxid = 1 - else: - maxid = maxid + 1 + id = NonPaymentJob.objects.aggregate(Max('id')) + maxid =id['id__max'] + get_job_no=NonPaymentJob.objects.get(id = maxid) + job_no = get_job_no.job_no + if job_no == None : + job_no = 1 + else : + job_no = job_no+1 user = UserProfile.objects.get(id=request.GET['id']) id=request.GET['id'] if request.method == 'POST': @@ -316,7 +317,7 @@ def non_payment_job(request): if form.is_valid(): profile = form.save(commit=False) profile.client= user - profile.job_no = maxid + profile.job_no = job_no profile.save() form.save_m2m() x = {'form': form, 'user': id} @@ -325,7 +326,7 @@ def non_payment_job(request): RequestContext(request)) else: form = NonPaymentJobForm() - form = {'form':form, 'maxid':maxid} + form = {'form':form, 'maxid':job_no} return render_to_response('tcc/non_payment_job.html',dict(form.\ items() + tmp.items()),context_instance=RequestContext(request)) @@ -435,15 +436,17 @@ def selectfield(request): 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 + 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 = maxid + 1 + last_jobno = last_jobno + 1 else: - maxid = jobno - m = Clientadd(client = client,user=user,job_no=maxid) + 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'] @@ -936,19 +939,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) @@ -958,17 +963,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) @@ -978,16 +983,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') @@ -997,22 +1003,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)) @@ -1058,17 +1069,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( @@ -1077,7 +1088,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 @@ -1113,17 +1126,17 @@ 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', @@ -1131,7 +1144,9 @@ def suspence_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 @@ -1176,11 +1191,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) @@ -1207,7 +1224,10 @@ 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 + get_bill_id = Bill.objects.filter(job_no=job_no).filter(date=job_date).\ + values('id') + bill = Bill.objects.get(id=get_bill_id) template = {'job':job,'job_no': job_no ,'bill':bill,'servicetaxprint' : servicetaxprint, 'highereducationtaxprint' : highereducationtaxprint,'educationtaxprint' :educationtaxprint,} @@ -1232,8 +1252,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() @@ -1243,8 +1263,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 * @@ -1289,10 +1312,10 @@ 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 + 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', @@ -1321,7 +1344,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} return render_to_response('tcc/report.html', dict(template.items() + tmp.items()), context_instance = RequestContext(request))