Skip to content

Commit

Permalink
major update for v0.0.20
Browse files Browse the repository at this point in the history
  • Loading branch information
SUBOdhar committed Jul 18, 2024
1 parent d6e4020 commit b9d22c3
Show file tree
Hide file tree
Showing 16 changed files with 432 additions and 198 deletions.
22 changes: 20 additions & 2 deletions auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@ def create_database_and_tables():
added_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS items_data (
id INTEGER PRIMARY KEY AUTOINCREMENT,
item TEXT,
quantity INTEGER,
batch_no TEXT,
manufacture_date TEXT,
expiry_date TEXT,
dealer_name TEXT,
price INTEGER,
added_date TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)
''')
cursor.execute('''
CREATE TABLE IF NOT EXISTS dealers (
id INTEGER PRIMARY KEY AUTOINCREMENT,
Expand Down Expand Up @@ -162,6 +175,10 @@ def add_item():
INSERT INTO items (item, quantity, batch_no, manufacture_date, expiry_date, dealer_name, price)
VALUES (?, ?, ?, ?, ?, ?, ?)
''', (data['item'], data['quantity'], data['batchNo'], data['manufactureDate'], data['expiryDate'], data['dealerName'], data['price']))
cursor.execute('''
INSERT INTO items_data (item, quantity, batch_no, manufacture_date, expiry_date, dealer_name, price)
VALUES (?, ?, ?, ?, ?, ?, ?)
''', (data['item'], data['quantity'], data['batchNo'], data['manufactureDate'], data['expiryDate'], data['dealerName'], data['price']))
conn.commit()
return jsonify({'message': 'Item added successfully', 'data': data}), 200

Expand Down Expand Up @@ -343,6 +360,7 @@ def daily_report():

if not verify_key(key):
return jsonify({'message': 'Not Authenticated'}), 401

try:
with sqlite3.connect('inventory.db') as conn:
cursor = conn.cursor()
Expand All @@ -365,10 +383,10 @@ def daily_report():
query += '''
UNION ALL
SELECT 'Sold' AS type, i.item, s.quantity, i.batch_no, i.manufacture_date AS date, NULL AS dealer_name, s.sale_date, c.name as customer_name, s.total_price
SELECT 'Sold' AS type, i.item, s.quantity, i.batch_no, i.manufacture_date AS date, NULL AS dealer_name, s.sale_date AS added_date, c.name as customer_name, s.total_price
FROM sales s
JOIN items i ON s.product_id = i.id
JOIN customers c ON s.customer_id = c.id
LEFT JOIN customers c ON s.customer_id = c.id
WHERE date(s.sale_date) = ?
'''
params.append(report_date)
Expand Down
Binary file modified inventory.db
Binary file not shown.
Binary file modified login_notification_data.db
Binary file not shown.
96 changes: 96 additions & 0 deletions svp/lib/pages/about.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import 'package:flutter/material.dart';
import 'package:package_info/package_info.dart';

class AboutPage extends StatefulWidget {
@override
_AboutPageState createState() => _AboutPageState();
}

class _AboutPageState extends State<AboutPage> {
String _version = 'Loading...';

@override
void initState() {
super.initState();
_fetchPackageInfo();
}

Future<void> _fetchPackageInfo() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
setState(() {
_version = packageInfo.version;
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('About'),
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () => Navigator.pop(context),
),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
const Center(
child: CircleAvatar(
radius: 60,
backgroundImage: AssetImage(
'assets/images/clock.png'), // Replace with your app logo
),
),
SizedBox(height: 24),
const Text(
'SVP',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
Text(
'Version $_version',
style: TextStyle(
fontSize: 18,
color: Colors.grey[600],
),
),
const SizedBox(height: 16),
const Divider(),
const SizedBox(height: 16),
const Text(
'Finance app',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
const Text(
'A finance based app to manage the products and sell the prducts',
style: TextStyle(fontSize: 16),
),
const SizedBox(height: 24),
const Text(
'SKBD',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 8),
const Text(
'Subodh vet pharma',
style: TextStyle(fontSize: 16),
),
],
),
),
);
}
}
6 changes: 3 additions & 3 deletions svp/lib/pages/add_product.dart
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ class _AddState extends State<Add> {
_selectedDealer ?? 'Select Dealer',
style: TextStyle(
color:
_selectedDealer == null ? Colors.grey : Colors.black,
_selectedDealer == null ? Colors.grey : Colors.green,
),
),
onTap: () {
Expand All @@ -350,7 +350,7 @@ class _AddState extends State<Add> {
: 'Manufacture Date: ${_manufactureDate!.toLocal().toString().split(' ')[0]}',
style: TextStyle(
color:
_manufactureDate == null ? Colors.grey : Colors.black,
_manufactureDate == null ? Colors.grey : Colors.green,
),
),
onTap: () => _selectDate(context, true),
Expand All @@ -363,7 +363,7 @@ class _AddState extends State<Add> {
? 'Select Expiry Date'
: 'Expiry Date: ${_expiryDate!.toLocal().toString().split(' ')[0]}',
style: TextStyle(
color: _expiryDate == null ? Colors.grey : Colors.black,
color: _expiryDate == null ? Colors.grey : Colors.green,
),
),
onTap: () => _selectDate(context, false),
Expand Down
158 changes: 83 additions & 75 deletions svp/lib/pages/chicken.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ class Chicken extends StatefulWidget {
}

class _ChickenState extends State<Chicken> {
final _formKey = GlobalKey<FormState>();

@override
Widget build(BuildContext context) {
return Scaffold(
Expand All @@ -20,82 +22,88 @@ class _ChickenState extends State<Chicken> {
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
const SizedBox(height: 10),
TextFormField(
keyboardType: TextInputType.name,
decoration: const InputDecoration(
labelText: 'Name',
prefixIcon: Icon(Icons.person),
border: UnderlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Please enter name";
}
return null;
},
),
const SizedBox(height: 10),
TextFormField(
keyboardType: TextInputType.text,
decoration: const InputDecoration(
labelText: 'Address',
prefixIcon: Icon(Icons.house),
border: UnderlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Please enter Address";
}
return null;
},
),
const SizedBox(height: 10),
TextFormField(
keyboardType: TextInputType.number,
decoration: const InputDecoration(
labelText: 'Quantity',
prefixIcon: Icon(Icons.indeterminate_check_box),
border: UnderlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Please enter Quantity";
}
return null;
},
),
const SizedBox(height: 10),
TextFormField(
keyboardType: TextInputType.number,
decoration: const InputDecoration(
labelText: 'Weight per piece',
prefixIcon: Icon(Icons.scale),
border: UnderlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Please enter Weight per piece";
}
return null;
},
),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () => {},
style: ElevatedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8.0),
child: SingleChildScrollView(
child: Form(
key: _formKey,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
const SizedBox(height: 10),
TextFormField(
keyboardType: TextInputType.name,
decoration: const InputDecoration(
labelText: 'Name',
prefixIcon: Icon(Icons.person),
border: UnderlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Please enter name";
}
return null;
},
),
backgroundColor: Colors.yellow.shade800,
foregroundColor: Colors.white,
),
child: const Text('Sell'),
)
],
const SizedBox(height: 10),
TextFormField(
keyboardType: TextInputType.text,
decoration: const InputDecoration(
labelText: 'Address',
prefixIcon: Icon(Icons.house),
border: UnderlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Please enter Address";
}
return null;
},
),
const SizedBox(height: 10),
TextFormField(
keyboardType: TextInputType.number,
decoration: const InputDecoration(
labelText: 'Quantity',
prefixIcon: Icon(Icons.indeterminate_check_box),
border: UnderlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Please enter Quantity";
}
return null;
},
),
const SizedBox(height: 10),
TextFormField(
keyboardType: TextInputType.number,
decoration: const InputDecoration(
labelText: 'Weight per piece',
prefixIcon: Icon(Icons.scale),
border: UnderlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return "Please enter Weight per piece";
}
return null;
},
),
const SizedBox(height: 10),
ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(
foregroundColor: Colors.white,
backgroundColor: Colors.yellow.shade800,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: const Text('Sell'),
)
],
),
),
),
),
);
Expand Down
Loading

0 comments on commit b9d22c3

Please sign in to comment.