Exemple #1
0
def clearance_result(request):
    if 'Submit' in request.GET:
        ref_no = request.GET['job']       
        work_charge = request.GET['work_charge']
        labour_charge = request.GET['labour_charge']
        car_taxi_charge= request.GET['car_taxi_charge']
        boring_charge_external= request.GET['boring_charge_external']
        boring_charge_internal= request.GET['boring_charge_internal']
        lab_testing_staff=request.GET['lab_testing_staff']
        field_testing_staff= request.GET['field_testing_staff']
        Test_date= request.GET['test_date']
        obj= SuspenseClearance(suspense_id=ref_no, work_charge=work_charge,
             labour_charge=labour_charge, car_taxi_charge=car_taxi_charge, 
             boring_charge_external=boring_charge_external,
             boring_charge_internal=boring_charge_internal,lab_testing_staff=
             lab_testing_staff,field_testing_staff=field_testing_staff,
             test_date=Test_date)
        obj.save()
        temp = {'ref_no': ref_no,'work_charge':work_charge ,'labour_charge':
                labour_charge, 'car_taxi_charge':car_taxi_charge,
                'boring_charge_external':boring_charge_external,
                'boring_charge_internal':boring_charge_internal,
                'lab_testing_staff':lab_testing_staff, 'field_testing_staff':
                field_testing_staff, 'Test_date':Test_date}
        return render(request, 'suspense/clearance_result.html', temp) 
Exemple #2
0
def clearance_result(request):
    if 'Submit' in request.GET:
        ref_no = request.GET['job']
        work_charge = request.GET['work_charge']
        labour_charge = request.GET['labour_charge']
        car_taxi_charge = request.GET['car_taxi_charge']
        boring_charge_external = request.GET['boring_charge_external']
        boring_charge_internal = request.GET['boring_charge_internal']
        lab_testing_staff = request.GET['lab_testing_staff']
        field_testing_staff = request.GET['field_testing_staff']
        Test_date = request.GET['test_date']
        obj = SuspenseClearance(suspense_id=ref_no,
                                work_charge=work_charge,
                                labour_charge=labour_charge,
                                car_taxi_charge=car_taxi_charge,
                                boring_charge_external=boring_charge_external,
                                boring_charge_internal=boring_charge_internal,
                                lab_testing_staff=lab_testing_staff,
                                field_testing_staff=field_testing_staff,
                                test_date=Test_date)
        obj.save()
        temp = {
            'ref_no': ref_no,
            'work_charge': work_charge,
            'labour_charge': labour_charge,
            'car_taxi_charge': car_taxi_charge,
            'boring_charge_external': boring_charge_external,
            'boring_charge_internal': boring_charge_internal,
            'lab_testing_staff': lab_testing_staff,
            'field_testing_staff': field_testing_staff,
            'Test_date': Test_date
        }
        return render(request, 'suspense/clearance_result.html', temp)
Exemple #3
0
def clearance_result(request):
    if request.method == 'POST':
        form = Clearance_form(request.POST)
        if form.is_valid():
            formdata = form.cleaned_data
            voucher_no = formdata['voucher_no']
            session = formdata['session']
            labour_charge = formdata['labour_charge']
            car_taxi_charge = formdata['car_taxi_charge']
            boring_charge_external = formdata['boring_charge_external']
            boring_charge_internal = formdata['boring_charge_internal']
            lab_testing_staff = formdata['lab_testing_staff']
            field_testing_staff = formdata['field_testing_staff']
            test_date = formdata['test_date']
            clear_date = formdata['clear_date']
            session_id = str(session)
            split = session_id.split(' : ')
            start_date = datetime.strptime(split[0], '%Y-%m-%d').date()
            end_date = datetime.strptime(split[1], '%Y-%m-%d').date()
            financialsession = FinancialSession.objects.values('id').\
            get(session_start_date=start_date, session_end_date=end_date)
            suspense_object = SuspenseOrder.objects.filter(voucher=voucher_no,\
                session_id=session).update(is_cleared=0)
            try:
                SuspenseClearance.objects.get(voucher_no=voucher_no,\
                    session=financialsession['id'])
                SuspenseClearance.objects.\
                filter(voucher_no=voucher_no, session=financialsession['id']).\
                update(session=session, voucher_no=voucher_no,\
                    work_charge=0, labour_charge=labour_charge,\
                    car_taxi_charge=car_taxi_charge,\
                    boring_charge_external=boring_charge_external,\
                    boring_charge_internal=boring_charge_internal,\
                    lab_testing_staff=lab_testing_staff,\
                    field_testing_staff=field_testing_staff,\
                    test_date=test_date)
            except:
                obj= SuspenseClearance(session=session, voucher_no=voucher_no,
                     work_charge=0, labour_charge=labour_charge,
                     car_taxi_charge=car_taxi_charge, 
                     boring_charge_external=boring_charge_external,
                     boring_charge_internal=boring_charge_internal,
                     lab_testing_staff=lab_testing_staff,
                     field_testing_staff=field_testing_staff,
                     test_date=test_date)
                obj.save()
            request_status = request_notify()    
            temp = {'session':session,'voucher_no': voucher_no,\
                    'labour_charge':labour_charge,\
                    'car_taxi_charge':car_taxi_charge,
                    'boring_charge_external':boring_charge_external,
                    'boring_charge_internal':boring_charge_internal,
                    'lab_testing_staff':lab_testing_staff,
                    'field_testing_staff':field_testing_staff,\
                    'test_date':test_date, 'clear_date':clear_date,\
                    'request':request_status}
            return render(request, 'suspense/clearance_result.html', temp)
        else:
            voucher = request.POST['voucher_no']
            session = request.POST['session']
            transport = Transport.objects.values('total').\
            get(voucher_no=voucher, session=session)
            form = Clearance_form(request.POST,initial={'voucher_no': voucher,\
            'session': session, 'car_taxi_charge':transport['total']})
            clearance = 'enable'
            message = "Fields are mandatory"
            request_status = request_notify()
            return render(request, 'suspense/suspense_first.html', \
                {'form':form, 'clearance':clearance, 'message':message,
                'request':request_status})
    else:
        return HttpResponseRedirect(\
            reverse('librehatti.suspense.views.clearance_search'))