0% found this document useful (0 votes)
30 views

Project File Informatics Practices (2024-2025)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views

Project File Informatics Practices (2024-2025)

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 66

Sales

SystemManagement
SHARDA GLOBAL SCHOOL, RANCHI

SESSION-[2024-25]
CLASS XII

SENIOR SCHOOL CERTIFICATE EXAMINATION

Informatics Practices (065)

Project Work

SUBMITTED TO SUBMITTED By

Mr. Subhojit Acharya Name:

Class:

Board Roll No.:


ACKNOWLEDGEMENT

I would like to express my special thanks of gratitude to my


teacher Subhojit Sir, who gave us the golden opportunity to
do this project work of “Informatics Practices”, which also
helped me in exploring lot of innovative and creative work
and I also came to know about so many new things. I am
really thankful to them.
“Thank You Again to all who helped me.”

STUDENT’S NAME:
CLASS: XII A
CBSE ROLL NO:-
CERTIFICATE

This is to certify that , Roll no:


of class XII has successfully completed his Project Work of
Informatics Practices (065) for the SSCE (SENIOR SCHOOL
CERTIFICATE EXAMINATION) as prescribed by CBSE in
the session 2024-2025.

_________________________ _________________________

Signature of Internal Examiner Signature of External Examiner

__________________ ___________

Signature of Principal School Stamp


INDEX
INTRODUCTION.............................................................................. 2
UNDERSTANDING SALES MANAGEMENT SYSTEM:.................................................7
KEY FEATURES:............................................................................................7
BENEFITS OF A SALES MANAGEMENT SYSTEM:....................................................8
SYSTEM DEVELOPMENT LIFE CYCLE.....................................................8
PHASES OF SYSTEM DEVELOPMENT LIFE CYCLE................................................10
Initial Phase......................................................................................10
Analysis Phases................................................................................11
Design Phase....................................................................................12
Implementation Phase....................................................................14
Testing Phase...................................................................................16
Deployment Phase...........................................................................18
Maintenance Phase.........................................................................20
Testing Phase...................................................................................22
TESTING METHOD.......................................................................................24
White Box Testing...........................................................................27
Blackbox Testing..............................................................................29
Greybox Testing...............................................................................32
SOURCE CODE.............................................................................35
STARTUP PROCEDURE....................................................................63
INSTALLATION (SOFTWARE)...........................................................................63
INSTALLATION(PACKAGES)............................................................................63
RUNNING THE SOFTWARE.............................................................................63
SYSTEM REQUIREMENT.................................................................63
Introduction
An effective Sales Management System is the cornerstone of success for any business aiming to
thrive in today's competitive marketplace. In an era defined by rapidly evolving technology and
dynamic consumer preferences, the need for a streamlined and efficient approach to sales is more
crucial than ever. This introduction aims to provide a glimpse into the key features and benefits of a
Sales Management System, showcasing its pivotal role in enhancing organizational productivity and
driving revenue growth.

Understanding Sales Management System:


A Sales Management System is a comprehensive solution designed to streamline and optimize the
entire sales process, from lead generation to closing deals and post-sale support. It serves as a
centralized hub that empowers sales teams with the tools and insights necessary to make informed
decisions, foster customer relationships, and ultimately boost sales performance.

Key Features:
1. Lead and Opportunity Tracking: Efficiently manage leads and opportunities, enabling sales
teams to prioritize efforts and focus on prospects with the highest potential.

2. Customer Relationship Management (CRM): Cultivate strong relationships with clients by


maintaining a centralized database of customer interactions, preferences, and purchase
history.

3. Sales Forecasting: Utilize data analytics to predict future sales trends, allowing for strategic
planning and resource allocation.

4. Inventory Management: Keep track of product availability, manage stock levels, and prevent
stockouts or overstock situations.

5. Performance Analytics: Access real-time insights into individual and team performance,
enabling data-driven decision-making and continuous improvement.

6. Communication and Collaboration: Facilitate seamless communication and collaboration


among sales teams, ensuring everyone is on the same page and working towards common
goals.

Benefits of a Sales Management System:


1. Increased Efficiency: Automate routine tasks, reducing manual workload and enabling sales
teams to focus on high-value activities.

2. Improved Decision-Making: Access to real-time data and analytics empowers management


to make informed decisions, identify market trends, and capitalize on opportunities.

3. Enhanced Customer Satisfaction: A well-managed CRM system enables personalized


interactions, leading to improved customer satisfaction and loyalty.

4. Scalability: As your business grows, a robust Sales Management System can easily scale to
accommodate increased sales volumes and expanding teams.

5. Cost Savings: Streamline processes, reduce errors, and minimize wasted resources, resulting
in cost savings across the sales lifecycle.
System Development Life Cycle
The System Development Life Cycle (SDLC) is a framework that outlines the processes involved in the
development, implementation, and maintenance of information systems or software applications. It
provides a structured approach to guide the planning, creation, testing, deployment, and
maintenance of systems in a systematic and organized manner. The SDLC typically consists of several
phases, each with specific goals and deliverables. While various models exist, the core phases of the
SDLC often include:

1. Planning:

● Objectives: Define the project's goals, scope, and feasibility.

● Activities: Conduct feasibility studies, identify resources, establish timelines, and


define project requirements.

2. Analysis:

● Objectives: Understand the current system or business processes, identify user


requirements, and define system functionalities.

● Activities: Conduct interviews, surveys, and research to gather information; create


system requirements and specifications.

3. Design:

● Objectives: Develop a blueprint for the system based on the gathered requirements.

● Activities: Create system architecture, design databases, user interfaces, and system
components; produce detailed technical specifications.

4. Implementation:

● Objectives: Build, code, and integrate the system components.

● Activities: Write code, develop databases, conduct unit testing, and integrate
components to create a functional system.

5. Testing:

● Objectives: Verify that the system functions as intended and identify and fix any
defects.

● Activities: Conduct various testing phases, including unit testing, integration testing,
system testing, and user acceptance testing.

6. Deployment:

● Objectives: Roll out the system for use by end-users.


● Activities: Develop deployment plans, train end-users, migrate data, and implement
the system in the production environment.

7. Maintenance and Support:

● Objectives: Address issues, make enhancements, and ensure the ongoing


functionality of the system.

● Activities: Monitor system performance, fix bugs, implement updates, and respond
to user feedback.

The SDLC is not necessarily a linear process; it can follow different models, such as the Waterfall
model, Agile model, or Spiral model, depending on project requirements and organizational
preferences. Each model has its advantages and drawbacks, and the choice often depends on factors
like project size, complexity, and the level of flexibility required.

The SDLC ensures that systems are developed systematically, with a clear understanding of user
needs, efficient use of resources, and the ability to adapt to changes throughout the development
process.

Phases of System Development Life Cycle


Initial Phase
The initial phase of the System Development Life Cycle (SDLC) is the Planning Phase. This phase is
crucial for setting the direction of the project and establishing a solid foundation for the
development process. During the planning phase, key decisions are made, and essential project
parameters are defined. The primary objectives of this phase include:

1. Define Project Goals and Objectives:

● Establish a clear understanding of the project's purpose, goals, and expected


outcomes.
● Define what the system is intended to achieve for the organization.

2. Assess Feasibility:

● Conduct feasibility studies to evaluate the practicality and viability of the project.

● Assess technical, operational, economic, and scheduling feasibility to determine if


the project is worth pursuing.

3. Identify and Allocate Resources:

● Identify and allocate human resources, technology, equipment, and budgetary


resources required for the project.

● Determine the skills and expertise needed for the development team.

4. Establish Project Timeline:

● Develop a timeline outlining the various phases of the SDLC, including milestones
and deadlines.

● Set realistic timeframes for each phase of the project.

5. Risk Assessment:

● Identify potential risks and challenges that may arise during the development
process.

● Develop strategies to mitigate or manage identified risks.

6. Create a Project Plan:

● Develop a comprehensive project plan that outlines the tasks, responsibilities, and
dependencies of each phase.

● Define the scope of work and create a roadmap for project execution.

7. Obtain Approvals:

● Seek approvals from key stakeholders, including management and project sponsors.

● Ensure that the project plan aligns with organizational goals and expectations.

8. Document the Project Scope:

● Clearly define the scope of the project, including the features and functionalities
that the system will include.

● Set boundaries to prevent scope creep during later phases.


9. Define Success Criteria:

● Establish criteria for evaluating the success of the project.

● Define measurable outcomes and objectives that can be used to assess the project's
performance.

The planning phase is essential for providing a roadmap that guides the development team
throughout the project. It helps in aligning the project with organizational objectives, ensuring that
resources are effectively utilized, and minimizing risks. A well-executed planning phase sets the stage
for a successful System Development Life Cycle.

Analysis Phases
The Analysis Phase is a critical stage in the System Development Life Cycle (SDLC) that follows the
Planning Phase. During the analysis phase, the focus shifts from defining project goals and
parameters to understanding and documenting the requirements of the system to be developed.
The primary objectives of the analysis phase include:

1. Gather Requirements:

● Conduct in-depth analysis to gather information about the needs and requirements
of the end-users and stakeholders.

● Use techniques such as interviews, surveys, workshops, and observations to collect


relevant data.

2. Understand Current Systems/Processes:

● Analyze existing systems or processes, if any, to identify strengths, weaknesses, and


areas for improvement.

● Document how users currently perform their tasks and identify pain points in the
existing system.

3. Define System Objectives:

● Clearly articulate the objectives the new system aims to achieve.

● Align system objectives with the overall goals of the organization and the
expectations of stakeholders.

4. Create Use Cases and Scenarios:

● Develop use cases and scenarios that describe how users will interact with the
system.

● Identify different user roles and their respective responsibilities.

5. Model Data:
● Create data models to represent the structure of the data that the system will
manage.

● Identify entities, relationships, and attributes to design an effective database


structure.

6. Document System Requirements:

● Document both functional and non-functional requirements of the system.

● Functional requirements describe what the system must do, while non-functional
requirements specify qualities such as performance, security, and usability.

7. Prioritize Requirements:

● Work with stakeholders to prioritize and categorize requirements based on their


importance and impact on the overall project.

● Identify critical features and functionalities that must be included in the initial
release.

8. Validation and Verification:

● Validate gathered requirements with stakeholders to ensure accuracy and


completeness.

● Verify that the documented requirements align with the organization's goals and the
expectations of end-users.

9. Feasibility Analysis:

● Revisit the feasibility analysis, considering the requirements gathered.

● Assess whether the proposed system is technically and economically feasible based
on the identified requirements.

10. Create System Specifications:

● Develop detailed system specifications that serve as a basis for the design phase.

● Ensure that specifications provide clear guidance to developers on how to


implement the system.

The analysis phase is crucial for ensuring that the development team has a comprehensive
understanding of what the system needs to accomplish. A thorough analysis helps prevent
misunderstandings, reduces the likelihood of rework in later phases, and lays the groundwork for a
successful design and implementation. The deliverables of the analysis phase often include
requirement documents, use cases, data models, and a clear understanding of the scope of the
system.
Design Phase
The Design Phase is a crucial stage in the System Development Life Cycle (SDLC) that follows the
Analysis Phase. During this phase, the requirements gathered during analysis are translated into a
detailed blueprint for the construction of the system. The primary objectives of the design phase
include creating a plan that specifies how the system will be built and defining its architecture. Here
are key aspects and activities involved in the design phase:

1. System Architecture:

● Develop a high-level system architecture that outlines the structure and


components of the system.

● Identify subsystems and their interactions, defining the overall system framework.

2. Database Design:

● Design the database structure, including tables, relationships, and constraints.

● Define data storage and retrieval mechanisms to support the application's


requirements.

3. User Interface Design:

● Create the user interface (UI) design based on user requirements.

● Consider usability, accessibility, and user experience principles in designing


interfaces.

4. System Specifications:

● Refine and elaborate on the system specifications produced during the analysis
phase.

● Provide detailed technical specifications that guide the development team in


building the system.

5. Hardware and Software Specifications:

● Specify the hardware and software requirements for the system.

● Identify the technologies, frameworks, and tools that will be used in the
development process.

6. Network Design (if applicable):

● Plan and design the network architecture if the system involves distributed
components or relies on network communication.

7. Security Design:
● Incorporate security measures into the system design.

● Identify potential security risks and define strategies to mitigate them.

8. Prototyping:

● Develop prototypes or mockups to provide a visual representation of the system.

● Gather feedback from stakeholders to refine the design before implementation.

9. Integration Planning:

● Plan how different system components will integrate and interact.

● Define interfaces and communication protocols between subsystems.

10. Scalability and Performance Considerations:

● Design the system with scalability in mind to accommodate future growth.

● Consider performance requirements and design the system to meet acceptable


response times.

11. Documentation:

● Create comprehensive documentation that serves as a reference for developers,


testers, and future maintainers.

● Include system architecture diagrams, data flow diagrams, and other relevant
documentation.

12. Review and Approval:

● Conduct design reviews with stakeholders to ensure alignment with requirements


and expectations.

● Obtain approvals from key stakeholders before proceeding to the implementation


phase.

The design phase is crucial for providing a detailed roadmap for developers and ensuring that the
system is architecturally sound and aligned with user requirements. A well-executed design phase
contributes to the overall success of the project by minimizing the likelihood of errors, reducing
development time, and facilitating a smoother implementation process.

Implementation Phase
The Implementation Phase is a pivotal stage in the System Development Life Cycle (SDLC) where the
designs created in the previous phases are turned into a working system. This phase involves actual
coding, development, integration of system components, and preparing for the transition to the
production environment. Key activities and considerations during the implementation phase include:
1. Coding:

● Write the actual code for the system based on the detailed specifications provided in
the design phase.

● Follow coding standards and best practices to ensure consistency and


maintainability.

2. Database Implementation:

● Create and implement the database structure based on the design specifications.

● Populate the database with sample data for testing purposes.

3. Unit Testing:

● Conduct unit testing to ensure that individual components or modules function as


intended.

● Identify and fix any bugs or issues at the unit level.

4. Integration Testing:

● Integrate different modules or components of the system.

● Perform integration testing to ensure that the integrated components work together
seamlessly.

5. System Testing:

● Test the entire system as a whole to validate its functionality against the defined
requirements.

● Identify and address any issues that arise during system testing.

6. User Acceptance Testing (UAT):

● Engage end-users in UAT to validate that the system meets their needs and
expectations.

● Gather feedback from users and make any necessary adjustments.

7. Data Migration:

● If applicable, migrate data from any existing systems to the new system.

● Ensure data integrity and accuracy during the migration process.

8. Documentation Update:
● Update documentation to reflect any changes made during the implementation
phase.

● Ensure that documentation is accurate and up-to-date.

9. Training:

● Provide training sessions for end-users to familiarize them with the new system.

● Ensure that users understand how to use the system effectively.

10. Deployment Planning:

● Develop a deployment plan outlining the steps and processes for transitioning the
system to the production environment.

● Consider rollback procedures in case issues arise during deployment.

11. Pilot Implementation (optional):

● Consider a pilot implementation with a smaller group of users before full-scale


deployment.

● Address any issues identified during the pilot phase.

12. Deployment:

● Deploy the system to the production environment.

● Monitor the deployment process and address any issues that may arise.

13. Post-Implementation Review:

● Conduct a post-implementation review to assess the success of the deployment.

● Gather feedback from users and stakeholders to identify areas for improvement.

14. Handover to Maintenance:

● Hand over the system to the maintenance and support team for ongoing
monitoring, updates, and support.

The implementation phase is a critical step in bringing the envisioned system to life. It involves
collaborative efforts among developers, testers, and other stakeholders to ensure a smooth
transition from development to production. Careful attention to detail and thorough testing during
this phase contributes to the overall success and stability of the system.

Testing Phase
The Testing Phase in the System Development Life Cycle (SDLC) is a critical stage where the system
undergoes comprehensive testing to ensure its functionality, reliability, and compliance with
requirements. The primary goal of testing is to identify and rectify defects, ensuring that the system
meets the specified criteria before deployment. Here are key activities and considerations during the
testing phase:

1. Unit Testing:

● Objective: Verify that individual components or units of the system work as


intended.

● Activities: Developers conduct tests on each module or component in isolation,


checking for correctness and adherence to design specifications.

2. Integration Testing:

● Objective: Validate the interactions and interfaces between integrated components


of the system.

● Activities: Test the combined functionality of modules to identify issues related to


data flow, communication, and integration.

3. System Testing:

● Objective: Validate the overall functionality of the entire system.

● Activities: Test the system as a whole to ensure that it meets the specified
requirements. This includes functional and non-functional testing.

4. Functional Testing:

● Objective: Verify that the system functions according to the defined requirements.

● Activities: Conduct tests to validate specific features, business processes, and use
cases outlined in the requirements.

5. Non-Functional Testing:

● Objective: Assess non-functional aspects such as performance, security, scalability,


and usability.

● Activities: Conduct performance testing, security testing, usability testing, and other
relevant non-functional tests.

6. User Acceptance Testing (UAT):

● Objective: Confirm that the system meets user expectations and business needs.

● Activities: Engage end-users to perform tests and provide feedback. Ensure that the
system aligns with user requirements and is ready for deployment.

7. Regression Testing:
● Objective: Ensure that new changes or fixes do not adversely affect existing
functionalities.

● Activities: Re-run previously conducted tests after modifications to identify and


address any unintended consequences.

8. Smoke Testing:

● Objective: Verify that the essential functionalities of the system work correctly after
each build.

● Activities: Perform a quick evaluation of critical features to determine if further


testing is warranted.

9. Compatibility Testing:

● Objective: Ensure that the system works correctly across different devices,
browsers, and operating systems.

● Activities: Test the system's compatibility with a variety of environments to identify


and resolve issues.

10. Performance Testing:

● Objective: Assess the system's performance under various conditions, including


load, stress, and scalability.

● Activities: Conduct tests to measure response times, resource usage, and system
stability under different scenarios.

11. Security Testing:

● Objective: Identify and address potential security vulnerabilities in the system.

● Activities: Conduct tests to assess the system's resistance to unauthorized access,


data breaches, and other security threats.

12. Usability Testing:

● Objective: Evaluate the user interface for ease of use and overall user satisfaction.

● Activities: Gather feedback from end-users regarding the system's user interface,
navigation, and overall user experience.

13. End-to-End Testing:

● Objective: Validate the flow and functionality of the entire system from start to
finish.
● Activities: Test the complete business processes to ensure seamless integration of
all components.

14. Test Documentation:

● Objective: Maintain comprehensive documentation of test cases, test scripts, and


results.

● Activities: Document test scenarios, expected outcomes, and any deviations


observed during testing.

15. Defect Tracking and Management:

● Objective: Identify and log defects or issues discovered during testing.

● Activities: Use a defect tracking system to manage and prioritize the resolution of
identified issues.

16. Approval for Deployment:

● Objective: Obtain approval from stakeholders to proceed with the deployment of


the system.

● Activities: Provide stakeholders with a summary of test results and seek their
approval to move to the next phase.

The testing phase is crucial for ensuring the reliability and quality of the system. Rigorous testing
helps identify and address issues early in the development process, reducing the likelihood of
defects reaching the production environment. Successful completion of the testing phase indicates
that the system is ready for deployment and use by end-users.

Deployment Phase
The Deployment Phase in the System Development Life Cycle (SDLC) is the stage where the
developed system is released and made available for use by end-users in the production
environment. The primary goal is to transition from the development and testing environments to a
live, operational state. The deployment phase involves several activities and considerations:

1. Deployment Planning:

● Develop a detailed deployment plan outlining the steps and processes for
transitioning the system to the production environment.

● Specify roles and responsibilities for team members involved in the deployment
process.

2. Data Migration:

● If applicable, migrate data from any existing systems to the new system.

● Ensure data integrity and accuracy during the migration process.


3. Environment Verification:

● Verify that the production environment is ready to host the system.

● Confirm that hardware, software, and network configurations are in place and meet
the system requirements.

4. Backup and Rollback Procedures:

● Establish backup procedures to safeguard data and configurations before


deployment.

● Define rollback procedures in case issues arise during or after deployment, allowing
a return to the previous state.

5. User Training:

● Conduct training sessions for end-users to familiarize them with the new system.

● Provide guidance on using the system effectively and efficiently.

6. Communication and Coordination:

● Communicate the deployment plan to all stakeholders, including end-users and


support teams.

● Coordinate with relevant departments to minimize disruptions during the


deployment.

7. Deployment Execution:

● Execute the deployment plan, following the specified steps and timelines.

● Monitor the deployment process to ensure that each phase is completed


successfully.

8. Verification and Validation:

● Verify that the deployed system functions correctly in the production environment.

● Validate that data migration, if performed, was successful and accurate.

9. Post-Deployment Support:

● Provide immediate post-deployment support to address any issues that may arise.

● Monitor system performance and user feedback.

10. Documentation Update:


● Update system documentation to reflect any changes made during the deployment
phase.

● Ensure that documentation accurately reflects the configuration of the live system.

11. Transition to Maintenance:

● Officially transition the system to the maintenance and support phase.

● Hand over the responsibility for ongoing monitoring, updates, and support to the
maintenance team.

12. User Acceptance:

● Confirm with end-users that the deployed system meets their expectations.

● Address any user concerns or issues promptly.

13. Project Review:

● Conduct a post-deployment review with key stakeholders to assess the success of


the deployment.

● Identify lessons learned and areas for improvement in future projects.

14. Closure of Deployment Phase:

● Officially close the deployment phase, signifying the successful transition of the
system to the production environment.

● Document the completion of deployment-related activities.

The deployment phase is a critical step in the SDLC, marking the culmination of the development
process and the beginning of the system's operational life. A well-executed deployment ensures a
smooth transition and minimizes disruptions to business operations. Continuous monitoring and
support during the post-deployment phase contribute to the overall success and stability of the
system in the production environment.

Maintenance Phase
The Maintenance Phase is the final stage in the System Development Life Cycle (SDLC), following the
deployment of the system in the production environment. This phase is characterized by ongoing
activities aimed at supporting, enhancing, and ensuring the continued functionality of the system.
The primary objectives of the maintenance phase include:

1. Monitoring and Performance Optimization:

● Continuously monitor the system's performance to identify and address any issues
that may impact its efficiency.
● Optimize the system for improved response times, resource utilization, and overall
performance.

2. Bug Fixes:

● Address and fix any bugs or defects identified during the deployment or discovered
during system usage.

● Prioritize and resolve issues based on their impact on system functionality.

3. Security Updates:

● Stay vigilant for potential security vulnerabilities and apply necessary updates and
patches to maintain the system's security.

● Regularly review and enhance security measures to mitigate emerging threats.

4. User Support:

● Provide ongoing support to end-users, addressing inquiries, issues, and questions


related to system usage.

● Maintain a helpdesk or support system for user assistance.

5. Data Maintenance:

● Regularly perform data checks and maintenance tasks to ensure data integrity and
accuracy.

● Implement data archiving or purging strategies to manage database size and


performance.

6. Adaptation to Changes:

● Accommodate changes in user requirements, business processes, or regulatory


standards.

● Modify the system as needed to align with evolving organizational needs.

7. Enhancements and Updates:

● Introduce new features or enhancements to the system to improve its functionality.

● Consider user feedback and emerging technologies when planning updates.

8. Documentation Maintenance:

● Keep system documentation up-to-date to reflect changes made during the


maintenance phase.
● Ensure that documentation accurately represents the current state of the system.

9. Technology Updates:

● Stay informed about advancements in technology and software components used in


the system.

● Update third-party libraries, frameworks, or dependencies to maintain compatibility


and security.

10. Regression Testing:

● Conduct regression testing to ensure that new changes or updates do not introduce
unintended side effects or issues.

● Validate the continued stability of existing functionalities.

11. Performance Monitoring:

● Continue monitoring system performance and scalability to anticipate and address


potential issues as the user base or data load increases.

12. End-of-Life Planning:

● Develop a plan for retiring the system when it reaches the end of its useful life.

● Consider data migration, archival, or replacement strategies.

13. Feedback and Continuous Improvement:

● Solicit feedback from end-users and stakeholders for insights into system
performance and user satisfaction.

● Use feedback to inform continuous improvement initiatives.

14. Cost-Benefit Analysis:

● Evaluate the cost-effectiveness of system maintenance activities against the benefits


they provide.

● Make informed decisions about allocating resources based on the system's ongoing
value to the organization.

The maintenance phase is a continuous cycle that ensures the system remains reliable, secure, and
aligned with organizational goals. It extends throughout the system's operational life, adapting to
changes in technology, user needs, and the business environment. Effective maintenance practices
contribute to the long-term success and sustainability of the system within the organization.
Testing Phase
The Testing Phase in the System Development Life Cycle (SDLC) is a critical stage where the
developed system undergoes various testing activities to ensure its functionality, reliability, and
compliance with specified requirements. The primary goal of testing is to identify and rectify defects
or issues before the system is deployed to the production environment. The testing phase involves
several key activities:

1. Unit Testing:

● Objective: Verify that individual components or units of the system work as


intended.

● Activities: Developers conduct tests on each module or component in isolation to


ensure that they perform as expected.

2. Integration Testing:

● Objective: Validate the interactions and interfaces between integrated components


of the system.

● Activities: Test the combined functionality of modules to identify issues related to


data flow, communication, and integration.

3. System Testing:

● Objective: Validate the overall functionality of the entire system.

● Activities: Test the system as a whole to ensure that it meets the specified
requirements. This includes functional and non-functional testing.

4. Functional Testing:

● Objective: Verify that the system functions according to the defined requirements.

● Activities: Conduct tests to validate specific features, business processes, and use
cases outlined in the requirements.

5. Non-Functional Testing:

● Objective: Assess non-functional aspects such as performance, security, scalability,


and usability.

● Activities: Conduct performance testing, security testing, usability testing, and other
relevant non-functional tests.

6. User Acceptance Testing (UAT):

● Objective: Confirm that the system meets user expectations and business needs.
● Activities: Engage end-users to perform tests and provide feedback. Ensure that the
system aligns with user requirements and is ready for deployment.

7. Regression Testing:

● Objective: Ensure that new changes or fixes do not adversely affect existing
functionalities.

● Activities: Re-run previously conducted tests after modifications to identify and


address any unintended consequences.

8. Smoke Testing:

● Objective: Verify that the essential functionalities of the system work correctly after
each build.

● Activities: Perform a quick evaluation of critical features to determine if further


testing is warranted.

9. Compatibility Testing:

● Objective: Ensure that the system works correctly across different devices,
browsers, and operating systems.

● Activities: Test the system's compatibility with a variety of environments to identify


and resolve issues.

10. Performance Testing:

● Objective: Assess the system's performance under various conditions, including


load, stress, and scalability.

● Activities: Conduct tests to measure response times, resource usage, and system
stability under different scenarios.

11. Security Testing:

● Objective: Identify and address potential security vulnerabilities in the system.

● Activities: Conduct tests to assess the system's resistance to unauthorized access,


data breaches, and other security threats.

12. Usability Testing:

● Objective: Evaluate the user interface for ease of use and overall user satisfaction.

● Activities: Gather feedback from end-users regarding the system's user interface,
navigation, and overall user experience.

13. End-to-End Testing:


● Objective: Validate the flow and functionality of the entire system from start to
finish.

● Activities: Test the complete business processes to ensure seamless integration of


all components.

14. Test Documentation:

● Objective: Maintain comprehensive documentation of test cases, test scripts, and


results.

● Activities: Document test scenarios, expected outcomes, and any deviations


observed during testing.

15. Defect Tracking and Management:

● Objective: Identify and log defects or issues discovered during testing.

● Activities: Use a defect tracking system to manage and prioritize the resolution of
identified issues.

16. Approval for Deployment:

● Objective: Obtain approval from stakeholders to proceed with the deployment of


the system.

● Activities: Provide stakeholders with a summary of test results and seek their
approval to move to the next phase.

The testing phase is a crucial aspect of the SDLC, helping to ensure the quality, reliability, and
performance of the developed system. Thorough testing reduces the likelihood of defects reaching
the production environment and contributes to the overall success of the project.

Testing Method
A comprehensive testing strategy is essential for ensuring the quality, reliability, and effectiveness of
a system throughout the System Development Life Cycle (SDLC). The strategy encompasses a variety
of testing methods, techniques, and best practices to address different aspects of the system. Here is
a comprehensive testing strategy for the SDLC:

1. Requirement Analysis:

● Verify that requirements are clear, complete, and testable.

● Establish traceability between requirements and test cases.

2. Test Planning:

● Develop a comprehensive test plan outlining the testing approach, scope, objectives,
resources, schedule, and deliverables.
● Identify testing environments and tools.

3. Testing Types:

● Unit Testing:

● Verify the correctness of individual components or modules.

● Conducted by developers during the coding phase.

● Integration Testing:

● Validate the interactions and interfaces between integrated components.

● Employ methods such as top-down, bottom-up, and incremental testing.

● System Testing:

● Validate the overall functionality and behavior of the entire system.

● Include functional and non-functional testing.

● Acceptance Testing:

● Confirm that the system meets user expectations and business


requirements.

● Includes User Acceptance Testing (UAT) by end-users.

4. Testing Levels:

● Static Testing:

● Review code, design documents, and requirements to identify defects.

● Conduct walkthroughs, inspections, and code reviews.

● Dynamic Testing:

● Execute the system or components to assess their behavior.

● Includes unit testing, integration testing, and system testing.

5. Testing Methods:

● Black Box Testing:


● Focus on testing the system's functionality without knowledge of internal
structures.

● Techniques include equivalence partitioning, boundary value analysis, and


scenario testing.

● White Box Testing:

● Focus on testing the internal structures, code, and paths of the system.

● Techniques include statement coverage, branch coverage, and path testing.

● Gray Box Testing:

● Combine elements of both black box and white box testing.

● Testers have partial knowledge of the internal structures.

6. Testing Artifacts:

● Develop comprehensive test cases based on requirements, design documents, and


use cases.

● Create test scripts for automated testing, particularly for regression testing.

7. Automation Testing:

● Automate repetitive and time-consuming test cases to increase efficiency.

● Use tools for test automation, such as Selenium for web applications or JUnit for unit
testing.

8. Regression Testing:

● Conduct regression testing after each code change or update to ensure existing
functionalities remain intact.

● Automate regression test suites for efficiency.

9. Performance Testing:

● Assess the system's performance under various conditions, including load, stress,
and scalability.

● Utilize tools like JMeter or LoadRunner for performance testing.

10. Security Testing:


● Identify and address potential security vulnerabilities in the system.

● Conduct penetration testing, security scans, and code reviews.

11. Usability Testing:

● Evaluate the user interface for ease of use and overall user satisfaction.

● Include end-users in usability testing and gather feedback.

12. Defect Tracking and Management:

● Implement a defect tracking system to log and prioritize identified issues.

● Track the status of defect resolution throughout the SDLC.

13. Test Environment Management:

● Ensure that testing environments mirror production environments as closely as


possible.

● Manage configurations and data for accurate testing.

14. Continuous Integration and Continuous Testing:

● Implement continuous integration practices to automatically build and test code


changes.

● Facilitate continuous testing as part of the development pipeline.

15. Metrics and Reporting:

● Define key performance indicators (KPIs) to measure testing progress and


effectiveness.

● Generate regular test reports to communicate status, trends, and areas of


improvement.

16. Collaboration and Communication:

● Foster collaboration between development, testing, and other stakeholders.

● Communicate effectively about test progress, issues, and outcomes.

17. Training and Skill Development:

● Provide training for testing team members to enhance their skills and knowledge.

● Keep the team updated on industry best practices and emerging trends.
18. Exit Criteria and Sign-Off:

● Define exit criteria to determine when testing is complete.

● Obtain sign-off from stakeholders before transitioning to the deployment phase.

19. Continuous Improvement:

● Conduct retrospectives to identify lessons learned and areas for improvement.

● Use feedback from testing activities to enhance future testing processes.

By integrating these elements into the SDLC, organizations can establish a robust testing strategy
that ensures the delivery of a high-quality and reliable system to end-users. The strategy should be
adaptable to project-specific needs and evolving requirements.

White Box Testing


White box testing, also known as glass box testing, clear box testing, or structural testing, is a
software testing method that involves examining the internal structure, code, and implementation
details of the system. Unlike black box testing, where the tester focuses on testing the system's
functionality without knowledge of its internal workings, white box testing requires knowledge of
the internal logic to design test cases. The goal is to ensure that all paths, conditions, and branches
of the code are tested to uncover defects in the logic and verify the correctness of the code. Here
are common methods and techniques used in white box testing:

1. Unit Testing:

● Verify the correctness of individual units or components of the system.

● Developers typically conduct unit testing during the coding phase.

2. Integration Testing:

● Validate the interactions and interfaces between integrated components.


● Test the combined functionality of modules to identify issues related to data flow,
communication, and integration.

3. System Testing:

● Validate the overall functionality of the entire system.

● Test the system as a whole to ensure that it meets specified requirements.

4. Path Testing:

● Test each possible path through the code to identify potential logical errors.

● Ensure that every statement and branch is executed at least once during testing.

5. Control Flow Testing:

● Test the flow of control within the code to ensure that statements are executed in
the expected sequence.

● Identify loops, conditions, and decision points.

6. Branch Coverage:

● Assess the coverage of decision branches within the code to ensure all possible
paths are tested.

● Measure the percentage of branches covered during testing.

7. Statement Coverage:

● Measure the percentage of code statements that have been executed during
testing.

● Ensure that every line of code is executed at least once.

8. Condition Coverage:

● Evaluate the coverage of different conditions and their outcomes within the code.

● Test different conditions to ensure all possible outcomes are considered.

9. Data Flow Testing:

● Analyze how data is used and manipulated within the code to identify potential
data-related issues.

● Test the flow of data through different variables and paths.

10. Mutation Testing:


● Introduce small changes (mutations) to the code and check if the test suite can
detect these changes.

● Identify weak points in the test suite by introducing deliberate defects.

11. Static Analysis:

● Use static analysis tools to analyze the source code without executing it.

● Identify issues such as code smells, coding standards violations, and potential errors.

12. Dynamic Analysis:

● Analyze the code during runtime to identify memory leaks, performance


bottlenecks, and other runtime issues.

● Use tools for dynamic code analysis and profiling.

13. Boundary Value Analysis:

● Test values at the boundaries of input ranges to identify potential issues.

● Verify that the system behaves correctly for minimum, maximum, and boundary
values.

14. Ad-hoc Testing:

● Conduct informal testing without predefined test cases.

● Use knowledge of the code and system to explore and identify potential issues.

15. Code Review:

● Conduct manual or automated code reviews to identify issues such as coding


standards violations, potential bugs, and maintainability concerns.

● Collaborate with other team members to ensure code quality.

White box testing is often performed by developers, and it is an integral part of the software
development process. It helps ensure the reliability and correctness of the code by thoroughly
examining the internal structures and logic of the system. While white box testing is crucial, it is
typically complemented by other testing methods, such as black box testing and grey box testing, to
achieve comprehensive test coverage.

Blackbox Testing
Black box testing is a software testing method where the internal workings, code structure, and
implementation details of the system are not known to the tester. The focus is on testing the
system's functionality, behaviour, and adherence to specifications without knowledge of its internal
logic. Black box testing treats the system as a "black box" where inputs are provided, and outputs
are observed, with no visibility into the internal processes. Here are common methods and
techniques used in black box testing:

1. Equivalence Partitioning:

● Group input conditions into classes or partitions and select representative values
from each partition.

● Test cases are designed to cover each partition, reducing the number of test cases
needed.

2. Boundary Value Analysis:

● Focus on testing values at the boundaries of input ranges.

● Verify that the system behaves correctly for the minimum, maximum, and values
just beyond the limits.

3. State Transition Testing:

● Model the system's behaviour in response to different states and transitions


between states.

● Design test cases to cover transitions between different states of the system.

4. Decision Table Testing:

● Create decision tables to represent different combinations of input conditions and


expected outcomes.

● Generate test cases based on combinations in the decision table.

5. Use Case Testing:

● Design test cases based on use cases, user stories, or functional requirements.

● Verify that the system behaves as expected in various scenarios.

6. Scenario Testing:

● Create realistic scenarios representing end-to-end user interactions with the system.

● Test the system's behaviour in different real-world situations.

7. Functional Testing:

● Test the functionality of the system against specified requirements.

● Include tests for input validation, output correctness, and adherence to functional
specifications.
8. Non-Functional Testing:

● Assess non-functional aspects such as performance, security, usability, and


reliability.

● Conduct tests related to response times, security vulnerabilities, user experience,


and system stability.

9. Random Testing:

● Provide random input values to the system to observe its responses.

● Identify unexpected behaviours or potential issues.

10. Ad-hoc Testing:

● Conduct unstructured testing without predefined test cases.

● Testers explore the system based on their intuition, experience, and creativity.

11. Compatibility Testing:

● Verify that the system works correctly across different devices, browsers, and
operating systems.

● Test compatibility with various configurations.

12. User Acceptance Testing (UAT):

● Engage end-users to perform tests and provide feedback.

● Confirm that the system meets user expectations and business requirements.

13. Regression Testing:

● Ensure that new changes or updates do not adversely affect existing functionalities.

● Re-run previously conducted tests after modifications to identify and address any
unintended consequences.

14. Smoke Testing:

● Verify that the essential functionalities of the system work correctly after each build.

● Perform a quick evaluation of critical features to determine if further testing is


warranted.

15. Compatibility Testing:


● Ensure that the system works correctly across different devices, browsers, and
operating systems.

● Test the system's compatibility with a variety of environments.

16. Performance Testing:

● Assess the system's performance under various conditions, including load, stress,
and scalability.

● Conduct tests to measure response times, resource usage, and system stability
under different scenarios.

17. Security Testing:

● Identify and address potential security vulnerabilities in the system.

● Conduct tests to assess the system's resistance to unauthorized access, data


breaches, and other security threats.

18. Usability Testing:

● Evaluate the user interface for ease of use and overall user satisfaction.

● Gather feedback from end-users regarding the system's user interface, navigation,
and overall user experience.

Black box testing is valuable for assessing the system from an end-user perspective and ensuring that
it behaves as expected without requiring knowledge of the underlying code or internal structures.

Greybox Testing
Grey box testing is a software testing method that combines elements of both black box testing and
white box testing. In grey box testing, the tester has partial knowledge of the internal workings of
the system. This approach allows testers to assess the system's functionality, behaviour, and internal
structures to a limited extent. Grey box testing is particularly useful when the testing team has some
knowledge of the system's internal logic but does not have complete access to the source code.

Here are some common methods and techniques used in grey box testing:

1. Data-Driven Testing:

● Utilize knowledge of the internal data structures to design test cases.

● Test different data inputs to assess how the system processes and handles data.

2. Database Testing:

● Examine and manipulate the database directly to verify data integrity, accuracy, and
consistency.
● Assess how the application interacts with the database.

3. API Testing:

● Test the application's APIs (Application Programming Interfaces) by sending requests


and examining responses.

● Evaluate the correctness of data exchanges between different system components.

4. Functional Testing:

● Focus on testing the functional aspects of the system based on available


specifications and requirements.

● Design test cases that exercise various functionalities without detailed knowledge of
the internal code.

5. Behavioural Testing:

● Assess the system's behaviour under different conditions.

● Testers observe and analyze how the system responds to inputs and stimuli.

6. State Transition Testing:

● Evaluate the system's behaviour as it transitions between different states.

● Identify possible paths and transitions based on partial knowledge of the internal
logic.

7. Code-Based Testing:

● Use partial knowledge of the code to design test cases that focus on specific code
paths or modules.

● Assess the functionality and correctness of specific code segments.

8. Error Guessing:

● Make educated guesses about potential errors or weak points in the system based
on partial knowledge.

● Design test cases to verify the presence or absence of anticipated issues.

9. Adaptive Testing:

● Adjust testing approaches based on feedback and insights gained during testing.

● Adapt test cases and strategies to explore areas of uncertainty.


10. Scenario-Based Testing:

● Create test scenarios based on a combination of external specifications and internal


knowledge.

● Evaluate how the system behaves in specific situations.

11. Limited Code Inspection:

● Examine parts of the code, especially those relevant to the testing scope.

● Look for potential issues, logical errors, or areas that require additional testing.

12. Code Profiling:

● Use code profiling tools to gather information about code execution, resource
utilization, and performance.

● Identify areas that may require more attention in terms of testing.

13. Trace Analysis:

● Review trace logs or outputs to understand the flow of execution and identify
potential areas of concern.

● Trace the system's behaviour based on available information.

Grey box testing allows testers to strike a balance between the external perspective of black box
testing and the internal insight of white box testing. It is particularly beneficial when the testing
team has some knowledge of the internal logic but lacks complete access to the source code or
detailed design. This approach helps uncover defects, assess system behaviour, and improve test
coverage.
Source Code
import customtkinter as ctk
from PIL import Image
import tkinter as tk
import mysql.connector
from tkinter import messagebox, ttk
import tkcalendar as tkc
import matplotlib.pyplot as plt
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import pandas as pd

ctk.set_appearance_mode("light")
ctk.set_default_color_theme("blue")

cou = 0

def startup():
global cou
try:
global host, use, passss
a = pd.read_csv("C:\\ProgramData\\Sales_management_log.csv")
host = a.iloc[0, 1]
use = a.iloc[1, 1]
passss = a.iloc[2, 1]
connection = mysql.connector.connect(host=host, user=use, password=passss)
cursor = connection.cursor()
print(
"_________________________________________MySQL connected "
"successfully_________________________________________")
except:
if cou == 0:
print(
"_________________________________________Enter login "
"credentials_________________________________________")
else:
print(
"_________________________________________Invalid login "
"credentials_________________________________________")
host = input("Enter host: ")
use = input("Enter user: ")
passss = input("Enter password: ")
log = pd.DataFrame(data=[host, use, passss])
log.to_csv("C:\\ProgramData\\Sales_management_log.csv")
cou += 1
startup()

def db(query):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(query)
mydb.commit()
mydb.close()
except mysql.connector.Error as e:
messagebox.showerror(title="Error while Execution", message=e)

def user_details():
global acc_name, user_name, pwd, dob, gender, designation, email, about_info,
user_id
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
curr.execute(f"SELECT * From USER where uname= '{user_id}';")
a = curr.fetchall()
acc_name = a[0][0]
user_name = a[0][1]
pwd = a[0][2]
dob = a[0][3]
gender = a[0][4]
designation = a[0][5]
email = a[0][6]
about_info = a[0][7]
mydb.close()

def intialize():
query_user = ("Create table if not exists User(account_holder varchar(50),uname
varchar(50) unique,pwd varchar("
"50),dob date,Gender varchar(6),Designation varchar(25),email
varchar(75),About text(250));")
query_inventory = ("Create table if not exists inventory(product_id char(5)
primary key,product_name varchar(50) ,"
"price int,amount int);")
query_employees = ("Create table if not exists employee(employee_id char(4)
primary key,employee_name varchar(50),"
"department varchar(30));")
query_order = ("Create table if not exists orders(product_id
char(5),product_name varchar(50),amount int,"
"employee_id char(4),Date date,Foreign key(product_id)
references inventory(Product_id) on update "
"cascade,Foreign key (employee_id) references
employee(employee_id) on update cascade);")
db(query_user)
db(query_inventory)
db(query_employees)
db(query_order)

# insert-command
insert_user1 = "Insert ignore into user(uname,pwd) values('root','root');"
insert_user = "Insert ignore into user(account_holder,uname,pwd,dob) values(%s,
%s,%s,%s);"
list_user = [("'Subhashish'", "'Subhashish'", 1234, "'2006-06-28'"),
("'Shaurya'", "'Shaurya'", 1234, "'2005-04-25'"), ("'Shriyansh'",
"'Shriyansh'", 1234, "'2006-07-21'")]
db(insert_user1)
for x in range(0, 3, 1):
query = (insert_user % list_user[x])
db(query)

insert_employee = "Insert ignore into


employee(employee_id,employee_name,department) values(%s,%s,%s);"
list_employee = [("'1'", "'Gipsy'", "'Baby'"), ("'2'", "'Zacherie'",
"'Music'"), ("'3'", "'Dom'", "'Games'"),
("'4'", "'Doroteya'", "'Garden'"), ("'5'", "'Tyne'",
"'Electronics'"),
("'6'", "'Godwin'", "'Electronics'"),
("'7'", "'Wenda'", "'Home'"), ("'8'", "'Godard'", "'Music'"),
("'9'", "'Xylina'", "'Electronics'"),
("'10'", "'Adoree'", "'Books'")]
for i in range(0, 10, 1):
query = (insert_employee % list_employee[i])
db(query)

insert_inventory = "Insert ignore into inventory values(%s,%s,%s,%s);"


list_product = [("'1'", "'Baby powder'", 468, 86), ("'2'", "'Music Disc'", 369,
45), ("'3'", "'Chess'", 434, 53),
("'4'", "'Spade'", 112, 55), ("'5'", "'Home Theater'", 215,
75), ("'6'", "'TV'", 383, 30),
("'7'", "'Knife set'", 201, 40), ("'8'", "'Band Posters'", 165,
53), ("'9'", "'Vacuum'", 390, 60),
("'10'", "'Wings of Fire'", 206, 99)]
for o in range(0, 10, 1):
query = (insert_inventory % list_product[o])
db(query)

class login_window(ctk.CTk):
global user_id, count
count = 0

def __init__(self):
super().__init__()
self._set_appearance_mode("dark")
self.title("Welcome")
s_width = self.winfo_screenwidth()
s_height = self.winfo_screenheight()
width = 600
height = 500
width_position = ((s_width / 2) - width / 2)
height_position = ((s_height / 2) - height / 2)
self.geometry("%dx%d+%d+%d" % (width, height, width_position,
height_position))
self.resizable(width=False, height=False)
img = ctk.CTkImage(light_image=Image.open("black and white hexagon.jpg"),
dark_image=Image.open("black and white hexagon.jpg"),
size=(600, 500))
self.frame = ctk.CTkFrame(master=self, width=600, height=500)
self.frame.place(relx=0, rely=0)
self.bg = ctk.CTkLabel(self.frame, 600, 500, image=img, text="")
self.bg.place(relx=0, rely=0)
if count == 0: # first-try
self.rf = ctk.CTkFrame(self, 300, 500, corner_radius=10,
fg_color="#191717", bg_color="#191717")
self.rf.place(relx=0.5, rely=0)
self.welcome = ctk.CTkLabel(self.rf, text="Welcome",
text_color="#CCC8AA", font=("Broadway", 25, "bold"))
self.welcome.place(relx=0.02, rely=0.13)
self.log = ctk.CTkLabel(self.rf, text="Log In to Your Account",
text_color="#CCC8AA", font=("Broadway", 17))
self.log.place(relx=0.02, rely=0.2)
self.username = ctk.CTkEntry(self.rf, width=280, height=35,
fg_color="white", placeholder_text="Username",
state="normal", corner_radius=10,
border_color="#176B87", border_width=5,
font=("Arial", 17))
self.username.place(relx=0.02, rely=0.33)
self.pwd = ctk.CTkEntry(self.rf, width=280, height=35,
fg_color="white", placeholder_text="Password",
state="normal", corner_radius=10,
border_color="#176B87", border_width=5, show="*",
font=("Arial", 17))
self.pwd.place(relx=0.02, rely=0.43)
self.login = ctk.CTkButton(self.rf, 280, 40, 10, 5, 2, "transparent",
"#164B60", text="Log In",
hover_color="#1B6B93", text_color="#CCC8AA",
font=("Arial", 20),
command=self.details)
self.login.place(relx=0.02, rely=0.55)
self.sign = ctk.CTkButton(self.rf, 280, 40, 10, 5, 2, "transparent",
"#164B60", text="Sign Up",
hover_color="#1B6B93", text_color="#CCC8AA",
font=("Arial", 20),
command=self.new_user)
self.sign.place(relx=0.02, rely=0.65)
elif count == 1: # Autofill
self.rf = ctk.CTkFrame(self, 300, 500, corner_radius=10,
fg_color="#191717", bg_color="#191717")
self.rf.place(relx=0.5, rely=0)
self.welcome = ctk.CTkLabel(self.rf, text="Welcome",
text_color="#CCC8AA", font=("Broadway", 25, "bold"))
self.welcome.place(relx=0.02, rely=0.13)
self.log = ctk.CTkLabel(self.rf, text="Log In to Your Account",
text_color="#CCC8AA", font=("Broadway", 17))
self.log.place(relx=0.02, rely=0.2)
self.username = ctk.CTkEntry(self.rf, width=280, height=35,
fg_color="white", placeholder_text="Username",
state="normal", corner_radius=10,
border_color="#176B87", border_width=5,
font=("Arial", 17))
self.username.place(relx=0.02, rely=0.33)
self.username.insert(0, user_id)
self.pwd = ctk.CTkEntry(self.rf, width=280, height=35,
fg_color="white", placeholder_text="Password",
state="normal", corner_radius=10,
border_color="#176B87", border_width=5, show="*",
font=("Arial", 17))
self.pwd.place(relx=0.02, rely=0.43)
self.login = ctk.CTkButton(self.rf, 280, 40, 10, 5, 2, "transparent",
"#164B60", text="Log In",
hover_color="#1B6B93", text_color="#CCC8AA",
font=("Arial", 20),
command=self.details)
self.login.place(relx=0.02, rely=0.55)
self.sign = ctk.CTkButton(self.rf, 280, 40, 10, 5, 2, "transparent",
"#164B60", text="Sign Up",
hover_color="#1B6B93", text_color="#CCC8AA",
font=("Arial", 20),
command=self.new_user)
self.sign.place(relx=0.02, rely=0.65)
elif count == 2: # new-user
self.rf = ctk.CTkFrame(self, 300, 500, corner_radius=10,
fg_color="#191717", bg_color="#191717")
self.rf.place(relx=0, rely=0)
self.welcome = ctk.CTkLabel(self.rf, text="Welcome",
text_color="#CCC8AA", font=("Broadway", 25, "bold"),
bg_color="#191717")
self.welcome.place(relx=0.02, rely=0.13)
self.log = ctk.CTkLabel(self.rf, text="Enter Your User Details",
text_color="#CCC8AA",
font=("Broadway", 17))
self.log.place(relx=0.02, rely=0.2)
self.nuser_frame = ctk.CTkScrollableFrame(self, 278, 210,
fg_color="#191717", bg_color="#191717",

scrollbar_button_color="#164B60",

scrollbar_button_hover_color="#1B6B93", )
self.nuser_frame.place(relx=0, rely=0.27)
self.NAME = ctk.CTkLabel(self.nuser_frame, width=270, height=15,
fg_color="#191717",
text="Account Holder Name:", font=("Arial",
17), text_color="#CCC8AA",
anchor=ctk.W)
self.NAME.pack()
self.name = ctk.CTkEntry(self.nuser_frame, width=270, height=35,
fg_color="white", placeholder_text="Name",
corner_radius=10, border_color="#176B87",
border_width=5, font=("Arial", 17))
self.name.pack()
self.USERNAME = ctk.CTkLabel(self.nuser_frame, width=270, height=15,
fg_color="#191717", text="Username:",
font=("Arial", 17), text_color="#CCC8AA",
anchor=ctk.W)
self.USERNAME.pack()
self.username = ctk.CTkEntry(self.nuser_frame, width=270, height=35,
fg_color="white",
placeholder_text="Username",
corner_radius=10, border_color="#176B87",
border_width=5, font=("Arial", 17))
self.username.pack()
self.PWD = ctk.CTkLabel(self.nuser_frame, width=270, height=15,
fg_color="#191717", text="Password:",
font=("Arial", 17), text_color="#CCC8AA",
anchor=ctk.W)
self.PWD.pack()
self.pwd = ctk.CTkEntry(self.nuser_frame, width=270, height=35,
fg_color="white",
placeholder_text="Password", show="*",
corner_radius=10, border_color="#176B87",
border_width=5, font=("Arial", 17))
self.pwd.pack()
self.CONFIRMPASSWORD = ctk.CTkLabel(self.nuser_frame, width=270,
height=15, fg_color="#191717",
text="Confirm Password:",
font=("Arial", 17), text_color="#CCC8AA",
anchor=ctk.W)
self.CONFIRMPASSWORD.pack()
self.confirm_pwd = ctk.CTkEntry(self.nuser_frame, width=270, height=35,
fg_color="white",
placeholder_text="Confirm Password",
corner_radius=10,
border_color="#176B87", border_width=5,
font=("Arial", 17))
self.confirm_pwd.pack()
self.DOB = ctk.CTkLabel(self.nuser_frame, width=270, height=15,
fg_color="#191717", text="Date of Birth:",
font=("Arial", 17), text_color="#CCC8AA",
anchor=ctk.W)
self.DOB.pack()
self.dob = tkc.DateEntry(master=self.nuser_frame, font=(None, 12),
selectmode="day")
self.dob.pack()
self.submit = ctk.CTkButton(self.rf, 280, 40, 10, 5, 2, "transparent",
"#164B60", text="SUBMIT",
hover_color="#1B6B93",
text_color="#CCC8AA", font=("Arial", 20),
command=self.submit)
self.submit.place(relx=0.02, rely=0.75)

def close_it(self):
self.quit()

def details(self):
global user_id, passwd
user_id = self.username.get()
passwd = self.pwd.get()
self.destroy()
fetch_login()

def new_user(self):
global count
count = 2
self.destroy()
login_window().mainloop()

def submit(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
global count, user_id
acc_name = self.name.get()
user_id = self.username.get()
pwd = self.pwd.get()
confirm_pwd = self.confirm_pwd.get()
dob = self.dob.get()
if pwd == confirm_pwd:
curr.execute("Select uname from User;")
users = curr.fetchall()
if user_id in users:
self.destroy()
messagebox.showerror(title="Error",
message="Same Username exists
"
" \n\n\n\n\n")
count = 2
login_window().mainloop()
else:
self.destroy()
try:
curr.execute(
f"insert into user(account_holder,uname,pwd,dob)
values('{acc_name}','{user_id}','{pwd}','{dob}');")
mydb.commit()
count = 1
except mysql.connector.Error as e:
messagebox.showerror(title="Error in execution", message=e)
count = 2
login_window().mainloop()
else:
self.destroy()
messagebox.showerror(title="Error",
message="Password Incorrect
"
" \n\n\n\n\n")
count = 2
login_window().mainloop()
mydb.close()

def fetch_login():
global user_id, passwd, count, users_id
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
query = f"select uname,pwd from user where uname = '{user_id}';"
curr.execute(query)
users_id = curr.fetchall()

if users_id == [(user_id, passwd)]:


user_details()
main_window().mainloop()
elif users_id[0][0] == user_id and users_id[0][1] != passwd:
messagebox.showerror("Error",
"Incorrect Password
\n\n\n\n\n")
count = 1
login_window().mainloop()

else:
messagebox.showerror("Error",
"No User found!
\n\n\n\n\n")
mydb.close()

class main_window(ctk.CTk):
def __init__(self):
global acc_name, user_name, pwd, dob, gender, designation, email,
about_info, user_id
# style = ttk.Style()
# style.configure("my.Treeview", background="white", foreground="black",
rowheight=30, fieldbackground="white",
# fone=(None, 100))
# style.map("my.Treeview", background=[("selected", "#001B79")])
super().__init__()
self._set_appearance_mode("dark")
self.title("Sales Management System")
width = 1920
height = 1080
self.geometry("%dx%d+0+0" % (width, height))

self.tabs = ctk.CTkTabview(self, 1920, 1080, 10, anchor="nw", )


self.tabs.place(relx=0, rely=0)

self.info = self.tabs.add("Info")
self.inventory = self.tabs.add("Inventory")
self.order = self.tabs.add("Order")
self.employees = self.tabs.add("Employees")
self.dv = self.tabs.add("Data Visualization")

# INFO-Tab
self.frame_info = tk.LabelFrame(self.info, width=1890, height=1000,
text="ACCOUNT DETAILS", font=(None, 15),
bg="white")
self.frame_info.pack(fill=tk.Y, expand=True, anchor=tk.NW)
self.frame = ctk.CTkFrame(self.frame_info, width=1880, height=970,
bg_color="white", fg_color="white")
self.frame.place(relx=0, rely=0)
img = ctk.CTkImage(light_image=Image.open("user.png"),
dark_image=Image.open("user.png"), size=(225, 225))
self.image = ctk.CTkLabel(self.frame, fg_color="#7071E8", width=1880,
height=300, text="", corner_radius=30,
image=img, anchor=ctk.N)
self.image.place(relx=0.0005, rely=0)
self.account_name = ctk.CTkLabel(self.frame, fg_color='#7071E8',
bg_color="#7071E8", width=1880, height=45,
text=f"Hi! {acc_name}", font=("helvetica",
30))
self.account_name.place(relx=0.0005, rely=0.235)
self.details = ctk.CTkFrame(self.frame, fg_color="#C683D7", height=660,
width=1880, corner_radius=30)
self.details.place(relx=0.0005, rely=0.32)

self.username_label = ctk.CTkLabel(self.details, fg_color="#C683D7",


text="Username : ", text_color="black",
font=("helvetica", 25))
self.username_label.place(relx=0.05, rely=0.04)
self.username = ctk.CTkLabel(self.details, fg_color='#C683D7',
text=f"{user_name}", font=("helvetica", 20))
self.username.place(relx=0.15, rely=0.04)

self.dob_label = ctk.CTkLabel(self.details, fg_color="#C683D7", text="DOB


: ", text_color="black",
font=("helvetica", 25))
self.dob_label.place(relx=0.05, rely=0.14)
self.dob = ctk.CTkLabel(self.details, fg_color='#C683D7', text=f"{dob}",
font=("helvetica", 20))
self.dob.place(relx=0.15, rely=0.14)

self.Gender_label = ctk.CTkLabel(self.details, fg_color="#C683D7",


text="Gender : ", text_color="black",
font=("helvetica", 25))
self.Gender_label.place(relx=0.05, rely=0.24)
self.Gender = ctk.CTkLabel(self.details, fg_color='#C683D7',
text=f"{gender}", font=("helvetica", 20))
self.Gender.place(relx=0.15, rely=0.24)

self.Designation_label = ctk.CTkLabel(self.details, fg_color="#C683D7",


text="Designation: ",
text_color="black",
font=("helvetica", 25))
self.Designation_label.place(relx=0.05, rely=0.34)
self.Designation = ctk.CTkLabel(self.details, fg_color='#C683D7',
text=f"{designation}", font=("helvetica", 20))
self.Designation.place(relx=0.15, rely=0.34)

self.EmailID_label = ctk.CTkLabel(self.details, fg_color="#C683D7",


text="Email : ", text_color="black",
font=("helvetica", 25))
self.EmailID_label.place(relx=0.05, rely=0.44)
self.EmailID = ctk.CTkLabel(self.details, fg_color='#C683D7',
text=f"{email}", font=("helvetica", 20))
self.EmailID.place(relx=0.15, rely=0.44)

self.About_label = ctk.CTkLabel(self.details, fg_color="#C683D7",


text="About : ", text_color="black",
font=("helvetica", 25))
self.About_label.place(relx=0.05, rely=0.54)
self.About = ctk.CTkLabel(self.details, fg_color='#C683D7',
text=f"{about_info}", font=("helvetica", 20))
self.About.place(relx=0.05, rely=0.6)

self.update = ctk.CTkButton(self.details, fg_color="#FFC7C7",


hover_color="#ED9ED6", text_color="black",
font=("helvetica", 20), text="Update Profile",
corner_radius=40,
command=self.update_profile)
self.update.place(relx=0.8, rely=0.9)
self.logout = ctk.CTkButton(self.details, fg_color="#FFC7C7",
hover_color="#ED9ED6", text_color="black",
font=("helvetica", 20), text="Logout",
corner_radius=40, command=self.lg_out)
self.logout.place(relx=0.9, rely=0.9)
self.change_pwd = ctk.CTkButton(self.details, fg_color="#FFC7C7",
hover_color="#ED9ED6", text_color="black",
font=("helvetica", 20), text="Change
Password", corner_radius=40,
command=self.change_password)
self.change_pwd.place(relx=0.68, rely=0.9)
self.frame_inventory = inventory(self.inventory)
self.frame_inventory.pack(fill=tk.Y, expand=True, anchor=tk.NW)
self.frame_order = order(self.order)
self.frame_order.pack(fill=tk.Y, expand=True, anchor=tk.NW)
self.frame_employees = employees(self.employees)
self.frame_employees.pack(fill=tk.Y, expand=True, anchor=tk.NW)
self.frame_dv = data_visualization(self.dv)
self.frame_dv.place(relx=0, rely=0)

def lg_out(self):
global count
self.destroy()
count = 1
login_window().mainloop()

def update_profile(self):
self.destroy()
update_window().mainloop()

def change_password(self):
self.destroy()
change_password().mainloop()

class update_window(ctk.CTk):
def __init__(self):
super().__init__()
self.title("Update Profile")
s_width = self.winfo_screenwidth()
s_height = self.winfo_screenheight()
width = 500
height = 300
width_position = ((s_width / 2) - width / 2)
height_position = ((s_height / 2) - height / 2)
self.geometry("%dx%d+%d+%d" % (width, height, width_position,
height_position))
self.resizable(width=False, height=False)
self.bg = ctk.CTkFrame(self, height=300, width=500, fg_color="#A6CF98",
bg_color="#A6CF98", corner_radius=10)
self.bg.place(relx=0, rely=0)
self.msg = ctk.CTkLabel(self.bg, text="Kindly Update Your Details",
text_color="black", fg_color="#A6CF98",
font=("Helvetica", 30))
self.msg.place(relx=0.15, rely=0)
self.acc_name_label = ctk.CTkLabel(self.bg, text="Account Name:",
text_color="black", fg_color="#A6CF98",
font=("Helvetica", 25))
self.acc_name_label.place(relx=0.08, rely=0.13)
self.DOB_label = ctk.CTkLabel(self.bg, text="DOB :",
text_color="black", fg_color="#A6CF98",
font=("Helvetica", 25))
self.DOB_label.place(relx=0.08, rely=0.23)
self.Gender_label = ctk.CTkLabel(self.bg, text="Gender :",
text_color="black", fg_color="#A6CF98",
font=("Helvetica", 25))
self.Gender_label.place(relx=0.08, rely=0.33)
self.designation_name_label = ctk.CTkLabel(self.bg,
text="Designation :", text_color="black",
fg_color="#A6CF98",
font=("Helvetica", 25))
self.designation_name_label.place(relx=0.08, rely=0.43)
self.email_label = ctk.CTkLabel(self.bg, text="Email :",
text_color="black", fg_color="#A6CF98",
font=("Helvetica", 25))
self.email_label.place(relx=0.08, rely=0.53)
self.about_info_label = ctk.CTkLabel(self.bg, text="About :-",
text_color="black", fg_color="#A6CF98",
font=("Helvetica", 25))
self.about_info_label.place(relx=0.08, rely=0.63)

self.acc_name_entry = ctk.CTkEntry(self.bg, width=220, height=30,


placeholder_text="New Account Name",
font=("Helvetica", 20))
self.acc_name_entry.place(relx=0.46, rely=0.13)
self.DOB_entry = ctk.CTkEntry(self.bg, width=220, height=30,
placeholder_text="New DOB",
font=("Helvetica", 20))
self.DOB_entry.place(relx=0.46, rely=0.23)
self.Gender_entry = ctk.CTkEntry(self.bg, width=220, height=30,
placeholder_text="New Gender",
font=("Helvetica", 20))
self.Gender_entry.place(relx=0.46, rely=0.33)
self.Designation_entry = ctk.CTkEntry(self.bg, width=220, height=30,
placeholder_text="New Designation",
font=("Helvetica", 20))
self.Designation_entry.place(relx=0.46, rely=0.43)
self.email_entry = ctk.CTkEntry(self.bg, width=220, height=30,
placeholder_text="New Email ID",
font=("Helvetica", 20))
self.email_entry.place(relx=0.46, rely=0.53)
self.about_info_entry = ctk.CTkEntry(self.bg, width=220, height=30,
placeholder_text="About you in 250
words max...", font=("Helvetica", 20))
self.about_info_entry.place(relx=0.46, rely=0.63)
self.autofill()
self.about_info_entry.bind("<Visibility>", self.words)
self.about_info_entry.bind("<KeyPress>", self.words)
self.about_info_entry.bind("<KeyRelease>", self.words)
self.word_count = ctk.CTkLabel(self.bg, width=50, height=30, text="")
self.word_count.place(relx=0.9, rely=0.63)
self.submit = ctk.CTkButton(self.bg, width=80, height=40, text="SUBMIT",
font=("Helvetica", 20),
command=self.submit)
self.submit.place(relx=0.4, rely=0.8)

def autofill(self):
global acc_name, dob, gender, designation, email, about_info
DOB = dob
Gender = gender
Designation = designation
list = [acc_name, DOB, Gender, Designation, email, about_info]
num = 0
for x in list:
if x is not None:
if num == 0:
self.acc_name_entry.insert(0, x)
elif num == 1:
self.DOB_entry.insert(0, x)
elif num == 2:
self.Gender_entry.insert(0, x)
elif num == 3:
self.Designation_entry.insert(0, x)
elif num == 4:
self.email_entry.insert(0, x)
elif num == 5:
self.about_info_entry.insert(0, x)
num += 1

def words(self, e):


a = len(self.about_info_entry.get())
self.word_count.configure(text=f"{a}/250")
if a > 248:
self.about_info_entry.delete(249, ctk.END)

def submit(self):
global user_name
a = self.acc_name_entry.get()
b = self.DOB_entry.get()
c = self.Gender_entry.get()
d = self.Designation_entry.get()
e = self.email_entry.get()
f = self.about_info_entry.get()
g = user_name
try:
db(f"UPDATE USER SET
account_holder='{a}',dob='{b}',gender='{c}',designation='{d}',email='{e}',about='{f
}' where uname='{g}'")
self.destroy()
user_details()
main_window().mainloop()
except mysql.connector.Error as e:
self.destroy()
messagebox.showerror(title="ERROR WHILE EXECUTION", message=e)
main_window().mainloop()

class change_password(ctk.CTk):
global users_id

def __init__(self):
super().__init__()
self.title("Change Password")
s_width = self.winfo_screenwidth()
s_height = self.winfo_screenheight()
width = 500
height = 300
width_position = ((s_width / 2) - width / 2)
height_position = ((s_height / 2) - height / 2)
self.geometry("%dx%d+%d+%d" % (width, height, width_position,
height_position))
self.resizable(width=False, height=False)
self.frame = ctk.CTkFrame(self, width=width, height=height,
fg_color="#A6CF98", corner_radius=10)
self.frame.place(relx=0, rely=0)
self.msg = ctk.CTkLabel(self.frame, text="Kindly! Update Your Password",
font=("Helvetica", 30))
self.msg.place(relx=0.1, rely=0.05)
self.pwd = ctk.CTkLabel(self.frame, text="Old Password :",
font=("Helvetica", 20))
self.pwd.place(relx=0.1, rely=0.2)
self.PWD = ctk.CTkEntry(self.frame, width=220, height=30,
placeholder_text="Old Password",
font=("Helvetica", 20))
self.PWD.place(relx=0.47, rely=0.2)
self.new_pwd = ctk.CTkLabel(self.frame, text="New Password :",
font=("Helvetica", 20))
self.new_pwd.place(relx=0.1, rely=0.4)
self.NEW_PWD = ctk.CTkEntry(self.frame, width=220, height=30,
placeholder_text="New Password",
font=("Helvetica", 20), show="*")
self.NEW_PWD.place(relx=0.47, rely=0.4)
self.confirm_pwd = ctk.CTkLabel(self.frame, text="Confirm Password :",
font=("Helvetica", 20))
self.confirm_pwd.place(relx=0.1, rely=0.6)
self.CONFIRM_PWD = ctk.CTkEntry(self.frame, width=220, height=30,
placeholder_text="Confirm Password",
font=("Helvetica", 20))
self.CONFIRM_PWD.place(relx=0.47, rely=0.6)
self.submit = ctk.CTkButton(self.frame, width=80, height=40, text="SUBMIT",
font=("Helvetica", 20),
command=self.submit)
self.submit.place(relx=0.4, rely=0.8)

def submit(self):
a = self.PWD.get()
b = self.NEW_PWD.get()
c = self.CONFIRM_PWD.get()
self.destroy()
if users_id[0][1] == a:
if b == c:
db(f"UPDATE user set pwd='{c}' where uname='{users_id[0][0]}';")
messagebox.showerror(title="Success", message="Password Updated
Successfully\n\n\n")
login_window().mainloop()
else:
messagebox.showerror(title="Incorrect New Password",
message="Entered New Password and Confirm
Password are not correct.\n\n\n")
self.mainloop()
else:
messagebox.showerror(title="Incorrect Old Password", message="Old
Password is INCORRECT.\n\n\n")
self.mainloop()

class inventory(tk.LabelFrame):
def __init__(self, parent):
super().__init__(parent, width=1890, height=1000, text="Inventory",
font=(None, 20), bg="white")
self.tree_frame = ctk.CTkFrame(self, width=1890, height=695)
self.tree_frame.pack(fill=ctk.Y, expand=True)
self.a = ttk.Scrollbar(self.tree_frame)
self.a.pack(fill=tk.Y, expand=True, side=tk.RIGHT)
self.inventory_table = ttk.Treeview(master=self.tree_frame, columns=["1",
"2", "3", "4"],
yscrollcommand=self.a.set,
selectmode="extended")
self.inventory_table.heading("#0", text="")
self.inventory_table.heading("1", text="Product_ID", anchor=ctk.CENTER)
self.inventory_table.heading("2", text="Product_Name", anchor=ctk.CENTER)
self.inventory_table.heading("3", text="Price", anchor=ctk.CENTER)
self.inventory_table.heading("4", text="Amount", anchor=ctk.CENTER)
self.inventory_table.column("#0", width=0, stretch=tk.NO)
self.inventory_table.column("1", width=470, minwidth=400,
anchor=ctk.CENTER, stretch=tk.YES)
self.inventory_table.column("2", width=470, minwidth=400,
anchor=ctk.CENTER, stretch=tk.YES)
self.inventory_table.column("3", width=470, minwidth=400,
anchor=ctk.CENTER, stretch=tk.YES)
self.inventory_table.column("4", width=470, minwidth=400,
anchor=ctk.CENTER, stretch=tk.YES)
self.inventory_table.tag_configure("odd", background="#6DB9EF")
self.inventory_table.tag_configure("even", background="white")
self.add_data()
self.inventory_table.pack(fill=tk.BOTH, expand=1, side=tk.LEFT)
self.inventory_table.bind("<ButtonRelease-1>", self.select_record)

self.edit_frame = tk.LabelFrame(self, text="Data Control", width="1880",


height="225",
font=(None, 18), bg="white")
self.edit_frame.place(relx=0.004, rely=0.76)

self.product_id = ctk.CTkLabel(self.edit_frame, text="Product ID:",


width=40, height=25, font=(None, 18))
self.product_id.place(relx=0, rely=0)
self.product_name = ctk.CTkLabel(self.edit_frame, text="Product Name:",
width=40, height=25, font=(None, 18))
self.product_name.place(relx=0.2, rely=0)
self.price = ctk.CTkLabel(self.edit_frame, text="Price:", width=40,
height=25, font=(None, 18))
self.price.place(relx=0.4, rely=0)
self.price = ctk.CTkLabel(self.edit_frame, text="Amount:", width=40,
height=25, font=(None, 18))
self.price.place(relx=0.6, rely=0)
self.Product_ID = ctk.CTkEntry(self.edit_frame)
self.Product_ID.place(relx=0, rely=0.2)
self.Product_Name = ctk.CTkEntry(self.edit_frame)
self.Product_Name.place(relx=0.2, rely=0.2)
self.Price = ctk.CTkEntry(self.edit_frame)
self.Price.place(relx=0.4, rely=0.2)
self.Amount = ctk.CTkEntry(self.edit_frame)
self.Amount.place(relx=0.6, rely=0.2)

self.command = tk.LabelFrame(self.edit_frame, text="Commands", width=1870,


height=90, bg="white",
font=(None, 18))
self.command.place(relx=0.002, rely=0.5)
self.load = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F", text="Modify Record",
command=self.load)
self.load.place(relx=0.002, rely=0)
self.add = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F", text="Add New Record",
command=self.add_record)
self.add.place(relx=0.15, rely=0)
self.update = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F", text="Update Record",
command=self.update_record)
self.update.place(relx=0.3, rely=0)
self.remove_one = ctk.CTkButton(self.command, width=100, height=40,
font=(None, 17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F",
text="Remove Single Record",
command=self.remove_record)
self.remove_one.place(relx=0.45, rely=0)
self.remove_all = ctk.CTkButton(self.command, width=100, height=40,
font=(None, 17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F",
text="Remove All", command=self.remove_all)
self.remove_all.place(relx=0.6, rely=0)
self.clear = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F",
text="Clear Entry Boxes",
command=self.clear_fun)
self.clear.place(relx=0.75, rely=0)

def select_record(self, e):


if self.Product_ID._state == "normal":
self.Product_ID.delete(0, ctk.END)
self.Product_Name.delete(0, ctk.END)
self.Price.delete(0, ctk.END)
self.Amount.delete(0, ctk.END)
selected = self.inventory_table.focus()
values = self.inventory_table.item(selected, 'values')
self.Product_ID.insert(0, values[0])
self.Product_Name.insert(0, values[1])
self.Price.insert(0, values[2])
self.Amount.insert(0, values[3])
self.Product_ID.configure(state=ctk.DISABLED)
self.Product_Name.configure(state=ctk.DISABLED)
self.Price.configure(state=ctk.DISABLED)
self.Amount.configure(state=ctk.DISABLED)
else:
self.Product_ID.configure(state=ctk.NORMAL)
self.Product_Name.configure(state=ctk.NORMAL)
self.Price.configure(state=ctk.NORMAL)
self.Amount.configure(state=ctk.NORMAL)
self.Product_ID.delete(0, ctk.END)
self.Product_Name.delete(0, ctk.END)
self.Price.delete(0, ctk.END)
self.Amount.delete(0, ctk.END)
selected = self.inventory_table.focus()
values = self.inventory_table.item(selected, 'values')
self.Product_ID.insert(0, values[0])
self.Product_Name.insert(0, values[1])
self.Price.insert(0, values[2])
self.Amount.insert(0, values[3])
self.Product_ID.configure(state=ctk.DISABLED)
self.Product_Name.configure(state=ctk.DISABLED)
self.Price.configure(state=ctk.DISABLED)
self.Amount.configure(state=ctk.DISABLED)

def load(self):
self.Product_ID.configure(state=ctk.DISABLED)
self.Product_Name.configure(state=ctk.NORMAL)
self.Price.configure(state=ctk.NORMAL)
self.Amount.configure(state=ctk.NORMAL)

def clear_fun(self):
self.Product_ID.configure(state=ctk.NORMAL)
self.Product_Name.configure(state=ctk.NORMAL)
self.Price.configure(state=ctk.NORMAL)
self.Amount.configure(state=ctk.NORMAL)
self.Product_ID.delete(0, ctk.END)
self.Product_Name.delete(0, ctk.END)
self.Price.delete(0, ctk.END)
self.Amount.delete(0, ctk.END)

def add_data(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
curr.execute("SELECT * FROM INVENTORY order by abs(product_id)")
table = curr.fetchall()
# print(table)
num = 0
for i in table:
if num % 2 == 0:
self.inventory_table.insert(parent='', index="end", iid=f"{num}",
values=(i[0], i[1], i[2], i[3]),
tags="even")
# print(i)
else:
self.inventory_table.insert(parent='', index="end", iid=f"{num}",
values=(i[0], i[1], i[2], i[3]),
tags="odd")
# print(i)
num += 1

def add_record(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"insert into inventory
values('{self.Product_ID.get()}','{self.Product_Name.get()}',{self.Price.get()},
{self.Amount.get()});")
messagebox.showerror(title="Message", message="Item added
successfully")
mydb.commit()
mydb.close()
for i in self.inventory_table.get_children():
self.inventory_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()

def remove_record(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"DELETE FROM INVENTORY WHERE
product_id='{self.Product_ID.get()}';")
messagebox.showerror(title="Message", message="Item removed
successfully")
mydb.commit()
mydb.close()
for i in self.inventory_table.get_children():
self.inventory_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()
def update_record(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"UPDATE INVENTORY set product_name =
'{self.Product_Name.get()}',price={self.Price.get()},amount={self.Amount.get()}
where product_id='{self.Product_ID.get()}';")
messagebox.showerror(title="Message", message="Items Updated
successfully")
mydb.commit()
mydb.close()
for i in self.inventory_table.get_children():
self.inventory_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()

def remove_all(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"DELETE FROM INVENTORY;")
messagebox.showerror(title="Message", message="All Items removed
successfully")
mydb.commit()
mydb.close()
for i in self.inventory_table.get_children():
self.inventory_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()

class employees(tk.LabelFrame):
def __init__(self, parent):
super().__init__(parent, width=1890, height=1000, text="Employee Profile",
font=(None, 20), bg="white")
self.tree_frame = ctk.CTkFrame(self, width=1890, height=695)
self.tree_frame.pack(fill=ctk.Y, expand=True)
self.a = ttk.Scrollbar(self.tree_frame)
self.a.pack(fill=tk.Y, expand=True, side=tk.RIGHT)
self.employee_table = ttk.Treeview(master=self.tree_frame, columns=["1",
"2", "3"],
yscrollcommand=self.a.set,
selectmode="extended")
self.employee_table.heading("#0", text="")
self.employee_table.heading("1", text="Employee_ID", anchor=ctk.CENTER)
self.employee_table.heading("2", text="Employee_Name", anchor=ctk.CENTER)
self.employee_table.heading("3", text="Department", anchor=ctk.CENTER)
self.employee_table.column("#0", width=0, stretch=tk.NO)
self.employee_table.column("1", width=626, minwidth=600, anchor=ctk.CENTER,
stretch=tk.YES)
self.employee_table.column("2", width=626, minwidth=600, anchor=ctk.CENTER,
stretch=tk.YES)
self.employee_table.column("3", width=626, minwidth=600, anchor=ctk.CENTER,
stretch=tk.YES)
self.employee_table.tag_configure("odd", background="#6DB9EF")
self.employee_table.tag_configure("even", background="white")
self.add_data()
self.employee_table.pack(fill=tk.BOTH, expand=1, side=tk.LEFT)
self.employee_table.bind("<ButtonRelease-1>", self.select_record)
self.edit_frame = tk.LabelFrame(self, text="Data Control", width="1880",
height="225",
font=(None, 18), bg="white")
self.edit_frame.place(relx=0.004, rely=0.76)

self.employee_id = ctk.CTkLabel(self.edit_frame, text="Employee ID:",


width=40, height=25, font=(None, 18))
self.employee_id.place(relx=0, rely=0)
self.employee_name = ctk.CTkLabel(self.edit_frame, text="Employee Name:",
width=40, height=25, font=(None, 18))
self.employee_name.place(relx=0.2, rely=0)
self.department = ctk.CTkLabel(self.edit_frame, text="Department:",
width=40, height=25, font=(None, 18))
self.department.place(relx=0.4, rely=0)
self.Employee_ID = ctk.CTkEntry(self.edit_frame)
self.Employee_ID.place(relx=0, rely=0.2)
self.Employee_Name = ctk.CTkEntry(self.edit_frame)
self.Employee_Name.place(relx=0.2, rely=0.2)
self.Department = ctk.CTkEntry(self.edit_frame)
self.Department.place(relx=0.4, rely=0.2)

self.command = tk.LabelFrame(self.edit_frame, text="Commands", width=1870,


height=90, bg="white",
font=(None, 18))
self.command.place(relx=0.002, rely=0.5)
self.load = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F", text="Modify Record",
command=self.load)
self.load.place(relx=0.002, rely=0)
self.add = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F", text="Add New Record",
command=self.add_record)
self.add.place(relx=0.15, rely=0)
self.update = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F", text="Update Record",
command=self.update_record)
self.update.place(relx=0.3, rely=0)
self.remove_one = ctk.CTkButton(self.command, width=100, height=40,
font=(None, 17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F",
text="Remove Single Record",
command=self.remove_record)
self.remove_one.place(relx=0.45, rely=0)
self.remove_all = ctk.CTkButton(self.command, width=100, height=40,
font=(None, 17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F",
text="Remove All", command=self.remove_all)
self.remove_all.place(relx=0.6, rely=0)
self.clear = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F",
text="Clear Entry Boxes",
command=self.clear_fun)
self.clear.place(relx=0.75, rely=0)

def select_record(self, e):


if self.Employee_ID._state == "normal":
self.Employee_ID.delete(0, ctk.END)
self.Employee_Name.delete(0, ctk.END)
self.Department.delete(0, ctk.END)
selected = self.employee_table.focus()
values = self.employee_table.item(selected, 'values')
self.Employee_ID.insert(0, values[0])
self.Employee_Name.insert(0, values[1])
self.Department.insert(0, values[2])
self.Employee_ID.configure(state=ctk.DISABLED)
self.Employee_Name.configure(state=ctk.DISABLED)
self.Department.configure(state=ctk.DISABLED)
else:
self.Employee_ID.configure(state=ctk.NORMAL)
self.Employee_Name.configure(state=ctk.NORMAL)
self.Department.configure(state=ctk.NORMAL)
self.Employee_ID.delete(0, ctk.END)
self.Employee_Name.delete(0, ctk.END)
self.Department.delete(0, ctk.END)
selected = self.employee_table.focus()
values = self.employee_table.item(selected, 'values')
self.Employee_ID.insert(0, values[0])
self.Employee_Name.insert(0, values[1])
self.Department.insert(0, values[2])
self.Employee_ID.configure(state=ctk.DISABLED)
self.Employee_Name.configure(state=ctk.DISABLED)
self.Department.configure(state=ctk.DISABLED)

def load(self):
self.Employee_ID.configure(state=ctk.DISABLED)
self.Employee_Name.configure(state=ctk.NORMAL)
self.Department.configure(state=ctk.NORMAL)

def clear_fun(self):
self.Employee_ID.configure(state=ctk.NORMAL)
self.Employee_Name.configure(state=ctk.NORMAL)
self.Department.configure(state=ctk.NORMAL)
self.Employee_ID.delete(0, ctk.END)
self.Employee_Name.delete(0, ctk.END)
self.Department.delete(0, ctk.END)

def add_data(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
curr.execute("SELECT * FROM employee order by abs(Employee_ID)")
table = curr.fetchall()
# print(table)
num = 0
for i in table:
if num % 2 == 0:
self.employee_table.insert(parent='', index="end", iid=f"{num}",
values=(i[0], i[1], i[2]),
tags="even")
# print(i)
else:
self.employee_table.insert(parent='', index="end", iid=f"{num}",
values=(i[0], i[1], i[2]),
tags="odd")
# print(i)
num += 1

def add_record(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"insert into employee
values('{self.Employee_ID.get()}','{self.Employee_Name.get()}','{self.Department.ge
t()}');")
messagebox.showerror(title="Message", message="Employee Profile added
successfully")
mydb.commit()
mydb.close()
for i in self.employee_table.get_children():
self.employee_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()

def remove_record(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"DELETE FROM EMPLOYEE WHERE
Employee_ID='{self.Employee_ID.get()}';")
messagebox.showerror(title="Message", message="Employee Profile removed
successfully")
mydb.commit()
mydb.close()
for i in self.employee_table.get_children():
self.employee_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()

def update_record(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"UPDATE EMPLOYEE set Employee_Name =
'{self.Employee_Name.get()}',Department='{self.Department.get()}' where
Employee_ID='{self.Employee_ID.get()}';")
messagebox.showerror(title="Message", message="Employee Profile Updated
successfully")
mydb.commit()
mydb.close()
for i in self.employee_table.get_children():
self.employee_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()

def remove_all(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"DELETE FROM Employee;")
messagebox.showerror(title="Message", message="All Employee Profiles
removed successfully")
mydb.commit()
mydb.close()
for i in self.employee_table.get_children():
self.employee_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()
class order(tk.LabelFrame):
def __init__(self, parent):
super().__init__(parent, width=1890, height=1000, text="Order", font=(None,
20), bg="white")
self.tree_frame = ctk.CTkFrame(self, width=1890, height=695)
self.tree_frame.pack(fill=ctk.Y, expand=True)
self.a = ttk.Scrollbar(self.tree_frame)
self.a.pack(fill=tk.Y, expand=True, side=tk.RIGHT)
self.order_table = ttk.Treeview(master=self.tree_frame, columns=["1", "2",
"3", "4", "5"],
yscrollcommand=self.a.set,
selectmode="extended")
self.order_table.heading("#0", text="")
self.order_table.heading("1", text="Product_ID", anchor=ctk.CENTER)
self.order_table.heading("2", text="Product_Name", anchor=ctk.CENTER)
self.order_table.heading("3", text="Amount", anchor=ctk.CENTER)
self.order_table.heading("4", text="Employee_ID", anchor=ctk.CENTER)
self.order_table.heading("5", text="Date of Purchase", anchor=ctk.CENTER)
self.order_table.column("#0", width=0, stretch=tk.NO)
self.order_table.column("1", width=375, minwidth=350, anchor=ctk.CENTER,
stretch=tk.YES)
self.order_table.column("2", width=375, minwidth=350, anchor=ctk.CENTER,
stretch=tk.YES)
self.order_table.column("3", width=375, minwidth=350, anchor=ctk.CENTER,
stretch=tk.YES)
self.order_table.column("4", width=375, minwidth=350, anchor=ctk.CENTER,
stretch=tk.YES)
self.order_table.column("5", width=375, minwidth=350, anchor=ctk.CENTER,
stretch=tk.YES)
self.order_table.tag_configure("odd", background="#6DB9EF")
self.order_table.tag_configure("even", background="white")
self.add_data()
self.order_table.pack(fill=tk.BOTH, expand=1, side=tk.LEFT)
self.order_table.bind("<ButtonRelease-1>", self.select_record)

self.edit_frame = tk.LabelFrame(self, text="Data Control", width="1880",


height="225",
font=(None, 18), bg="white")
self.edit_frame.place(relx=0.004, rely=0.76)

self.product_id = ctk.CTkLabel(self.edit_frame, text="Product ID:",


width=40, height=25, font=(None, 18))
self.product_id.place(relx=0, rely=0)
self.product_name = ctk.CTkLabel(self.edit_frame, text="Product Name:",
width=40, height=25, font=(None, 18))
self.product_name.place(relx=0.2, rely=0)
self.amount = ctk.CTkLabel(self.edit_frame, text="Amount:", width=40,
height=25, font=(None, 18))
self.amount.place(relx=0.4, rely=0)
self.employee_ID = ctk.CTkLabel(self.edit_frame, text="Employee_ID:",
width=40, height=25, font=(None, 18))
self.employee_ID.place(relx=0.6, rely=0)
self.date = ctk.CTkLabel(self.edit_frame, text="Date of Purchase:",
width=40, height=25, font=(None, 18))
self.date.place(relx=0.8, rely=0)
self.Product_ID = ctk.CTkEntry(self.edit_frame)
self.Product_ID.place(relx=0, rely=0.2)
img = ctk.CTkImage(light_image=Image.open("search.jpg"),
dark_image=Image.open("search.jpg"), size=(30, 30))
self.search = ctk.CTkButton(self.edit_frame, width=30, height=30,
image=img, text="", fg_color="white",
hover_color="white", corner_radius=5,
command=self.search)
self.search.place(relx=0.075, rely=0.2)
self.Product_Name = ctk.CTkEntry(self.edit_frame)
self.Product_Name.place(relx=0.2, rely=0.2)
self.Amount = ctk.CTkEntry(self.edit_frame)
self.Amount.place(relx=0.4, rely=0.2)
self.Employee_ID = ctk.CTkEntry(self.edit_frame)
self.Employee_ID.place(relx=0.6, rely=0.2)
self.Date = ctk.CTkEntry(self.edit_frame)
self.Date.place(relx=0.8, rely=0.2)
self.Date.bind("<ButtonRelease>", self.DOP_entry)

self.command = tk.LabelFrame(self.edit_frame, text="Commands", width=1870,


height=90, bg="white",
font=(None, 18))
self.command.place(relx=0.002, rely=0.5)
self.load = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F", text="Modify Record",
command=self.load)
self.load.place(relx=0.002, rely=0)
self.add = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F", text="Add New Record",
command=self.add_record)
self.add.place(relx=0.15, rely=0)
self.update = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F", text="Update Record",
command=self.update_record)
self.update.place(relx=0.3, rely=0)
self.remove_one = ctk.CTkButton(self.command, width=100, height=40,
font=(None, 17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F",
text="Remove Single Record",
command=self.remove_record)
self.remove_one.place(relx=0.45, rely=0)
self.remove_all = ctk.CTkButton(self.command, width=100, height=40,
font=(None, 17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F",
text="Remove All", command=self.remove_all)
self.remove_all.place(relx=0.6, rely=0)
self.clear = ctk.CTkButton(self.command, width=100, height=40, font=(None,
17), corner_radius=5,
fg_color="#D3D3D3", text_color="black",
hover_color="#11468F",
text="Clear Entry Boxes",
command=self.clear_fun)
self.clear.place(relx=0.75, rely=0)
self.Amount.bind("<KeyPress>", self.value)
self.Amount.bind("<KeyRelease>", self.value)

def DOP_entry(self, e):


cal(self, 1525, 680).grab_set()

def search(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
id = self.Product_ID.get()
# print(id)
curr.execute(f"SELECT product_name FROM inventory where product_id =
'{id}'")
table = curr.fetchall()
self.Product_Name.configure(state=ctk.NORMAL)
self.Product_Name.delete(0, ctk.END)
self.Product_Name.insert(0, table[0][0])
self.Product_Name.configure(state=ctk.DISABLED)
mydb.close()

def value(self, e):


global amount_value
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
id = self.Product_ID.get()
curr.execute(f"SELECT amount FROM inventory where product_id = '{id}'")
amount_value = curr.fetchall()
if int(self.Amount.get()) <= amount_value[0][0]:
self.Amount.configure(text_color="black")
else:
self.Amount.configure(text_color="red")
mydb.close()

def select_record(self, e):


if self.Product_ID._state == "normal":
self.Product_ID.delete(0, ctk.END)
self.Product_Name.delete(0, ctk.END)
self.Amount.delete(0, ctk.END)
self.Employee_ID.delete(0, ctk.END)
self.Date.delete(0, ctk.END)
selected = self.order_table.focus()
values = self.order_table.item(selected, 'values')
self.Product_ID.insert(0, values[0])
self.Product_Name.insert(0, values[1])
self.Amount.insert(0, values[2])
self.Employee_ID.insert(0, values[3])
self.Date.insert(0, values[4])
self.Product_ID.configure(state=ctk.DISABLED)
self.Product_Name.configure(state=ctk.DISABLED)
self.Amount.configure(state=ctk.DISABLED)
self.Employee_ID.configure(state=ctk.DISABLED)
self.Date.configure(state=ctk.DISABLED)
else:
self.Product_ID.configure(state=ctk.NORMAL)
self.Product_Name.configure(state=ctk.NORMAL)
self.Amount.configure(state=ctk.NORMAL)
self.Employee_ID.configure(state=ctk.NORMAL)
self.Date.configure(state=ctk.NORMAL)
self.Product_ID.delete(0, ctk.END)
self.Product_Name.delete(0, ctk.END)
self.Amount.delete(0, ctk.END)
self.Employee_ID.delete(0, ctk.END)
self.Date.delete(0, ctk.END)
selected = self.order_table.focus()
values = self.order_table.item(selected, 'values')
self.Product_ID.insert(0, values[0])
self.Product_Name.insert(0, values[1])
self.Amount.insert(0, values[2])
self.Employee_ID.insert(0, values[3])
self.Date.insert(0, values[4])
self.Product_ID.configure(state=ctk.NORMAL)
self.Product_Name.configure(state=ctk.NORMAL)
self.Amount.configure(state=ctk.NORMAL)
self.Employee_ID.configure(state=ctk.NORMAL)
self.Date.configure(state=ctk.NORMAL)

def load(self):
self.Amount.configure(state=ctk.NORMAL)
self.Employee_ID.configure(state=ctk.NORMAL)
self.Date.configure(state=ctk.NORMAL)

def clear_fun(self):
self.Product_ID.configure(state=ctk.NORMAL)
self.Product_Name.configure(state=ctk.NORMAL)
self.Amount.configure(state=ctk.NORMAL)
self.Employee_ID.configure(state=ctk.NORMAL)
self.Date.configure(state=ctk.NORMAL)
self.Product_ID.delete(0, ctk.END)
self.Product_Name.delete(0, ctk.END)
self.Amount.delete(0, ctk.END)
self.Employee_ID.delete(0, ctk.END)
self.Date.delete(0, ctk.END)

def add_data(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
curr.execute("SELECT * FROM orders order by date")
table = curr.fetchall()
# print(table)
num = 0
for i in table:
if num % 2 == 0:
self.order_table.insert(parent='', index="end", iid=f"{num}",
values=(i[0], i[1], i[2], i[3], i[4]),
tags="even")
# print(i)
else:
self.order_table.insert(parent='', index="end", iid=f"{num}",
values=(i[0], i[1], i[2], i[3], i[4]),
tags="odd")
# print(i)
num += 1

def add_record(self):
global amount_value
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
print(int(self.Amount.get()))
if amount_value[0][0] >= int(self.Amount.get()):
tuple1 = (self.Product_ID.get(), self.Product_Name.get(),
int(self.Amount.get()), self.Employee_ID.get(),
self.Date.get())
curr.execute(f"UPDATE INVENTORY SET AMOUNT=AMOUNT-{tuple1[2]} where
PRODUCT_ID='{tuple1[0]}'")
try:
# print(tuple1)
curr.execute(
f"insert into orders values('{tuple1[0]}','{tuple1[1]}',
{tuple1[2]},'{tuple1[3]}','{tuple1[4]}');")
messagebox.showerror(title="Message",
message="Item Purchased successfully.\nThank
You For Your Purchase")
mydb.commit()
mydb.close()
for i in self.order_table.get_children():
self.order_table.delete(i)
self.add_data()
self.clear_fun()
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution",
message=e)
self.clear_fun()

else:
messagebox.showerror(title="Insufficient Amount", message="Insufficient
Amount")

def remove_record(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"DELETE FROM ORDERS WHERE PRODUCT_ID='{self.Product_ID.get()}';")
messagebox.showerror(title="Message", message="Purchase History removed
successfully")
mydb.commit()
mydb.close()
for i in self.order_table.get_children():
self.order_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()

def update_record(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"UPDATE ORDER SET
AMOUNT={self.Amount.get()},EMPLOYEE_ID='{self.Employee_ID.get()}',DATE='{self.Date.
get()}'")
messagebox.showerror(title="Message", message="Purchase History Updated
successfully")
mydb.commit()
mydb.close()
for i in self.order_table.get_children():
self.order_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()

def remove_all(self):
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
try:
curr.execute(
f"DELETE FROM ORDERS;")
messagebox.showerror(title="Message", message="All Purchase History
removed successfully")
mydb.commit()
mydb.close()
for i in self.order_table.get_children():
self.order_table.delete(i)
self.add_data()
except mysql.connector.Error as e:
messagebox.showerror(title="Error Occured while Execution", message=e)
self.clear_fun()

class cal(ctk.CTkToplevel):
def __init__(self, parent, x, y):
super().__init__(parent)

def get_value(parent):
global DOP
parent.Date.delete(0, ctk.END)
DOP = (self.dob.get_date())
parent.Date.insert(0, DOP)
self.destroy()

self.geometry("240x220+%d+%d" % (x, y))


self.title("Select Purchase Date")
self.wm_attributes('-toolwindow', 'True')
self.frame = ctk.CTkFrame(master=self, width=400, height=400,
fg_color="white")
self.frame.pack()
self.dob = tkc.Calendar(master=self.frame, date_pattern="y-mm-dd")
self.dob.pack()
self.button = ctk.CTkButton(master=self, width=240, corner_radius=5,
text="SUBMIT", font=("Helvetica", 18),
command=lambda: get_value(parent))
self.button.pack(pady=5)

class data_visualization(tk.LabelFrame):
def __init__(self, parent):
super().__init__(parent, text="DATA VISUALIZATION", width="1900",
height="1000",
font=("Arial", 15))
self.frame1 = graph(self)
self.frame1.grid(row=0, column=0, sticky=ctk.NSEW)
self.frame2 = graph(self)
self.frame2.grid(row=0, column=1, sticky=ctk.NSEW)
self.frame3 = graph(self)
self.frame3.grid(row=1, column=0, sticky=ctk.NSEW)
self.frame4 = graph(self)
self.frame4.grid(row=1, column=1, sticky=ctk.NSEW)

class graph(ctk.CTkFrame):
def __init__(self, parent):
super().__init__(parent, width=948, height=498, fg_color="#ECCDB4",
corner_radius=0)
self.data_dic()
self.option_menu = ctk.CTkOptionMenu(self, values=["Inventory by Product",
"Purchase History", "Total Sales",
"Item Sales"],
command=self.graph_callable,
fg_color="#F0EDD4",
button_color="#FEA1A1", dropdown_hover_color="#ECCDB4",
text_color="black",
button_hover_color="#D25380")
self.option_menu.place(relx=0.02, rely=0.02)

def data_dic(self):
global inv_dict
mydb = mysql.connector.connect(host=host, username=use, passwd=passss,
database="sales_management")
curr = mydb.cursor()
query1 = "select product_name,amount from inventory order by
abs(product_id);"
curr.execute(query1)
query1_tmp = curr.fetchall()
inv_dict = dict((x, y) for x, y in query1_tmp)

query2 = "select product_name,date from orders order by date;"


curr.execute(query2)
query2_tmp = curr.fetchall()
Purchase_history_dict = dict((x, y) for x, y in query2_tmp)

query3 = "select distinct product_name ,sum(amount) from orders group by


product_name;"
curr.execute(query3)
query3_tmp = curr.fetchall()
item_sold_dict = dict((x, y) for x, y in query3_tmp)
item_totalsales = {}
for (x, y) in query3_tmp:
query = f"select price from inventory where product_name='{x}'"
curr.execute(query)
res_list = curr.fetchall()
item_totalsales[x] = (res_list[0][0] * y)

# Inventory Graph
self.inv, ax1 = plt.subplots(figsize=(9, 4.2))
ax1.barh(list(inv_dict.keys()), inv_dict.values())
ax1.set_title("Inventory by Product")
ax1.set_xlabel("Product Name")
ax1.set_ylabel("Stock Present")
# Purchase History Graph
self.phis, ax2 = plt.subplots(figsize=(9, 4.2))
plt.xticks(rotation=5, ha="right")
ax2.plot_date(Purchase_history_dict.values(), Purchase_history_dict.keys())
ax2.set_title("Purchase History")
ax2.set_xlabel("Date of Purchase")
ax2.set_ylabel("Item Purchased")
# Item sold graph
self.item_sold, ax3 = plt.subplots(figsize=(9, 4.2))
plt.xticks(rotation=15, ha="right")
ax3.bar(item_sold_dict.keys(), item_sold_dict.values())
ax3.set_title("Item Sold")
ax3.set_xlabel("Items")
ax3.set_ylabel("Amount")
# Total Sales
self.total_sales, ax4 = plt.subplots(figsize=(9, 4.2))
ax4.pie(list(item_totalsales.values()),
labels=list(item_totalsales.keys()), startangle=90)
ax4.set_title("Total Sales by Each Item")
ax4.legend(title=f"Total Sales Rs.{sum(list(item_totalsales.values()))}",
loc="upper right",
bbox_to_anchor=(1, 1), bbox_transform=plt.gcf().transFigure)

def graph_callable(self, choice):


option = choice
# print(option)
self.graph_maker(option)
# self.canvas.destroy()

def graph_maker(self, a):


if a == "Inventory by Product":
self.canvas = FigureCanvasTkAgg(self.inv, self)
self.canvas.draw()
self.canvas.get_tk_widget().place(relx=0.02, rely=0.1)
elif a == "Purchase History":
self.canvas = FigureCanvasTkAgg(self.phis, self)
self.canvas.draw()
self.canvas.get_tk_widget().place(relx=0.02, rely=0.1)
elif a == "Total Sales":
self.canvas = FigureCanvasTkAgg(self.total_sales, self)
self.canvas.draw()
self.canvas.get_tk_widget().place(relx=0.02, rely=0.1)
elif a == "Item Sales":
self.canvas = FigureCanvasTkAgg(self.item_sold, self)
self.canvas.draw()
self.canvas.get_tk_widget().place(relx=0.02, rely=0.1)

if __name__ == '__main__':
startup()
intialize()
login_window().mainloop()
Startup Procedure
Installation (Software)
1. Pycharm (Only for the first time), it is downloadable from ‘www.jetbrains.com’
2. MySQL (Only for the first time), it is downloadable from ‘www.mysql.org’

For Best Experience 1080P resolution with 100% scaling is prefered

Installation(Packages)
1. pandas
2. mysql.connector
3. tkinter
4. customtkinter
5. tkcalender
6. pillow
7. matplotlib

Running the Software


1. Open the folder named “Sales Management System” in Pycharm
2. Run the file named “main.py”

System Requirement
Biblography

● Informatics Practices by Sumita Arora

● Youtube: codemy.com

● Stackoverflow

● GeekforGeek

You might also like