ABSTRACT
Farmers are called as backbones of India because Indian Economy mainly based on farmers without them, it will be in critical stage. Indians will proudly say India is famous for agriculture but at the same time farmers are facing many challenges during growing of crops in their land. Now a days, the farmers have loss in their crops and sugarcane yielding and they couldn’t get the damage amounts. To overcome this issues, the farmers can insure their crops. If any harms occur in the crops they can claim through this website. Many insurance company’s are tie up with us. They will check the details and if all data’s are correct, the company will provide the loss amount to the farmers. The main objective of this project is developing a website especially for farmers to provide the insurance. Before cultivating the crops, the farmer should insure the land and their crops. If any damage occurs, they will upload the affected crop images in the website. After the affirmation by the insurance company, the amount will be credited to the farmer’s account.
Software Description
Front End : PYTHON
Back End : MYSQL Server
Modules
●Admin Module
●User Module
●Apply Insurance
●Verification Process
●Insurance Amount
1.INTRODUCTION In India, around 60% people depending on agriculture. India is famous for agriculture where Indian people will export more agriculture products to other countries, so India also popularly named as an agricultural country. In India among all suicides cases registered Farmer suicides will be around 11.2% of all suicides. The reasons for farmer suicides may be due to floods, family problems, due to financial problems due to unavailable water resources, sometimes due to no time whenever loss happened to a farmer. In India many suicides cases are registered in every year but at least 1 to 2 percent suicide cases of farmers in every state. If we observe the 4 years among one lakh people suicides cases minimum ten thousands suicide cases are farmers. The author surveyed different years of suicides cases among which many farmer suicides cases are registered in every year. The intention of the author is to avoid or to prevent suicides cases of farmers by developing this software application.
2.SYSTEM ANALYSIS
2.1EXISTING SYSTEM Now a day, the farmer’s suicide will increase. Many places in India and agricultural will down yearly. Farmers did not responsible for the natural disaster and government also didn’t care about this activities. Because no proper communication between the government and farmer. In this project has no existing system. The existing system is handled manually. The system follows large number of paper work for maintaining insurance details and user can be difficult to search the insurance policy details in manual process. In this existing system takes lots of time for searching particular insurance policy information.
DISADVANTAGES •Farmers will not get the proper amount from the government for crops loss. •In India the large amount of suicides will occurred. •Government didn’t give proper amount to the farmers. •Lots of the time consumed for each report generation. •Immediate response to the queries is difficult. •Manual system is takes more time. •Existing system is manually, so it increases the chances of errors.
2.2PROPOSED SYSTEM The proposed system is developed after a detailed study about the requirements requested by the user. Proposed system is a computerized one, where all the limitations of manual system are compensated. Insurance details of agricultural insurance management system have simplified the working information and make a user friendly environment, where the user is provided with much flexibility to manage effectively. It helps the admin to generate desirable reports more quickly and also to produce better results. The main theme of the project is developed to the farmers to provide the proper insurance. Farmers will get loss amount immediate from the insurance company. The company can quickly take action when the farmers apply the insurance using this system. So the farmer will get the amount after the verification process through online. ADVANTAGES •In this application through the farmers no one can attempt the suicide because there will be immediate support from the government. •In future the farmer’s suicides will totally reduce and agricultural cultivation will increased through this application. •Reduction of paper work •Automation of existing manual information systems. •Reduction of manual processing •Decrease in processing time
3.SYSTEM REQUIREMENTS
3.1HARDWARE REQUIREMENTS
●Processor : Dual core processor 2.6.0 GHZ ●RAM : 4GB ●Hard disk : Hitachi 320 GB ●Keyboard : Standard keyboard ●Monitor : 15 inch color monitor
3.2 SOFTWARE REQUIREMENTS
●Operating system : Windows OS ●Front End : PHP 5.2.6 ●Back End : MySQL 5.0.51b ●Web Server : WAMP Server 2.0 ●IDE : Macromedia Dreamweaver 8 (Adobe)
4.PROJECT DESCRIPTION
4.1 SOFTWARE DESCRIPTION Frond End: Python Python is an interpreted high-level programming language for general-purpose programming. Created by Guido van Rossum and first released in 1991, Python has a design philosophy that emphasizes code readability, notably using significant whitespace. It provides constructs that enable clear programming on both small and large scales. In July 2018, Van Rossum stepped down as the leader in the language community. Python features a dynamic type system and automatic memory management. It supports multiple programming paradigms, including object-oriented, imperative, functional and procedural, and has a large and comprehensive standard library. Python interpreters are available for many operating systems. CPython, the reference implementation of Python, is open source software and has a community-based development model, as do nearly all of Python's other implementations. Python and CPython are managed by the non-profit Python Software Foundation. Rather than having all of its functionality built into its core, Python was designed to be highly extensible. This compact modularity has made it particularly popular as a means of adding programmable interfaces to existing applications. Van Rossum's vision of a small core language with a large standard library and easily extensible interpreter stemmed from his frustrations with ABC, which espoused the opposite approach. While offering choice in coding methodology, the Python philosophy rejects exuberant syntax (such as that of Perl) in favor of a simpler, less-cluttered grammar. As Alex Martelli put it: "To describe something as 'clever' is not considered a compliment in the Python culture."Python's philosophy rejects the Perl "there is more than one way to do it" approach to language design in favour of "there should be one—and preferably only one—obvious way to do it". Python's developers strive to avoid premature optimization, and reject patches to non-critical parts of CPython that would offer marginal increases in speed at the cost of clarity.[ When speed is important, a Python programmer can move time-critical functions to extension modules written in languages such as C, or use PyPy, a just-in-time compiler. CPython is also available, which translates a Python script into C and makes direct C-level API calls into the Python interpreter. An important goal of Python's developers is keeping it fun to use. This is reflected in the language's name a tribute to the British comedy group Monty Python and in occasionally playful approaches to tutorials and reference materials, such as examples that refer to spam and eggs (from a famous Monty Python sketch) instead of the standard for and bar. A common neologism in the Python community is pythonic, which can have a wide range of meanings related to program style. To say that code is pythonic is to say that it uses Python idioms well, that it is natural or shows fluency in the language, that it conforms with Python's minimalist philosophy and emphasis on readability. In contrast, code that is difficult to understand or reads like a rough transcription from another programming language is called unpythonic. Users and admirers of Python, especially those considered knowledgeable or experienced, are often referred to as Pythonists, Pythonistas, and Pythoneers. Python is an interpreted, object-oriented, high-level programming language with dynamic semantics. Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together. Python's simple, easy to learn syntax emphasizes readability and therefore reduces the cost of program maintenance. Python supports modules and packages, which encourages program modularity and code reuse. The Python interpreter and the extensive standard library are available in source or binary form without charge for all major platforms, and can be freely distributed. Often, programmers fall in love with Python because of the increased productivity it provides. Since there is no compilation step, the edit-test-debug cycle is incredibly fast. Debugging Python programs is easy: a bug or bad input will never cause a segmentation fault. Instead, when the interpreter discovers an error, it raises an exception. When the program doesn't catch the exception, the interpreter prints a stack trace. A source level debugger allows inspection of local and global variables, evaluation of arbitrary expressions, setting breakpoints, stepping through the code a line at a time, and so on. The debugger is written in Python itself, testifying to Python's introspective power. On the other hand, often the quickest way to debug a program is to add a few print statements to the source: the fast edit-test-debug cycle makes this simple approach very effective. Python’s initial development was spearheaded by Guido van Rossum in the late 1980s. Today, it is developed by the Python Software Foundation. Because Python is a multiparadigm language, Python programmers can accomplish their tasks using different styles of programming: object oriented, imperative, functional or reflective. Python can be used in Web development, numeric programming, game development, serial port access and more. There are two attributes that make development time in Python faster than in other programming languages: 1.Python is an interpreted language, which precludes the need to compile code before executing a program because Python does the compilation in the background. Because Python is a high-level programming language, it abstracts many sophisticated details from the programming code. Python focuses so much on this abstraction that its code can be understood by most novice programmers. 2.Python code tends to be shorter than comparable codes. Although Python offers fast development times, it lags slightly in terms of execution time. Compared to fully compiling languages like C and C++, Python programs execute slower. Of course, with the processing speeds of computers these days, the speed differences are usually only observed in benchmarking tests, not in real-world operations. In most cases, Python is already included in Linux distributions and Mac OS X machines.
Back End: My SQL MySQL is the world's most used open source relational database management system (RDBMS) as of 2008 that run as a server providing multi-user access to a number of databases. The MySQL development project has made its source code available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements. MySQL was owned and sponsored by a single for-profit firm, the Swedish company MySQL AB, now owned by Oracle Corporation. MySQL is a popular choice of database for use in web applications, and is a central component of the widely used LAMP open source web application software stack—LAMP is an acronym for "Linux, Apache, MySQL, Perl/PHP/Python." Free-software-open source projects that require a full-featured database management system often use MySQL.For commercial use, several paid editions are available, and offer additional functionality. Applications which use MySQL databases include: TYPO3, Joomla, Word Press, phpBB, MyBB, Drupal and other software built on the LAMP software stack. MySQL is also used in many high-profile, large-scale World Wide Web products, including Wikipedia, Google(though not for searches), ImagebookTwitter, Flickr, Nokia.com, and YouTube. Inter images MySQL is primarily an RDBMS and ships with no GUI tools to administer MySQL databases or manage data contained within the databases. Users may use the included command line tools, or use MySQL "front-ends", desktop software and web applications that create and manage MySQL databases, build database structures, back up data, inspect status, and work with data records. The official set of MySQL front-end tools, MySQL Workbench is actively developed by Oracle, and is freely available for use. Graphical The official MySQL Workbench is a free integrated environment developed by MySQL AB, that enables users to graphically administer MySQL databases and visually design database structures. MySQL Workbench replaces the previous package of software, MySQL GUI Tools. Similar to other third-party packages, but still considered the authoritative MySQL frontend, MySQL Workbench lets users manage database design & modeling, SQL development (replacing MySQL Query Browser) and Database administration (replacing MySQL Administrator).MySQL Workbench is available in two editions, the regular free and open source Community Edition which may be downloaded from the MySQL website, and the proprietary Standard Edition which extends and improves the feature set of the Community Edition
5.SYSTEM DESIGN
5.1DATAFLOW DIAGRAM
A two-dimensional diagram explains how data is processed and transferred in a system. The graphical depiction identifies each source of data and how it interacts with other data sources to reach a common output. Individuals seeking to draft a data flow diagram must identify external inputs and outputs, determine how the inputs and outputs relate to each other, and explain with graphics how these connections relate and what they result in. This type of diagram helps business development and design teams visualize how data is processed and identify or improve certain aspects. Data flow Symbols: Symbol Description An entity. A source of data or a destination for data. A process or task that is performed by the system.
A data store, a place where data is held between processes.
A data flow.
LEVEL 0 The Level 0 DFD shows how the system is divided into 'sub-systems' (processes), each of which deals with one or more of the data flows to or from an external agent, and which together provide all of the functionality of the system as a whole. It also identifies internal data stores that must be present in order for the system to do its job, and shows the flow of data between the various parts of the system.
LEVEL 1 The next stage is to create the Level 1 Data Flow Diagram. This highlights the main functions carried out by the system. As a rule, to describe the system was using between two and seven functions - two being a simple system and seven being a co
5.2ARCHITECTURE DIAGRAM A system architecture or systems architecture is the conceptual model that defines the structure, behavior, and more views of a system. An architecture description is a formal description and representation of a system, organized in a way that supports reasoning about the structures and behaviors of the system. System architecture can comprise system components, the externally visible properties of those components, the relationships (e.g. the behavior) between them. It can provide a plan from which products can be procured, and systems developed, that will work together to implement the overall system. There have been efforts to formalize languages to describe system architecture, collectively these are called architecture description languages (ADLs). Various organizations define systems architecture in different ways, including: ●An allocated arrangement of physical elements which provides the design solution for a consumer product or life-cycle process intended to satisfy the requirements of the functional architecture and the requirements baseline. ●Architecture comprises the most important, pervasive, top-level, strategic inventions, decisions, and their associated rationales about the overall structure (i.e., essential elements and their relationships) and associated characteristics and behavior. ●If documented, it may include information such as a detailed inventory of current hardware, software and networking capabilities; a description of long-range plans and priorities for future purchases, and a plan for upgrading and/or replacing dated equipment and software ●The composite of the design architectures for products and their life-cycle processes.
5.3USE CASE DIAGRAM A use case diagram at its simplest is a representation of a user's interaction with the system that shows the relationship between the user and the different use cases in which the user is involved. In this context, a "system" is something being developed or operated, such as a web site. The "actors" are people or entities operating under defined roles within the system.
6.IMPLEMENTATION
MODULES ●Admin Module ●User Module ●Apply Insurance ●Verification Process ●Insurance Amount
MODULE DESCRIPTIONS
●Admin In this module, the admin can login the system using his/her username and password. And the admin can add the insurance details like insurance name, rules, company details, etc. ●User There is registration form available where new user can create their account by providing required information to the system. The registration form details are like name, email, gender, mobile number, address, and etc. These details are stored in the database. And then can getting to the username and password in the system. User can login in the system using his/her username and password. ●Apply Insurance User or Farmer can apply the insurance, after successful login to the system. After successfully verified by admin, the farmer can claim his/her insurance amount. ●Verification Process In this module, the admin can view the user insurance applied details. After viewing the user insurance details the admin can verify the user documents and details. ●Insurance Amount The company will provide the insurance amount with proper verification. 7.TESTING Testing is a series of different tests that whose primary purpose is to fully exercise the computer based system. Although each test has a different purpose, all work should verify that all system element have been properly integrated and performed allocated function. Testing is the process of checking whether the developed system works according to the actual requirement and objectives of the system. The philosophy behind testing is to find the errors. A good test is one that has a high probability of finding an undiscovered error. A successful test is one that uncovers the undiscovered error. Test cases are devised with this purpose in mind. A test case is a set of data that the system will process as an input. 6.1Types of Testing System testing After a system has been verified, it needs to be thoroughly tested to ensure that every component of the system is performing in accordance with the specific requirements and that it is operating as it should including when the wrong functions are requested or the wrong data is introduced. Testing measures consist of developing a set of test criteria either for the entire system or for specific hardware, software and communications components. For an important and sensitive system such as an electronic voting system, a structured system testing program may be established to ensure that all aspects of the system are thoroughly tested. Testing measures that could be followed include: ●Applying functional tests to determine whether the test criteria have been met ●Applying qualitative assessments to determine whether the test criteria have been met. ●Conducting tests in “laboratory” conditions and conducting tests in a variety of “real life” conditions. ●Conducting tests over an extended period of time to ensure systems can perform consistently. ●Conducting “load tests”, simulating as close as possible likely conditions while using or exceeding the amounts of data that can be expected to be handled in an actual situation. Test measures for hardware may include: ●Applying “non-operating” tests to ensure that equipment can stand up to expected levels of physical handling. ●Testing “hard wired” code in hardware (firmware) to ensure its logical correctness and that appropriate standards are followed. Tests for software components also include: ●Testing all programs to ensure its logical correctness and that appropriate design, development and implementation standards have been followed. ●Conducting “load tests”, simulating as close as possible a variety of “real life” conditions using or exceeding the amounts of data that could be expected in an actual situation. ●Verifying that integrity of data is maintained throughout its required manipulation.
Unit Testing The first test in the development process is the unit test. The source code is normally divided into modules, which in turn are divided into smaller units called units. These units have specific behavior. The test done on these units of code is called unit test. Unit test depends upon the language on which the project is developed. Unit tests ensure that each unique path of the project performs accurately to the documented specifications and contains clearly defined inputs and expected results. Functional and reliability testing in an Engineering environment. Producing tests for the behavior of components (nodes and vertices) of a product to ensure their correct behavior prior to system integration. Integration Testing Testing in which modules are combined and tested as a group. Modules are typically code modules, individual applications, source and destination applications on a network, etc. Integration Testing follows unit testing and precedes system testing. Testing after the product is code complete. Betas are often widely distributed or even distributed to the public at large in hopes that they will buy the final product when it is release. Validation Testing Valid and invalid data should be created and the program should be made to process this data to catch errors. When the user of each module wants to enter into the page by the login page using the use rid and password .If the user gives the wrong password or use rid then the information is provided to the user like “you must enter user id and password”. Here the inputs given by the user are validated. That is password validation, format of date are correct, textbox validation. Changes that need to be done after result of this testing.
8.CONCLUSION This project entitled as “Agricultural Insurance Management System” has been developed to satisfy all the proposed requirements. The process of recording details about insurance is more simple and easy. The system reduces the possibility of errors to a great extent and maintains the data in an efficient manner. User friendliness is the unique feature of this system. The system generates the reports as and when required. The system is highly interactive and flexible for further enhancement. The coding is done in a simplified and easy to understandable manner so that other team trying to enhance the project can do so without facing much difficulty. The documentation will also assist in the process as it has also been carried out in a simplified and concise way.
FUTURE ENHANCEMENT
In future the web application will develop in the android application. The farmers can easily insure their land details through this app. Farmers will get the immediate notifications from the insured company. And we will attach the feedback from also.
APPENDICES
flask import Flask, render_template, flash, request, session,send_file from flask import render_template, redirect, url_for, request #from wtforms import Form, TextField, TextAreaField, validators, StringField, SubmitField from werkzeug.utils import secure_filename import datetime import mysql.connector import sys app = Flask(name) app.config['DEBUG'] app.config['SECRET_KEY'] = '7d441f27d441f27567d441f2b6176a'
@app.route("/") def homepage(): return render_template('index.html')
@app.route("/AdminLogin") def AdminLogin(): alert = 'sdgsdhgdfjh' #return render_template('goback.html', data=alert) return render_template('AdminLogin.html') @app.route("/CompanyLogin") def CompanyLogin(): return render_template('CompanyLogin.html') @app.route("/NewCompany") def NewCompany(): return render_template('NewCompany.html') @app.route("/UserLogin") def UserLogin(): return render_template('UserLogin.html') @app.route("/NewUser") def NewUser(): return render_template('NewUser.html') @app.route("/NewInsurance") def NewInsurance(): return render_template('NewInsurance.html') @app.route("/AbookInfo") def AbookInfo(): conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM Booktb ") data = cur.fetchall() return render_template('AbookInfo.html',data=data) @app.route("/AdminHome") def AdminHome(): conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM regtb ") data = cur.fetchall() return render_template('AdminHome.html',data=data) @app.route("/AdminCompanyInfo") def AdminCompanyInfo(): conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM companytb where Status='waiting' ") data = cur.fetchall() conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM companytb where Status !='waiting' ") data1 = cur.fetchall() return render_template('AdminCompanyInfo.html', data=data, data1=data1) @app.route("/AdminInsurInfo") def AdminInsurInfo(): conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM insurtb ") data = cur.fetchall() return render_template('AdminInsurInfo.html',data=data ) @app.route("/AClaimInfo") def AClaimInfo(): conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM claimtb ") data = cur.fetchall() return render_template('AClaimInfo.html',data=data ) @app.route("/appr") def appr(): cid = request.args.get('cid') conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute( "update companytb set Status='Active' where UserName='" + str(cid) + "' ") conn.commit() conn.close() conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM companytb where Status='waiting' ") data = cur.fetchall() conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM companytb where Status!='waiting' ") data1 = cur.fetchall() return render_template('AdminCompanyInfo.html', data=data, data1=data1 ) @app.route("/remove") def remove(): cuname = session['cname'] did = request.args.get('did') conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute("delete from insurtb where Id='"+ did +"' ") conn.commit() conn.close() conn=mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') # cursor = conn.cursor() cur = conn.cursor() cur.execute("SELECT * FROM insurtb where CompanyNAme ='"+ cuname +"' ") data = cur.fetchall() return render_template('CompanyInsurInfo.html', data=data ) @app.route("/UserHome") def UserHome(): user = session['uname'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') # cursor = conn.cursor() cur = conn.cursor() cur.execute("SELECT * FROM regtb where username='" + user + "'") data = cur.fetchall() return render_template('UserHome.html',data=data) @app.route("/CompanyHome") def CompanyHome(): cuname = session['cname'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') # cursor = conn.cursor() cur = conn.cursor() cur.execute("SELECT * FROM companytb where username='" + cuname + "'") data = cur.fetchall() return render_template('CompanyHome.html', data=data) @app.route("/CBooking") def CBooking(): cuname = session['cname'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') # cursor = conn.cursor() cur = conn.cursor() cur.execute("SELECT * FROM booktb where CompanyName='" + cuname + "'") data = cur.fetchall() return render_template('CBooking.html', data=data) @app.route("/adminlogin", methods=['GET', 'POST']) def adminlogin(): error = None if request.method == 'POST': if request.form['uname'] == 'admin' or request.form['password'] == 'admin': conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') # cursor = conn.cursor() cur = conn.cursor() cur.execute("SELECT * FROM regtb ") data = cur.fetchall() return render_template('AdminHome.html' , data=data) else: return render_template('index.html', error=error) @app.route("/companylogin", methods=['GET', 'POST']) def companylogin(): error = None if request.method == 'POST': username = request.form['uname'] password = request.form['password'] session['cname'] = request.form['uname'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute("SELECT * from companytb where username='" + username + "' and Password='" + password + "'") data = cursor.fetchone() if data is None: alert = 'Username or Password is wrong' return render_template('goback.html', data=alert) else: print(data[0]) session['uid'] = data[0] status = data[9] if( status == 'waiting'): alert = 'Waiting For Company Approval' return render_template('goback.html', data=alert) else: conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') # cursor = conn.cursor() cur = conn.cursor() cur.execute("SELECT * FROM companytb where username='" + username + "' and Password='" + password + "'") data = cur.fetchall() return render_template('CompanyHome.html', data=data) @app.route("/userlogin", methods=['GET', 'POST']) def userlogin(): if request.method == 'POST': username = request.form['uname'] password = request.form['password'] session['uname'] = request.form['uname'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute("SELECT * from regtb where username='" + username + "' and Password='" + password + "'") data = cursor.fetchone() if data is None: alert = 'Username or Password is wrong' render_template('goback.html', data=alert) else: print(data[0]) session['uid'] = data[0] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') # cursor = conn.cursor() cur = conn.cursor() cur.execute("SELECT * FROM regtb where username='" + username + "' and Password='" + password + "'") data = cur.fetchall() return render_template('UserHome.html', data=data ) @app.route("/Search") def Search(): #date = datetime.datetime.now().strftime('%d-%b-%Y') #print(date) conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM insurtb ") data = cur.fetchall() return render_template('Search.html',data=data) @app.route("/dsearch", methods=['GET', 'POST']) def dsearch(): crname = request.form['crname'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM insurtb where CropsName like '%" + crname +"%' ") data = cur.fetchall() return render_template('Search.html',data=data) @app.route("/fullInfo") def fullInfo(): did = request.args.get('did') session['did'] = did conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM insurtb where id='" + did + "' ") data1 = cur.fetchall() return render_template('InsureFullInfo.html',data=data1 ) @app.route("/Book", methods=['GET', 'POST']) def Book(): if request.method == 'POST': uname = session['uname'] did = session['did'] ctype = request.form['ctype'] cardno = request.form['cardno'] cvno = request.form['cvno'] date = datetime.datetime.now().strftime('%d-%b-%Y') conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute("SELECT * FROM insurtb where id='" + did + "'") data = cursor.fetchone() if data: insid = data[1] coname= data[2] insurName = data[4] price = data[5] camt=data[7] else: return 'Incorrect username / password !' conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute("SELECT * FROM regtb where UserName='" + uname + "'") data = cursor.fetchone() if data: Mobile = data[4] Email= data[3] else: return 'Incorrect username / password !' conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute("SELECT count(*) as count FROM booktb ") data = cursor.fetchone() if data: count = data[0] if count == 0: count =1; else: count+=1 else: return 'Incorrect username / password !' print(count) Bookingid="BOOKID00" + str(count) conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute( "INSERT INTO booktb VALUES ('','" + Bookingid + "','"+ insid +"','"+ coname +"','" + insurName + "','" + uname + "','" + Mobile + "','" + Email + "','" + str(price) + "','"+ ctype +"','"+ cardno +"','"+ cvno +"','"+ date +"','waiting','"+camt+"')") conn.commit() conn.close() # return 'file register successfully' conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM booktb where UserName= '"+ uname +"' ") data = cur.fetchall() return render_template('UbookInfo.html' , data =data ) @app.route("/UBookInfo") def UBookInfo(): uname = session['uname'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') # cursor = conn.cursor() cur = conn.cursor() cur.execute("SELECT * FROM booktb where UserName='" + uname +"' ") data = cur.fetchall() return render_template('UBookInfo.html', data=data) @app.route("/cfullInfo") def cfullInfo(): cid = request.args.get('cid') session['cid'] = cid conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM booktb where id='" + cid + "' ") data1 = cur.fetchall() return render_template('UClaim.html',data=data1 ) @app.route("/CBook", methods=['GET', 'POST']) def CBook(): if request.method == 'POST': uname = session['uname'] cid =session['cid'] cinfo = request.form['cinfo'] file = request.files['file'] file.save("static/upload/" + file.filename) file1 = request.files['file1'] file1.save("static/upload/" + file1.filename) conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute("SELECT * FROM booktb where id='" + cid + "'") data = cursor.fetchone() if data: coname = data[3] insurName = data[4] camt=data[14] else: return 'Incorrect username / password !' conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute("SELECT * FROM regtb where UserName='" + uname + "'") data = cursor.fetchone() if data: Mobile = data[4] Email= data[3] else: return 'Incorrect username / password !' conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute( "INSERT INTO claimtb VALUES ('" + cid + "','"+ uname +"','"+ Mobile +"','" + Email + "','" + insurName + "','" + camt + "','" + cinfo + "','" + file.filename + "','"+ file1.filename +"','waiting','"+coname+"')") conn.commit() conn.close() # return 'file register successfully' conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM claimtb where UserName= '"+ uname +"' ") data = cur.fetchall() return render_template('UClaimInfo.html' , data =data ) @app.route("/UClaimInfo") def UClaimInfo(): uname = session['uname'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM claimtb where UserName='" + uname + "' ") data1 = cur.fetchall() return render_template('UClaimInfo.html',data=data1 ) @app.route("/CInsuranceClaim") def CInsuranceClaim(): cuname = session['cname'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM claimtb where CompanyName='" + cuname + "' ") data1 = cur.fetchall() return render_template('CInsuranceClaim.html',data=data1 ) @app.route('/download') def download(): id = request.args.get('id') conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute("SELECT * FROM claimtb where Isuranceid = '" + str(id) + "' ") data = cursor.fetchone() if data: filename = "static\upload\"+data[8] return send_file(filename, as_attachment=True) else: return 'Incorrect username / password !' @app.route("/Aappr") def Aappr(): cid = request.args.get('cid') conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute( "update claimtb set Status='Approved' where Isuranceid='" + str(cid) + "' ") conn.commit() conn.close() conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM claimtb where Status='waiting' ") data = cur.fetchall() conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM claimtb where Status!='waiting' ") data1 = cur.fetchall() return render_template('CInsuranceClaim.html', data=data, data1=data1 ) @app.route("/Rappr") def Rappr(): cid = request.args.get('cid') conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute( "update claimtb set Status='Reject' where Isuranceid='" + str(cid) + "' ") conn.commit() conn.close() conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM claimtb where Status='waiting' ") data = cur.fetchall() conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM claimtb where Status!='waiting' ") data1 = cur.fetchall() return render_template('CInsuranceClaim.html', data=data, data1=data1 ) @app.route("/newuser", methods=['GET', 'POST']) def newuser(): if request.method == 'POST': name1 = request.form['name'] gender1 = request.form['gender'] Age = request.form['age'] email = request.form['email'] pnumber = request.form['phone'] address = request.form['address'] uname = request.form['uname'] password = request.form['psw'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute( "INSERT INTO regtb VALUES ('" + name1 + "','" + gender1 + "','" + Age + "','" + email + "','" + pnumber + "','" + address + "','" + uname + "','" + password + "')") conn.commit() conn.close() # return 'file register successfully' return render_template('UserLogin.html') @app.route("/newcompany", methods=['GET', 'POST']) def newcompany(): if request.method == 'POST': name1 = request.form['name'] regno = request.form['regno'] phone = request.form['phone'] phone2 = request.form['phone2'] email = request.form['email'] website = request.form['website'] address = request.form['address'] uname = request.form['uname'] password = request.form['psw'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute( "INSERT INTO companytb VALUES ('" + name1 + "','" + regno + "','" + phone + "','" + phone2 + "','" + email + "','" + website + "','"+address+"','" + uname + "','" + password + "','waiting')") conn.commit() conn.close() return render_template('CompanyLogin.html') @app.route("/newinsur", methods=['GET', 'POST']) def newinsur(): if request.method == 'POST': cname = session['cname'] id = request.form['id'] crname = request.form['crname'] iname = request.form['iname'] pamt = request.form['pamt'] vali = request.form['vali'] camt = request.form['camt'] info = request.form['info'] file = request.files['file'] file.save("static/upload/" + file.filename) conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cursor = conn.cursor() cursor.execute( "INSERT INTO insurtb VALUES ('','"+ id +"','" + cname + "','" + crname + "','" + iname + "','"+ pamt +"','" + vali + "','" + camt + "','" + info + "','" + file.filename + "')") conn.commit() conn.close() alert = 'New Insurance Info register successfully' return render_template('goback.html',data=alert ) @app.route("/CompanyInsurInfo") def CompanyInsurInfo(): cuname = session['cname'] conn = mysql.connector.connect(user='root', password='', host='localhost', database='1Agriinsurancedb') cur = conn.cursor() cur.execute("SELECT * FROM insurtb where CompanyName ='"+ cuname +"' ") data = cur.fetchall() return render_template('CompanyInsurInfo.html',data=data) if name == 'main': app.run(debug=True, use_reloader=True)
9.2SCREEN SHOT
10.BIBLIOGRAPHY 3 BOOK REFERENCES ●Van Rossum, Guido, and Fred L. Drake. The python language reference manual. Network Theory Ltd., 2011. ●Van Rossum, Guido, and Fred L. Drake. The python language reference manual. Network Theory Ltd., 2011. ●Dierbach, Charles. Introduction to Computer Science using Python: A Computational Problem-Solving Focus. Wiley Publishing, 2012. ●James, Mike. Programmer's Python: Everything is an Object Something Completely Different. I/O Press, 2018. ●Reges, Stuart, Marty Stepp, and Allison Obourn. Building Python Programs. Pearson, 2018. WEBSITE REFERENCES ●https://docs.python.org/3/tutorial/ ●https://www.w3schools.com/python/ ●https://www.tutorialspoint.com/python/index.htm ●https://www.programiz.com/python-programming ●https://www.learnpython.org/