Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adjustment stock, possibility to select the project #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
# platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
6 changes: 3 additions & 3 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_keyboard_visibility: 0339d06371254c3eb25eeb90ba8d17dca8f9c069
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
network_info_plus: 6d0c3eb8367b8164fa3fb0c19875e3f59d49697f
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011

COCOAPODS: 1.11.3
COCOAPODS: 1.15.2
8 changes: 4 additions & 4 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -343,7 +343,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down Expand Up @@ -420,7 +420,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
Expand Down Expand Up @@ -469,7 +469,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SUPPORTED_PLATFORMS = iphoneos;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
9 changes: 8 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ import 'package:animated_splash_screen/animated_splash_screen.dart';
import 'package:bhima_collect/providers/current_depot_provider.dart';
import 'package:bhima_collect/providers/entry_movement.dart';
import 'package:bhima_collect/providers/exit_movement.dart';
import 'package:bhima_collect/providers/project.dart';
import 'package:bhima_collect/screens/depot.dart';
import 'package:bhima_collect/screens/home.dart';
import 'package:bhima_collect/screens/settings.dart';
import 'package:bhima_collect/screens/splash_screen.dart';
import 'package:bhima_collect/screens/stock_adjustment.dart';
import 'package:bhima_collect/screens/stock_entry.dart';
import 'package:bhima_collect/screens/stock_entry_integration.dart';
import 'package:bhima_collect/screens/stock_exit.dart';
Expand All @@ -23,6 +25,7 @@ void main() {
ChangeNotifierProvider(create: (_) => CurrentDepotProvider()),
ChangeNotifierProvider(create: (_) => EntryMovement()),
ChangeNotifierProvider(create: (_) => ExitMovement()),
ChangeNotifierProvider(create: (_) => Project())
],
child: const MainScreen(),
));
Expand Down Expand Up @@ -73,8 +76,11 @@ class _MyAppState extends State<MainScreen> {
actionsIconTheme: IconThemeData(color: Colors.blue[800]),
centerTitle: true,
titleTextStyle: const TextStyle(color: Colors.blue)),
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: const Scaffold(
body: MyApp(),
),
home: const MyApp(),
// initialRoute: '/',
routes: {
'/home': (context) => const HomePage(),
Expand All @@ -85,6 +91,7 @@ class _MyAppState extends State<MainScreen> {
'/stock_exit': (context) => const StockExitPage(),
'/stock_integration': (context) => const StockEntryIntegration(),
'/stock_loss': (context) => const StockLossPage(),
'/stock_adjustment': (context) => const StockAdjustmentPage(),
},
);
}
Expand Down
36 changes: 34 additions & 2 deletions lib/models/lot.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,45 @@ class Lot {
return collection;
}

static formatList(List lotsRaw) {
List<Lot> lots = lotsRaw.map((lot) {
return Lot(
uuid: lot['lot_uuid'],
label: lot['lot_label'],
lot_description: lot['lot_description'],
code: lot['code'],
inventory_uuid: lot['inventory_uuid'],
text: lot['inventory_text'],
unit_type: lot['unit_type'],
group_name: lot['group_name'],
depot_text: lot['depot_text'],
depot_uuid: lot['depot_uuid'],
is_asset: lot['is_asset'],
barcode: lot['barcode'],
serial_number: lot['serial_number'],
reference_number: lot['reference_number'],
manufacturer_brand: lot['manufacturer_brand'],
manufacturer_model: lot['manufacturer_model'],
unit_cost: lot['unit_cost'],
quantity: lot['quantity'],
avg_consumption: lot['avg_consumption'],
exhausted: parseBool(lot['exhausted']),
expired: parseBool(lot['expired']),
near_expiration: parseBool(lot['near_expiration']),
expiration_date: parseDate(lot['expiration_date']),
entry_date: parseDate(lot['entry_date']),
);
}).toList();
return lots;
}

// Define a function that inserts lot into the database
static Future<void> insertLot(dynamic database, Lot lot) async {
final db = await database;
await db.insert(
'lot',
lot.toMap(),
conflictAlgorithm: ConflictAlgorithm.ignore,
conflictAlgorithm: ConflictAlgorithm.replace,
);
}

Expand All @@ -234,7 +266,7 @@ class Lot {
final batch = txn.batch();
for (var lot in lots) {
batch.insert('lot', lot.toMap(),
conflictAlgorithm: ConflictAlgorithm.ignore);
conflictAlgorithm: ConflictAlgorithm.replace);
}
await batch.commit(noResult: true);
});
Expand Down
Loading