added invoice and order collection
This commit is contained in:
@@ -3,6 +3,7 @@ package com.bib.essensbestellungsverwaltung;
|
||||
@author Malte Schulze Hobeling
|
||||
*/
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FoodMgr {
|
||||
@@ -48,7 +49,34 @@ public class FoodMgr {
|
||||
}
|
||||
|
||||
public static long createFood_selection(String[] food_selectionData){
|
||||
String[] food_selectionH = {"childid","foodplanid","foodid"};
|
||||
return Database.insert("food_selection",food_selectionH,food_selectionData);
|
||||
String[] food_selectionH = {"childid","food_planid","foodid"};
|
||||
List<String> food_plan = Database.getEntryById("food_plan",Long.parseLong(food_selectionData[1]));
|
||||
String[] food_planParts = food_plan.get(0).split(":");
|
||||
if(Long.parseLong(food_planParts[6]) == 0){
|
||||
return Database.insert("food_selection",food_selectionH,food_selectionData);
|
||||
}else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> getDayOrder(String date){
|
||||
List<String> orders = new ArrayList<>();
|
||||
List<String> food_plan = getFood_plan(date);
|
||||
String[] food_planParts = food_plan.get(0).split(":");
|
||||
for(int i = 2; i < 2+4; i++){
|
||||
List<String> food = getFoodById(Long.parseLong(food_planParts[i]));
|
||||
String[] foodParts = food.get(0).split(":");
|
||||
String foodName = foodParts[1];
|
||||
String[] food_selectionH = {"food_planid","foodid"};
|
||||
String[] food_selectionD = {food_planParts[0],foodParts[0]};
|
||||
int count = Database.count("food_selection",food_selectionH,food_selectionD);
|
||||
orders.add(foodName+":"+count);
|
||||
}
|
||||
String[] updateH = {"id","issent"};
|
||||
String[] updateD = {food_planParts[0],"1"};
|
||||
if(Database.update("food_plan",updateH,updateD) < 0){
|
||||
System.out.println("Fehler");
|
||||
}
|
||||
return orders;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user